@livenetworks/ashlar 2.1.6 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-connector/ln-api-connector.schema.json +2 -2
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-coordinator/src/ln-data-coordinator.js +1 -1
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-data-store/src/ln-data-store.js +6 -8
- package/components/ln-table/README.md +1 -1
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table/ln-table.schema.json +211 -211
- package/components/ln-table/src/ln-table.js +23 -12
- package/package.json +1 -1
- package/theme/config/mixins/_ln-table.scss +5 -1
- package/web-types.json +2337 -2337
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function pe(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function oe(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let a=1;a<t.length;a++)if(t[a]&&t[a].nodeType===1){i=t[a];break}if(!oe(i))return}e.apply(console,t)}}function v(e,t,o){const i=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function Z(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){Z(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Ve(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function Ge(e,t){const o=!!(t&&t.typed),i=t&&t.exclude,a={},l=e.elements,c={};if(o)for(let d=0;d<l.length;d++){const s=l[d];s.name&&s.type==="checkbox"&&!s.disabled&&(c[s.name]=(c[s.name]||0)+1)}for(let d=0;d<l.length;d++){const s=l[d];if(!(!s.name||s.disabled||s.type==="file"||s.type==="submit"||s.type==="button")&&!(i&&s.matches&&s.matches(i)))if(s.type==="checkbox")o&&c[s.name]===1?a[s.name]=s.checked:(a[s.name]||(a[s.name]=[]),s.checked&&a[s.name].push(s.value));else if(s.type==="radio")s.checked&&(a[s.name]=s.value);else if(s.type==="select-multiple"){a[s.name]=[];for(let w=0;w<s.options.length;w++)s.options[w].selected&&a[s.name].push(s.options[w].value)}else if(o&&s.type==="hidden")a[s.name]=s.value;else if(o&&(s.type==="number"||s.type==="range")){const w=Number(s.value);a[s.name]=s.value===""||isNaN(w)?null:w}else a[s.name]=s.value}return a}function He(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function We(e,t){const o=e.elements,i=[],a={};for(let l=0;l<o.length;l++){const c=o[l];c.name&&c.type==="checkbox"&&(a[c.name]=(a[c.name]||0)+1)}for(let l=0;l<o.length;l++){const c=o[l];if(c.type==="file"||c.type==="submit"||c.type==="button")continue;const d=c.getAttribute("data-ln-fill-as")||c.name;if(!d||!(d in t))continue;const s=t[d];if(c.type==="checkbox"){if(Array.isArray(s))c.checked=s.indexOf(c.value)!==-1;else if(a[c.name]>1){const w=String(s).split(",").map(function(b){return b.trim()});c.checked=w.indexOf(c.value)!==-1}else c.checked=He(s);i.push(c)}else if(c.type==="radio")c.checked=c.value===String(s),i.push(c);else if(c.type==="select-multiple"){if(Array.isArray(s))for(let w=0;w<c.options.length;w++)c.options[w].selected=s.indexOf(c.options[w].value)!==-1;i.push(c)}else c.value=s,c.tagName==="SELECT"&&s!=null&&c.setAttribute("data-ln-value",s),i.push(c)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=We,window.lnCore.serializeForm=Ge,window.lnCore.resolveFormMethod=Ve);const ge={};function Qe(e,t){ge[e]=t}function Je(e){return ge[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=Qe,window.lnCore.getDataMapper=Je);function Ze(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,Z(function(){new MutationObserver(function(){v(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const me={};function Xe(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];me[o]=t}function Ye(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return me[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=Xe,window.lnCore.getLocaleFallback=Ye,window.lnCore.ensureLocaleObserver=Ze);const ie={};function et(e,t){ie[e]||(ie[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=ie[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function be(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let c=0;c<o.length;c++){const d=o[c],s=d.getAttribute("data-ln-field");t[s]!=null&&(d.textContent=t[s])}const i=e.querySelectorAll("[data-ln-attr]");for(let c=0;c<i.length;c++){const d=i[c],s=d.getAttribute("data-ln-attr").split(",");for(let w=0;w<s.length;w++){const b=s[w].trim().split(":");if(b.length!==2)continue;const _=b[0].trim(),x=b[1].trim();t[x]!=null&&d.setAttribute(_,t[x])}}const a=e.querySelectorAll("[data-ln-show]");for(let c=0;c<a.length;c++){const d=a[c],s=d.getAttribute("data-ln-show");s in t&&d.classList.toggle("hidden",!t[s])}const l=e.querySelectorAll("[data-ln-class]");for(let c=0;c<l.length;c++){const d=l[c],s=d.getAttribute("data-ln-class").split(",");for(let w=0;w<s.length;w++){const b=s[w].trim().split(":");if(b.length!==2)continue;const _=b[0].trim(),x=b[1].trim();x in t&&d.classList.toggle(_,!!t[x])}}return e}function tt(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<o.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[i],t??null),o[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)be(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function _e(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const l=o.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(c,d){return t[d]!==void 0?t[d]:""}))}const i=function(l,c){return t[c]!==void 0?t[c]:""},a=Array.from(e.querySelectorAll("*"));e.nodeType===1&&a.push(e);for(let l=0;l<a.length;l++){const c=a[l],d=c.attributes;for(let s=0;s<d.length;s++){const w=d[s];w.value.indexOf("{{")!==-1&&c.setAttribute(w.name,w.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function nt(e,t,o,i,a,l){const c={};for(let s=0;s<e.children.length;s++){const w=e.children[s],b=w.getAttribute("data-ln-render-key");b&&(c[b]=w)}const d=document.createDocumentFragment();for(let s=0;s<t.length;s++){const w=t[s],b=String(i(w));let _=c[b];if(_)a(_,w,s);else{const x=et(o,l);if(!x||(_e(x,w),_=x.firstElementChild,!_))continue;_.setAttribute("data-ln-render-key",b),a(_,w,s)}d.appendChild(_)}e.textContent="",e.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=_e,window.lnCore.fill=be,window.lnCore.lnFill=tt,window.lnCore.renderList=nt);function ae(e,t,o){const i=e.getAttribute(t);return i===null?o:i}function X(e,t,o){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?o:i}function se(e,t,o=!1){const i=e.getAttribute(t);if(i===null)return!!o;const a=i.trim().toLowerCase();return!(a==="false"||a==="0")}function le(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const ce=new Map;function Ce(e,t){const o=(e?e.join("|"):"")+"::"+t;if(ce.has(o))return ce.get(o);const i=new Set(e||[]),a=function(l,c){const d=l.getAttribute(c);return d!==null&&i.has(d)?d:t};return ce.set(o,a),a}function Se(e,t,o){const i=parseFloat(e.getAttribute(t));return isNaN(i)?o:i}function ve(e,t,o){const i=e.getAttribute(t);if(!i)return o;try{return JSON.parse(i)}catch{return o}}function Ae(e,t,o,i,a){if(!e||t===null)return!0;const l=i||"ln-component",c=e.type;if(c==="trigger"||c==="marker"||c==="string"||c==="list"||!c||t===""&&e.fallback!==void 0)return!0;const d=s=>{a?console.warn(s,a):console.warn(s)};if(c==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(d(`[${l}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(c==="enum"){const s=e.values||[];return s.includes(t)?!0:(d(`[${l}] Invalid value "${t}" for attribute "${o}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return d(`[${l}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(d(`[${l}] Value ${s} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(d(`[${l}] Value ${s} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(d(`[${l}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(s){return d(`[${l}] Invalid JSON for attribute "${o}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function xe(e,t,o){for(const i in o){const[a,l,c]=o[i];Object.defineProperty(e,i,{get:function(){return a(t,l,c)},enumerable:!0,configurable:!0})}return e}function ke(e){const t={};for(const o in e){const i=e[o];if(!i||!i.prop)continue;let a=i.read;if(!a&&i.type)switch(i.type){case"enum":a=Ce(i.values,i.fallback);break;case"integer":a=X;break;case"float":a=Se;break;case"boolean":a=se;break;case"list":a=le;break;case"json":a=ve;break;case"string":default:a=ae;break}a||(a=ae),t[i.prop]=[a,o,i.fallback]}return t}function rt(e){const t={};for(const o in e){const i=e[o];i&&i.effect&&(t[o]=i.effect)}return Object.keys(t).length?t:null}function ot(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=xe,window.lnCore.attrSpec=ke,window.lnCore.attrStr=ae,window.lnCore.attrInt=X,window.lnCore.attrBool=se,window.lnCore.attrList=le,window.lnCore.attrEnum=Ce,window.lnCore.attrFloat=Se,window.lnCore.attrJson=ve);function G(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function Ee(e,t,o,i){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c={selector:t,attribute:o,ComponentFn:i};if(e.matches&&e.matches(l)&&G(e,c),e.querySelectorAll){const d=e.querySelectorAll(l);for(let s=0;s<d.length;s++)G(d[s],c)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function it(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function at(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function Ie(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function st(e){const t=Ie(),o=e.observed||[];for(let i=0;i<o.length;i++){const a=o[i];t.byAttr.has(a)||t.byAttr.set(a,[]),t.byAttr.get(a).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const a=t.byDeclaredAttr.get(i);a.some(l=>l.componentTag===e.componentTag)||a.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=ot(e);if(i===null)t.reactiveWildcard.push(e);else for(const a of i)t.byReactive.has(a)||t.byReactive.set(a,[]),t.byReactive.get(a).push(e)}e.persist&&t.persist.push(e)}function qe(e,t,o,i){for(let a=0;a<e.length;a++){const l=e[a];if(!t[l.attribute])continue;const c=l.effects&&l.effects[o];c?c(t,o,i):l.onAttrChange&&(!l.declared||l.declared.has(o))&&l.onAttrChange(t,o,i)}}function lt(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,i=Ie(),a=i.byAttr.get(t),l=pe()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!o&&!a&&!l)return;const c=e.target;if(e.oldValue!==c.getAttribute(t)){if(l&&oe(c)){const d=i.byDeclaredAttr.get(t),s=c.getAttribute(t);for(let w=0;w<d.length;w++)Ae(d[w].spec,s,t,d[w].componentTag,c)}if(window.lnCore._debugSink&&(o||a)&&window.lnCore._debugSink("attr",t,c,{oldValue:e.oldValue,newValue:c.getAttribute(t)}),o){const d=i.byReactive.get(t);d&&qe(d,c,t,e.oldValue),i.reactiveWildcard.length&&qe(i.reactiveWildcard,c,t,e.oldValue)}if(a)for(let d=0;d<a.length;d++){const s=a[d];if(s.handler){s.handler(c,t,e.oldValue);continue}s.onAttributeChange&&c[s.attribute]?s.onAttributeChange(c,t):(Ee(c,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(c))}}}function ct(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,Z(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{lt(t[o])}catch(i){console.error("[ln-core] mutation handler failed",t[o].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function ue(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function de(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function fe(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Le(e){const t=ue();if(!t.length)return;const o=e.target;if(o){const a=o.nodeType===1?o:o.parentElement;if(a&&(a.isContentEditable||a.closest&&a.closest('[contenteditable]:not([contenteditable="false"])')))return}const i=de();if(e.target&&i.length)for(let a=0;a<i.length;a++){const l=i[a],c=l.query,d=e.target.nodeType===1?e.target.matches&&e.target.matches(c)?e.target:e.target.closest?e.target.closest(c):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(c):null;d&&l.onSubtreeChange(d,e)}for(let a=0;a<e.addedNodes.length;a++){const l=e.addedNodes[a];if(l.nodeType===1){const c=!!(l.firstElementChild||l.children&&l.children.length);for(let d=0;d<t.length;d++){const s=t[d];if(s.selector&&s.attribute&&s.ComponentFn){if(!c)l.matches&&l.matches(s.query)&&G(l,s);else if(l.matches&&l.matches(s.query)&&G(l,s),l.querySelectorAll){const w=l.querySelectorAll(s.query);for(let b=0;b<w.length;b++)G(w[b],s)}}s.onInit&&s.onInit(l)}}}for(let a=0;a<e.removedNodes.length;a++){const l=e.removedNodes[a];if(l.nodeType===1){if(document.contains(l))continue;const c=!!(l.firstElementChild||l.children&&l.children.length);for(let d=0;d<t.length;d++){const s=t[d],w=s.query;if(w){if(!c)l.matches&&l.matches(w)&&fe(l,s);else if(l.matches&&l.matches(w)&&fe(l,s),l.querySelectorAll){const b=l.querySelectorAll(w);for(let _=0;_<b.length;_++)fe(b[_],s)}}}}}}function De(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,Z(function(){const e=new MutationObserver(function(t){for(let o=0;o<t.length;o++){const i=t[o];if(i.type==="childList")try{Le(i)}catch(a){console.error("[ln-core] lifecycle handler failed",i.target,a)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function ut(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const o=t.takeRecords();for(let i=0;i<o.length;i++){const a=o[i];if(a.type==="childList")try{Le(a)}catch(l){console.error("[ln-core] lifecycle handler failed",a.target,l)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function dt(e){ue().push(e),e.onSubtreeChange&&e.query&&de().push(e),De()}function Ne(e,t,o,i,a={}){const l=a.extraAttributes||[],c=a.onAttributeChange||null,d=a.onSubtreeChange||null,s=a.onInit||null,w=a.onAttrChange||null,b=a.effects||null,_=a.attributes||null,x=_?rt(_):b,j=_?new Set(Object.keys(_)):null,$=a.persist||null;function g(L){const D=L||document.body;if(Ee(D,e,t,o),_&&pe())for(const F in _){const we=_[F],U=Array.from(D.querySelectorAll("["+F+"]"));D.matches&&D.matches("["+F+"]")&&U.push(D);for(let P=0;P<U.length;P++){const W=U[P];oe(W)&&Ae(we,W.getAttribute(F),F,i,W)}}s&&s(D)}const S=[];if(e.indexOf("[")!==-1){const L=/\[([\w-]+)/g;let D;for(;(D=L.exec(e))!==null;)S.push(D[1])}else S.push(e);st({selector:e,attribute:t,componentTag:i,attributes:_,ComponentFn:o,onInit:s,observed:S.concat(l),onAttributeChange:c,onAttrChange:w,effects:x,declared:j,persist:$}),ct();const q=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,k=a.subtreeQuery||(q?e:"["+e+"]"),A={selector:e,attribute:t,ComponentFn:o,onInit:s,onSubtreeChange:d,query:k};ue().push(A),d&&k&&de().push(A),De(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=Ne,window.lnCore.observeLifecycle=dt,window.lnCore.withoutLifecycle=ut);function E(){it()>0?at(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E):E(),g}function ft(e){let t=!1;for(let o=0;o<e.length;o++){const i=e[o];if(!(i===""||i==null)&&(t=!0,!Number.isFinite(Number(i))))return"string"}return t?"number":"string"}function ht(e,t,o,i){if(o==="number"){const c=parseFloat(e),d=parseFloat(t);return(isNaN(c)?0:c)-(isNaN(d)?0:d)}const a=e!=null?String(e):"",l=t!=null?String(t):"";return i?i.compare(a,l):a<l?-1:a>l?1:0}function Te(e){return(e||"").replace(/^#/,"")}function he(e){const t=e===void 0?location.hash:e,o={},i=Te(t);if(!i)return o;const a=i.split("&");for(let l=0;l<a.length;l++){const c=a[l];if(!c)continue;const d=c.indexOf(":"),s=d>-1?c.slice(0,d):c,w=d>-1?c.slice(d+1):"";if(s)try{o[s]=decodeURIComponent(w)}catch{o[s]=w}}return o}function wt(e){if(!e)return null;const t=he();return e in t?t[e]:null}function yt(e,t){if(!e)return;const o=he();t==null?delete o[e]:o[e]=String(t);const a=Object.keys(o).map(function(l){const c=o[l];return c===""?l:l+":"+encodeURIComponent(c)}).join("&");Te(location.hash)!==a&&(location.hash=a)}function pt(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function gt(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function mt(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function bt(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function _t(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ct(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),i=e.slice(t+1),a=i?i.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:o,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=he,window.lnCore.hashGet=wt,window.lnCore.hashSet=yt,window.lnCore.hashLinkClick=pt,window.lnCore.resolveHashNamespace=gt,window.lnCore.hashSortEncode=mt,window.lnCore.hashSortDecode=bt,window.lnCore.hashFilterEncode=_t,window.lnCore.hashFilterDecode=Ct);let H=null;const St="ln-ashlar:storage-salt:v1",ze=32768;function Re(e){let t="";const o=e.byteLength;for(let i=0;i<o;i+=ze)t+=String.fromCharCode.apply(null,e.subarray(i,Math.min(i+ze,o)));return btoa(t)}function Oe(e){const t=atob(e),o=t.length,i=new Uint8Array(o);for(let a=0;a<o;a++)i[a]=t.charCodeAt(a);return i}function Me(e,t){let o=H,i={};return typeof CryptoKey<"u"&&e instanceof CryptoKey?o=e:e&&typeof e=="object"&&(i=e,typeof CryptoKey<"u"&&i.key instanceof CryptoKey&&(o=i.key)),{key:o,options:i}}async function vt(e,t={}){if(!e)throw new Error("[ln-crypto] Key derivation failed: Secret string is required");const o=t.method||"pbkdf2",i=new TextEncoder;if(o==="sha256"){const s=await crypto.subtle.digest("SHA-256",i.encode(e));return crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["encrypt","decrypt"])}const a=t.salt||St,l=typeof a=="string"?i.encode(a):a,c=t.iterations||1e5,d=await crypto.subtle.importKey("raw",i.encode(e),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:l,iterations:c,hash:"SHA-256"},d,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Be(e,t={}){if(!e){H=null;return}try{const o=t.method||"sha256";H=await vt(e,{...t,method:o})}catch(o){throw console.error("[ln-core/crypto] Key derivation failed:",o),H=null,o}}function B(){return H}async function At(e,t,o){const{key:i}=Me(t);if(e==null)return e;if(!i)throw new Error("[ln-crypto] Encryption failed: No active cryptographic key provided");try{const a=new TextEncoder,l=crypto.getRandomValues(new Uint8Array(12)),c=typeof e=="string"?e:JSON.stringify(e),d=await crypto.subtle.encrypt({name:"AES-GCM",iv:l},i,a.encode(c));return{v:1,alg:"AES-GCM",encrypted:!0,iv:Re(l),data:Re(new Uint8Array(d))}}catch(a){throw console.error("[ln-core/crypto] Encryption failed:",a),new Error("[ln-crypto] Encryption failed: "+(a&&a.message?a.message:String(a)))}}async function xt(e,t,o){const{key:i,options:a}=Me(t),l=a.silent===!0;if(!e||!e.encrypted)return e;if(!i){if(l)return{...e,decryptionError:!0};throw new Error("[ln-crypto] Decryption failed: No active cryptographic key provided")}if(!e.iv||!e.data){if(l)return{...e,decryptionError:!0};throw new Error("[ln-crypto] Decryption failed: Malformed envelope (missing iv or data)")}try{const c=new TextDecoder,d=Oe(e.iv),s=Oe(e.data),w=await crypto.subtle.decrypt({name:"AES-GCM",iv:d},i,s),b=c.decode(w);try{return JSON.parse(b)}catch{return b}}catch(c){if(l)return{...e,decryptionError:!0};throw console.error("[ln-core/crypto] Decryption failed. Key may be incorrect or payload tampered:",c),new Error("[ln-crypto] Decryption failed. Key may be incorrect or payload tampered: "+(c&&c.message?c.message:String(c)))}}function kt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=kt);function Et(e){return String(e||"").trim().toLowerCase()}function It(e){const t=Et(e);return t?t.split(/\s+/).filter(Boolean):[]}function qt(e,t){if(!t||t.length===0)return!0;if(!e)return!1;const o=String(e).toLowerCase();for(let i=0;i<t.length;i++)if(o.indexOf(t[i])===-1)return!1;return!0}function Lt(e,t){if(!t||t.length===0)return!0;if(e==null)return!1;const o=String(e).trim().toLowerCase();for(let i=0;i<t.length;i++)if(String(t[i]).trim().toLowerCase()===o)return!0;return!1}function Dt(e={}){let t=e.windowSize>0?e.windowSize:1e3,o=e.pageSize>0?e.pageSize:200,i=e.fetchDebounce!=null?e.fetchDebounce:120;const a=typeof e.requestPage=="function"?e.requestPage:()=>{},l=new Map,c=new Set;let d=0,s=0,w=0,b=!1,_=null;function x(g,S){l.delete(g),l.set(g,S)}function j(){if(l.size<=t)return[];const g=[];for(;l.size>t;){const q=l.keys().next().value;g.push(l.get(q)),l.delete(q)}const S=new Set(l.values());return g.filter(q=>!S.has(q))}function $(g,S){c.add(g),clearTimeout(_),_=setTimeout(()=>a(g,o,S),i)}return{get logicalTotal(){return d},set logicalTotal(g){d=g},get grandTotal(){return s},set grandTotal(g){s=g},get queryGen(){return w},set queryGen(g){w=g},get size(){return l.size},get hasLoaded(){return b},getId:g=>{if(!l.has(g))return;const S=l.get(g);return x(g,S),S},ensure:(g,S,q)=>{if(!b&&!c.has(0))return $(0,q);if(d<=0)return;const k=Math.max(0,g),A=Math.min(d,S);for(let E=k;E<A;E++)if(!l.has(E)){const L=Math.floor(E/o)*o;if(!c.has(L))return $(L,q)}},ingest:(g,S,q,k,A)=>{if(A!=null&&A!==w)return[];b=!0,q!=null&&(s=q),k!=null&&(d=k);for(let E=0;E<S.length;E++)x(g+E,S[E]);return c.delete(g),j()},reset:function(){w++,this.clear()},clear:()=>{b=!1,l.clear(),c.clear(),clearTimeout(_)},configure:(g={})=>{let S=[];return g.windowSize>0&&g.windowSize!==t&&(t=g.windowSize,S=j()),g.pageSize>0&&(o=g.pageSize),g.fetchDebounce>=0&&(i=g.fetchDebounce),S}}}function Nt(e,t,o){if(!Array.isArray(e)||!t||!t.field)return e;const{field:i,direction:a}=t,l=a==="desc",c=e.map(s=>s?s[i]:void 0),d=ft(c);return[...e].sort((s,w)=>{const b=s?s[i]:void 0,_=w?w[i]:void 0,x=ht(b,_,d,o);return l?-x:x})}function Fe(e,t){if(!Array.isArray(e)||!t||typeof t!="object")return e;const o=Object.keys(t).filter(i=>Array.isArray(t[i])&&t[i].length>0);return o.length?e.filter(i=>i?o.every(a=>Lt(i[a],t[a])):!1):e}function Tt(e,t,o){if(!Array.isArray(e)||!t||!o||!o.length)return e;const i=It(t);return i.length?e.filter(a=>a?i.every(l=>o.some(c=>{const d=a[c];return d!=null&&qt(String(d),[l])})):!1):e}function zt(e,t,o){if(!Array.isArray(e)||!e.length)return 0;if(o==="count")return e.length;const i=e.map(l=>l&&l[t]!=null?parseFloat(l[t]):NaN).filter(l=>Number.isFinite(l)),a=i.reduce((l,c)=>l+c,0);return o==="sum"?a:o==="avg"&&i.length?a/i.length:0}function Rt(e,t={},o=[],i){if(!Array.isArray(e))return{records:[],total:0,filtered:0};const a=e.length;let l=e;t.filters&&(l=Fe(l,t.filters)),t.search&&(l=Tt(l,t.search,o));const c=l.length;if(t.sort&&(l=Nt(l,t.sort,i)),t.offset||t.limit){const d=t.offset||0,s=t.limit||l.length;l=l.slice(d,d+s)}return{records:l,total:a,filtered:c}}function Ot(e,t){return!Array.isArray(e)||!t||typeof t!="object"?e:e.map(o=>{if(!o)return null;const i={...o};for(const[a,l]of Object.entries(t))if(typeof l=="function")try{i[a]=l(o)}catch{i[a]=void 0}return i})}function Mt(e,t,o,i="_meta"){if(!Array.isArray(e)||!e.includes(i))return!0;for(const a of Object.keys(t||{})){if(!e.includes(a))return!0;const l=t[a]&&t[a].indexes||[],c=o&&o[a]||[];if(l.some(d=>!c.includes(d)))return!0}return!1}function Bt(e){return{ok:!1,error:e&&e.message?e.message:String(e)}}(function(){const e="data-ln-data-store",t="lnDataStore";if(window[t]!==void 0)return;function o(n,r,u){const f=n.getAttribute(r);if(f==="never"||f==="-1")return-1;const h=parseInt(f,10);return isNaN(h)?u:h}const i={"data-ln-data-store":{type:"marker",effect:Ue,description:"Identifies the element as a data-store definition container"},"data-ln-data-store-indexes":{type:"list",effect:Ue,description:"Comma-separated index field names for the IndexedDB store"},"data-ln-data-store-stale":{prop:"_staleThreshold",type:"integer",read:o,fallback:300,description:"Cache staleness threshold in seconds, or -1/never"},"data-ln-data-store-search-fields":{prop:"_searchFields",type:"list",read:le,description:"Record fields to index for client-side search"},"data-ln-data-store-no-local-query":{prop:"noLocalQuery",type:"boolean",read:se,description:"Bypasses local IndexedDB query resolution, forcing remote fetching"},"data-ln-data-store-window":{prop:"_windowSize",type:"integer",read:X,fallback:1e3,min:10,effect:rn,description:"Virtual scrolling cache window size in records"},"data-ln-data-store-window-page":{prop:"_windowPageSize",type:"integer",read:X,fallback:200,min:5,effect:on,description:"Virtual scrolling slice page size"},"data-ln-data-store-frozen":{type:"marker",description:"Applied at runtime to indicate store schema is locked in IndexedDB"}},a=ke(i),l="ln_app_cache",c="_meta",d="1.0";let s=null,w=null;const b={};function _(n){n&&n.name==="QuotaExceededError"&&v(document,"ln-data-store:quota-exceeded",{error:n})}function x(){const n={};for(const r of document.querySelectorAll(`[${e}]`)){const u=r.id;if(u){const f=r.getAttribute("data-ln-data-store-indexes")||"";n[u]={indexes:f.split(",").map(h=>h.trim()).filter(Boolean)}}}return n}function j(){return w||(w=new Promise(n=>{if(typeof indexedDB>"u")return console.warn("[ln-data-store] IndexedDB is not available in this environment"),n(null);const r=x(),u=Object.keys(r),f=indexedDB.open(l);f.onerror=()=>{console.warn("[ln-data-store] IndexedDB open failed"),n(null)},f.onsuccess=h=>{const y=h.target.result,p=Array.from(y.objectStoreNames),m=u.filter(T=>p.includes(T));let C={};if(m.length>0){const T=y.transaction(m,"readonly");for(const z of m)C[z]=Array.from(T.objectStore(z).indexNames)}if(!Mt(p,r,C,c))return $(y),s=y,n(y);const K=y.version;y.close();const M=indexedDB.open(l,K+1);let R=!1,O=null;M.onblocked=()=>{console.warn("[ln-data-store] Database upgrade blocked — waiting for other tabs to close connection"),v(document,"ln-data-store:blocked",{db:l}),O||(O=setTimeout(()=>{R||(console.warn("[ln-data-store] Database upgrade timed out while blocked"),R=!0,w=null,n(null))},5e3))},M.onerror=()=>{R||(O&&clearTimeout(O),R=!0,w=null,console.warn("[ln-data-store] Database upgrade failed"),n(null))},M.onupgradeneeded=T=>{const z=T.target.result,an=T.target.transaction;z.objectStoreNames.contains(c)||z.createObjectStore(c,{keyPath:"key"});for(const J of u)if(z.objectStoreNames.contains(J)){const re=an.objectStore(J);for(const V of r[J].indexes)re.indexNames.contains(V)||re.createIndex(V,V,{unique:!1})}else{const re=z.createObjectStore(J,{keyPath:"id"});for(const V of r[J].indexes)re.createIndex(V,V,{unique:!1})}},M.onsuccess=T=>{if(R){T.target.result&&T.target.result.close();return}O&&clearTimeout(O),R=!0;const z=T.target.result;$(z),s=z,n(z)}}}),w)}function $(n){n.onversionchange=()=>{n.close(),s=null,w=null}}function g(){return s?Promise.resolve(s):(w=null,j())}async function S(n){if(!B()||!n)return n;const r={...n},u=r.id,f=await At(r);return!f||!f.encrypted?n:{...f,id:u}}async function q(n){return!n||!n.encrypted||!B()?n:xt(n,{silent:!0})}const k=(n,r)=>g().then(u=>u?u.transaction(n,r).objectStore(n):null);function A(n){return new Promise((r,u)=>{n.onsuccess=()=>r(n.result),n.onerror=()=>{_(n.error),u(n.error)}})}const E=n=>k(n,"readonly").then(r=>r?A(r.getAll()):[]).then(r=>B()?Promise.all(r.map(u=>q(u))):r),L=(n,r)=>k(n,"readonly").then(u=>u?A(u.get(r)).then(f=>f!==void 0?f:typeof r=="string"&&r.trim()!==""&&!isNaN(Number(r))?A(u.get(Number(r))):typeof r=="number"?A(u.get(String(r))):null):null).then(u=>u?q(u):null),D=(n,r)=>g().then(u=>{if(!u)return[];const h=u.transaction(n,"readonly").objectStore(n),y=r.map(p=>A(h.get(p)).then(m=>m!==void 0?m:typeof p=="string"&&p.trim()!==""&&!isNaN(Number(p))?A(h.get(Number(p))):typeof p=="number"?A(h.get(String(p))):null));return Promise.all(y).then(p=>B()?Promise.all(p.map(m=>m?q(m):null)):p)}),F=(n,r)=>(B()?S(r):Promise.resolve(r)).then(f=>k(n,"readwrite").then(h=>h?A(h.put(f)):null)),we=(n,r)=>k(n,"readwrite").then(u=>u?A(u.delete(r)).then(()=>{if(typeof r=="string"&&r.trim()!==""&&!isNaN(Number(r)))return A(u.delete(Number(r)));if(typeof r=="number")return A(u.delete(String(r)))}):null),U=n=>k(n,"readwrite").then(r=>r?A(r.clear()):null),P=n=>k(n,"readonly").then(r=>r?A(r.count()):0),W=n=>k(c,"readonly").then(r=>r?A(r.get(n)):null),Y=(n,r)=>k(c,"readwrite").then(u=>{if(u)return r.key=n,A(u.put(r))});function N(n){return this.dom=n,this._name=n.id,this._name||console.warn("[ln-data-store] missing id — the store cannot be addressed",n),xe(this,n,a),this._handlers=null,this.isLoaded=!1,this.canServe=!1,this.isInitialized=!1,this.initializationError=null,this.hasCache=!1,this.isSyncing=!1,this.lastSyncedAt=null,this.query={filters:{},search:"",sort:null},n.hasAttribute("data-ln-data-store-window")?this._windowIndex=Dt({windowSize:this._windowSize,pageSize:this._windowPageSize,requestPage:(r,u,f)=>{v(this.dom,"ln-data-store:request-page",{store:this._name,offset:r,limit:u,query:f,queryGen:this._windowIndex.queryGen})}}):this._windowIndex=null,this.windowed=this._windowIndex!==null,this.totalCount=0,this.presenters=null,this._mutationChain=Promise.resolve(),b[this._name]=this,Ft(this),this.ready=Vt(this),this}function Ft(n){n._handlers={create:r=>ee(n,"create",r.detail,()=>Pt(n,r.detail)),update:r=>ee(n,"update",r.detail,()=>jt(n,r.detail)),delete:r=>ee(n,"delete",r.detail,()=>$t(n,r.detail)),"bulk-delete":r=>ee(n,"bulk-delete",r.detail,()=>Kt(n,r.detail)),"sync-failed":r=>{n.isSyncing=!1,v(n.dom,"ln-data-store:sync-error",{store:n._name,error:r.detail&&r.detail.error,status:r.detail&&r.detail.status})}};for(const[r,u]of Object.entries(n._handlers))n.dom.addEventListener(`ln-data-store:request-${r}`,u);n._queryHandlers={"ln-search:change":r=>{r.preventDefault();const u=r.detail&&r.detail.term!=null?r.detail.term:"";u!==n.query.search&&(n.query.search=u,ye(n))},"ln-filter:change":r=>{r.preventDefault();const u=r.detail&&r.detail.key;if(!u)return;const f=(r.detail.values||[]).slice(),h=n.query.filters[u];(h?h.length===f.length&&h.every((p,m)=>p===f[m]):!f.length)||(f.length?n.query.filters[u]=f:delete n.query.filters[u],ye(n))},"ln-sort:change":r=>{r.preventDefault();const u=r.detail&&r.detail.field,f=r.detail&&r.detail.direction,h=f&&f!=="none"?{field:u,direction:f}:null,y=n.query.sort;!y&&!h||y&&h&&y.field===h.field&&y.direction===h.direction||(n.query.sort=h,ye(n))}};for(const[r,u]of Object.entries(n._queryHandlers))n.dom.addEventListener(r,u)}function ee(n,r,u,f){const h=u&&u.requestId;return n._mutationChain=n._mutationChain.then(()=>n.ready).then(()=>{if(n.initializationError)throw n.initializationError;return f()}).catch(y=>Ut(n,r,h,y)),n._mutationChain}function te(n,r=0){return P(n._name).then(u=>{if(n._windowIndex||n.windowed){const f=n.totalCount!=null?n.totalCount:u;n.totalCount=Math.max(0,f+r)}else n.totalCount=u;return n.hasCache=!0,n.isLoaded=!0,n.canServe=!0,Y(n._name,{schema_version:d,last_synced_at:n.lastSyncedAt,has_cache:!0,record_count:n.totalCount})})}function Pt(n,{tempId:r,data:u={},requestId:f}={}){const h={...u,id:r};return F(n._name,h).then(()=>te(n,1)).then(()=>{v(n.dom,"ln-data-store:created",{store:n._name,record:h,tempId:r,requestId:f})})}function jt(n,{id:r,data:u={},requestId:f}={}){return L(n._name,r).then(h=>{if(!h)throw new Error(`Record not found: ${r}`);const y=h.id,p={...h,...u,id:y},m=u.id,C=m!==void 0&&m!==y;return(C?Gt(n._name,y,{...p,id:m}):F(n._name,p)).then(()=>te(n,0)).then(()=>{v(n.dom,"ln-data-store:updated",{store:n._name,record:C?{...p,id:m}:p,previous:h,requestId:f})})})}function $t(n,{id:r,requestId:u}={}){return L(n._name,r).then(f=>{if(!f){v(n.dom,"ln-data-store:deleted",{store:n._name,id:r,requestId:u,missing:!0});return}const h=f.id;return we(n._name,h).then(()=>te(n,-1)).then(()=>{v(n.dom,"ln-data-store:deleted",{store:n._name,id:h,requestId:u})})})}function Kt(n,{ids:r=[],requestId:u}={}){return r.length?Promise.all(r.map(f=>L(n._name,f))).then(f=>{const h=f.filter(Boolean).map(y=>y.id);return ne(n._name,h).then(()=>te(n,-h.length)).then(()=>{v(n.dom,"ln-data-store:deleted",{store:n._name,ids:h,requestId:u})})}):(v(n.dom,"ln-data-store:deleted",{store:n._name,ids:[],requestId:u}),Promise.resolve())}function Ut(n,r,u,f){console.error("[ln-data-store] "+r+" failed:",f),v(n.dom,"ln-data-store:mutation-error",{store:n._name,action:r,requestId:u,error:f})}function Vt(n){return j().then(r=>{if(!r)throw new Error("IndexedDB is unavailable");return W(n._name)}).then(r=>{if(n.initializationError=null,r&&r.schema_version===d)n.lastSyncedAt=r.last_synced_at||null,n.totalCount=r.record_count||0,n.hasCache=r.has_cache===!0||n.totalCount>0,n.hasCache&&(n.isLoaded=!0,n.canServe=!0,v(n.dom,"ln-data-store:ready",{store:n._name,count:n.totalCount,source:"cache"})),n.isInitialized=!0,v(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:n.hasCache,lastSyncedAt:n.lastSyncedAt,count:n.totalCount});else{if(r&&r.schema_version!==d)return U(n._name).then(()=>Y(n._name,{schema_version:d,last_synced_at:null,has_cache:!1,record_count:0})).then(()=>{n.isInitialized=!0,n.hasCache=!1,v(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!1,lastSyncedAt:null,count:0})});n.isInitialized=!0,n.hasCache=!1,v(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!1,lastSyncedAt:null,count:0})}}).catch(r=>(n.isInitialized=!0,n.isLoaded=!1,n.canServe=!1,n.hasCache=!1,n.isSyncing=!1,n.initializationError=r,v(n.dom,"ln-data-store:initialization-error",{store:n._name,error:r}),{ok:!1,error:r}))}function Pe(n){n.isSyncing=!0,v(n.dom,"ln-data-store:request-remote-sync",{since:n.lastSyncedAt})}function je(n,r){return g().then(u=>u?(B()?Promise.all(r.map(h=>S(h))):Promise.resolve(r)).then(h=>new Promise((y,p)=>{const m=u.transaction(n,"readwrite"),C=m.objectStore(n);h.forEach(I=>C.put(I)),m.oncomplete=()=>y(),m.onerror=()=>{_(m.error),p(m.error)}})):void 0)}function ne(n,r){return g().then(u=>{if(u)return new Promise((f,h)=>{const y=u.transaction(n,"readwrite"),p=y.objectStore(n);r.forEach(m=>{p.delete(m),typeof m=="string"&&m.trim()!==""&&!isNaN(Number(m))?p.delete(Number(m)):typeof m=="number"&&p.delete(String(m))}),y.oncomplete=()=>f(),y.onerror=()=>h(y.error)})})}function Gt(n,r,u){return(B()?S(u):Promise.resolve(u)).then(h=>g().then(y=>{if(y)return new Promise((p,m)=>{const C=y.transaction(n,"readwrite"),I=C.objectStore(n);I.put(h),I.delete(r),C.oncomplete=()=>p(),C.onerror=()=>{_(C.error),m(C.error)}})}))}const Ht=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function Wt(n){return n?Object.keys(n).filter(r=>Array.isArray(n[r])&&n[r].length>0):[]}function Qt(n,r,u){return r.every(f=>u[f].map(String).includes(String(n[f])))}function Jt(n){return String(n||"").toLowerCase().split(/\s+/).filter(Boolean)}function Zt(n,r,u){return r.every(f=>u.some(h=>{const y=n[h];return y!=null&&String(y).toLowerCase().includes(f)}))}function Xt(n,r,u){return zt(n,r,u)}function Q(n,r){return Ot(r,n.presenters&&n.presenters.computed)}function Yt(n){return!n.sort&&!B()}function en(n,r,u){const f=Wt(r.filters),h=r.search?Jt(r.search):[],y=n._searchFields,p=h.length>0&&y&&y.length>0;return k(n._name,"readonly").then(m=>m?new Promise((C,I)=>{const K=[],M=m.openCursor();M.onsuccess=()=>{const R=M.result;if(!R||K.length>=u){C(K);return}const O=R.value;(!f.length||Qt(O,f,r.filters))&&(!p||Zt(O,h,y))&&K.push(O),R.continue()},M.onerror=()=>I(M.error)}):[])}function $e(n,r,u){return Rt(r,u,n._searchFields,Ht)}function Ke(n,r,u){const f=[];for(let y=r;y<r+u;y++){const p=n._windowIndex.getId(y);f.push(p)}const h=Array.from(new Set(f.filter(y=>y!==void 0)));return D(n._name,h).then(y=>{const p=new Map;for(let C=0;C<y.length;C++){const I=y[C];I&&p.set(String(I.id),I)}const m=[];for(let C=0;C<f.length;C++){const I=f[C];if(I===void 0)m.push(null);else{const K=p.get(String(I));m.push(K||null)}}return{data:Q(n,m),total:n._windowIndex.grandTotal,filtered:n._windowIndex.logicalTotal,offset:r,queryGen:n._windowIndex.queryGen}})}N.prototype.getAll=function(n={}){const r=this;if(r._windowIndex){const u=n.offset||0,f=n.limit||200;if(r._windowIndex.ensure(u,u+f,n),!r._windowIndex.hasLoaded&&!r.noLocalQuery){const h=u+f,y=p=>p.length?{data:Q(r,p),offset:u,queryGen:r._windowIndex.queryGen,provisional:!0}:Ke(r,u,f);return Yt(n)?en(r,n,h).then(p=>y(p.slice(u,h))):E(r._name).then(p=>y($e(r,p,n).records))}return Ke(r,u,f)}return E(r._name).then(u=>{const f=$e(r,u,n);return{data:Q(r,f.records),total:f.total,filtered:f.filtered}})},N.prototype.getById=function(n){return L(this._name,n).then(r=>r?Q(this,[r])[0]:null)},N.prototype.count=function(n){return n&&Object.keys(n).length>0?E(this._name).then(u=>Fe(u,n).length):this.windowed&&this.totalCount!=null?Promise.resolve(this.totalCount):P(this._name)},N.prototype.aggregate=function(n,r){return E(this._name).then(u=>Xt(u,n,r))},N.prototype.setPresenters=function(n){this.presenters=n},N.prototype.applySync=function(n,r,u,f){f=f||{};const h=this;if(h._windowIndex&&f.queryGen!=null&&f.queryGen!==h._windowIndex.queryGen)return Promise.resolve({ok:!0,stale:!0});let y=g().then(p=>{if(!p)throw new Error("IndexedDB unavailable")});return n.length>0&&(y=y.then(()=>je(h._name,n))),r.length>0&&(y=y.then(()=>ne(h._name,r))),y.then(()=>{if(h._windowIndex&&(f.offset!=null||f.total!=null)){const p=f.offset!=null?f.offset:0,m=n.map(I=>I.id),C=h._windowIndex.ingest(p,m,f.total,f.filtered,f.queryGen);if(C&&C.length)return ne(h._name,C)}}).then(()=>P(h._name)).then(p=>(h.totalCount=f.total!==void 0?f.total:p,h.hasCache=!0,Y(h._name,{schema_version:d,last_synced_at:u,has_cache:!0,record_count:h.totalCount}))).then(()=>{const p=!h.isLoaded;return h.isLoaded=!0,h.canServe=!0,h.isSyncing=!1,h.lastSyncedAt=u,p?(v(h.dom,"ln-data-store:loaded",{store:h._name,count:h.totalCount,meta:f}),v(h.dom,"ln-data-store:ready",{store:h._name,count:h.totalCount,source:"server",meta:f})):v(h.dom,"ln-data-store:synced",{store:h._name,added:n.length,deleted:r.length,changed:!0,meta:f}),{ok:!0}}).catch(p=>{h.isSyncing=!1;const m=p&&p.message?p.message:String(p);return console.error("[ln-data-store] applySync failed:",p),v(h.dom,"ln-data-store:sync-error",{store:h._name,error:m}),Bt(p)})},N.prototype.applyQuery=function(n,r){r=r||{};const u=this;let f=Promise.resolve();return n.length>0&&(f=f.then(()=>je(u._name,n))),f.then(()=>P(u._name)).then(h=>(u.totalCount=r.total!==void 0?r.total:h,n.length>0&&(u.canServe=!0),Q(u,n))).catch(h=>(console.error("[ln-data-store] applyQuery failed:",h),[]))},N.prototype.forceSync=function(){this.isSyncing||Pe(this)},N.prototype.fullReload=function(){const n=this;return U(n._name).then(()=>Y(n._name,{schema_version:d,last_synced_at:null,has_cache:!1,record_count:0})).then(()=>{n.isLoaded=!1,n.hasCache=!1,n.lastSyncedAt=null,n.totalCount=0,Pe(n)})},N.prototype.destroy=function(){if(this._windowIndex&&(this._windowIndex.clear(),this._windowIndex=null,this.windowed=!1),this._handlers){for(const[n,r]of Object.entries(this._handlers))this.dom.removeEventListener(`ln-data-store:request-${n}`,r);this._handlers=null}if(this._queryHandlers){for(const[n,r]of Object.entries(this._queryHandlers))this.dom.removeEventListener(n,r);this._queryHandlers=null}delete b[this._name],delete this.dom[t]};function tn(){return g().then(n=>{if(!n)return;const r=Array.from(n.objectStoreNames);return new Promise((u,f)=>{const h=n.transaction(r,"readwrite");r.forEach(y=>h.objectStore(y).clear()),h.oncomplete=()=>u(),h.onerror=()=>f(h.error)})}).then(()=>{Object.values(b).forEach(n=>{n.isLoaded=!1,n.canServe=!1,n.isInitialized=!1,n.initializationError=null,n.hasCache=!1,n.isSyncing=!1,n.lastSyncedAt=null,n.totalCount=0})})}function ye(n){n._windowIndex&&n._windowIndex.reset(),v(n.dom,"ln-data-store:query-changed",{store:n._name,query:{filters:Object.assign({},n.query.filters),search:n.query.search,sort:n.query.sort?Object.assign({},n.query.sort):null}})}const nn="data-ln-data-store-frozen";function Ue(n,r){n.setAttribute(nn,r)}function rn(n){const r=n[t];if(!r._windowIndex)return;const u=r._windowIndex.configure({windowSize:r._windowSize});u.length&&ne(r._name,u).catch(f=>{console.error("[ln-data-store] window shrink eviction failed:",f)})}function on(n){const r=n[t];r._windowIndex&&r._windowIndex.configure({pageSize:r._windowPageSize})}Ne(e,t,N,"ln-data-store",{attributes:i}),window[t].clearAll=tn,window[t].init=window[t],window[t].setStorageKey=Be,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.setStorageKey=Be)})()})();
|
|
1
|
+
(function(){"use strict";function pe(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function oe(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let a=1;a<t.length;a++)if(t[a]&&t[a].nodeType===1){i=t[a];break}if(!oe(i))return}e.apply(console,t)}}function v(e,t,o){const i=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function Z(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){Z(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Ue(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function Ve(e,t){const o=!!(t&&t.typed),i=t&&t.exclude,a={},l=e.elements,c={};if(o)for(let d=0;d<l.length;d++){const s=l[d];s.name&&s.type==="checkbox"&&!s.disabled&&(c[s.name]=(c[s.name]||0)+1)}for(let d=0;d<l.length;d++){const s=l[d];if(!(!s.name||s.disabled||s.type==="file"||s.type==="submit"||s.type==="button")&&!(i&&s.matches&&s.matches(i)))if(s.type==="checkbox")o&&c[s.name]===1?a[s.name]=s.checked:(a[s.name]||(a[s.name]=[]),s.checked&&a[s.name].push(s.value));else if(s.type==="radio")s.checked&&(a[s.name]=s.value);else if(s.type==="select-multiple"){a[s.name]=[];for(let w=0;w<s.options.length;w++)s.options[w].selected&&a[s.name].push(s.options[w].value)}else if(o&&s.type==="hidden")a[s.name]=s.value;else if(o&&(s.type==="number"||s.type==="range")){const w=Number(s.value);a[s.name]=s.value===""||isNaN(w)?null:w}else a[s.name]=s.value}return a}function Ge(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function He(e,t){const o=e.elements,i=[],a={};for(let l=0;l<o.length;l++){const c=o[l];c.name&&c.type==="checkbox"&&(a[c.name]=(a[c.name]||0)+1)}for(let l=0;l<o.length;l++){const c=o[l];if(c.type==="file"||c.type==="submit"||c.type==="button")continue;const d=c.getAttribute("data-ln-fill-as")||c.name;if(!d||!(d in t))continue;const s=t[d];if(c.type==="checkbox"){if(Array.isArray(s))c.checked=s.indexOf(c.value)!==-1;else if(a[c.name]>1){const w=String(s).split(",").map(function(b){return b.trim()});c.checked=w.indexOf(c.value)!==-1}else c.checked=Ge(s);i.push(c)}else if(c.type==="radio")c.checked=c.value===String(s),i.push(c);else if(c.type==="select-multiple"){if(Array.isArray(s))for(let w=0;w<c.options.length;w++)c.options[w].selected=s.indexOf(c.options[w].value)!==-1;i.push(c)}else c.value=s,c.tagName==="SELECT"&&s!=null&&c.setAttribute("data-ln-value",s),i.push(c)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=He,window.lnCore.serializeForm=Ve,window.lnCore.resolveFormMethod=Ue);const ge={};function We(e,t){ge[e]=t}function Qe(e){return ge[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=We,window.lnCore.getDataMapper=Qe);function Je(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,Z(function(){new MutationObserver(function(){v(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const me={};function Ze(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];me[o]=t}function Xe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return me[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=Ze,window.lnCore.getLocaleFallback=Xe,window.lnCore.ensureLocaleObserver=Je);const ie={};function Ye(e,t){ie[e]||(ie[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=ie[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function be(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let c=0;c<o.length;c++){const d=o[c],s=d.getAttribute("data-ln-field");t[s]!=null&&(d.textContent=t[s])}const i=e.querySelectorAll("[data-ln-attr]");for(let c=0;c<i.length;c++){const d=i[c],s=d.getAttribute("data-ln-attr").split(",");for(let w=0;w<s.length;w++){const b=s[w].trim().split(":");if(b.length!==2)continue;const _=b[0].trim(),x=b[1].trim();t[x]!=null&&d.setAttribute(_,t[x])}}const a=e.querySelectorAll("[data-ln-show]");for(let c=0;c<a.length;c++){const d=a[c],s=d.getAttribute("data-ln-show");s in t&&d.classList.toggle("hidden",!t[s])}const l=e.querySelectorAll("[data-ln-class]");for(let c=0;c<l.length;c++){const d=l[c],s=d.getAttribute("data-ln-class").split(",");for(let w=0;w<s.length;w++){const b=s[w].trim().split(":");if(b.length!==2)continue;const _=b[0].trim(),x=b[1].trim();x in t&&d.classList.toggle(_,!!t[x])}}return e}function et(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<o.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[i],t??null),o[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)be(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function _e(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const l=o.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(c,d){return t[d]!==void 0?t[d]:""}))}const i=function(l,c){return t[c]!==void 0?t[c]:""},a=Array.from(e.querySelectorAll("*"));e.nodeType===1&&a.push(e);for(let l=0;l<a.length;l++){const c=a[l],d=c.attributes;for(let s=0;s<d.length;s++){const w=d[s];w.value.indexOf("{{")!==-1&&c.setAttribute(w.name,w.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function tt(e,t,o,i,a,l){const c={};for(let s=0;s<e.children.length;s++){const w=e.children[s],b=w.getAttribute("data-ln-render-key");b&&(c[b]=w)}const d=document.createDocumentFragment();for(let s=0;s<t.length;s++){const w=t[s],b=String(i(w));let _=c[b];if(_)a(_,w,s);else{const x=Ye(o,l);if(!x||(_e(x,w),_=x.firstElementChild,!_))continue;_.setAttribute("data-ln-render-key",b),a(_,w,s)}d.appendChild(_)}e.textContent="",e.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=_e,window.lnCore.fill=be,window.lnCore.lnFill=et,window.lnCore.renderList=tt);function ae(e,t,o){const i=e.getAttribute(t);return i===null?o:i}function X(e,t,o){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?o:i}function se(e,t,o=!1){const i=e.getAttribute(t);if(i===null)return!!o;const a=i.trim().toLowerCase();return!(a==="false"||a==="0")}function le(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const ce=new Map;function Ce(e,t){const o=(e?e.join("|"):"")+"::"+t;if(ce.has(o))return ce.get(o);const i=new Set(e||[]),a=function(l,c){const d=l.getAttribute(c);return d!==null&&i.has(d)?d:t};return ce.set(o,a),a}function Se(e,t,o){const i=parseFloat(e.getAttribute(t));return isNaN(i)?o:i}function ve(e,t,o){const i=e.getAttribute(t);if(!i)return o;try{return JSON.parse(i)}catch{return o}}function Ae(e,t,o,i,a){if(!e||t===null)return!0;const l=i||"ln-component",c=e.type;if(c==="trigger"||c==="marker"||c==="string"||c==="list"||!c||t===""&&e.fallback!==void 0)return!0;const d=s=>{a?console.warn(s,a):console.warn(s)};if(c==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(d(`[${l}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(c==="enum"){const s=e.values||[];return s.includes(t)?!0:(d(`[${l}] Invalid value "${t}" for attribute "${o}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return d(`[${l}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(d(`[${l}] Value ${s} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(d(`[${l}] Value ${s} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(d(`[${l}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(s){return d(`[${l}] Invalid JSON for attribute "${o}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function xe(e,t,o){for(const i in o){const[a,l,c]=o[i];Object.defineProperty(e,i,{get:function(){return a(t,l,c)},enumerable:!0,configurable:!0})}return e}function ke(e){const t={};for(const o in e){const i=e[o];if(!i||!i.prop)continue;let a=i.read;if(!a&&i.type)switch(i.type){case"enum":a=Ce(i.values,i.fallback);break;case"integer":a=X;break;case"float":a=Se;break;case"boolean":a=se;break;case"list":a=le;break;case"json":a=ve;break;case"string":default:a=ae;break}a||(a=ae),t[i.prop]=[a,o,i.fallback]}return t}function nt(e){const t={};for(const o in e){const i=e[o];i&&i.effect&&(t[o]=i.effect)}return Object.keys(t).length?t:null}function rt(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=xe,window.lnCore.attrSpec=ke,window.lnCore.attrStr=ae,window.lnCore.attrInt=X,window.lnCore.attrBool=se,window.lnCore.attrList=le,window.lnCore.attrEnum=Ce,window.lnCore.attrFloat=Se,window.lnCore.attrJson=ve);function G(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function Ee(e,t,o,i){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c={selector:t,attribute:o,ComponentFn:i};if(e.matches&&e.matches(l)&&G(e,c),e.querySelectorAll){const d=e.querySelectorAll(l);for(let s=0;s<d.length;s++)G(d[s],c)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ot(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function it(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function Ie(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function at(e){const t=Ie(),o=e.observed||[];for(let i=0;i<o.length;i++){const a=o[i];t.byAttr.has(a)||t.byAttr.set(a,[]),t.byAttr.get(a).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const a=t.byDeclaredAttr.get(i);a.some(l=>l.componentTag===e.componentTag)||a.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=rt(e);if(i===null)t.reactiveWildcard.push(e);else for(const a of i)t.byReactive.has(a)||t.byReactive.set(a,[]),t.byReactive.get(a).push(e)}e.persist&&t.persist.push(e)}function qe(e,t,o,i){for(let a=0;a<e.length;a++){const l=e[a];if(!t[l.attribute])continue;const c=l.effects&&l.effects[o];c?c(t,o,i):l.onAttrChange&&(!l.declared||l.declared.has(o))&&l.onAttrChange(t,o,i)}}function st(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,i=Ie(),a=i.byAttr.get(t),l=pe()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!o&&!a&&!l)return;const c=e.target;if(e.oldValue!==c.getAttribute(t)){if(l&&oe(c)){const d=i.byDeclaredAttr.get(t),s=c.getAttribute(t);for(let w=0;w<d.length;w++)Ae(d[w].spec,s,t,d[w].componentTag,c)}if(window.lnCore._debugSink&&(o||a)&&window.lnCore._debugSink("attr",t,c,{oldValue:e.oldValue,newValue:c.getAttribute(t)}),o){const d=i.byReactive.get(t);d&&qe(d,c,t,e.oldValue),i.reactiveWildcard.length&&qe(i.reactiveWildcard,c,t,e.oldValue)}if(a)for(let d=0;d<a.length;d++){const s=a[d];if(s.handler){s.handler(c,t,e.oldValue);continue}s.onAttributeChange&&c[s.attribute]?s.onAttributeChange(c,t):(Ee(c,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(c))}}}function lt(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,Z(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{st(t[o])}catch(i){console.error("[ln-core] mutation handler failed",t[o].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function ue(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function de(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function fe(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Le(e){const t=ue();if(!t.length)return;const o=e.target;if(o){const a=o.nodeType===1?o:o.parentElement;if(a&&(a.isContentEditable||a.closest&&a.closest('[contenteditable]:not([contenteditable="false"])')))return}const i=de();if(e.target&&i.length)for(let a=0;a<i.length;a++){const l=i[a],c=l.query,d=e.target.nodeType===1?e.target.matches&&e.target.matches(c)?e.target:e.target.closest?e.target.closest(c):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(c):null;d&&l.onSubtreeChange(d,e)}for(let a=0;a<e.addedNodes.length;a++){const l=e.addedNodes[a];if(l.nodeType===1){const c=!!(l.firstElementChild||l.children&&l.children.length);for(let d=0;d<t.length;d++){const s=t[d];if(s.selector&&s.attribute&&s.ComponentFn){if(!c)l.matches&&l.matches(s.query)&&G(l,s);else if(l.matches&&l.matches(s.query)&&G(l,s),l.querySelectorAll){const w=l.querySelectorAll(s.query);for(let b=0;b<w.length;b++)G(w[b],s)}}s.onInit&&s.onInit(l)}}}for(let a=0;a<e.removedNodes.length;a++){const l=e.removedNodes[a];if(l.nodeType===1){if(document.contains(l))continue;const c=!!(l.firstElementChild||l.children&&l.children.length);for(let d=0;d<t.length;d++){const s=t[d],w=s.query;if(w){if(!c)l.matches&&l.matches(w)&&fe(l,s);else if(l.matches&&l.matches(w)&&fe(l,s),l.querySelectorAll){const b=l.querySelectorAll(w);for(let _=0;_<b.length;_++)fe(b[_],s)}}}}}}function De(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,Z(function(){const e=new MutationObserver(function(t){for(let o=0;o<t.length;o++){const i=t[o];if(i.type==="childList")try{Le(i)}catch(a){console.error("[ln-core] lifecycle handler failed",i.target,a)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function ct(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const o=t.takeRecords();for(let i=0;i<o.length;i++){const a=o[i];if(a.type==="childList")try{Le(a)}catch(l){console.error("[ln-core] lifecycle handler failed",a.target,l)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function ut(e){ue().push(e),e.onSubtreeChange&&e.query&&de().push(e),De()}function Ne(e,t,o,i,a={}){const l=a.extraAttributes||[],c=a.onAttributeChange||null,d=a.onSubtreeChange||null,s=a.onInit||null,w=a.onAttrChange||null,b=a.effects||null,_=a.attributes||null,x=_?nt(_):b,j=_?new Set(Object.keys(_)):null,$=a.persist||null;function g(L){const D=L||document.body;if(Ee(D,e,t,o),_&&pe())for(const F in _){const we=_[F],U=Array.from(D.querySelectorAll("["+F+"]"));D.matches&&D.matches("["+F+"]")&&U.push(D);for(let P=0;P<U.length;P++){const W=U[P];oe(W)&&Ae(we,W.getAttribute(F),F,i,W)}}s&&s(D)}const S=[];if(e.indexOf("[")!==-1){const L=/\[([\w-]+)/g;let D;for(;(D=L.exec(e))!==null;)S.push(D[1])}else S.push(e);at({selector:e,attribute:t,componentTag:i,attributes:_,ComponentFn:o,onInit:s,observed:S.concat(l),onAttributeChange:c,onAttrChange:w,effects:x,declared:j,persist:$}),lt();const q=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,k=a.subtreeQuery||(q?e:"["+e+"]"),A={selector:e,attribute:t,ComponentFn:o,onInit:s,onSubtreeChange:d,query:k};ue().push(A),d&&k&&de().push(A),De(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=Ne,window.lnCore.observeLifecycle=ut,window.lnCore.withoutLifecycle=ct);function E(){ot()>0?it(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E):E(),g}function dt(e){let t=!1;for(let o=0;o<e.length;o++){const i=e[o];if(!(i===""||i==null)&&(t=!0,!Number.isFinite(Number(i))))return"string"}return t?"number":"string"}function ft(e,t,o,i){if(o==="number"){const c=parseFloat(e),d=parseFloat(t);return(isNaN(c)?0:c)-(isNaN(d)?0:d)}const a=e!=null?String(e):"",l=t!=null?String(t):"";return i?i.compare(a,l):a<l?-1:a>l?1:0}function Te(e){return(e||"").replace(/^#/,"")}function he(e){const t=e===void 0?location.hash:e,o={},i=Te(t);if(!i)return o;const a=i.split("&");for(let l=0;l<a.length;l++){const c=a[l];if(!c)continue;const d=c.indexOf(":"),s=d>-1?c.slice(0,d):c,w=d>-1?c.slice(d+1):"";if(s)try{o[s]=decodeURIComponent(w)}catch{o[s]=w}}return o}function ht(e){if(!e)return null;const t=he();return e in t?t[e]:null}function wt(e,t){if(!e)return;const o=he();t==null?delete o[e]:o[e]=String(t);const a=Object.keys(o).map(function(l){const c=o[l];return c===""?l:l+":"+encodeURIComponent(c)}).join("&");Te(location.hash)!==a&&(location.hash=a)}function yt(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function pt(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function gt(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function mt(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function bt(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function _t(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),i=e.slice(t+1),a=i?i.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:o,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=he,window.lnCore.hashGet=ht,window.lnCore.hashSet=wt,window.lnCore.hashLinkClick=yt,window.lnCore.resolveHashNamespace=pt,window.lnCore.hashSortEncode=gt,window.lnCore.hashSortDecode=mt,window.lnCore.hashFilterEncode=bt,window.lnCore.hashFilterDecode=_t);let H=null;const Ct="ln-ashlar:storage-salt:v1",ze=32768;function Re(e){let t="";const o=e.byteLength;for(let i=0;i<o;i+=ze)t+=String.fromCharCode.apply(null,e.subarray(i,Math.min(i+ze,o)));return btoa(t)}function Oe(e){const t=atob(e),o=t.length,i=new Uint8Array(o);for(let a=0;a<o;a++)i[a]=t.charCodeAt(a);return i}function Me(e,t){let o=H,i={};return typeof CryptoKey<"u"&&e instanceof CryptoKey?o=e:e&&typeof e=="object"&&(i=e,typeof CryptoKey<"u"&&i.key instanceof CryptoKey&&(o=i.key)),{key:o,options:i}}async function St(e,t={}){if(!e)throw new Error("[ln-crypto] Key derivation failed: Secret string is required");const o=t.method||"pbkdf2",i=new TextEncoder;if(o==="sha256"){const s=await crypto.subtle.digest("SHA-256",i.encode(e));return crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["encrypt","decrypt"])}const a=t.salt||Ct,l=typeof a=="string"?i.encode(a):a,c=t.iterations||1e5,d=await crypto.subtle.importKey("raw",i.encode(e),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:l,iterations:c,hash:"SHA-256"},d,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Be(e,t={}){if(!e){H=null;return}try{const o=t.method||"sha256";H=await St(e,{...t,method:o})}catch(o){throw console.error("[ln-core/crypto] Key derivation failed:",o),H=null,o}}function B(){return H}async function vt(e,t,o){const{key:i}=Me(t);if(e==null)return e;if(!i)throw new Error("[ln-crypto] Encryption failed: No active cryptographic key provided");try{const a=new TextEncoder,l=crypto.getRandomValues(new Uint8Array(12)),c=typeof e=="string"?e:JSON.stringify(e),d=await crypto.subtle.encrypt({name:"AES-GCM",iv:l},i,a.encode(c));return{v:1,alg:"AES-GCM",encrypted:!0,iv:Re(l),data:Re(new Uint8Array(d))}}catch(a){throw console.error("[ln-core/crypto] Encryption failed:",a),new Error("[ln-crypto] Encryption failed: "+(a&&a.message?a.message:String(a)))}}async function At(e,t,o){const{key:i,options:a}=Me(t),l=a.silent===!0;if(!e||!e.encrypted)return e;if(!i){if(l)return{...e,decryptionError:!0};throw new Error("[ln-crypto] Decryption failed: No active cryptographic key provided")}if(!e.iv||!e.data){if(l)return{...e,decryptionError:!0};throw new Error("[ln-crypto] Decryption failed: Malformed envelope (missing iv or data)")}try{const c=new TextDecoder,d=Oe(e.iv),s=Oe(e.data),w=await crypto.subtle.decrypt({name:"AES-GCM",iv:d},i,s),b=c.decode(w);try{return JSON.parse(b)}catch{return b}}catch(c){if(l)return{...e,decryptionError:!0};throw console.error("[ln-core/crypto] Decryption failed. Key may be incorrect or payload tampered:",c),new Error("[ln-crypto] Decryption failed. Key may be incorrect or payload tampered: "+(c&&c.message?c.message:String(c)))}}function xt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=xt);function kt(e){return String(e||"").trim().toLowerCase()}function Et(e){const t=kt(e);return t?t.split(/\s+/).filter(Boolean):[]}function It(e,t){if(!t||t.length===0)return!0;if(!e)return!1;const o=String(e).toLowerCase();for(let i=0;i<t.length;i++)if(o.indexOf(t[i])===-1)return!1;return!0}function qt(e,t){if(!t||t.length===0)return!0;if(e==null)return!1;const o=String(e).trim().toLowerCase();for(let i=0;i<t.length;i++)if(String(t[i]).trim().toLowerCase()===o)return!0;return!1}function Lt(e={}){let t=e.windowSize>0?e.windowSize:1e3,o=e.pageSize>0?e.pageSize:200,i=e.fetchDebounce!=null?e.fetchDebounce:120;const a=typeof e.requestPage=="function"?e.requestPage:()=>{},l=new Map,c=new Set;let d=0,s=0,w=0,b=!1,_=null;function x(g,S){l.delete(g),l.set(g,S)}function j(){if(l.size<=t)return[];const g=[];for(;l.size>t;){const q=l.keys().next().value;g.push(l.get(q)),l.delete(q)}const S=new Set(l.values());return g.filter(q=>!S.has(q))}function $(g,S){c.add(g),clearTimeout(_),_=setTimeout(()=>a(g,o,S),i)}return{get logicalTotal(){return d},set logicalTotal(g){d=g},get grandTotal(){return s},set grandTotal(g){s=g},get queryGen(){return w},set queryGen(g){w=g},get size(){return l.size},get hasLoaded(){return b},getId:g=>{if(!l.has(g))return;const S=l.get(g);return x(g,S),S},ensure:(g,S,q)=>{if(!b&&!c.has(0))return $(0,q);if(d<=0)return;const k=Math.max(0,g),A=Math.min(d,S);for(let E=k;E<A;E++)if(!l.has(E)){const L=Math.floor(E/o)*o;if(!c.has(L))return $(L,q)}},ingest:(g,S,q,k,A)=>{if(A!=null&&A!==w)return[];b=!0,q!=null&&(s=q),k!=null&&(d=k);for(let E=0;E<S.length;E++)x(g+E,S[E]);return c.delete(g),j()},reset:function(){w++,this.clear()},clear:()=>{b=!1,l.clear(),c.clear(),clearTimeout(_)},configure:(g={})=>{let S=[];return g.windowSize>0&&g.windowSize!==t&&(t=g.windowSize,S=j()),g.pageSize>0&&(o=g.pageSize),g.fetchDebounce>=0&&(i=g.fetchDebounce),S}}}function Dt(e,t,o){if(!Array.isArray(e)||!t||!t.field)return e;const{field:i,direction:a}=t,l=a==="desc",c=e.map(s=>s?s[i]:void 0),d=dt(c);return[...e].sort((s,w)=>{const b=s?s[i]:void 0,_=w?w[i]:void 0,x=ft(b,_,d,o);return l?-x:x})}function Fe(e,t){if(!Array.isArray(e)||!t||typeof t!="object")return e;const o=Object.keys(t).filter(i=>Array.isArray(t[i])&&t[i].length>0);return o.length?e.filter(i=>i?o.every(a=>qt(i[a],t[a])):!1):e}function Nt(e,t,o){if(!Array.isArray(e)||!t||!o||!o.length)return e;const i=Et(t);return i.length?e.filter(a=>a?i.every(l=>o.some(c=>{const d=a[c];return d!=null&&It(String(d),[l])})):!1):e}function Tt(e,t,o){if(!Array.isArray(e)||!e.length)return 0;if(o==="count")return e.length;const i=e.map(l=>l&&l[t]!=null?parseFloat(l[t]):NaN).filter(l=>Number.isFinite(l)),a=i.reduce((l,c)=>l+c,0);return o==="sum"?a:o==="avg"&&i.length?a/i.length:0}function zt(e,t={},o=[],i){if(!Array.isArray(e))return{records:[],total:0,filtered:0};const a=e.length;let l=e;t.filters&&(l=Fe(l,t.filters)),t.search&&(l=Nt(l,t.search,o));const c=l.length;if(t.sort&&(l=Dt(l,t.sort,i)),t.offset||t.limit){const d=t.offset||0,s=t.limit||l.length;l=l.slice(d,d+s)}return{records:l,total:a,filtered:c}}function Rt(e,t){return!Array.isArray(e)||!t||typeof t!="object"?e:e.map(o=>{if(!o)return null;const i={...o};for(const[a,l]of Object.entries(t))if(typeof l=="function")try{i[a]=l(o)}catch{i[a]=void 0}return i})}function Ot(e,t,o,i="_meta"){if(!Array.isArray(e)||!e.includes(i))return!0;for(const a of Object.keys(t||{})){if(!e.includes(a))return!0;const l=t[a]&&t[a].indexes||[],c=o&&o[a]||[];if(l.some(d=>!c.includes(d)))return!0}return!1}function Mt(e){return{ok:!1,error:e&&e.message?e.message:String(e)}}(function(){const e="data-ln-data-store",t="lnDataStore";if(window[t]!==void 0)return;function o(n,r,u){const f=n.getAttribute(r);if(f==="never"||f==="-1")return-1;const h=parseInt(f,10);return isNaN(h)?u:h}const i={"data-ln-data-store":{type:"marker",effect:Ke,description:"Identifies the element as a data-store definition container"},"data-ln-data-store-indexes":{type:"list",effect:Ke,description:"Comma-separated index field names for the IndexedDB store"},"data-ln-data-store-stale":{prop:"_staleThreshold",type:"integer",read:o,fallback:300,description:"Cache staleness threshold in seconds, or -1/never"},"data-ln-data-store-search-fields":{prop:"_searchFields",type:"list",read:le,description:"Record fields to index for client-side search"},"data-ln-data-store-no-local-query":{prop:"noLocalQuery",type:"boolean",read:se,description:"Bypasses local IndexedDB query resolution, forcing remote fetching"},"data-ln-data-store-window":{prop:"_windowSize",type:"integer",read:X,fallback:1e3,min:10,effect:rn,description:"Virtual scrolling cache window size in records"},"data-ln-data-store-window-page":{prop:"_windowPageSize",type:"integer",read:X,fallback:200,min:5,effect:on,description:"Virtual scrolling slice page size"},"data-ln-data-store-frozen":{type:"marker",description:"Applied at runtime to indicate store schema is locked in IndexedDB"}},a=ke(i),l="ln_app_cache",c="_meta",d="1.0";let s=null,w=null;const b={};function _(n){n&&n.name==="QuotaExceededError"&&v(document,"ln-data-store:quota-exceeded",{error:n})}function x(){const n={};for(const r of document.querySelectorAll(`[${e}]`)){const u=r.id;if(u){const f=r.getAttribute("data-ln-data-store-indexes")||"";n[u]={indexes:f.split(",").map(h=>h.trim()).filter(Boolean)}}}return n}function j(){return w||(w=new Promise(n=>{if(typeof indexedDB>"u")return console.warn("[ln-data-store] IndexedDB is not available in this environment"),n(null);const r=x(),u=Object.keys(r),f=indexedDB.open(l);f.onerror=()=>{console.warn("[ln-data-store] IndexedDB open failed"),n(null)},f.onsuccess=h=>{const y=h.target.result,p=Array.from(y.objectStoreNames),m=u.filter(T=>p.includes(T));let C={};if(m.length>0){const T=y.transaction(m,"readonly");for(const z of m)C[z]=Array.from(T.objectStore(z).indexNames)}if(!Ot(p,r,C,c))return $(y),s=y,n(y);const K=y.version;y.close();const M=indexedDB.open(l,K+1);let R=!1,O=null;M.onblocked=()=>{console.warn("[ln-data-store] Database upgrade blocked — waiting for other tabs to close connection"),v(document,"ln-data-store:blocked",{db:l}),O||(O=setTimeout(()=>{R||(console.warn("[ln-data-store] Database upgrade timed out while blocked"),R=!0,w=null,n(null))},5e3))},M.onerror=()=>{R||(O&&clearTimeout(O),R=!0,w=null,console.warn("[ln-data-store] Database upgrade failed"),n(null))},M.onupgradeneeded=T=>{const z=T.target.result,an=T.target.transaction;z.objectStoreNames.contains(c)||z.createObjectStore(c,{keyPath:"key"});for(const J of u)if(z.objectStoreNames.contains(J)){const re=an.objectStore(J);for(const V of r[J].indexes)re.indexNames.contains(V)||re.createIndex(V,V,{unique:!1})}else{const re=z.createObjectStore(J,{keyPath:"id"});for(const V of r[J].indexes)re.createIndex(V,V,{unique:!1})}},M.onsuccess=T=>{if(R){T.target.result&&T.target.result.close();return}O&&clearTimeout(O),R=!0;const z=T.target.result;$(z),s=z,n(z)}}}),w)}function $(n){n.onversionchange=()=>{n.close(),s=null,w=null}}function g(){return s?Promise.resolve(s):(w=null,j())}async function S(n){if(!B()||!n)return n;const r={...n},u=r.id,f=await vt(r);return!f||!f.encrypted?n:{...f,id:u}}async function q(n){return!n||!n.encrypted||!B()?n:At(n,{silent:!0})}const k=(n,r)=>g().then(u=>u?u.transaction(n,r).objectStore(n):null);function A(n){return new Promise((r,u)=>{n.onsuccess=()=>r(n.result),n.onerror=()=>{_(n.error),u(n.error)}})}const E=n=>k(n,"readonly").then(r=>r?A(r.getAll()):[]).then(r=>B()?Promise.all(r.map(u=>q(u))):r),L=(n,r)=>k(n,"readonly").then(u=>u?A(u.get(r)).then(f=>f!==void 0?f:typeof r=="string"&&r.trim()!==""&&!isNaN(Number(r))?A(u.get(Number(r))):typeof r=="number"?A(u.get(String(r))):null):null).then(u=>u?q(u):null),D=(n,r)=>g().then(u=>{if(!u)return[];const h=u.transaction(n,"readonly").objectStore(n),y=r.map(p=>A(h.get(p)).then(m=>m!==void 0?m:typeof p=="string"&&p.trim()!==""&&!isNaN(Number(p))?A(h.get(Number(p))):typeof p=="number"?A(h.get(String(p))):null));return Promise.all(y).then(p=>B()?Promise.all(p.map(m=>m?q(m):null)):p)}),F=(n,r)=>(B()?S(r):Promise.resolve(r)).then(f=>k(n,"readwrite").then(h=>h?A(h.put(f)):null)),we=(n,r)=>k(n,"readwrite").then(u=>u?A(u.delete(r)).then(()=>{if(typeof r=="string"&&r.trim()!==""&&!isNaN(Number(r)))return A(u.delete(Number(r)));if(typeof r=="number")return A(u.delete(String(r)))}):null),U=n=>k(n,"readwrite").then(r=>r?A(r.clear()):null),P=n=>k(n,"readonly").then(r=>r?A(r.count()):0),W=n=>k(c,"readonly").then(r=>r?A(r.get(n)):null),Y=(n,r)=>k(c,"readwrite").then(u=>{if(u)return r.key=n,A(u.put(r))});function N(n){return this.dom=n,this._name=n.id,this._name||console.warn("[ln-data-store] missing id — the store cannot be addressed",n),xe(this,n,a),this._handlers=null,this.isLoaded=!1,this.canServe=!1,this.isInitialized=!1,this.initializationError=null,this.hasCache=!1,this.isSyncing=!1,this.lastSyncedAt=null,this.query={filters:{},search:"",sort:null},n.hasAttribute("data-ln-data-store-window")?this._windowIndex=Lt({windowSize:this._windowSize,pageSize:this._windowPageSize,requestPage:(r,u,f)=>{v(this.dom,"ln-data-store:request-page",{store:this._name,offset:r,limit:u,query:f,queryGen:this._windowIndex.queryGen})}}):this._windowIndex=null,this.windowed=this._windowIndex!==null,this.totalCount=0,this.presenters=null,this._mutationChain=Promise.resolve(),b[this._name]=this,Bt(this),this.ready=Ut(this),this}function Bt(n){n._handlers={create:r=>ee(n,"create",r.detail,()=>Ft(n,r.detail)),update:r=>ee(n,"update",r.detail,()=>Pt(n,r.detail)),delete:r=>ee(n,"delete",r.detail,()=>jt(n,r.detail)),"bulk-delete":r=>ee(n,"bulk-delete",r.detail,()=>$t(n,r.detail)),"sync-failed":r=>{n.isSyncing=!1,v(n.dom,"ln-data-store:sync-error",{store:n._name,error:r.detail&&r.detail.error,status:r.detail&&r.detail.status})}};for(const[r,u]of Object.entries(n._handlers))n.dom.addEventListener(`ln-data-store:request-${r}`,u);n._queryHandlers={"ln-search:change":r=>{r.preventDefault();const u=r.detail&&r.detail.term!=null?r.detail.term:"";u!==n.query.search&&(n.query.search=u,ye(n))},"ln-filter:change":r=>{r.preventDefault();const u=r.detail&&r.detail.key;if(!u)return;const f=(r.detail.values||[]).slice(),h=n.query.filters[u];(h?h.length===f.length&&h.every((p,m)=>p===f[m]):!f.length)||(f.length?n.query.filters[u]=f:delete n.query.filters[u],ye(n))},"ln-sort:change":r=>{r.preventDefault();const u=r.detail&&r.detail.field,f=r.detail&&r.detail.direction,h=f&&f!=="none"?{field:u,direction:f}:null,y=n.query.sort;!y&&!h||y&&h&&y.field===h.field&&y.direction===h.direction||(n.query.sort=h,ye(n))}};for(const[r,u]of Object.entries(n._queryHandlers))n.dom.addEventListener(r,u)}function ee(n,r,u,f){const h=u&&u.requestId;return n._mutationChain=n._mutationChain.then(()=>n.ready).then(()=>{if(n.initializationError)throw n.initializationError;return f()}).catch(y=>Kt(n,r,h,y)),n._mutationChain}function te(n,r=0){return P(n._name).then(u=>{if(n._windowIndex||n.windowed){const f=n.totalCount!=null?n.totalCount:u;n.totalCount=Math.max(0,f+r)}else n.totalCount=u;return n.hasCache=!0,n.isLoaded=!0,n.canServe=!0,Y(n._name,{schema_version:d,last_synced_at:n.lastSyncedAt,has_cache:!0,record_count:n.totalCount})})}function Ft(n,{tempId:r,data:u={},requestId:f}={}){const h={...u,id:r};return F(n._name,h).then(()=>te(n,1)).then(()=>{v(n.dom,"ln-data-store:created",{store:n._name,record:h,tempId:r,requestId:f})})}function Pt(n,{id:r,data:u={},requestId:f}={}){return L(n._name,r).then(h=>{if(!h)throw new Error(`Record not found: ${r}`);const y=h.id,p={...h,...u,id:y},m=u.id,C=m!==void 0&&m!==y;return(C?Vt(n._name,y,{...p,id:m}):F(n._name,p)).then(()=>te(n,0)).then(()=>{v(n.dom,"ln-data-store:updated",{store:n._name,record:C?{...p,id:m}:p,previous:h,requestId:f})})})}function jt(n,{id:r,requestId:u}={}){return L(n._name,r).then(f=>{if(!f){v(n.dom,"ln-data-store:deleted",{store:n._name,id:r,requestId:u,missing:!0});return}const h=f.id;return we(n._name,h).then(()=>te(n,-1)).then(()=>{v(n.dom,"ln-data-store:deleted",{store:n._name,id:h,requestId:u})})})}function $t(n,{ids:r=[],requestId:u}={}){return r.length?Promise.all(r.map(f=>L(n._name,f))).then(f=>{const h=f.filter(Boolean).map(y=>y.id);return ne(n._name,h).then(()=>te(n,-h.length)).then(()=>{v(n.dom,"ln-data-store:deleted",{store:n._name,ids:h,requestId:u})})}):(v(n.dom,"ln-data-store:deleted",{store:n._name,ids:[],requestId:u}),Promise.resolve())}function Kt(n,r,u,f){console.error("[ln-data-store] "+r+" failed:",f),v(n.dom,"ln-data-store:mutation-error",{store:n._name,action:r,requestId:u,error:f})}function Ut(n){return j().then(r=>{if(!r)throw new Error("IndexedDB is unavailable");return W(n._name)}).then(r=>{if(n.initializationError=null,r&&r.schema_version===d)n.lastSyncedAt=r.last_synced_at||null,n.totalCount=r.record_count||0,n.hasCache=r.has_cache===!0||n.totalCount>0,n.hasCache&&(n.isLoaded=!0,n.canServe=!0,v(n.dom,"ln-data-store:ready",{store:n._name,count:n.totalCount,source:"cache"})),n.isInitialized=!0,v(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:n.hasCache,lastSyncedAt:n.lastSyncedAt,count:n.totalCount});else{if(r&&r.schema_version!==d)return U(n._name).then(()=>Y(n._name,{schema_version:d,last_synced_at:null,has_cache:!1,record_count:0})).then(()=>{n.isInitialized=!0,n.hasCache=!1,v(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!1,lastSyncedAt:null,count:0})});n.isInitialized=!0,n.hasCache=!1,v(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!1,lastSyncedAt:null,count:0})}}).catch(r=>(n.isInitialized=!0,n.isLoaded=!1,n.canServe=!1,n.hasCache=!1,n.isSyncing=!1,n.initializationError=r,v(n.dom,"ln-data-store:initialization-error",{store:n._name,error:r}),{ok:!1,error:r}))}function Pe(n){n.isSyncing=!0,v(n.dom,"ln-data-store:request-remote-sync",{since:n.lastSyncedAt})}function je(n,r){return g().then(u=>u?(B()?Promise.all(r.map(h=>S(h))):Promise.resolve(r)).then(h=>new Promise((y,p)=>{const m=u.transaction(n,"readwrite"),C=m.objectStore(n);h.forEach(I=>C.put(I)),m.oncomplete=()=>y(),m.onerror=()=>{_(m.error),p(m.error)}})):void 0)}function ne(n,r){return g().then(u=>{if(u)return new Promise((f,h)=>{const y=u.transaction(n,"readwrite"),p=y.objectStore(n);r.forEach(m=>{p.delete(m),typeof m=="string"&&m.trim()!==""&&!isNaN(Number(m))?p.delete(Number(m)):typeof m=="number"&&p.delete(String(m))}),y.oncomplete=()=>f(),y.onerror=()=>h(y.error)})})}function Vt(n,r,u){return(B()?S(u):Promise.resolve(u)).then(h=>g().then(y=>{if(y)return new Promise((p,m)=>{const C=y.transaction(n,"readwrite"),I=C.objectStore(n);I.put(h),I.delete(r),C.oncomplete=()=>p(),C.onerror=()=>{_(C.error),m(C.error)}})}))}const Gt=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function Ht(n){return n?Object.keys(n).filter(r=>Array.isArray(n[r])&&n[r].length>0):[]}function Wt(n,r,u){return r.every(f=>u[f].map(String).includes(String(n[f])))}function Qt(n){return String(n||"").toLowerCase().split(/\s+/).filter(Boolean)}function Jt(n,r,u){return r.every(f=>u.some(h=>{const y=n[h];return y!=null&&String(y).toLowerCase().includes(f)}))}function Zt(n,r,u){return Tt(n,r,u)}function Q(n,r){return Rt(r,n.presenters&&n.presenters.computed)}function Xt(n){return!n.sort&&!B()}function Yt(n,r,u){const f=Ht(r.filters),h=r.search?Qt(r.search):[],y=n._searchFields,p=h.length>0&&y&&y.length>0;return k(n._name,"readonly").then(m=>m?new Promise((C,I)=>{const K=[],M=m.openCursor();M.onsuccess=()=>{const R=M.result;if(!R||K.length>=u){C(K);return}const O=R.value;(!f.length||Wt(O,f,r.filters))&&(!p||Jt(O,h,y))&&K.push(O),R.continue()},M.onerror=()=>I(M.error)}):[])}function $e(n,r,u){return zt(r,u,n._searchFields,Gt)}function en(n,r,u){const f=[];for(let y=r;y<r+u;y++){const p=n._windowIndex.getId(y);f.push(p)}const h=Array.from(new Set(f.filter(y=>y!==void 0)));return D(n._name,h).then(y=>{const p=new Map;for(let C=0;C<y.length;C++){const I=y[C];I&&p.set(String(I.id),I)}const m=[];for(let C=0;C<f.length;C++){const I=f[C];if(I===void 0)m.push(null);else{const K=p.get(String(I));m.push(K||null)}}return{data:Q(n,m),total:n._windowIndex.grandTotal,filtered:n._windowIndex.logicalTotal,offset:r,queryGen:n._windowIndex.queryGen}})}N.prototype.getAll=function(n={}){const r=this;if(r._windowIndex){const u=n.offset||0,f=n.limit||200;if(r._windowIndex.ensure(u,u+f,n),!r._windowIndex.hasLoaded&&!r.noLocalQuery){const h=u+f,y=p=>({data:Q(r,p),offset:u,queryGen:r._windowIndex.queryGen,provisional:!0});return Xt(n)?Yt(r,n,h).then(p=>y(p.slice(u,h))):E(r._name).then(p=>y($e(r,p,n).records))}return en(r,u,f)}return E(r._name).then(u=>{const f=$e(r,u,n);return{data:Q(r,f.records),total:f.total,filtered:f.filtered}})},N.prototype.getById=function(n){return L(this._name,n).then(r=>r?Q(this,[r])[0]:null)},N.prototype.count=function(n){return n&&Object.keys(n).length>0?E(this._name).then(u=>Fe(u,n).length):this.windowed&&this.totalCount!=null?Promise.resolve(this.totalCount):P(this._name)},N.prototype.aggregate=function(n,r){return E(this._name).then(u=>Zt(u,n,r))},N.prototype.setPresenters=function(n){this.presenters=n},N.prototype.applySync=function(n,r,u,f){f=f||{};const h=this;if(h._windowIndex&&f.queryGen!=null&&f.queryGen!==h._windowIndex.queryGen)return Promise.resolve({ok:!0,stale:!0});let y=g().then(p=>{if(!p)throw new Error("IndexedDB unavailable")});return n.length>0&&(y=y.then(()=>je(h._name,n))),r.length>0&&(y=y.then(()=>ne(h._name,r))),y.then(()=>{if(h._windowIndex&&(f.offset!=null||f.total!=null)){const p=f.offset!=null?f.offset:0,m=n.map(I=>I.id),C=h._windowIndex.ingest(p,m,f.total,f.filtered,f.queryGen);if(C&&C.length)return ne(h._name,C)}}).then(()=>P(h._name)).then(p=>(h.totalCount=f.total!==void 0?f.total:p,h.hasCache=!0,Y(h._name,{schema_version:d,last_synced_at:u,has_cache:!0,record_count:h.totalCount}))).then(()=>{const p=!h.isLoaded;return h.isLoaded=!0,h.canServe=!0,h.isSyncing=!1,h.lastSyncedAt=u,p?(v(h.dom,"ln-data-store:loaded",{store:h._name,count:h.totalCount,meta:f}),v(h.dom,"ln-data-store:ready",{store:h._name,count:h.totalCount,source:"server",meta:f})):v(h.dom,"ln-data-store:synced",{store:h._name,added:n.length,deleted:r.length,changed:!0,meta:f}),{ok:!0}}).catch(p=>{h.isSyncing=!1;const m=p&&p.message?p.message:String(p);return console.error("[ln-data-store] applySync failed:",p),v(h.dom,"ln-data-store:sync-error",{store:h._name,error:m}),Mt(p)})},N.prototype.applyQuery=function(n,r){r=r||{};const u=this;let f=Promise.resolve();return n.length>0&&(f=f.then(()=>je(u._name,n))),f.then(()=>P(u._name)).then(h=>(u.totalCount=r.total!==void 0?r.total:h,n.length>0&&(u.canServe=!0),Q(u,n))).catch(h=>(console.error("[ln-data-store] applyQuery failed:",h),[]))},N.prototype.forceSync=function(){this.isSyncing||Pe(this)},N.prototype.fullReload=function(){const n=this;return U(n._name).then(()=>Y(n._name,{schema_version:d,last_synced_at:null,has_cache:!1,record_count:0})).then(()=>{n.isLoaded=!1,n.hasCache=!1,n.lastSyncedAt=null,n.totalCount=0,Pe(n)})},N.prototype.destroy=function(){if(this._windowIndex&&(this._windowIndex.clear(),this._windowIndex=null,this.windowed=!1),this._handlers){for(const[n,r]of Object.entries(this._handlers))this.dom.removeEventListener(`ln-data-store:request-${n}`,r);this._handlers=null}if(this._queryHandlers){for(const[n,r]of Object.entries(this._queryHandlers))this.dom.removeEventListener(n,r);this._queryHandlers=null}delete b[this._name],delete this.dom[t]};function tn(){return g().then(n=>{if(!n)return;const r=Array.from(n.objectStoreNames);return new Promise((u,f)=>{const h=n.transaction(r,"readwrite");r.forEach(y=>h.objectStore(y).clear()),h.oncomplete=()=>u(),h.onerror=()=>f(h.error)})}).then(()=>{Object.values(b).forEach(n=>{n.isLoaded=!1,n.canServe=!1,n.isInitialized=!1,n.initializationError=null,n.hasCache=!1,n.isSyncing=!1,n.lastSyncedAt=null,n.totalCount=0})})}function ye(n){n._windowIndex&&n._windowIndex.reset(),v(n.dom,"ln-data-store:query-changed",{store:n._name,query:{filters:Object.assign({},n.query.filters),search:n.query.search,sort:n.query.sort?Object.assign({},n.query.sort):null}})}const nn="data-ln-data-store-frozen";function Ke(n,r){n.setAttribute(nn,r)}function rn(n){const r=n[t];if(!r._windowIndex)return;const u=r._windowIndex.configure({windowSize:r._windowSize});u.length&&ne(r._name,u).catch(f=>{console.error("[ln-data-store] window shrink eviction failed:",f)})}function on(n){const r=n[t];r._windowIndex&&r._windowIndex.configure({pageSize:r._windowPageSize})}Ne(e,t,N,"ln-data-store",{attributes:i}),window[t].clearAll=tn,window[t].init=window[t],window[t].setStorageKey=Be,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.setStorageKey=Be)})()})();
|
|
@@ -774,14 +774,12 @@ import { aggregateRecords, decorateRecords, filterRecords, queryRecords, checkNe
|
|
|
774
774
|
// (empty store, or nothing matched locally) is not an answer either:
|
|
775
775
|
// the positional page reports the window as unresolved and the view
|
|
776
776
|
// keeps the previous generation until the server settles it.
|
|
777
|
-
const provisional = records =>
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
: _positionalPage(self, offset, limit);
|
|
777
|
+
const provisional = records => ({
|
|
778
|
+
data: _decorate(self, records),
|
|
779
|
+
offset: offset,
|
|
780
|
+
queryGen: self._windowIndex.queryGen,
|
|
781
|
+
provisional: true
|
|
782
|
+
});
|
|
785
783
|
|
|
786
784
|
if (_canScanEarly(options)) {
|
|
787
785
|
return _scanLocal(self, options, need).then(matches =>
|
|
@@ -271,7 +271,7 @@ altogether. See [`ln-search`'s SSR table section](../ln-search/README.md) and
|
|
|
271
271
|
`demo/admin/src/pages/table.html` for the canonical markup. `ln-table` is
|
|
272
272
|
only needed once sort, column filters (`data-ln-table-filter-col`), or
|
|
273
273
|
data-driven rows enter the picture — see `demo/admin/src/pages/table-filter.html`
|
|
274
|
-
and `demo/admin/src/pages/table-
|
|
274
|
+
and `demo/admin/src/pages/table-api.html`. The two shapes never combine on
|
|
275
275
|
the same target: `ln-table` calls `preventDefault()` unconditionally on
|
|
276
276
|
`ln-search:change`, and since `dispatchCancelable` bubbles, that supersedes
|
|
277
277
|
`ln-search`'s own DOM-filter path the instant `data-ln-table` is present.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function G(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function M(t){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return t?window.lnCore._debugIsContained(t):window.lnCore._debugSink!==null;if(t&&t.closest){const e=t.closest("[data-ln-debug]");return!(!e||typeof document<"u"&&e===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const t=console.warn;console.warn=function(...e){if(typeof e[0]=="string"&&(e[0].startsWith("[ln-")||e[0].startsWith("[lnCore"))){let o=null;for(let s=1;s<e.length;s++)if(e[s]&&e[s].nodeType===1){o=e[s];break}if(!M(o))return}t.apply(console,e)}}function D(t,e,l){const o=l||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",e,t,o),t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:o}))}function gt(t,e,l){t._applyFilterAndSort(),t._vStart=-1,t._vEnd=-1,t._render(),t._updateFooter();const o={sort:t.currentSort,filters:t.currentFilters,search:t.currentSearch};o[l]=t.name,D(t.dom,e,o)}function H(t,e){if(!document.body){document.addEventListener("DOMContentLoaded",function(){H(t,e)}),console.warn("["+e+'] Script loaded before <body> — add "defer" to your <script> tag');return}t()}function K(t){return t.hasAttribute("value")?t.getAttribute("value"):t.hasAttribute("data-ln-value")?t.getAttribute("data-ln-value"):t.tagName==="TIME"&&t.hasAttribute("datetime")?t.getAttribute("datetime"):t.textContent.trim()}function mt(t){const e=t.querySelector('input[name="_method"]');return((e&&e.value!==""?e.value:t.method)||"").toUpperCase()}function yt(t,e){const l=!!(e&&e.typed),o=e&&e.exclude,s={},h=t.elements,c={};if(l)for(let f=0;f<h.length;f++){const r=h[f];r.name&&r.type==="checkbox"&&!r.disabled&&(c[r.name]=(c[r.name]||0)+1)}for(let f=0;f<h.length;f++){const r=h[f];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(o&&r.matches&&r.matches(o)))if(r.type==="checkbox")l&&c[r.name]===1?s[r.name]=r.checked:(s[r.name]||(s[r.name]=[]),r.checked&&s[r.name].push(r.value));else if(r.type==="radio")r.checked&&(s[r.name]=r.value);else if(r.type==="select-multiple"){s[r.name]=[];for(let p=0;p<r.options.length;p++)r.options[p].selected&&s[r.name].push(r.options[p].value)}else if(l&&r.type==="hidden")s[r.name]=r.value;else if(l&&(r.type==="number"||r.type==="range")){const p=Number(r.value);s[r.name]=r.value===""||isNaN(p)?null:p}else s[r.name]=r.value}return s}function Ct(t){if(typeof t!="string")return!!t;const e=t.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!==""&&e!=="off"&&e!=="no"}function St(t,e){const l=t.elements,o=[],s={};for(let h=0;h<l.length;h++){const c=l[h];c.name&&c.type==="checkbox"&&(s[c.name]=(s[c.name]||0)+1)}for(let h=0;h<l.length;h++){const c=l[h];if(c.type==="file"||c.type==="submit"||c.type==="button")continue;const f=c.getAttribute("data-ln-fill-as")||c.name;if(!f||!(f in e))continue;const r=e[f];if(c.type==="checkbox"){if(Array.isArray(r))c.checked=r.indexOf(c.value)!==-1;else if(s[c.name]>1){const p=String(r).split(",").map(function(m){return m.trim()});c.checked=p.indexOf(c.value)!==-1}else c.checked=Ct(r);o.push(c)}else if(c.type==="radio")c.checked=c.value===String(r),o.push(c);else if(c.type==="select-multiple"){if(Array.isArray(r))for(let p=0;p<c.options.length;p++)c.options[p].selected=r.indexOf(c.options[p].value)!==-1;o.push(c)}else c.value=r,c.tagName==="SELECT"&&r!=null&&c.setAttribute("data-ln-value",r),o.push(c)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=St,window.lnCore.serializeForm=yt,window.lnCore.resolveFormMethod=mt);const Q={};function vt(t,e){Q[t]=e}function At(t){return Q[t]||{ingress:e=>e,egress:e=>e}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=vt,window.lnCore.getDataMapper=At);function Et(t){const e=t?t.closest("[lang]"):null,l=(e?e.getAttribute("lang")||e.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return l?l.trim():"en-US"}function kt(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,H(function(){new MutationObserver(function(){D(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const Y={};function xt(t,e){if(!t||typeof e!="object")return;const l=t.toLowerCase().split("-")[0];Y[l]=e}function Dt(t){if(!t)return null;const e=t.toLowerCase().split("-")[0];return Y[e]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=xt,window.lnCore.getLocaleFallback=Dt,window.lnCore.ensureLocaleObserver=kt);const N={};function J(t,e){N[t]||(N[t]=document.querySelector('[data-ln-template="'+t+'"]'));const l=N[t];return l?l.content.cloneNode(!0):(console.warn("["+(e||"ln-core")+'] Template "'+t+'" not found'),null)}function X(t,e,l){if(t){const o=t.querySelector('[data-ln-template="'+e+'"]');if(o)return o.content.cloneNode(!0)}return J(e,l)}function Z(t,e){if(!t||!e)return t;const l=t.querySelectorAll("[data-ln-field]");for(let c=0;c<l.length;c++){const f=l[c],r=f.getAttribute("data-ln-field");e[r]!=null&&(f.textContent=e[r])}const o=t.querySelectorAll("[data-ln-attr]");for(let c=0;c<o.length;c++){const f=o[c],r=f.getAttribute("data-ln-attr").split(",");for(let p=0;p<r.length;p++){const m=r[p].trim().split(":");if(m.length!==2)continue;const v=m[0].trim(),E=m[1].trim();e[E]!=null&&f.setAttribute(v,e[E])}}const s=t.querySelectorAll("[data-ln-show]");for(let c=0;c<s.length;c++){const f=s[c],r=f.getAttribute("data-ln-show");r in e&&f.classList.toggle("hidden",!e[r])}const h=t.querySelectorAll("[data-ln-class]");for(let c=0;c<h.length;c++){const f=h[c],r=f.getAttribute("data-ln-class").split(",");for(let p=0;p<r.length;p++){const m=r[p].trim().split(":");if(m.length!==2)continue;const v=m[0].trim(),E=m[1].trim();E in e&&f.classList.toggle(v,!!e[E])}}return t}function Lt(t,e){t.matches&&t.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",t,e??null),t.dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0})));const l=t.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<l.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",l[o],e??null),l[o].dispatchEvent(new CustomEvent("ln-fill",{detail:e??null,bubbles:!0}));return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(t){if(!(!t.target.matches||!t.target.matches("[data-ln-fillable]")))if(t.detail)Z(t.target,t.detail);else{const e=t.target.querySelectorAll("[data-ln-field]");for(let l=0;l<e.length;l++)e[l].textContent=""}})));function W(t,e){if(!t||!e)return t;const l=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;l.nextNode();){const h=l.currentNode;h.textContent.indexOf("{{")!==-1&&(h.textContent=h.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(c,f){return e[f]!==void 0?e[f]:""}))}const o=function(h,c){return e[c]!==void 0?e[c]:""},s=Array.from(t.querySelectorAll("*"));t.nodeType===1&&s.push(t);for(let h=0;h<s.length;h++){const c=s[h],f=c.attributes;for(let r=0;r<f.length;r++){const p=f[r];p.value.indexOf("{{")!==-1&&c.setAttribute(p.name,p.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return t}function Tt(t,e,l,o,s,h){const c={};for(let r=0;r<t.children.length;r++){const p=t.children[r],m=p.getAttribute("data-ln-render-key");m&&(c[m]=p)}const f=document.createDocumentFragment();for(let r=0;r<e.length;r++){const p=e[r],m=String(o(p));let v=c[m];if(v)s(v,p,r);else{const E=J(l,h);if(!E||(W(E,p),v=E.firstElementChild,!v))continue;v.setAttribute("data-ln-render-key",m),s(v,p,r)}f.appendChild(v)}t.textContent="",t.appendChild(f)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=Z,window.lnCore.lnFill=Lt,window.lnCore.renderList=Tt);function F(t,e,l){const o=t.getAttribute(e);return o===null?l:o}function tt(t,e,l){const o=parseInt(t.getAttribute(e),10);return isNaN(o)?l:o}function P(t,e,l=!1){const o=t.getAttribute(e);if(o===null)return!!l;const s=o.trim().toLowerCase();return!(s==="false"||s==="0")}function et(t,e){return(t.getAttribute(e)||"").split(",").map(l=>l.trim()).filter(Boolean)}const V=new Map;function nt(t,e){const l=(t?t.join("|"):"")+"::"+e;if(V.has(l))return V.get(l);const o=new Set(t||[]),s=function(h,c){const f=h.getAttribute(c);return f!==null&&o.has(f)?f:e};return V.set(l,s),s}function it(t,e,l){const o=parseFloat(t.getAttribute(e));return isNaN(o)?l:o}function lt(t,e,l){const o=t.getAttribute(e);if(!o)return l;try{return JSON.parse(o)}catch{return l}}function rt(t,e,l,o,s){if(!t||e===null)return!0;const h=o||"ln-component",c=t.type;if(c==="trigger"||c==="marker"||c==="string"||c==="list"||!c||e===""&&t.fallback!==void 0)return!0;const f=r=>{s?console.warn(r,s):console.warn(r)};if(c==="boolean"){const r=e.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(f(`[${h}] Invalid value "${e}" for boolean attribute "${l}". Allowed: "true", "false", or presence-only.`),!1):!0}if(c==="enum"){const r=t.values||[];return r.includes(e)?!0:(f(`[${h}] Invalid value "${e}" for attribute "${l}". Allowed: ${r.join(", ")}. Fallback: "${t.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(e))return f(`[${h}] Invalid integer "${e}" for attribute "${l}". Fallback: ${t.fallback}.`),!1;const r=parseInt(e,10);return t.min!==void 0&&r<t.min?(f(`[${h}] Value ${r} for attribute "${l}" is less than min (${t.min}).`),!1):t.max!==void 0&&r>t.max?(f(`[${h}] Value ${r} for attribute "${l}" is greater than max (${t.max}).`),!1):!0}if(c==="float")return isNaN(Number(e))?(f(`[${h}] Invalid float "${e}" for attribute "${l}". Fallback: ${t.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(e),!0}catch(r){return f(`[${h}] Invalid JSON for attribute "${l}": ${r.message}. Fallback: ${t.fallback}.`),!1}return!0}function ot(t,e,l){for(const o in l){const[s,h,c]=l[o];Object.defineProperty(t,o,{get:function(){return s(e,h,c)},enumerable:!0,configurable:!0})}return t}function st(t){const e={};for(const l in t){const o=t[l];if(!o||!o.prop)continue;let s=o.read;if(!s&&o.type)switch(o.type){case"enum":s=nt(o.values,o.fallback);break;case"integer":s=tt;break;case"float":s=it;break;case"boolean":s=P;break;case"list":s=et;break;case"json":s=lt;break;case"string":default:s=F;break}s||(s=F),e[o.prop]=[s,l,o.fallback]}return e}function qt(t){const e={};for(const l in t){const o=t[l];o&&o.effect&&(e[l]=o.effect)}return Object.keys(e).length?e:null}function Rt(t){if(t.onAttrChange&&!t.declared)return null;const e=new Set;if(t.effects)for(const l in t.effects)e.add(l);if(t.onAttrChange&&t.declared)for(const l of t.declared)e.add(l);return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ot,window.lnCore.attrSpec=st,window.lnCore.attrStr=F,window.lnCore.attrInt=tt,window.lnCore.attrBool=P,window.lnCore.attrList=et,window.lnCore.attrEnum=nt,window.lnCore.attrFloat=it,window.lnCore.attrJson=lt);function O(t,e){if(!t[e.attribute]){window.lnCore._persistSink&&t.hasAttribute&&t.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(t,e.selector);try{t[e.attribute]=new e.ComponentFn(t)}catch(l){console.error("["+e.attribute+"] init failed",t,l)}}}function at(t,e,l,o){if(t.nodeType!==1)return;const h=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]",c={selector:e,attribute:l,ComponentFn:o};if(t.matches&&t.matches(h)&&O(t,c),t.querySelectorAll){const f=t.querySelectorAll(h);for(let r=0;r<f.length;r++)O(f[r],c)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function It(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ft(t){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(t):setTimeout(t,0)):t()}function ct(){window.lnCore=window.lnCore||{};const t=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return t.byReactive=t.byReactive||new Map,t.reactiveWildcard=t.reactiveWildcard||[],t}function Ot(t){const e=ct(),l=t.observed||[];for(let o=0;o<l.length;o++){const s=l[o];e.byAttr.has(s)||e.byAttr.set(s,[]),e.byAttr.get(s).push(t)}if(e.byDeclaredAttr=e.byDeclaredAttr||new Map,t.attributes)for(const o in t.attributes){e.byDeclaredAttr.has(o)||e.byDeclaredAttr.set(o,[]);const s=e.byDeclaredAttr.get(o);s.some(h=>h.componentTag===t.componentTag)||s.push({spec:t.attributes[o],componentTag:t.componentTag})}if(t.onAttrChange||t.effects){e.reactive.push(t);const o=Rt(t);if(o===null)e.reactiveWildcard.push(t);else for(const s of o)e.byReactive.has(s)||e.byReactive.set(s,[]),e.byReactive.get(s).push(t)}t.persist&&e.persist.push(t)}function dt(t,e,l,o){for(let s=0;s<t.length;s++){const h=t[s];if(!e[h.attribute])continue;const c=h.effects&&h.effects[l];c?c(e,l,o):h.onAttrChange&&(!h.declared||h.declared.has(l))&&h.onAttrChange(e,l,o)}}function Ht(t){const e=t.attributeName,l=e.indexOf("data-ln-")===0,o=ct(),s=o.byAttr.get(e),h=G()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(e);if(!l&&!s&&!h)return;const c=t.target;if(t.oldValue!==c.getAttribute(e)){if(h&&M(c)){const f=o.byDeclaredAttr.get(e),r=c.getAttribute(e);for(let p=0;p<f.length;p++)rt(f[p].spec,r,e,f[p].componentTag,c)}if(window.lnCore._debugSink&&(l||s)&&window.lnCore._debugSink("attr",e,c,{oldValue:t.oldValue,newValue:c.getAttribute(e)}),l){const f=o.byReactive.get(e);f&&dt(f,c,e,t.oldValue),o.reactiveWildcard.length&&dt(o.reactiveWildcard,c,e,t.oldValue)}if(s)for(let f=0;f<s.length;f++){const r=s[f];if(r.handler){r.handler(c,e,t.oldValue);continue}r.onAttributeChange&&c[r.attribute]?r.onAttributeChange(c,e):(at(c,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(c))}}}function Mt(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,H(function(){new MutationObserver(function(e){for(let l=0;l<e.length;l++)try{Ht(e[l])}catch(o){console.error("[ln-core] mutation handler failed",e[l].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function B(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function z(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function $(t,e){if(!document.contains(t))if(e.attribute){const l=t[e.attribute];if(l&&typeof l.destroy=="function")try{l.destroy()}catch(o){console.error("["+e.attribute+"] destroy failed",t,o)}delete t[e.attribute]}else e.onDestroy&&e.onDestroy(t)}function ut(t){const e=B();if(!e.length)return;const l=t.target;if(l){const s=l.nodeType===1?l:l.parentElement;if(s&&(s.isContentEditable||s.closest&&s.closest('[contenteditable]:not([contenteditable="false"])')))return}const o=z();if(t.target&&o.length)for(let s=0;s<o.length;s++){const h=o[s],c=h.query,f=t.target.nodeType===1?t.target.matches&&t.target.matches(c)?t.target:t.target.closest?t.target.closest(c):null:t.target.parentElement&&t.target.parentElement.closest?t.target.parentElement.closest(c):null;f&&h.onSubtreeChange(f,t)}for(let s=0;s<t.addedNodes.length;s++){const h=t.addedNodes[s];if(h.nodeType===1){const c=!!(h.firstElementChild||h.children&&h.children.length);for(let f=0;f<e.length;f++){const r=e[f];if(r.selector&&r.attribute&&r.ComponentFn){if(!c)h.matches&&h.matches(r.query)&&O(h,r);else if(h.matches&&h.matches(r.query)&&O(h,r),h.querySelectorAll){const p=h.querySelectorAll(r.query);for(let m=0;m<p.length;m++)O(p[m],r)}}r.onInit&&r.onInit(h)}}}for(let s=0;s<t.removedNodes.length;s++){const h=t.removedNodes[s];if(h.nodeType===1){if(document.contains(h))continue;const c=!!(h.firstElementChild||h.children&&h.children.length);for(let f=0;f<e.length;f++){const r=e[f],p=r.query;if(p){if(!c)h.matches&&h.matches(p)&&$(h,r);else if(h.matches&&h.matches(p)&&$(h,r),h.querySelectorAll){const m=h.querySelectorAll(p);for(let v=0;v<m.length;v++)$(m[v],r)}}}}}}function ht(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,H(function(){const t=new MutationObserver(function(e){for(let l=0;l<e.length;l++){const o=e[l];if(o.type==="childList")try{ut(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}});window.lnCore._lifecycleObserver=t,t.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Nt(t){if(typeof window>"u")return t();window.lnCore=window.lnCore||{};const e=window.lnCore._lifecycleObserver;if(!e)return t();const l=e.takeRecords();for(let o=0;o<l.length;o++){const s=l[o];if(s.type==="childList")try{ut(s)}catch(h){console.error("[ln-core] lifecycle handler failed",s.target,h)}}e.disconnect();try{return t()}finally{e.observe(document.body,{childList:!0,subtree:!0})}}function Wt(t){B().push(t),t.onSubtreeChange&&t.query&&z().push(t),ht()}function ft(t,e,l,o,s={}){const h=s.extraAttributes||[],c=s.onAttributeChange||null,f=s.onSubtreeChange||null,r=s.onInit||null,p=s.onAttrChange||null,m=s.effects||null,v=s.attributes||null,E=v?qt(v):m,q=v?new Set(Object.keys(v)):null,R=s.persist||null;function I(b){const d=b||document.body;if(at(d,t,e,l),v&&G())for(const w in v){const _=v[w],g=Array.from(d.querySelectorAll("["+w+"]"));d.matches&&d.matches("["+w+"]")&&g.push(d);for(let y=0;y<g.length;y++){const L=g[y];M(L)&&rt(_,L.getAttribute(w),w,o,L)}}r&&r(d)}const A=[];if(t.indexOf("[")!==-1){const b=/\[([\w-]+)/g;let d;for(;(d=b.exec(t))!==null;)A.push(d[1])}else A.push(t);Ot({selector:t,attribute:e,componentTag:o,attributes:v,ComponentFn:l,onInit:r,observed:A.concat(h),onAttributeChange:c,onAttrChange:p,effects:E,declared:q,persist:R}),Mt();const n=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1,u=s.subtreeQuery||(n?t:"["+t+"]"),i={selector:t,attribute:e,ComponentFn:l,onInit:r,onSubtreeChange:f,query:u};B().push(i),f&&u&&z().push(i),ht(),window[e]=I,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ft,window.lnCore.observeLifecycle=Wt,window.lnCore.withoutLifecycle=Nt);function a(){It()>0?Ft(function(){I(document.body)}):I(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a(),I}function Pt(t,e){let l=!1;return function(){l||(l=!0,queueMicrotask(function(){l=!1,t()}))}}function Vt(t){t=t||{};let e=t.windowSize>0?t.windowSize:1e3,l=t.pageSize>0?t.pageSize:200,o=t.threshold!=null?t.threshold:25,s=t.fetchDebounce!=null?t.fetchDebounce:120;const h=typeof t.requestPage=="function"?t.requestPage:function(){},c=typeof t.onChange=="function"?t.onChange:function(){},f=new Map,r=new Map,p=new Set;let m=0,v=0,E=0,q={sort:null,filters:{},search:""},R=null,I=0,A=0,n=!1;function u(d){r.set(d,++I)}function i(){return!!(q&&(q.search||q.filters&&Object.keys(q.filters).length))}function a(){if(f.size<=e)return;const d=Array.from(f.keys()).sort(function(_,g){return(r.get(_)||0)-(r.get(g)||0)});let w=0;for(;f.size>e&&w<d.length;)f.delete(d[w]),r.delete(d[w]),w++}function b(d,w){p.add(d),h(q,d,w)}return{get:function(d){return f.get(d)},has:function(d){return f.has(d)},peek:function(){return f.size?f.values().next().value:void 0},get logicalTotal(){return m},get grandTotal(){return v},get queryGen(){return E},get size(){return f.size},ensure:function(d,w){clearTimeout(R),A=d;for(let k=d;k<w;k++)f.has(k)&&u(k);if(m<=0)return;const _=Math.max(0,d-o),g=Math.min(m,w+o),y=Math.floor(_/l),L=Math.floor(Math.max(0,g-1)/l);let T=-1;for(let k=y;k<=L;k++){const C=k*l,S=Math.min(l,m-C);let x=!1;const Xt=Math.max(C,_),Zt=Math.min(C+S,g);for(let U=Xt;U<Zt;U++)if(!f.has(U)){x=!0;break}if(x&&!p.has(C)){T=C;break}}T!==-1&&(R=setTimeout(function(){b(T,l)},s))},ingest:function(d){if(d=d||{},d.queryGen!=null&&d.queryGen!==E)return!1;const w=d.offset||0,_=d.data||[];let g=0;for(let y=0;y<_.length;y++)_[y]!=null&&g++;if(g===0&&(d.provisional||d.filtered>0))return p.delete(w),!1;n&&(f.clear(),r.clear(),n=!1),d.provisional||(v=d.total!=null?d.total:v,m=d.filtered!=null?d.filtered:d.data?d.data.length:m);for(let y=0;y<_.length;y++)_[y]!=null&&(f.set(w+y,_[y]),u(w+y));return p.delete(w),a(),c(),!0},requestInitial:function(d){d&&(q=d),b(0,l)},invalidate:function(d){E++,p.clear(),clearTimeout(R),d&&(q=d),n=!0,b(0,l)},revalidate:function(){E++,p.clear(),clearTimeout(R),n=!0;const d=Math.max(0,Math.floor(A/l)*l);b(d,l)},release:function(d){p.delete(d)},destroy:function(){clearTimeout(R),f.clear(),r.clear(),p.clear()},configure:function(d){d=d||{};let w=!1;if(d.windowSize!=null&&d.windowSize>0&&d.windowSize!==e){const _=d.windowSize<e;e=d.windowSize,_&&a(),w=!0}d.pageSize!=null&&d.pageSize>0&&(l=d.pageSize),d.threshold!=null&&d.threshold>=0&&(o=d.threshold),d.fetchDebounce!=null&&d.fetchDebounce>=0&&(s=d.fetchDebounce),w&&c()},setGrandTotal:function(d){d==null||isNaN(d)||d<0||(v=d,i()||(m=d),c())}}}function bt(t){return(t||"").replace(/^#/,"")}function j(t){const e=t===void 0?location.hash:t,l={},o=bt(e);if(!o)return l;const s=o.split("&");for(let h=0;h<s.length;h++){const c=s[h];if(!c)continue;const f=c.indexOf(":"),r=f>-1?c.slice(0,f):c,p=f>-1?c.slice(f+1):"";if(r)try{l[r]=decodeURIComponent(p)}catch{l[r]=p}}return l}function Bt(t){if(!t)return null;const e=j();return t in e?e[t]:null}function zt(t,e){if(!t)return;const l=j();e==null?delete l[t]:l[t]=String(e);const s=Object.keys(l).map(function(h){const c=l[h];return c===""?h:h+":"+encodeURIComponent(c)}).join("&");bt(location.hash)!==s&&(location.hash=s)}function $t(t){return t.button===1||t.ctrlKey||t.metaKey||t.shiftKey?!1:(t.preventDefault(),!0)}function jt(t,e){if(!t||!t.hasAttribute("data-ln-hash"))return null;const l=t.getAttribute("data-ln-hash");if(l&&l.trim()!=="")return l.trim();const o=t.getAttribute("data-ln-sort")||t.getAttribute("data-ln-search-for")||t.getAttribute("data-ln-search")||t.getAttribute("data-ln-filter")||t.id;return o?e?o+"-"+e:o:e||null}function Ut(t,e){return!e||e==="none"||t===null||t===void 0?null:String(t)+"."+e}function Gt(t){return!t||typeof t!="string"?null:t.endsWith(".asc")?{fieldOrColumn:t.slice(0,-4),direction:"asc"}:t.endsWith(".desc")?{fieldOrColumn:t.slice(0,-5),direction:"desc"}:null}function Kt(t,e){return!t||!Array.isArray(e)||e.length===0?null:t+":"+e.map(encodeURIComponent).join(",")}function Qt(t){if(!t||typeof t!="string")return null;const e=t.indexOf(":");if(e===-1)return null;const l=t.slice(0,e),o=t.slice(e+1),s=o?o.split(",").map(function(h){try{return decodeURIComponent(h)}catch{return h}}).filter(Boolean):[];return{key:l,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=j,window.lnCore.hashGet=Bt,window.lnCore.hashSet=zt,window.lnCore.hashLinkClick=$t,window.lnCore.resolveHashNamespace=jt,window.lnCore.hashSortEncode=Ut,window.lnCore.hashSortDecode=Gt,window.lnCore.hashFilterEncode=Kt,window.lnCore.hashFilterDecode=Qt);function Yt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Yt);function pt(t,e,l,o,s=15){if(o<=0||l<=0)return{start:0,end:0,topPadding:0,bottomPadding:0};const h=Math.max(0,t||0),c=Math.max(0,e||0),f=Math.floor(h/l),r=Math.ceil(c/l),p=Math.max(0,f-s),m=Math.min(o,f+r+s),v=p*l,E=Math.max(0,(o-m)*l);return{start:p,end:m,topPadding:v,bottomPadding:E}}function Jt(t,e){const l=Array.isArray(t)?t.length:0,o=e instanceof Set?e:new Set(e||[]);let s=0;if(Array.isArray(t))for(let f=0;f<t.length;f++)o.has(t[f])&&s++;else s=o.size;const h=l>0&&s===l,c=s>0&&s<l;return{totalCount:l,selectedCount:s,isAllSelected:h,isIndeterminate:c}}function wt(t,e,l){const o=new Set(t);return e==null||((l!==void 0?l:!o.has(e))?o.add(e):o.delete(e)),o}function _t(t,e,l){const o=new Set(t);if(!Array.isArray(e))return o;if(l)for(let s=0;s<e.length;s++)e[s]!=null&&o.add(e[s]);else for(let s=0;s<e.length;s++)o.delete(e[s]);return o}(function(){const t="data-ln-table",e="lnTable",l="data-ln-table-empty";if(window[e]!==void 0)return;function r(n,u){if(!n||!n.isDataDriven)return;const i=n.dom.hasAttribute("data-ln-table-window");if(i&&!n._windowed)n._enterWindowedMode(),n._kickWindowInitial();else if(!i&&n._windowed)n._exitWindowedMode();else if(i&&n._windowed){const a=parseInt(u,10);a>0&&n._cache.configure({windowSize:a})}}function p(n,u){if(!n||!n.isDataDriven||!n._windowed||!n._cache)return;const i=parseInt(u,10);i>0&&n._cache.configure({pageSize:i})}function m(n,u){if(!n||!n.isDataDriven||!n._windowed||!n._cache)return;const i=parseInt(u,10);i>=0&&n._cache.configure({threshold:i})}function v(n,u){if(!n||!n.isDataDriven||!n._windowed||!n._cache)return;const i=parseInt(u,10);i>=0&&n._cache.setGrandTotal(i)}const E={"data-ln-table":{prop:"name",type:"string",read:F,fallback:"",description:"Table instance name or identifier"},"data-ln-table-source":{prop:"source",type:"string",read:F,fallback:"",description:"Source store or coordinator addressing"},"data-ln-table-selectable":{prop:"_selectable",type:"boolean",read:P,description:"Enables row selection check controls"},"data-ln-table-window":{type:"integer",fallback:1e3,min:10,effect:r,description:"Virtual scrolling window size in rows"},"data-ln-table-window-page":{type:"integer",fallback:200,min:5,effect:p,description:"Virtual scrolling slice page size"},"data-ln-table-window-threshold":{type:"integer",fallback:50,min:0,effect:m,description:"Scroll threshold margin in pixels to trigger page fetch"},"data-ln-table-count":{type:"integer",min:0,effect:v,description:"Total record count override for virtual scrollbar calculation"},"data-ln-table-row":{type:"marker",description:"Table row template element"},"data-ln-table-row-id":{type:"string",description:"Record identifier on row element"},"data-ln-table-row-action":{type:"trigger",description:"Action trigger inside a table row"},"data-ln-table-row-select":{type:"trigger",description:"Row selection checkbox trigger"},"data-ln-table-col":{type:"string",description:"Column header identifier or field mapping"},"data-ln-table-col-select":{type:"trigger",description:"Header select-all checkbox trigger"},"data-ln-table-cell-attr":{type:"string",description:"Cell attribute template mapping"},"data-ln-table-empty":{type:"marker",description:"Container for table empty state"},"data-ln-table-select-all-label":{type:"string",description:"Accessibility label for select-all header trigger"}},q=st(E);typeof Intl<"u"&&new Intl.Collator(document.documentElement.lang||void 0,{sensitivity:"base"});function R(n,u){if(n==null||isNaN(n))return"";try{return new Intl.NumberFormat(Et(u)).format(n)}catch{return String(n)}}function I(n){let u=n.parentElement;for(;u&&u!==document.body&&u!==document.documentElement;){const a=getComputedStyle(u).overflowY;if(a==="auto"||a==="scroll")return u;u=u.parentElement}return null}function A(n){this.dom=n,ot(this,n,q),this.table=n.querySelector("table"),this.tbody=n.querySelector("[data-ln-table-body]")||n.querySelector("tbody"),this.thead=n.querySelector("thead");const u=this.thead?this.thead.querySelector("tr:last-child"):null;this.ths=u?Array.from(u.querySelectorAll("th")):[],this._totalSpan=n.querySelector("[data-ln-table-total]"),this._filteredSpan=n.querySelector("[data-ln-table-filtered]"),this._filteredSpan&&(this._filteredWrap=this._filteredSpan.parentElement!==n?this._filteredSpan.parentElement:null),this._selectedSpan=n.querySelector("[data-ln-table-selected]"),this._selectedSpan&&(this._selectedWrap=this._selectedSpan.parentElement!==n?this._selectedSpan.parentElement:null),this.isDataDriven=n.hasAttribute("data-ln-table-source"),this._data=[],this._filteredData=[],this._searchTerm="",this._sortCol=-1,this._sortDir=null,this._columnFilters={},this.selectedIds=new Set,this._virtual=!1,this._rowHeight=0,this._vStart=-1,this._vEnd=-1,this._rafId=null,this._scrollHandler=null,this._scrollContainer=null,this._colgroup=null;const i=this;return this._onSetSearch=function(a){const b=(a.detail&&a.detail.query!=null?a.detail.query:a.detail&&a.detail.term!=null?a.detail.term:"").trim();i.isDataDriven?(i.currentSearch=b,D(n,"ln-table:search",{table:i.name,query:i.currentSearch}),i._requestData()):(i._searchTerm=b.toLowerCase(),i._applyFilterAndSort(),i._vStart=-1,i._vEnd=-1,i._render(),i._updateFooter(),D(n,"ln-table:filter",{term:i._searchTerm,matched:i._filteredData.length,total:i._data.length}))},n.addEventListener("ln-table:set-search",this._onSetSearch),this._onSearchChange=function(a){a.preventDefault(),i._onSetSearch(a)},n.addEventListener("ln-search:change",this._onSearchChange),this._onRequestClearFilters=function(){i.isDataDriven?(i.currentFilters={},i.currentSearch="",D(n,"ln-table:clear-filters",{table:i.name}),i._requestData()):(i._searchTerm="",i._columnFilters={},i._applyFilterAndSort(),i._vStart=-1,i._vEnd=-1,i._render(),i._updateFooter(),D(n,"ln-table:filter",{term:"",matched:i._filteredData.length,total:i._data.length}))},n.addEventListener("ln-table:request-clear-filters",this._onRequestClearFilters),this._selectableActive=!1,this._selectable&&this._enableSelection(),this.isDataDriven?(this.isLoaded=!1,this.totalCount=0,this.visibleCount=0,this.currentSort=null,this.currentFilters={},this.currentSearch="",this._lastTotal=0,this._lastFiltered=0,this._hasInitialSeed=!1,this._windowed=!1,this._cache=null,this.isDataDriven&&n.hasAttribute("data-ln-table-window")&&this._enterWindowedMode(),this._onSetData=function(a){const b=a.detail||{},d=b.data||[],w=b.total!=null?b.total:d.length;if(!(i._hasInitialSeed&&!i.isLoaded&&d.length===0&&w===0)){if(i._windowed){i._cache.ingest(b)&&!b.provisional&&n.classList.remove("ln-table--loading");return}i._data=d,i._lastTotal=w,i._lastFiltered=b.filtered!=null?b.filtered:i._data.length,i.totalCount=i._lastTotal,i.visibleCount=i._lastFiltered,i.isLoaded=!0,i._hasInitialSeed=!1,n.classList.remove("ln-table--loading"),i._vStart=-1,i._vEnd=-1,i._applyFilterAndSort(),i._render(),i._updateFooter(),D(n,"ln-table:rendered",{table:i.name,total:i.totalCount,visible:i.visibleCount})}},n.addEventListener("ln-table:set-data",this._onSetData),this._onSetLoading=function(a){const b=a.detail&&a.detail.loading;n.classList.toggle("ln-table--loading",!!b),b&&(i.isLoaded=!1)},n.addEventListener("ln-table:set-loading",this._onSetLoading),this._onPageFailed=function(a){!i._windowed||!i._cache||i._cache.release(a.detail&&a.detail.offset)},n.addEventListener("ln-table:page-failed",this._onPageFailed),this._onRequestRevalidate=function(){!i._windowed||!i._cache||i._cache.revalidate()},n.addEventListener("ln-table:request-revalidate",this._onRequestRevalidate),this._onRequestInvalidate=function(){!i._windowed||!i._cache||i._requestData()},n.addEventListener("ln-table:request-invalidate",this._onRequestInvalidate),this._onSort=function(a){!a.detail||a.detail.field==null||(a.preventDefault(),i.currentSort=a.detail.direction==="none"?null:{field:a.detail.field,direction:a.detail.direction},i._requestData())},n.addEventListener("ln-sort:change",this._onSort),this._windowed&&this._selectable&&this._selectAllCheckbox&&this._selectAllCheckbox.classList.add("hidden"),this._onRowClick=function(a){if(a.target.closest("[data-ln-table-row-select]")||a.target.closest("[data-ln-table-row-action]")||a.target.closest("a")||a.target.closest("button")||a.ctrlKey||a.metaKey||a.button===1)return;const b=a.target.closest("[data-ln-table-row]");if(!b)return;const d=b.getAttribute("data-ln-table-row-id"),w=b._lnRecord||{};D(n,"ln-table:row-click",{table:i.name,id:d,record:w})},this.tbody&&this.tbody.addEventListener("click",this._onRowClick),this._onRowAction=function(a){const b=a.target.closest("[data-ln-table-row-action]");if(!b)return;const d=b.closest("[data-ln-table-row]");if(!d)return;const w=b.getAttribute("data-ln-table-row-action"),_=d.getAttribute("data-ln-table-row-id"),g=d._lnRecord||{};D(n,"ln-table:row-action",{table:i.name,id:_,action:w,record:g})},this.tbody&&this.tbody.addEventListener("click",this._onRowAction),this.tbody&&this.tbody.rows.length>0&&this._parseRows(),this._windowed?this._kickWindowInitial():D(n,"ln-table:request-data",{table:this.name,sort:this.currentSort,filters:this.currentFilters,search:this.currentSearch})):(this._emptyTbodyObserver=null,this.tbody&&this.tbody.rows.length>0?this._parseRows():this.tbody&&(this._emptyTbodyObserver=new MutationObserver(function(){i.tbody.rows.length>0&&(i._emptyTbodyObserver.disconnect(),i._emptyTbodyObserver=null,i._parseRows())}),this._emptyTbodyObserver.observe(this.tbody,{childList:!0})),this._onSort=function(a){if(!a.detail||a.detail.column==null)return;a.preventDefault();const b=a.detail.direction==="none"?null:a.detail.direction;i._sortCol=b===null?-1:a.detail.column,i._sortDir=b,i._applyFilterAndSort(),i._vStart=-1,i._vEnd=-1,i._render(),D(n,"ln-table:sorted",{column:a.detail.column,direction:a.detail.direction,matched:i._filteredData.length,total:i._data.length})},n.addEventListener("ln-sort:change",this._onSort),this._onFilterChange=function(a){if(a.preventDefault(),!a.detail)return;const b=a.detail.key,d=a.detail.values||[];if(b){if(d.length===0)delete i._columnFilters[b];else{const w=[];for(let _=0;_<d.length;_++)w.push(d[_].toLowerCase());i._columnFilters[b]=w}i._applyFilterAndSort(),i._vStart=-1,i._vEnd=-1,i._render(),i._updateFooter(),D(n,"ln-table:filter",{term:i._searchTerm,matched:i._filteredData.length,total:i._data.length})}},n.addEventListener("ln-filter:change",this._onFilterChange)),this}A.prototype._parseRows=function(){const n=this.tbody.rows,u=this.ths;this._data=[],n.length>0&&(this._rowHeight=n[0].offsetHeight||40),this._lockColumnWidths();for(let i=0;i<n.length;i++){const a=n[i],b=[],d=[],w=[];for(let g=0;g<a.cells.length;g++){const y=a.cells[g],L=y.textContent.trim();b[g]=K(y),d[g]=L.toLowerCase(),y.querySelector("[data-ln-table-row-action]")||w.push(L.toLowerCase())}let _=null;if(this.isDataDriven){_={};const g=a.getAttribute("data-ln-table-row-id");g!=null&&(_.id=g);for(let y=0;y<u.length;y++){const L=u[y].getAttribute("data-ln-table-col");if(L){const T=y;if(T<a.cells.length){const k=a.cells[T];_[L]=K(k)}}}}this._data.push({values:b,rawTexts:d,html:a.outerHTML,searchText:w.join(" "),id:this.isDataDriven&&_?_.id:void 0,..._})}this._filteredData=this._data.slice(),this._data.length>0&&(this._hasInitialSeed=!0),this.isDataDriven&&(this._lastTotal=this._data.length,this._lastFiltered=this._data.length,this.totalCount=this._data.length,this.visibleCount=this._data.length,this._updateFooter()),this._render(),D(this.dom,"ln-table:ready",{total:this._data.length})},A.prototype._applyFilterAndSort=function(){this._filteredData=this._data?this._data.slice():[],this.visibleCount=this.isDataDriven&&this._lastFiltered!=null?this._lastFiltered:this._filteredData.length},A.prototype._lockColumnWidths=function(){if(!this.table||!this.thead||this._colgroup)return;const n=document.createElement("colgroup");this.ths.forEach(function(u){const i=document.createElement("col");i.style.width=u.offsetWidth+"px",n.appendChild(i)}),this.table.insertBefore(n,this.table.firstChild),this.table.style.tableLayout="fixed",this._colgroup=n},A.prototype._render=function(){if(this.tbody)if(this.isDataDriven){if(this._windowed){this._renderWindowed();return}const n=this._lastTotal,u=this.visibleCount;if(n===0){this._disableVirtualScroll(),this._showEmptyState();return}if(this._filteredData.length===0||u===0){this._disableVirtualScroll(),this._showEmptyState();return}this._filteredData.length>200?(this._enableVirtualScroll(),this._renderVirtual()):(this._disableVirtualScroll(),this._renderAll())}else{const n=this._filteredData.length;n===0&&(this._searchTerm||Object.keys(this._columnFilters).length>0)?(this._disableVirtualScroll(),this._showEmptyState()):n>200?(this._enableVirtualScroll(),this._renderVirtual()):(this._disableVirtualScroll(),this._renderAll())}},A.prototype._renderAll=function(){if(this.isDataDriven){const n=this._filteredData,u=document.createDocumentFragment();for(let i=0;i<n.length;i++){const a=this._buildRow(n[i]);if(!a)break;u.appendChild(a)}this.tbody.replaceChildren(u),this._selectable&&this._updateSelectAll()}else{const n=[],u=this._filteredData;for(let i=0;i<u.length;i++)n.push(u[i].html);this.tbody.innerHTML=n.join(""),this._selectable&&this._restoreSelection()}},A.prototype._enableVirtualScroll=function(){if(this._virtual)return;this._virtual=!0,this._vStart=-1,this._vEnd=-1;const n=this;if(!this._rowHeight)if(this.tbody&&this.tbody.rows.length>0)this._rowHeight=this.tbody.rows[0].offsetHeight||40;else{let i=null;if(this._windowed){const a=this._cache?this._cache.peek():null;i=a?this._buildRow(a):this._buildPlaceholderRow()}else this.isDataDriven&&this._data.length>0&&(i=this._buildRow(this._data[0]));i&&this.tbody&&(this.tbody.appendChild(i),this._rowHeight=i.offsetHeight||40,i.remove())}this.isDataDriven?this._scrollContainer=I(this.dom):this._scrollContainer=null;const u=this._scrollContainer||window;this._scrollHandler=function(){n._rafId||(n._rafId=requestAnimationFrame(function(){n._rafId=null,n._windowed?n._renderWindowed():n._renderVirtual()}))},u.addEventListener("scroll",this._scrollHandler,{passive:!0}),window.addEventListener("resize",this._scrollHandler,{passive:!0})},A.prototype._disableVirtualScroll=function(){this._virtual&&(this._virtual=!1,this._scrollHandler&&((this._scrollContainer||window).removeEventListener("scroll",this._scrollHandler),window.removeEventListener("resize",this._scrollHandler),this._scrollHandler=null),this._scrollContainer=null,this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._vStart=-1,this._vEnd=-1)},A.prototype._renderVirtual=function(){const n=this._filteredData,u=n.length,i=this._rowHeight;if(!i||!u)return;const a=this.thead?this.thead.offsetHeight:0,b=this._scrollContainer;let d,w;if(b){const C=this.table.getBoundingClientRect(),S=b.getBoundingClientRect(),x=C.top-S.top+b.scrollTop+a;d=b.scrollTop-x,w=b.clientHeight}else{const x=this.table.getBoundingClientRect().top+window.scrollY+a;d=window.scrollY-x,w=window.innerHeight}const _=pt(d,w,i,u,15),g=_.start,y=_.end;if(g===this._vStart&&y===this._vEnd)return;this._vStart=g,this._vEnd=y;const L=this.ths.length||1,T=_.topPadding,k=_.bottomPadding;if(this.isDataDriven){const C=document.createDocumentFragment();if(T>0){const S=document.createElement("tr");S.className="ln-table__spacer",S.setAttribute("aria-hidden","true");const x=document.createElement("td");x.setAttribute("colspan",L),x.style.height=T+"px",S.appendChild(x),C.appendChild(S)}for(let S=g;S<y;S++){const x=this._buildRow(n[S]);x&&C.appendChild(x)}if(k>0){const S=document.createElement("tr");S.className="ln-table__spacer",S.setAttribute("aria-hidden","true");const x=document.createElement("td");x.setAttribute("colspan",L),x.style.height=k+"px",S.appendChild(x),C.appendChild(S)}this.tbody.replaceChildren(C),this._selectable&&this._updateSelectAll()}else{let C="";T>0&&(C+='<tr class="ln-table__spacer" aria-hidden="true"><td colspan="'+L+'" style="height:'+T+'px;padding:0;border:none"></td></tr>');for(let S=g;S<y;S++)C+=n[S].html;k>0&&(C+='<tr class="ln-table__spacer" aria-hidden="true"><td colspan="'+L+'" style="height:'+k+'px;padding:0;border:none"></td></tr>'),this.tbody.innerHTML=C,this._selectable&&this._restoreSelection()}},A.prototype._buildPlaceholderRow=function(){const n=document.createElement("tr");n.className="ln-table__placeholder",n.setAttribute("aria-hidden","true");const u=document.createElement("td");return u.setAttribute("colspan",this.ths.length||1),u.style.height=this._rowHeight+"px",n.appendChild(u),n},A.prototype._renderWindowed=function(){if(this.isLoaded&&this._cache.logicalTotal===0){this._disableVirtualScroll(),this._showEmptyState();return}this._virtual||this._enableVirtualScroll();const n=this._rowHeight;if(!n)return;const u=this._cache.logicalTotal,i=this.thead?this.thead.offsetHeight:0,a=this._scrollContainer;let b,d;if(a){const C=this.table.getBoundingClientRect(),S=a.getBoundingClientRect(),x=C.top-S.top+a.scrollTop+i;b=a.scrollTop-x,d=a.clientHeight}else{const x=this.table.getBoundingClientRect().top+window.scrollY+i;b=window.scrollY-x,d=window.innerHeight}const w=pt(b,d,n,u,15),_=w.start,g=w.end,y=this.ths.length||1,L=w.topPadding,T=w.bottomPadding,k=document.createDocumentFragment();if(L>0){const C=document.createElement("tr");C.className="ln-table__spacer",C.setAttribute("aria-hidden","true");const S=document.createElement("td");S.setAttribute("colspan",y),S.style.height=L+"px",C.appendChild(S),k.appendChild(C)}for(let C=_;C<g;C++)if(this._cache.has(C)){const S=this._buildRow(this._cache.get(C));S&&k.appendChild(S)}else k.appendChild(this._buildPlaceholderRow());if(T>0){const C=document.createElement("tr");C.className="ln-table__spacer",C.setAttribute("aria-hidden","true");const S=document.createElement("td");S.setAttribute("colspan",y),S.style.height=T+"px",C.appendChild(S),k.appendChild(C)}this.tbody.replaceChildren(k),this._vStart=_,this._vEnd=g,this._cache.ensure(_,g)},A.prototype._showEmptyState=function(){const n=this.ths.length||1;let u=null,i=null;if(this.isDataDriven){const a=this._lastTotal!=null?this._lastTotal:this._data.length,d=this.visibleCount===0&&a>0,w=d?this.name+"-empty-filtered":this.name+"-empty";if(i=X(this.dom,w,"ln-table"),!i){const _=this.dom.querySelector("template[data-ln-table-empty]");if(_){const g=d?"search":"initial",y=_.content.querySelector('[data-ln-table-empty-when="'+g+'"]')||_.content.firstElementChild;y&&(i=document.importNode(y,!0))}}if(i)if(i.tagName==="TR")u=i;else{const _=document.createElement("td");_.setAttribute("colspan",String(n)),_.appendChild(i);const g=document.createElement("tr");g.className="ln-table__empty",g.appendChild(_),u=g}}else{const a=this.dom.querySelector("template["+l+"]"),b=document.createElement("td");b.setAttribute("colspan",String(n)),a&&b.appendChild(document.importNode(a.content,!0));const d=document.createElement("tr");d.className="ln-table__empty",d.appendChild(b),u=d}u?this.tbody.replaceChildren(u):this.tbody.replaceChildren(),D(this.dom,"ln-table:empty",{term:this.isDataDriven?this.currentSearch||"":this._searchTerm,total:this.isDataDriven?this._lastTotal!=null?this._lastTotal:this._data.length:this._data.length})},A.prototype._fillRow=function(n,u){W(n,u);const i=n.querySelectorAll("[data-ln-table-cell-attr]");for(let a=0;a<i.length;a++){const b=i[a],d=b.getAttribute("data-ln-table-cell-attr").split(",");for(let w=0;w<d.length;w++){const _=d[w].trim().split(":");if(_.length!==2)continue;const g=_[0].trim(),y=_[1].trim();u[g]!=null&&b.setAttribute(y,u[g])}}},A.prototype._buildRow=function(n){let u=X(this.dom,this.name+"-row","ln-table");if(!u){const a=this.dom.querySelector("template[data-ln-table-row]");a&&(u=document.importNode(a.content,!0))}let i=u?u.querySelector("[data-ln-table-row]")||u.firstElementChild:null;if(i)this._fillRow(i,n);else if(n&&n.html){const a=document.createElement("tbody");a.innerHTML=n.html,i=a.firstElementChild}else{i=document.createElement("tr"),i.setAttribute("data-ln-table-row","");const a=this.ths;for(let b=0;b<a.length;b++){const d=a[b].hasAttribute("data-ln-table-col-select"),w=document.createElement("td");if(d){const _=document.createElement("input");_.type="checkbox",_.setAttribute("data-ln-table-row-select",""),_.setAttribute("aria-label","Select row"),w.appendChild(_)}else{const _=a[b].getAttribute("data-ln-table-col");_&&n[_]!=null&&(w.textContent=String(n[_]))}i.appendChild(w)}}if(i._lnRecord=n,n.id!=null&&i.setAttribute("data-ln-table-row-id",n.id),this._selectable&&n.id!=null&&this.selectedIds.has(String(n.id))){i.classList.add("ln-row-selected");const a=i.querySelector("[data-ln-table-row-select]");a&&(a.checked=!0)}return i},A.prototype._requestData=function(){if(this._windowed){this.dom.classList.add("ln-table--loading"),this._cache.invalidate({sort:this.currentSort,filters:this.currentFilters,search:this.currentSearch});return}gt(this,"ln-table:request-data","table")},A.prototype._enterWindowedMode=function(){const n=this,u=this.dom,i=parseInt(u.getAttribute("data-ln-table-window"),10),a=parseInt(u.getAttribute("data-ln-table-window-page"),10),b=parseInt(u.getAttribute("data-ln-table-window-threshold"),10);this._onCacheChange=function(){!n._windowed||!n._cache||(n.totalCount=n._cache.grandTotal,n.visibleCount=n._cache.logicalTotal,n._lastTotal=n._cache.grandTotal,n.isLoaded=!0,n._vStart=-1,n._vEnd=-1,n._render(),n._updateFooter(),D(u,"ln-table:rendered",{table:n.name,total:n.totalCount,visible:n.visibleCount}))},this._renderBatch=Pt(this._onCacheChange),this._cache=Vt({windowSize:i>0?i:1e3,pageSize:a>0?a:200,threshold:b>=0?b:25,fetchDebounce:120,requestPage:function(d,w,_){D(u,"ln-table:request-data",{table:n.name,sort:d.sort,filters:d.filters,search:d.search,offset:w,limit:_,queryGen:n._cache.queryGen})},onChange:this._renderBatch}),this._windowed=!0,this._selectable&&this._selectAllCheckbox&&this._selectAllCheckbox.classList.add("hidden")},A.prototype._kickWindowInitial=function(){if(this._data.length>0){let n=parseInt(this.dom.getAttribute("data-ln-table-count"),10);if(isNaN(n)&&this._totalSpan){const i=this._totalSpan.textContent.replace(/[^\d]/g,"");i&&(n=parseInt(i,10))}const u=n>0?n:this._data.length;this._cache.ingest({data:this._data,offset:0,total:u,filtered:u})}else this.dom.classList.add("ln-table--loading"),this._cache.requestInitial({sort:this.currentSort,filters:this.currentFilters,search:this.currentSearch})},A.prototype._exitWindowedMode=function(){this._disableVirtualScroll(),this._cache&&this._cache.destroy(),this._cache=null,this._windowed=!1,this._renderBatch=null,this._onCacheChange=null,this._selectAllCheckbox&&this._selectAllCheckbox.classList.remove("hidden"),this._rowHeight=0,this._vStart=-1,this._vEnd=-1,this._data=[],this._filteredData=[],this.dom.classList.add("ln-table--loading"),this._requestData()},A.prototype._updateSelectAll=function(){if(!this._selectAllCheckbox||!this.tbody)return;const n=this.tbody.querySelectorAll("[data-ln-table-row]"),u=[];for(let a=0;a<n.length;a++){const b=n[a].getAttribute("data-ln-table-row-id");b!=null&&u.push(b)}const i=Jt(u,this.selectedIds);this._selectAllCheckbox.checked=i.isAllSelected,this._selectAllCheckbox.indeterminate=i.isIndeterminate},A.prototype._restoreSelection=function(){if(!this.tbody)return;const n=this.tbody.querySelectorAll("[data-ln-table-row]");for(let u=0;u<n.length;u++){const i=n[u].getAttribute("data-ln-table-row-id"),a=i!=null&&this.selectedIds.has(i);n[u].classList.toggle("ln-row-selected",a);const b=n[u].querySelector("[data-ln-table-row-select]");b&&(b.checked=a)}this._updateSelectAll()},Object.defineProperty(A.prototype,"selectedCount",{get:function(){return this.selectedIds.size},set:function(){}}),A.prototype._enableSelection=function(){if(this._selectableActive)return;this._selectableActive=!0;const n=this;if(this._onSelectionChange=function(u){const i=u.target.closest("[data-ln-table-row-select]");if(!i)return;const a=i.closest("[data-ln-table-row]");if(!a)return;const b=a.getAttribute("data-ln-table-row-id");b!=null&&(n.selectedIds=wt(n.selectedIds,b,i.checked),a.classList.toggle("ln-row-selected",i.checked),n.selectedCount=n.selectedIds.size,n._updateSelectAll(),n._updateFooter(),D(n.dom,"ln-table:select",{table:n.name,selectedIds:n.selectedIds,count:n.selectedCount}))},this.tbody&&this.tbody.addEventListener("change",this._onSelectionChange),this._selectAllCheckbox=this.dom.querySelector('[data-ln-table-col-select] input[type="checkbox"]')||this.dom.querySelector("[data-ln-table-col-select]"),this._selectAllCheckbox&&this._selectAllCheckbox.tagName==="TH"){const u=document.createElement("input");u.type="checkbox";const i=n.dom.querySelector('[data-ln-table-dict="select-all"]'),a=n.dom.getAttribute("data-ln-table-select-all-label")||(i?i.textContent.trim():null)||"Select all";u.setAttribute("aria-label",a),this._selectAllCheckbox.appendChild(u),this._selectAllCheckbox=u}if(this._selectAllCheckbox&&(this._onSelectAll=function(){const u=n._selectAllCheckbox.checked,i=n.tbody?n.tbody.querySelectorAll("[data-ln-table-row]"):[],a=[];for(let b=0;b<i.length;b++){const d=i[b].getAttribute("data-ln-table-row-id"),w=i[b].querySelector("[data-ln-table-row-select]");d!=null&&(a.push(d),i[b].classList.toggle("ln-row-selected",u),w&&(w.checked=u))}n.selectedIds=_t(n.selectedIds,a,u),n.selectedCount=n.selectedIds.size,D(n.dom,"ln-table:select-all",{table:n.name,selected:u}),D(n.dom,"ln-table:select",{table:n.name,selectedIds:n.selectedIds,count:n.selectedCount}),n._updateFooter()},this._selectAllCheckbox.addEventListener("change",this._onSelectAll)),this.tbody){const u=this.tbody.querySelectorAll("[data-ln-table-row]");for(let i=0;i<u.length;i++){const a=u[i].querySelector("[data-ln-table-row-select]"),b=u[i].getAttribute("data-ln-table-row-id");a&&a.checked&&b!=null&&(n.selectedIds=wt(n.selectedIds,b,!0),u[i].classList.add("ln-row-selected"))}this.selectedCount=this.selectedIds.size,this.selectedCount>0&&this._updateSelectAll()}},A.prototype._disableSelection=function(){if(!this._selectableActive)return;this._selectableActive=!1,this.tbody&&this._onSelectionChange&&this.tbody.removeEventListener("change",this._onSelectionChange),this._selectAllCheckbox&&this._onSelectAll&&this._selectAllCheckbox.removeEventListener("change",this._onSelectAll);const n=this.dom.querySelector("[data-ln-table-col-select]");if(n){const u=n.querySelector('input[type="checkbox"]');u&&u.remove()}if(this._selectAllCheckbox=null,this.selectedIds=_t(this.selectedIds,Array.from(this.selectedIds),!1),this.selectedCount=0,this.tbody){const u=this.tbody.querySelectorAll("[data-ln-table-row]");for(let i=0;i<u.length;i++){u[i].classList.remove("ln-row-selected");const a=u[i].querySelector("[data-ln-table-row-select]");a&&(a.checked=!1)}}this._updateFooter()},A.prototype._updateFooter=function(){let n=0,u=0;this.isDataDriven?(n=this._lastTotal!=null?this._lastTotal:this._data.length,u=this.visibleCount):(n=this._data.length,u=this._filteredData.length);const i=u<n;if(this._totalSpan&&(this._totalSpan.textContent=R(n,this.dom)),this._filteredSpan&&(this._filteredSpan.textContent=i?R(u,this.dom):""),this._filteredWrap&&this._filteredWrap.classList.toggle("hidden",!i),this._selectedSpan){const a=this.selectedIds?this.selectedIds.size:0;this._selectedSpan.textContent=a>0?R(a,this.dom):"",this._selectedWrap&&this._selectedWrap.classList.toggle("hidden",a===0)}},A.prototype.destroy=function(){this.dom[e]&&(this._disableVirtualScroll(),this.dom.removeEventListener("ln-table:set-search",this._onSetSearch),this.dom.removeEventListener("ln-table:request-clear-filters",this._onRequestClearFilters),this.isDataDriven?(this.dom.removeEventListener("ln-table:set-data",this._onSetData),this.dom.removeEventListener("ln-table:set-loading",this._onSetLoading),this.dom.removeEventListener("ln-table:page-failed",this._onPageFailed),this.dom.removeEventListener("ln-table:request-revalidate",this._onRequestRevalidate),this.dom.removeEventListener("ln-table:request-invalidate",this._onRequestInvalidate),this.dom.removeEventListener("ln-sort:change",this._onSort),this.tbody&&(this.tbody.removeEventListener("click",this._onRowClick),this.tbody.removeEventListener("click",this._onRowAction)),this._cache&&this._cache.destroy()):(this._emptyTbodyObserver&&(this._emptyTbodyObserver.disconnect(),this._emptyTbodyObserver=null),this.dom.removeEventListener("ln-sort:change",this._onSort),this.dom.removeEventListener("ln-search:change",this._onSearchChange),this.dom.removeEventListener("ln-filter:change",this._onFilterChange)),this._onSelectionChange&&this.tbody&&this.tbody.removeEventListener("change",this._onSelectionChange),this._selectAllCheckbox&&this._onSelectAll&&this._selectAllCheckbox.removeEventListener("change",this._onSelectAll),this._colgroup&&(this._colgroup.remove(),this._colgroup=null),this.table&&(this.table.style.tableLayout=""),this._data=[],this._filteredData=[],delete this.dom[e])},ft(t,e,A,"ln-table",{attributes:E})})()})();
|
|
1
|
+
(function(){"use strict";function G(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function M(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){o=t[s];break}if(!M(o))return}e.apply(console,t)}}function D(e,t,l){const o=l||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function ge(e,t,l){e._applyFilterAndSort(),e._vStart=-1,e._vEnd=-1,e._render(),e._updateFooter();const o={sort:e.currentSort,filters:e.currentFilters,search:e.currentSearch};o[l]=e.name,D(e.dom,t,o)}function H(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){H(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function K(e){return e.hasAttribute("value")?e.getAttribute("value"):e.hasAttribute("data-ln-value")?e.getAttribute("data-ln-value"):e.tagName==="TIME"&&e.hasAttribute("datetime")?e.getAttribute("datetime"):e.textContent.trim()}function me(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ye(e,t){const l=!!(t&&t.typed),o=t&&t.exclude,s={},h=e.elements,c={};if(l)for(let f=0;f<h.length;f++){const r=h[f];r.name&&r.type==="checkbox"&&!r.disabled&&(c[r.name]=(c[r.name]||0)+1)}for(let f=0;f<h.length;f++){const r=h[f];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(o&&r.matches&&r.matches(o)))if(r.type==="checkbox")l&&c[r.name]===1?s[r.name]=r.checked:(s[r.name]||(s[r.name]=[]),r.checked&&s[r.name].push(r.value));else if(r.type==="radio")r.checked&&(s[r.name]=r.value);else if(r.type==="select-multiple"){s[r.name]=[];for(let p=0;p<r.options.length;p++)r.options[p].selected&&s[r.name].push(r.options[p].value)}else if(l&&r.type==="hidden")s[r.name]=r.value;else if(l&&(r.type==="number"||r.type==="range")){const p=Number(r.value);s[r.name]=r.value===""||isNaN(p)?null:p}else s[r.name]=r.value}return s}function Ce(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function Se(e,t){const l=e.elements,o=[],s={};for(let h=0;h<l.length;h++){const c=l[h];c.name&&c.type==="checkbox"&&(s[c.name]=(s[c.name]||0)+1)}for(let h=0;h<l.length;h++){const c=l[h];if(c.type==="file"||c.type==="submit"||c.type==="button")continue;const f=c.getAttribute("data-ln-fill-as")||c.name;if(!f||!(f in t))continue;const r=t[f];if(c.type==="checkbox"){if(Array.isArray(r))c.checked=r.indexOf(c.value)!==-1;else if(s[c.name]>1){const p=String(r).split(",").map(function(m){return m.trim()});c.checked=p.indexOf(c.value)!==-1}else c.checked=Ce(r);o.push(c)}else if(c.type==="radio")c.checked=c.value===String(r),o.push(c);else if(c.type==="select-multiple"){if(Array.isArray(r))for(let p=0;p<c.options.length;p++)c.options[p].selected=r.indexOf(c.options[p].value)!==-1;o.push(c)}else c.value=r,c.tagName==="SELECT"&&r!=null&&c.setAttribute("data-ln-value",r),o.push(c)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=Se,window.lnCore.serializeForm=ye,window.lnCore.resolveFormMethod=me);const Q={};function ve(e,t){Q[e]=t}function Ae(e){return Q[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ve,window.lnCore.getDataMapper=Ae);function Ee(e){const t=e?e.closest("[lang]"):null,l=(t?t.getAttribute("lang")||t.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return l?l.trim():"en-US"}function ke(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,H(function(){new MutationObserver(function(){D(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const Y={};function xe(e,t){if(!e||typeof t!="object")return;const l=e.toLowerCase().split("-")[0];Y[l]=t}function De(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return Y[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=xe,window.lnCore.getLocaleFallback=De,window.lnCore.ensureLocaleObserver=ke);const N={};function J(e,t){N[e]||(N[e]=document.querySelector('[data-ln-template="'+e+'"]'));const l=N[e];return l?l.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function X(e,t,l){if(e){const o=e.querySelector('[data-ln-template="'+t+'"]');if(o)return o.content.cloneNode(!0)}return J(t,l)}function Z(e,t){if(!e||!t)return e;const l=e.querySelectorAll("[data-ln-field]");for(let c=0;c<l.length;c++){const f=l[c],r=f.getAttribute("data-ln-field");t[r]!=null&&(f.textContent=t[r])}const o=e.querySelectorAll("[data-ln-attr]");for(let c=0;c<o.length;c++){const f=o[c],r=f.getAttribute("data-ln-attr").split(",");for(let p=0;p<r.length;p++){const m=r[p].trim().split(":");if(m.length!==2)continue;const v=m[0].trim(),E=m[1].trim();t[E]!=null&&f.setAttribute(v,t[E])}}const s=e.querySelectorAll("[data-ln-show]");for(let c=0;c<s.length;c++){const f=s[c],r=f.getAttribute("data-ln-show");r in t&&f.classList.toggle("hidden",!t[r])}const h=e.querySelectorAll("[data-ln-class]");for(let c=0;c<h.length;c++){const f=h[c],r=f.getAttribute("data-ln-class").split(",");for(let p=0;p<r.length;p++){const m=r[p].trim().split(":");if(m.length!==2)continue;const v=m[0].trim(),E=m[1].trim();E in t&&f.classList.toggle(v,!!t[E])}}return e}function Te(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const l=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<l.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",l[o],t??null),l[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)Z(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let l=0;l<t.length;l++)t[l].textContent=""}})));function W(e,t){if(!e||!t)return e;const l=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;l.nextNode();){const h=l.currentNode;h.textContent.indexOf("{{")!==-1&&(h.textContent=h.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(c,f){return t[f]!==void 0?t[f]:""}))}const o=function(h,c){return t[c]!==void 0?t[c]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let h=0;h<s.length;h++){const c=s[h],f=c.attributes;for(let r=0;r<f.length;r++){const p=f[r];p.value.indexOf("{{")!==-1&&c.setAttribute(p.name,p.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function Le(e,t,l,o,s,h){const c={};for(let r=0;r<e.children.length;r++){const p=e.children[r],m=p.getAttribute("data-ln-render-key");m&&(c[m]=p)}const f=document.createDocumentFragment();for(let r=0;r<t.length;r++){const p=t[r],m=String(o(p));let v=c[m];if(v)s(v,p,r);else{const E=J(l,h);if(!E||(W(E,p),v=E.firstElementChild,!v))continue;v.setAttribute("data-ln-render-key",m),s(v,p,r)}f.appendChild(v)}e.textContent="",e.appendChild(f)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=Z,window.lnCore.lnFill=Te,window.lnCore.renderList=Le);function F(e,t,l){const o=e.getAttribute(t);return o===null?l:o}function ee(e,t,l){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?l:o}function P(e,t,l=!1){const o=e.getAttribute(t);if(o===null)return!!l;const s=o.trim().toLowerCase();return!(s==="false"||s==="0")}function te(e,t){return(e.getAttribute(t)||"").split(",").map(l=>l.trim()).filter(Boolean)}const V=new Map;function ne(e,t){const l=(e?e.join("|"):"")+"::"+t;if(V.has(l))return V.get(l);const o=new Set(e||[]),s=function(h,c){const f=h.getAttribute(c);return f!==null&&o.has(f)?f:t};return V.set(l,s),s}function ie(e,t,l){const o=parseFloat(e.getAttribute(t));return isNaN(o)?l:o}function le(e,t,l){const o=e.getAttribute(t);if(!o)return l;try{return JSON.parse(o)}catch{return l}}function re(e,t,l,o,s){if(!e||t===null)return!0;const h=o||"ln-component",c=e.type;if(c==="trigger"||c==="marker"||c==="string"||c==="list"||!c||t===""&&e.fallback!==void 0)return!0;const f=r=>{s?console.warn(r,s):console.warn(r)};if(c==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(f(`[${h}] Invalid value "${t}" for boolean attribute "${l}". Allowed: "true", "false", or presence-only.`),!1):!0}if(c==="enum"){const r=e.values||[];return r.includes(t)?!0:(f(`[${h}] Invalid value "${t}" for attribute "${l}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return f(`[${h}] Invalid integer "${t}" for attribute "${l}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(f(`[${h}] Value ${r} for attribute "${l}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(f(`[${h}] Value ${r} for attribute "${l}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(f(`[${h}] Invalid float "${t}" for attribute "${l}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(r){return f(`[${h}] Invalid JSON for attribute "${l}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function oe(e,t,l){for(const o in l){const[s,h,c]=l[o];Object.defineProperty(e,o,{get:function(){return s(t,h,c)},enumerable:!0,configurable:!0})}return e}function se(e){const t={};for(const l in e){const o=e[l];if(!o||!o.prop)continue;let s=o.read;if(!s&&o.type)switch(o.type){case"enum":s=ne(o.values,o.fallback);break;case"integer":s=ee;break;case"float":s=ie;break;case"boolean":s=P;break;case"list":s=te;break;case"json":s=le;break;case"string":default:s=F;break}s||(s=F),t[o.prop]=[s,l,o.fallback]}return t}function qe(e){const t={};for(const l in e){const o=e[l];o&&o.effect&&(t[l]=o.effect)}return Object.keys(t).length?t:null}function Re(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const l in e.effects)t.add(l);if(e.onAttrChange&&e.declared)for(const l of e.declared)t.add(l);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=oe,window.lnCore.attrSpec=se,window.lnCore.attrStr=F,window.lnCore.attrInt=ee,window.lnCore.attrBool=P,window.lnCore.attrList=te,window.lnCore.attrEnum=ne,window.lnCore.attrFloat=ie,window.lnCore.attrJson=le);function O(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(l){console.error("["+t.attribute+"] init failed",e,l)}}}function ae(e,t,l,o){if(e.nodeType!==1)return;const h=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c={selector:t,attribute:l,ComponentFn:o};if(e.matches&&e.matches(h)&&O(e,c),e.querySelectorAll){const f=e.querySelectorAll(h);for(let r=0;r<f.length;r++)O(f[r],c)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ie(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Fe(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function ce(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function Oe(e){const t=ce(),l=e.observed||[];for(let o=0;o<l.length;o++){const s=l[o];t.byAttr.has(s)||t.byAttr.set(s,[]),t.byAttr.get(s).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const s=t.byDeclaredAttr.get(o);s.some(h=>h.componentTag===e.componentTag)||s.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=Re(e);if(o===null)t.reactiveWildcard.push(e);else for(const s of o)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function de(e,t,l,o){for(let s=0;s<e.length;s++){const h=e[s];if(!t[h.attribute])continue;const c=h.effects&&h.effects[l];c?c(t,l,o):h.onAttrChange&&(!h.declared||h.declared.has(l))&&h.onAttrChange(t,l,o)}}function He(e){const t=e.attributeName,l=t.indexOf("data-ln-")===0,o=ce(),s=o.byAttr.get(t),h=G()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(t);if(!l&&!s&&!h)return;const c=e.target;if(e.oldValue!==c.getAttribute(t)){if(h&&M(c)){const f=o.byDeclaredAttr.get(t),r=c.getAttribute(t);for(let p=0;p<f.length;p++)re(f[p].spec,r,t,f[p].componentTag,c)}if(window.lnCore._debugSink&&(l||s)&&window.lnCore._debugSink("attr",t,c,{oldValue:e.oldValue,newValue:c.getAttribute(t)}),l){const f=o.byReactive.get(t);f&&de(f,c,t,e.oldValue),o.reactiveWildcard.length&&de(o.reactiveWildcard,c,t,e.oldValue)}if(s)for(let f=0;f<s.length;f++){const r=s[f];if(r.handler){r.handler(c,t,e.oldValue);continue}r.onAttributeChange&&c[r.attribute]?r.onAttributeChange(c,t):(ae(c,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(c))}}}function Me(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,H(function(){new MutationObserver(function(t){for(let l=0;l<t.length;l++)try{He(t[l])}catch(o){console.error("[ln-core] mutation handler failed",t[l].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function B(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function z(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function $(e,t){if(!document.contains(e))if(t.attribute){const l=e[t.attribute];if(l&&typeof l.destroy=="function")try{l.destroy()}catch(o){console.error("["+t.attribute+"] destroy failed",e,o)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ue(e){const t=B();if(!t.length)return;const l=e.target;if(l){const s=l.nodeType===1?l:l.parentElement;if(s&&(s.isContentEditable||s.closest&&s.closest('[contenteditable]:not([contenteditable="false"])')))return}const o=z();if(e.target&&o.length)for(let s=0;s<o.length;s++){const h=o[s],c=h.query,f=e.target.nodeType===1?e.target.matches&&e.target.matches(c)?e.target:e.target.closest?e.target.closest(c):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(c):null;f&&h.onSubtreeChange(f,e)}for(let s=0;s<e.addedNodes.length;s++){const h=e.addedNodes[s];if(h.nodeType===1){const c=!!(h.firstElementChild||h.children&&h.children.length);for(let f=0;f<t.length;f++){const r=t[f];if(r.selector&&r.attribute&&r.ComponentFn){if(!c)h.matches&&h.matches(r.query)&&O(h,r);else if(h.matches&&h.matches(r.query)&&O(h,r),h.querySelectorAll){const p=h.querySelectorAll(r.query);for(let m=0;m<p.length;m++)O(p[m],r)}}r.onInit&&r.onInit(h)}}}for(let s=0;s<e.removedNodes.length;s++){const h=e.removedNodes[s];if(h.nodeType===1){if(document.contains(h))continue;const c=!!(h.firstElementChild||h.children&&h.children.length);for(let f=0;f<t.length;f++){const r=t[f],p=r.query;if(p){if(!c)h.matches&&h.matches(p)&&$(h,r);else if(h.matches&&h.matches(p)&&$(h,r),h.querySelectorAll){const m=h.querySelectorAll(p);for(let v=0;v<m.length;v++)$(m[v],r)}}}}}}function he(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,H(function(){const e=new MutationObserver(function(t){for(let l=0;l<t.length;l++){const o=t[l];if(o.type==="childList")try{ue(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ne(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const l=t.takeRecords();for(let o=0;o<l.length;o++){const s=l[o];if(s.type==="childList")try{ue(s)}catch(h){console.error("[ln-core] lifecycle handler failed",s.target,h)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function We(e){B().push(e),e.onSubtreeChange&&e.query&&z().push(e),he()}function fe(e,t,l,o,s={}){const h=s.extraAttributes||[],c=s.onAttributeChange||null,f=s.onSubtreeChange||null,r=s.onInit||null,p=s.onAttrChange||null,m=s.effects||null,v=s.attributes||null,E=v?qe(v):m,q=v?new Set(Object.keys(v)):null,R=s.persist||null;function I(b){const d=b||document.body;if(ae(d,e,t,l),v&&G())for(const w in v){const _=v[w],g=Array.from(d.querySelectorAll("["+w+"]"));d.matches&&d.matches("["+w+"]")&&g.push(d);for(let y=0;y<g.length;y++){const T=g[y];M(T)&&re(_,T.getAttribute(w),w,o,T)}}r&&r(d)}const A=[];if(e.indexOf("[")!==-1){const b=/\[([\w-]+)/g;let d;for(;(d=b.exec(e))!==null;)A.push(d[1])}else A.push(e);Oe({selector:e,attribute:t,componentTag:o,attributes:v,ComponentFn:l,onInit:r,observed:A.concat(h),onAttributeChange:c,onAttrChange:p,effects:E,declared:q,persist:R}),Me();const i=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,u=s.subtreeQuery||(i?e:"["+e+"]"),n={selector:e,attribute:t,ComponentFn:l,onInit:r,onSubtreeChange:f,query:u};B().push(n),f&&u&&z().push(n),he(),window[t]=I,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=fe,window.lnCore.observeLifecycle=We,window.lnCore.withoutLifecycle=Ne);function a(){Ie()>0?Fe(function(){I(document.body)}):I(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a(),I}function Pe(e,t){let l=!1;return function(){l||(l=!0,queueMicrotask(function(){l=!1,e()}))}}function Ve(e){e=e||{};let t=e.windowSize>0?e.windowSize:1e3,l=e.pageSize>0?e.pageSize:200,o=e.threshold!=null?e.threshold:25,s=e.fetchDebounce!=null?e.fetchDebounce:120;const h=typeof e.requestPage=="function"?e.requestPage:function(){},c=typeof e.onChange=="function"?e.onChange:function(){},f=new Map,r=new Map,p=new Set;let m=0,v=0,E=0,q={sort:null,filters:{},search:""},R=null,I=0,A=0,i=!1;function u(d){r.set(d,++I)}function n(){return!!(q&&(q.search||q.filters&&Object.keys(q.filters).length))}function a(){if(f.size<=t)return;const d=Array.from(f.keys()).sort(function(_,g){return(r.get(_)||0)-(r.get(g)||0)});let w=0;for(;f.size>t&&w<d.length;)f.delete(d[w]),r.delete(d[w]),w++}function b(d,w){p.add(d),h(q,d,w)}return{get:function(d){return f.get(d)},has:function(d){return f.has(d)},peek:function(){return f.size?f.values().next().value:void 0},get logicalTotal(){return m},get grandTotal(){return v},get queryGen(){return E},get size(){return f.size},ensure:function(d,w){clearTimeout(R),A=d;for(let k=d;k<w;k++)f.has(k)&&u(k);if(m<=0)return;const _=Math.max(0,d-o),g=Math.min(m,w+o),y=Math.floor(_/l),T=Math.floor(Math.max(0,g-1)/l);let L=-1;for(let k=y;k<=T;k++){const C=k*l,S=Math.min(l,m-C);let x=!1;const Xe=Math.max(C,_),Ze=Math.min(C+S,g);for(let U=Xe;U<Ze;U++)if(!f.has(U)){x=!0;break}if(x&&!p.has(C)){L=C;break}}L!==-1&&(R=setTimeout(function(){b(L,l)},s))},ingest:function(d){if(d=d||{},d.queryGen!=null&&d.queryGen!==E)return!1;const w=d.offset||0,_=d.data||[];let g=0;for(let y=0;y<_.length;y++)_[y]!=null&&g++;if(g===0&&(d.provisional||d.filtered>0))return p.delete(w),!1;i&&(f.clear(),r.clear(),i=!1),d.provisional||(v=d.total!=null?d.total:v,m=d.filtered!=null?d.filtered:d.data?d.data.length:m);for(let y=0;y<_.length;y++)_[y]!=null&&(f.set(w+y,_[y]),u(w+y));return p.delete(w),a(),c(),!0},requestInitial:function(d){d&&(q=d),b(0,l)},invalidate:function(d){E++,p.clear(),clearTimeout(R),d&&(q=d),i=!0,b(0,l)},revalidate:function(){E++,p.clear(),clearTimeout(R),i=!0;const d=Math.max(0,Math.floor(A/l)*l);b(d,l)},release:function(d){p.delete(d)},destroy:function(){clearTimeout(R),f.clear(),r.clear(),p.clear()},configure:function(d){d=d||{};let w=!1;if(d.windowSize!=null&&d.windowSize>0&&d.windowSize!==t){const _=d.windowSize<t;t=d.windowSize,_&&a(),w=!0}d.pageSize!=null&&d.pageSize>0&&(l=d.pageSize),d.threshold!=null&&d.threshold>=0&&(o=d.threshold),d.fetchDebounce!=null&&d.fetchDebounce>=0&&(s=d.fetchDebounce),w&&c()},setGrandTotal:function(d){d==null||isNaN(d)||d<0||(v=d,n()||(m=d),c())}}}function be(e){return(e||"").replace(/^#/,"")}function j(e){const t=e===void 0?location.hash:e,l={},o=be(t);if(!o)return l;const s=o.split("&");for(let h=0;h<s.length;h++){const c=s[h];if(!c)continue;const f=c.indexOf(":"),r=f>-1?c.slice(0,f):c,p=f>-1?c.slice(f+1):"";if(r)try{l[r]=decodeURIComponent(p)}catch{l[r]=p}}return l}function Be(e){if(!e)return null;const t=j();return e in t?t[e]:null}function ze(e,t){if(!e)return;const l=j();t==null?delete l[e]:l[e]=String(t);const s=Object.keys(l).map(function(h){const c=l[h];return c===""?h:h+":"+encodeURIComponent(c)}).join("&");be(location.hash)!==s&&(location.hash=s)}function $e(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function je(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const l=e.getAttribute("data-ln-hash");if(l&&l.trim()!=="")return l.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function Ue(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ge(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Ke(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Qe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const l=e.slice(0,t),o=e.slice(t+1),s=o?o.split(",").map(function(h){try{return decodeURIComponent(h)}catch{return h}}).filter(Boolean):[];return{key:l,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=j,window.lnCore.hashGet=Be,window.lnCore.hashSet=ze,window.lnCore.hashLinkClick=$e,window.lnCore.resolveHashNamespace=je,window.lnCore.hashSortEncode=Ue,window.lnCore.hashSortDecode=Ge,window.lnCore.hashFilterEncode=Ke,window.lnCore.hashFilterDecode=Qe);function Ye(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Ye);function pe(e,t,l,o,s=15){if(o<=0||l<=0)return{start:0,end:0,topPadding:0,bottomPadding:0};const h=Math.max(0,e||0),c=Math.max(0,t||0),f=Math.floor(h/l),r=Math.ceil(c/l),p=Math.max(0,f-s),m=Math.min(o,f+r+s),v=p*l,E=Math.max(0,(o-m)*l);return{start:p,end:m,topPadding:v,bottomPadding:E}}function Je(e,t){const l=Array.isArray(e)?e.length:0,o=t instanceof Set?t:new Set(t||[]);let s=0;if(Array.isArray(e))for(let f=0;f<e.length;f++)o.has(e[f])&&s++;else s=o.size;const h=l>0&&s===l,c=s>0&&s<l;return{totalCount:l,selectedCount:s,isAllSelected:h,isIndeterminate:c}}function we(e,t,l){const o=new Set(e);return t==null||((l!==void 0?l:!o.has(t))?o.add(t):o.delete(t)),o}function _e(e,t,l){const o=new Set(e);if(!Array.isArray(t))return o;if(l)for(let s=0;s<t.length;s++)t[s]!=null&&o.add(t[s]);else for(let s=0;s<t.length;s++)o.delete(t[s]);return o}(function(){const e="data-ln-table",t="lnTable",l="data-ln-table-empty";if(window[t]!==void 0)return;function r(i,u){if(!i||!i.isDataDriven)return;const n=i.dom.hasAttribute("data-ln-table-window");if(n&&!i._windowed)i._enterWindowedMode(),i._kickWindowInitial();else if(!n&&i._windowed)i._exitWindowedMode();else if(n&&i._windowed){const a=parseInt(u,10);a>0&&i._cache.configure({windowSize:a})}}function p(i,u){if(!i||!i.isDataDriven||!i._windowed||!i._cache)return;const n=parseInt(u,10);n>0&&i._cache.configure({pageSize:n})}function m(i,u){if(!i||!i.isDataDriven||!i._windowed||!i._cache)return;const n=parseInt(u,10);n>=0&&i._cache.configure({threshold:n})}function v(i,u){if(!i||!i.isDataDriven||!i._windowed||!i._cache)return;const n=parseInt(u,10);n>=0&&i._cache.setGrandTotal(n)}const E={"data-ln-table":{prop:"name",type:"string",read:F,fallback:"",description:"Table instance name or identifier"},"data-ln-table-source":{prop:"source",type:"string",read:F,fallback:"",description:"Source store or coordinator addressing"},"data-ln-table-selectable":{prop:"_selectable",type:"boolean",read:P,description:"Enables row selection check controls"},"data-ln-table-window":{type:"integer",fallback:1e3,min:10,effect:r,description:"Virtual scrolling window size in rows"},"data-ln-table-window-page":{type:"integer",fallback:200,min:5,effect:p,description:"Virtual scrolling slice page size"},"data-ln-table-window-threshold":{type:"integer",fallback:50,min:0,effect:m,description:"Scroll threshold margin in pixels to trigger page fetch"},"data-ln-table-count":{type:"integer",min:0,effect:v,description:"Total record count override for virtual scrollbar calculation"},"data-ln-table-row":{type:"marker",description:"Table row template element"},"data-ln-table-row-id":{type:"string",description:"Record identifier on row element"},"data-ln-table-row-action":{type:"trigger",description:"Action trigger inside a table row"},"data-ln-table-row-select":{type:"trigger",description:"Row selection checkbox trigger"},"data-ln-table-col":{type:"string",description:"Column header identifier or field mapping"},"data-ln-table-col-select":{type:"trigger",description:"Header select-all checkbox trigger"},"data-ln-table-cell-attr":{type:"string",description:"Cell attribute template mapping"},"data-ln-table-empty":{type:"marker",description:"Container for table empty state"},"data-ln-table-select-all-label":{type:"string",description:"Accessibility label for select-all header trigger"}},q=se(E);typeof Intl<"u"&&new Intl.Collator(document.documentElement.lang||void 0,{sensitivity:"base"});function R(i,u){if(i==null||isNaN(i))return"";try{return new Intl.NumberFormat(Ee(u)).format(i)}catch{return String(i)}}function I(i){let u=i.parentElement;for(;u&&u!==document.body&&u!==document.documentElement;){const a=getComputedStyle(u).overflowY;if(a==="auto"||a==="scroll")return u;u=u.parentElement}return null}function A(i){this.dom=i,oe(this,i,q),this.table=i.querySelector("table"),this.tbody=i.querySelector("[data-ln-table-body]")||i.querySelector("tbody"),this.thead=i.querySelector("thead");const u=this.thead?this.thead.querySelector("tr:last-child"):null;this.ths=u?Array.from(u.querySelectorAll("th")):[],this._totalSpan=i.querySelector("[data-ln-table-total]"),this._filteredSpan=i.querySelector("[data-ln-table-filtered]"),this._filteredSpan&&(this._filteredWrap=this._filteredSpan.parentElement!==i?this._filteredSpan.parentElement:null),this._selectedSpan=i.querySelector("[data-ln-table-selected]"),this._selectedSpan&&(this._selectedWrap=this._selectedSpan.parentElement!==i?this._selectedSpan.parentElement:null),this.isDataDriven=i.hasAttribute("data-ln-table-source"),this._data=[],this._filteredData=[],this._searchTerm="",this._sortCol=-1,this._sortDir=null,this._columnFilters={},this.selectedIds=new Set,this._virtual=!1,this._rowHeight=0,this._vStart=-1,this._vEnd=-1,this._rafId=null,this._scrollHandler=null,this._scrollContainer=null,this._colgroup=null;const n=this;return this._onSetSearch=function(a){const b=(a.detail&&a.detail.query!=null?a.detail.query:a.detail&&a.detail.term!=null?a.detail.term:"").trim();n.isDataDriven?(n.currentSearch=b,D(i,"ln-table:search",{table:n.name,query:n.currentSearch}),n._requestData()):(n._searchTerm=b.toLowerCase(),n._applyFilterAndSort(),n._vStart=-1,n._vEnd=-1,n._render(),n._updateFooter(),D(i,"ln-table:filter",{term:n._searchTerm,matched:n._filteredData.length,total:n._data.length}))},i.addEventListener("ln-table:set-search",this._onSetSearch),this._onSearchChange=function(a){a.preventDefault(),n._onSetSearch(a)},i.addEventListener("ln-search:change",this._onSearchChange),this._onRequestClearFilters=function(){n.isDataDriven?(n.currentFilters={},n.currentSearch="",D(i,"ln-table:clear-filters",{table:n.name}),n._requestData()):(n._searchTerm="",n._columnFilters={},n._applyFilterAndSort(),n._vStart=-1,n._vEnd=-1,n._render(),n._updateFooter(),D(i,"ln-table:filter",{term:"",matched:n._filteredData.length,total:n._data.length}))},i.addEventListener("ln-table:request-clear-filters",this._onRequestClearFilters),this._selectableActive=!1,this._selectable&&this._enableSelection(),this.isDataDriven?(this.isLoaded=!1,this.totalCount=0,this.visibleCount=0,this.currentSort=null,this.currentFilters={},this.currentSearch="",this._lastTotal=0,this._lastFiltered=0,this._hasInitialSeed=!1,this._windowed=!1,this._cache=null,this.isDataDriven&&i.hasAttribute("data-ln-table-window")&&this._enterWindowedMode(),this._onSetData=function(a){const b=a.detail||{},d=b.data||[],w=b.total!=null?b.total:d.length;if(!(n._hasInitialSeed&&!n.isLoaded&&d.length===0&&w===0)){if(n._windowed){n._cache.ingest(b)&&!b.provisional&&i.classList.remove("ln-table--loading");return}n._data=d,n._lastTotal=w,n._lastFiltered=b.filtered!=null?b.filtered:n._data.length,n.totalCount=n._lastTotal,n.visibleCount=n._lastFiltered,n.isLoaded=!0,n._hasInitialSeed=!1,i.classList.remove("ln-table--loading"),n._vStart=-1,n._vEnd=-1,n._applyFilterAndSort(),n._render(),n._updateFooter(),D(i,"ln-table:rendered",{table:n.name,total:n.totalCount,visible:n.visibleCount})}},i.addEventListener("ln-table:set-data",this._onSetData),this._onSetLoading=function(a){const b=a.detail&&a.detail.loading;i.classList.toggle("ln-table--loading",!!b),b&&(n.isLoaded=!1)},i.addEventListener("ln-table:set-loading",this._onSetLoading),this._onPageFailed=function(a){!n._windowed||!n._cache||n._cache.release(a.detail&&a.detail.offset)},i.addEventListener("ln-table:page-failed",this._onPageFailed),this._onRequestRevalidate=function(){!n._windowed||!n._cache||n._cache.revalidate()},i.addEventListener("ln-table:request-revalidate",this._onRequestRevalidate),this._onRequestInvalidate=function(a){if(!(!n._windowed||!n._cache)){if(a&&a.detail&&a.detail.query){const b=a.detail.query;b.search!==void 0&&(n.currentSearch=b.search),b.filters!==void 0&&(n.currentFilters=b.filters),b.sort!==void 0&&(n.currentSort=b.sort)}n._requestData()}},i.addEventListener("ln-table:request-invalidate",this._onRequestInvalidate),this._onSort=function(a){!a.detail||a.detail.field==null||(a.preventDefault(),n.currentSort=a.detail.direction==="none"?null:{field:a.detail.field,direction:a.detail.direction},n._requestData())},i.addEventListener("ln-sort:change",this._onSort),this._windowed&&this._selectable&&this._selectAllCheckbox&&this._selectAllCheckbox.classList.add("hidden"),this._onRowClick=function(a){if(a.target.closest("[data-ln-table-row-select]")||a.target.closest("[data-ln-table-row-action]")||a.target.closest("a")||a.target.closest("button")||a.ctrlKey||a.metaKey||a.button===1)return;const b=a.target.closest("[data-ln-table-row]");if(!b)return;const d=b.getAttribute("data-ln-table-row-id"),w=b._lnRecord||{};D(i,"ln-table:row-click",{table:n.name,id:d,record:w})},this.tbody&&this.tbody.addEventListener("click",this._onRowClick),this._onRowAction=function(a){const b=a.target.closest("[data-ln-table-row-action]");if(!b)return;const d=b.closest("[data-ln-table-row]");if(!d)return;const w=b.getAttribute("data-ln-table-row-action"),_=d.getAttribute("data-ln-table-row-id"),g=d._lnRecord||{};D(i,"ln-table:row-action",{table:n.name,id:_,action:w,record:g})},this.tbody&&this.tbody.addEventListener("click",this._onRowAction),this.tbody&&this.tbody.rows.length>0&&this._parseRows(),setTimeout(function(){!n.dom||!document.contains(n.dom)||(n._windowed?n._kickWindowInitial():D(i,"ln-table:request-data",{table:n.name,sort:n.currentSort,filters:n.currentFilters,search:n.currentSearch}))},0)):(this._emptyTbodyObserver=null,this.tbody&&this.tbody.rows.length>0?this._parseRows():this.tbody&&(this._emptyTbodyObserver=new MutationObserver(function(){n.tbody.rows.length>0&&(n._emptyTbodyObserver.disconnect(),n._emptyTbodyObserver=null,n._parseRows())}),this._emptyTbodyObserver.observe(this.tbody,{childList:!0})),this._onSort=function(a){if(!a.detail||a.detail.column==null)return;a.preventDefault();const b=a.detail.direction==="none"?null:a.detail.direction;n._sortCol=b===null?-1:a.detail.column,n._sortDir=b,n._applyFilterAndSort(),n._vStart=-1,n._vEnd=-1,n._render(),D(i,"ln-table:sorted",{column:a.detail.column,direction:a.detail.direction,matched:n._filteredData.length,total:n._data.length})},i.addEventListener("ln-sort:change",this._onSort),this._onFilterChange=function(a){if(a.preventDefault(),!a.detail)return;const b=a.detail.key,d=a.detail.values||[];if(b){if(d.length===0)delete n._columnFilters[b];else{const w=[];for(let _=0;_<d.length;_++)w.push(d[_].toLowerCase());n._columnFilters[b]=w}n._applyFilterAndSort(),n._vStart=-1,n._vEnd=-1,n._render(),n._updateFooter(),D(i,"ln-table:filter",{term:n._searchTerm,matched:n._filteredData.length,total:n._data.length})}},i.addEventListener("ln-filter:change",this._onFilterChange)),this}A.prototype._parseRows=function(){const i=this.tbody.rows,u=this.ths;this._data=[],i.length>0&&(this._rowHeight=i[0].offsetHeight||40),this._lockColumnWidths();for(let n=0;n<i.length;n++){const a=i[n],b=[],d=[],w=[];for(let g=0;g<a.cells.length;g++){const y=a.cells[g],T=y.textContent.trim();b[g]=K(y),d[g]=T.toLowerCase(),y.querySelector("[data-ln-table-row-action]")||w.push(T.toLowerCase())}let _=null;if(this.isDataDriven){_={};const g=a.getAttribute("data-ln-table-row-id");g!=null&&(_.id=g);for(let y=0;y<u.length;y++){const T=u[y].getAttribute("data-ln-table-col");if(T){const L=y;if(L<a.cells.length){const k=a.cells[L];_[T]=K(k)}}}}this._data.push({values:b,rawTexts:d,html:a.outerHTML,searchText:w.join(" "),id:this.isDataDriven&&_?_.id:void 0,..._})}this._filteredData=this._data.slice(),this._data.length>0&&(this._hasInitialSeed=!0),this.isDataDriven&&(this._lastTotal=this._data.length,this._lastFiltered=this._data.length,this.totalCount=this._data.length,this.visibleCount=this._data.length,this._updateFooter()),this._render(),D(this.dom,"ln-table:ready",{total:this._data.length})},A.prototype._applyFilterAndSort=function(){this._filteredData=this._data?this._data.slice():[],this.visibleCount=this.isDataDriven&&this._lastFiltered!=null?this._lastFiltered:this._filteredData.length},A.prototype._lockColumnWidths=function(){if(!this.table||!this.thead||this._colgroup)return;const i=document.createElement("colgroup");this.ths.forEach(function(u){const n=document.createElement("col");n.style.width=u.offsetWidth+"px",i.appendChild(n)}),this.table.insertBefore(i,this.table.firstChild),this.table.style.tableLayout="fixed",this._colgroup=i},A.prototype._render=function(){if(this.tbody)if(this.isDataDriven){if(this._windowed){this._renderWindowed();return}const i=this._lastTotal,u=this.visibleCount;if(i===0){this._disableVirtualScroll(),this._showEmptyState();return}if(this._filteredData.length===0||u===0){this._disableVirtualScroll(),this._showEmptyState();return}this._filteredData.length>200?(this._enableVirtualScroll(),this._renderVirtual()):(this._disableVirtualScroll(),this._renderAll())}else{const i=this._filteredData.length;i===0&&(this._searchTerm||Object.keys(this._columnFilters).length>0)?(this._disableVirtualScroll(),this._showEmptyState()):i>200?(this._enableVirtualScroll(),this._renderVirtual()):(this._disableVirtualScroll(),this._renderAll())}},A.prototype._renderAll=function(){if(this.isDataDriven){const i=this._filteredData,u=document.createDocumentFragment();for(let n=0;n<i.length;n++){const a=this._buildRow(i[n]);if(!a)break;u.appendChild(a)}this.tbody.replaceChildren(u),this._selectable&&this._updateSelectAll()}else{const i=[],u=this._filteredData;for(let n=0;n<u.length;n++)i.push(u[n].html);this.tbody.innerHTML=i.join(""),this._selectable&&this._restoreSelection()}},A.prototype._enableVirtualScroll=function(){if(this._virtual)return;this._virtual=!0,this._vStart=-1,this._vEnd=-1;const i=this;if(!this._rowHeight)if(this.tbody&&this.tbody.rows.length>0)this._rowHeight=this.tbody.rows[0].offsetHeight||40;else{let n=null;if(this._windowed){const a=this._cache?this._cache.peek():null;n=a?this._buildRow(a):this._buildPlaceholderRow()}else this.isDataDriven&&this._data.length>0&&(n=this._buildRow(this._data[0]));n&&this.tbody&&(this.tbody.appendChild(n),this._rowHeight=n.offsetHeight||40,n.remove())}this.isDataDriven?this._scrollContainer=I(this.dom):this._scrollContainer=null;const u=this._scrollContainer||window;this._scrollHandler=function(){i._rafId||(i._rafId=requestAnimationFrame(function(){i._rafId=null,i._windowed?i._renderWindowed():i._renderVirtual()}))},u.addEventListener("scroll",this._scrollHandler,{passive:!0}),window.addEventListener("resize",this._scrollHandler,{passive:!0})},A.prototype._disableVirtualScroll=function(){this._virtual&&(this._virtual=!1,this._scrollHandler&&((this._scrollContainer||window).removeEventListener("scroll",this._scrollHandler),window.removeEventListener("resize",this._scrollHandler),this._scrollHandler=null),this._scrollContainer=null,this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._vStart=-1,this._vEnd=-1)},A.prototype._renderVirtual=function(){const i=this._filteredData,u=i.length,n=this._rowHeight;if(!n||!u)return;const a=this.thead?this.thead.offsetHeight:0,b=this._scrollContainer;let d,w;if(b){const C=this.table.getBoundingClientRect(),S=b.getBoundingClientRect(),x=C.top-S.top+b.scrollTop+a;d=b.scrollTop-x,w=b.clientHeight}else{const x=this.table.getBoundingClientRect().top+window.scrollY+a;d=window.scrollY-x,w=window.innerHeight}const _=pe(d,w,n,u,15),g=_.start,y=_.end;if(g===this._vStart&&y===this._vEnd)return;this._vStart=g,this._vEnd=y;const T=this.ths.length||1,L=_.topPadding,k=_.bottomPadding;if(this.isDataDriven){const C=document.createDocumentFragment();if(L>0){const S=document.createElement("tr");S.className="ln-table__spacer",S.setAttribute("aria-hidden","true");const x=document.createElement("td");x.setAttribute("colspan",T),x.style.height=L+"px",S.appendChild(x),C.appendChild(S)}for(let S=g;S<y;S++){const x=this._buildRow(i[S]);x&&C.appendChild(x)}if(k>0){const S=document.createElement("tr");S.className="ln-table__spacer",S.setAttribute("aria-hidden","true");const x=document.createElement("td");x.setAttribute("colspan",T),x.style.height=k+"px",S.appendChild(x),C.appendChild(S)}this.tbody.replaceChildren(C),this._selectable&&this._updateSelectAll()}else{let C="";L>0&&(C+='<tr class="ln-table__spacer" aria-hidden="true"><td colspan="'+T+'" style="height:'+L+'px;padding:0;border:none"></td></tr>');for(let S=g;S<y;S++)C+=i[S].html;k>0&&(C+='<tr class="ln-table__spacer" aria-hidden="true"><td colspan="'+T+'" style="height:'+k+'px;padding:0;border:none"></td></tr>'),this.tbody.innerHTML=C,this._selectable&&this._restoreSelection()}},A.prototype._buildPlaceholderRow=function(){const i=document.createElement("tr");i.className="ln-table__placeholder",i.setAttribute("aria-hidden","true");const u=document.createElement("td");return u.setAttribute("colspan",this.ths.length||1),u.style.height=this._rowHeight+"px",i.appendChild(u),i},A.prototype._renderWindowed=function(){if(this.isLoaded&&this._cache.logicalTotal===0){this._disableVirtualScroll(),this._showEmptyState();return}this._virtual||this._enableVirtualScroll();const i=this._rowHeight;if(!i)return;const u=this._cache.logicalTotal,n=this.thead?this.thead.offsetHeight:0,a=this._scrollContainer;let b,d;if(a){const C=this.table.getBoundingClientRect(),S=a.getBoundingClientRect(),x=C.top-S.top+a.scrollTop+n;b=a.scrollTop-x,d=a.clientHeight}else{const x=this.table.getBoundingClientRect().top+window.scrollY+n;b=window.scrollY-x,d=window.innerHeight}const w=pe(b,d,i,u,15),_=w.start,g=w.end;if(_===this._vStart&&g===this._vEnd)return;const y=this.ths.length||1,T=w.topPadding,L=w.bottomPadding,k=document.createDocumentFragment();if(T>0){const C=document.createElement("tr");C.className="ln-table__spacer",C.setAttribute("aria-hidden","true");const S=document.createElement("td");S.setAttribute("colspan",y),S.style.height=T+"px",C.appendChild(S),k.appendChild(C)}for(let C=_;C<g;C++)if(this._cache.has(C)){const S=this._buildRow(this._cache.get(C));S&&k.appendChild(S)}else k.appendChild(this._buildPlaceholderRow());if(L>0){const C=document.createElement("tr");C.className="ln-table__spacer",C.setAttribute("aria-hidden","true");const S=document.createElement("td");S.setAttribute("colspan",y),S.style.height=L+"px",C.appendChild(S),k.appendChild(C)}this.tbody.replaceChildren(k),this._vStart=_,this._vEnd=g,this._cache.ensure(_,g)},A.prototype._showEmptyState=function(){const i=this.ths.length||1;let u=null,n=null;if(this.isDataDriven){const a=this._lastTotal!=null?this._lastTotal:this._data.length,d=this.visibleCount===0&&a>0,w=d?this.name+"-empty-filtered":this.name+"-empty";if(n=X(this.dom,w,"ln-table"),!n){const _=this.dom.querySelector("template[data-ln-table-empty]");if(_){const g=d?"search":"initial",y=_.content.querySelector('[data-ln-table-empty-when="'+g+'"]')||_.content.firstElementChild;y&&(n=document.importNode(y,!0))}}if(n)if(n.tagName==="TR")u=n;else{const _=document.createElement("td");_.setAttribute("colspan",String(i)),_.appendChild(n);const g=document.createElement("tr");g.className="ln-table__empty",g.appendChild(_),u=g}}else{const a=this.dom.querySelector("template["+l+"]"),b=document.createElement("td");b.setAttribute("colspan",String(i)),a&&b.appendChild(document.importNode(a.content,!0));const d=document.createElement("tr");d.className="ln-table__empty",d.appendChild(b),u=d}u?this.tbody.replaceChildren(u):this.tbody.replaceChildren(),D(this.dom,"ln-table:empty",{term:this.isDataDriven?this.currentSearch||"":this._searchTerm,total:this.isDataDriven?this._lastTotal!=null?this._lastTotal:this._data.length:this._data.length})},A.prototype._fillRow=function(i,u){W(i,u);const n=i.querySelectorAll("[data-ln-table-cell-attr]");for(let a=0;a<n.length;a++){const b=n[a],d=b.getAttribute("data-ln-table-cell-attr").split(",");for(let w=0;w<d.length;w++){const _=d[w].trim().split(":");if(_.length!==2)continue;const g=_[0].trim(),y=_[1].trim();u[g]!=null&&b.setAttribute(y,u[g])}}},A.prototype._buildRow=function(i){let u=X(this.dom,this.name+"-row","ln-table");if(!u){const a=this.dom.querySelector("template[data-ln-table-row]");a&&(u=document.importNode(a.content,!0))}let n=u?u.querySelector("[data-ln-table-row]")||u.firstElementChild:null;if(n)this._fillRow(n,i);else if(i&&i.html){const a=document.createElement("tbody");a.innerHTML=i.html,n=a.firstElementChild}else{n=document.createElement("tr"),n.setAttribute("data-ln-table-row","");const a=this.ths;for(let b=0;b<a.length;b++){const d=a[b].hasAttribute("data-ln-table-col-select"),w=document.createElement("td");if(d){const _=document.createElement("input");_.type="checkbox",_.setAttribute("data-ln-table-row-select",""),_.setAttribute("aria-label","Select row"),w.appendChild(_)}else{const _=a[b].getAttribute("data-ln-table-col");_&&i[_]!=null&&(w.textContent=String(i[_]))}n.appendChild(w)}}if(n._lnRecord=i,i.id!=null&&n.setAttribute("data-ln-table-row-id",i.id),this._selectable&&i.id!=null&&this.selectedIds.has(String(i.id))){n.classList.add("ln-row-selected");const a=n.querySelector("[data-ln-table-row-select]");a&&(a.checked=!0)}return n},A.prototype._requestData=function(){if(this._windowed){this.dom.classList.add("ln-table--loading"),this._cache.invalidate({sort:this.currentSort,filters:this.currentFilters,search:this.currentSearch});return}ge(this,"ln-table:request-data","table")},A.prototype._enterWindowedMode=function(){const i=this,u=this.dom,n=parseInt(u.getAttribute("data-ln-table-window"),10),a=parseInt(u.getAttribute("data-ln-table-window-page"),10),b=parseInt(u.getAttribute("data-ln-table-window-threshold"),10);this._onCacheChange=function(){!i._windowed||!i._cache||(i.totalCount=i._cache.grandTotal,i.visibleCount=i._cache.logicalTotal,i._lastTotal=i._cache.grandTotal,i.isLoaded=!0,i._vStart=-1,i._vEnd=-1,i._render(),i._updateFooter(),D(u,"ln-table:rendered",{table:i.name,total:i.totalCount,visible:i.visibleCount}))},this._renderBatch=Pe(this._onCacheChange),this._cache=Ve({windowSize:n>0?n:1e3,pageSize:a>0?a:200,threshold:b>=0?b:25,fetchDebounce:120,requestPage:function(d,w,_){D(u,"ln-table:request-data",{table:i.name,sort:d.sort,filters:d.filters,search:d.search,offset:w,limit:_,queryGen:i._cache.queryGen})},onChange:this._renderBatch}),this._windowed=!0,this._selectable&&this._selectAllCheckbox&&this._selectAllCheckbox.classList.add("hidden")},A.prototype._kickWindowInitial=function(){if(this._data.length>0){let i=parseInt(this.dom.getAttribute("data-ln-table-count"),10);if(isNaN(i)&&this._totalSpan){const n=this._totalSpan.textContent.replace(/[^\d]/g,"");n&&(i=parseInt(n,10))}const u=i>0?i:this._data.length;this._cache.ingest({data:this._data,offset:0,total:u,filtered:u})}else this.dom.classList.add("ln-table--loading"),this._cache.requestInitial({sort:this.currentSort,filters:this.currentFilters,search:this.currentSearch})},A.prototype._exitWindowedMode=function(){this._disableVirtualScroll(),this._cache&&this._cache.destroy(),this._cache=null,this._windowed=!1,this._renderBatch=null,this._onCacheChange=null,this._selectAllCheckbox&&this._selectAllCheckbox.classList.remove("hidden"),this._rowHeight=0,this._vStart=-1,this._vEnd=-1,this._data=[],this._filteredData=[],this.dom.classList.add("ln-table--loading"),this._requestData()},A.prototype._updateSelectAll=function(){if(!this._selectAllCheckbox||!this.tbody)return;const i=this.tbody.querySelectorAll("[data-ln-table-row]"),u=[];for(let a=0;a<i.length;a++){const b=i[a].getAttribute("data-ln-table-row-id");b!=null&&u.push(b)}const n=Je(u,this.selectedIds);this._selectAllCheckbox.checked=n.isAllSelected,this._selectAllCheckbox.indeterminate=n.isIndeterminate},A.prototype._restoreSelection=function(){if(!this.tbody)return;const i=this.tbody.querySelectorAll("[data-ln-table-row]");for(let u=0;u<i.length;u++){const n=i[u].getAttribute("data-ln-table-row-id"),a=n!=null&&this.selectedIds.has(n);i[u].classList.toggle("ln-row-selected",a);const b=i[u].querySelector("[data-ln-table-row-select]");b&&(b.checked=a)}this._updateSelectAll()},Object.defineProperty(A.prototype,"selectedCount",{get:function(){return this.selectedIds.size},set:function(){}}),A.prototype._enableSelection=function(){if(this._selectableActive)return;this._selectableActive=!0;const i=this;if(this._onSelectionChange=function(u){const n=u.target.closest("[data-ln-table-row-select]");if(!n)return;const a=n.closest("[data-ln-table-row]");if(!a)return;const b=a.getAttribute("data-ln-table-row-id");b!=null&&(i.selectedIds=we(i.selectedIds,b,n.checked),a.classList.toggle("ln-row-selected",n.checked),i.selectedCount=i.selectedIds.size,i._updateSelectAll(),i._updateFooter(),D(i.dom,"ln-table:select",{table:i.name,selectedIds:i.selectedIds,count:i.selectedCount}))},this.tbody&&this.tbody.addEventListener("change",this._onSelectionChange),this._selectAllCheckbox=this.dom.querySelector('[data-ln-table-col-select] input[type="checkbox"]')||this.dom.querySelector("[data-ln-table-col-select]"),this._selectAllCheckbox&&this._selectAllCheckbox.tagName==="TH"){const u=document.createElement("input");u.type="checkbox";const n=i.dom.querySelector('[data-ln-table-dict="select-all"]'),a=i.dom.getAttribute("data-ln-table-select-all-label")||(n?n.textContent.trim():null)||"Select all";u.setAttribute("aria-label",a),this._selectAllCheckbox.appendChild(u),this._selectAllCheckbox=u}if(this._selectAllCheckbox&&(this._onSelectAll=function(){const u=i._selectAllCheckbox.checked,n=i.tbody?i.tbody.querySelectorAll("[data-ln-table-row]"):[],a=[];for(let b=0;b<n.length;b++){const d=n[b].getAttribute("data-ln-table-row-id"),w=n[b].querySelector("[data-ln-table-row-select]");d!=null&&(a.push(d),n[b].classList.toggle("ln-row-selected",u),w&&(w.checked=u))}i.selectedIds=_e(i.selectedIds,a,u),i.selectedCount=i.selectedIds.size,D(i.dom,"ln-table:select-all",{table:i.name,selected:u}),D(i.dom,"ln-table:select",{table:i.name,selectedIds:i.selectedIds,count:i.selectedCount}),i._updateFooter()},this._selectAllCheckbox.addEventListener("change",this._onSelectAll)),this.tbody){const u=this.tbody.querySelectorAll("[data-ln-table-row]");for(let n=0;n<u.length;n++){const a=u[n].querySelector("[data-ln-table-row-select]"),b=u[n].getAttribute("data-ln-table-row-id");a&&a.checked&&b!=null&&(i.selectedIds=we(i.selectedIds,b,!0),u[n].classList.add("ln-row-selected"))}this.selectedCount=this.selectedIds.size,this.selectedCount>0&&this._updateSelectAll()}},A.prototype._disableSelection=function(){if(!this._selectableActive)return;this._selectableActive=!1,this.tbody&&this._onSelectionChange&&this.tbody.removeEventListener("change",this._onSelectionChange),this._selectAllCheckbox&&this._onSelectAll&&this._selectAllCheckbox.removeEventListener("change",this._onSelectAll);const i=this.dom.querySelector("[data-ln-table-col-select]");if(i){const u=i.querySelector('input[type="checkbox"]');u&&u.remove()}if(this._selectAllCheckbox=null,this.selectedIds=_e(this.selectedIds,Array.from(this.selectedIds),!1),this.selectedCount=0,this.tbody){const u=this.tbody.querySelectorAll("[data-ln-table-row]");for(let n=0;n<u.length;n++){u[n].classList.remove("ln-row-selected");const a=u[n].querySelector("[data-ln-table-row-select]");a&&(a.checked=!1)}}this._updateFooter()},A.prototype._updateFooter=function(){let i=0,u=0;this.isDataDriven?(i=this._lastTotal!=null?this._lastTotal:this._data.length,u=this.visibleCount):(i=this._data.length,u=this._filteredData.length);const n=u<i;if(this._totalSpan&&(this._totalSpan.textContent=R(i,this.dom)),this._filteredSpan&&(this._filteredSpan.textContent=n?R(u,this.dom):""),this._filteredWrap&&this._filteredWrap.classList.toggle("hidden",!n),this._selectedSpan){const a=this.selectedIds?this.selectedIds.size:0;this._selectedSpan.textContent=a>0?R(a,this.dom):"",this._selectedWrap&&this._selectedWrap.classList.toggle("hidden",a===0)}},A.prototype.destroy=function(){this.dom[t]&&(this._disableVirtualScroll(),this.dom.removeEventListener("ln-table:set-search",this._onSetSearch),this.dom.removeEventListener("ln-table:request-clear-filters",this._onRequestClearFilters),this.isDataDriven?(this.dom.removeEventListener("ln-table:set-data",this._onSetData),this.dom.removeEventListener("ln-table:set-loading",this._onSetLoading),this.dom.removeEventListener("ln-table:page-failed",this._onPageFailed),this.dom.removeEventListener("ln-table:request-revalidate",this._onRequestRevalidate),this.dom.removeEventListener("ln-table:request-invalidate",this._onRequestInvalidate),this.dom.removeEventListener("ln-sort:change",this._onSort),this.tbody&&(this.tbody.removeEventListener("click",this._onRowClick),this.tbody.removeEventListener("click",this._onRowAction)),this._cache&&this._cache.destroy()):(this._emptyTbodyObserver&&(this._emptyTbodyObserver.disconnect(),this._emptyTbodyObserver=null),this.dom.removeEventListener("ln-sort:change",this._onSort),this.dom.removeEventListener("ln-search:change",this._onSearchChange),this.dom.removeEventListener("ln-filter:change",this._onFilterChange)),this._onSelectionChange&&this.tbody&&this.tbody.removeEventListener("change",this._onSelectionChange),this._selectAllCheckbox&&this._onSelectAll&&this._selectAllCheckbox.removeEventListener("change",this._onSelectAll),this._colgroup&&(this._colgroup.remove(),this._colgroup=null),this.table&&(this.table.style.tableLayout=""),this._data=[],this._filteredData=[],delete this.dom[t])},fe(e,t,A,"ln-table",{attributes:E})})()})();
|