@livenetworks/ashlar 2.1.11 → 2.1.13

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.
Files changed (76) hide show
  1. package/README.md +25 -2
  2. package/components/COMPONENTS.md +82 -78
  3. package/components/ln-accordion/ln-accordion.js +1 -1
  4. package/components/ln-ajax/ln-ajax.js +1 -1
  5. package/components/ln-api-connector/ln-api-connector.js +1 -1
  6. package/components/ln-api-queue/ln-api-queue.js +1 -1
  7. package/components/ln-autosave/ln-autosave.js +1 -1
  8. package/components/ln-chart/ln-chart.js +1 -1
  9. package/components/ln-circular-progress/ln-circular-progress.js +1 -1
  10. package/components/ln-confirm/ln-confirm.js +1 -1
  11. package/components/ln-core/README.md +25 -69
  12. package/components/ln-core/events.js +5 -2
  13. package/components/ln-core/index.js +1 -1
  14. package/components/ln-core/lifecycle.js +25 -44
  15. package/components/ln-core/reactive.js +0 -59
  16. package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
  17. package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
  18. package/components/ln-data-store/ln-data-store.js +1 -1
  19. package/components/ln-date/ln-date.js +1 -1
  20. package/components/ln-debug/ln-debug.js +1 -1
  21. package/components/ln-debug/ln-debug.schema.json +28 -28
  22. package/components/ln-debug/src/debug-verifier.js +24 -30
  23. package/components/ln-debug/src/ln-debug.js +3 -11
  24. package/components/ln-dropdown/ln-dropdown.js +1 -1
  25. package/components/ln-editor/ln-editor.js +1 -1
  26. package/components/ln-external-links/ln-external-links.js +1 -1
  27. package/components/ln-filter/ln-filter.js +1 -1
  28. package/components/ln-filter/src/ln-filter.js +3 -1
  29. package/components/ln-form/ln-form.js +1 -1
  30. package/components/ln-icon/ln-icon.js +1 -1
  31. package/components/ln-include/ln-include.js +1 -1
  32. package/components/ln-key/ln-key.js +1 -1
  33. package/components/ln-link/ln-link.js +1 -1
  34. package/components/ln-list/ln-list.js +1 -1
  35. package/components/ln-modal/ln-modal.js +1 -1
  36. package/components/ln-nav/ln-nav.js +1 -1
  37. package/components/ln-number/ln-number.js +1 -1
  38. package/components/ln-obfuscator/ln-obfuscator.js +1 -1
  39. package/components/ln-options/ln-options.js +1 -1
  40. package/components/ln-persist/ln-persist.js +1 -1
  41. package/components/ln-picklist/ln-picklist.js +1 -1
  42. package/components/ln-popover/ln-popover.js +1 -1
  43. package/components/ln-progress/ln-progress.js +1 -1
  44. package/components/ln-router/ln-router.js +1 -1
  45. package/components/ln-scroll/ln-scroll.js +1 -1
  46. package/components/ln-search/ln-search.js +1 -1
  47. package/components/ln-slug/ln-slug.js +1 -1
  48. package/components/ln-sort/ln-sort.js +1 -1
  49. package/components/ln-sortable/ln-sortable.js +1 -1
  50. package/components/ln-stat/ln-stat.js +1 -1
  51. package/components/ln-table/ln-table.js +1 -1
  52. package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
  53. package/components/ln-tabs/ln-tabs.js +1 -1
  54. package/components/ln-time/ln-time.js +1 -1
  55. package/components/ln-toast/ln-toast.js +1 -1
  56. package/components/ln-toggle/ln-toggle.js +1 -1
  57. package/components/ln-tooltip/ln-tooltip.js +1 -1
  58. package/components/ln-translations/ln-translations.js +1 -1
  59. package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
  60. package/components/ln-upload/ln-upload.js +1 -1
  61. package/components/ln-validate/ln-validate.js +1 -1
  62. package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
  63. package/package.json +95 -85
  64. package/theme/README.md +73 -0
  65. package/theme/components/_table.scss +1 -2
  66. package/theme/config/_density.scss +104 -191
  67. package/theme/config/mixins/_avatar.scss +2 -2
  68. package/theme/config/mixins/_card.scss +2 -5
  69. package/theme/config/mixins/_form.scss +26 -39
  70. package/theme/config/mixins/_nav.scss +4 -4
  71. package/theme/config/mixins/_spacing.scss +4 -4
  72. package/theme/config/mixins/_table.scss +9 -33
  73. package/theme/tailwind/components.css +1661 -0
  74. package/theme/tailwind/entry.css +3 -0
  75. package/theme/tailwind/theme.css +23 -0
  76. package/web-types.json +1 -1
@@ -1 +1 @@
1
- (function(){"use strict";function be(){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 C(e,t,r){const i=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function X(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){X(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 Ge(e,t){const r=!!(t&&t.typed),i=t&&t.exclude,a={},l=e.elements,c={};if(r)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")r&&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(r&&s.type==="hidden")a[s.name]=s.value;else if(r&&(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 Ve(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 r=e.elements,i=[],a={};for(let l=0;l<r.length;l++){const c=r[l];c.name&&c.type==="checkbox"&&(a[c.name]=(a[c.name]||0)+1)}for(let l=0;l<r.length;l++){const c=r[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=Ve(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=Ue);const _e={};function He(e,t){_e[e]=t}function Qe(e){return _e[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=He,window.lnCore.getDataMapper=Qe);function Je(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,X(function(){new MutationObserver(function(){C(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const Ce={};function Ze(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];Ce[r]=t}function Xe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return Ce[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 r=ie[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function Se(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let c=0;c<r.length;c++){const d=r[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 r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<r.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[i],t??null),r[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)Se(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function Ae(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const l=r.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,r,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(r,l);if(!x||(Ae(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=Ae,window.lnCore.fill=Se,window.lnCore.lnFill=et,window.lnCore.renderList=tt);function ae(e,t,r){const i=e.getAttribute(t);return i===null?r:i}function Y(e,t,r){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?r:i}function se(e,t,r=!1){const i=e.getAttribute(t);if(i===null)return!!r;const a=i.trim().toLowerCase();return!(a==="false"||a==="0")}function le(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const ce=new Map;function ve(e,t){const r=(e?e.join("|"):"")+"::"+t;if(ce.has(r))return ce.get(r);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(r,a),a}function xe(e,t,r){const i=parseFloat(e.getAttribute(t));return isNaN(i)?r:i}function ke(e,t,r){const i=e.getAttribute(t);if(!i)return r;try{return JSON.parse(i)}catch{return r}}function qe(e,t,r,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 "${r}". 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 "${r}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return d(`[${l}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(d(`[${l}] Value ${s} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(d(`[${l}] Value ${s} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(d(`[${l}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(s){return d(`[${l}] Invalid JSON for attribute "${r}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function Ee(e,t,r){for(const i in r){const[a,l,c]=r[i];Object.defineProperty(e,i,{get:function(){return a(t,l,c)},enumerable:!0,configurable:!0})}return e}function Ie(e){const t={};for(const r in e){const i=e[r];if(!i||!i.prop)continue;let a=i.read;if(!a&&i.type)switch(i.type){case"enum":a=ve(i.values,i.fallback);break;case"integer":a=Y;break;case"float":a=xe;break;case"boolean":a=se;break;case"list":a=le;break;case"json":a=ke;break;case"string":default:a=ae;break}a||(a=ae),t[i.prop]=[a,r,i.fallback]}return t}function nt(e){const t={};for(const r in e){const i=e[r];i&&i.effect&&(t[r]=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 r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=Ee,window.lnCore.attrSpec=Ie,window.lnCore.attrStr=ae,window.lnCore.attrInt=Y,window.lnCore.attrBool=se,window.lnCore.attrList=le,window.lnCore.attrEnum=ve,window.lnCore.attrFloat=xe,window.lnCore.attrJson=ke);function W(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(r){console.error("["+t.attribute+"] init failed",e,r)}}}function Le(e,t,r,i){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c={selector:t,attribute:r,ComponentFn:i};if(e.matches&&e.matches(l)&&W(e,c),e.querySelectorAll){const d=e.querySelectorAll(l);for(let s=0;s<d.length;s++)W(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 De(){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=De(),r=e.observed||[];for(let i=0;i<r.length;i++){const a=r[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 Re(e,t,r,i){for(let a=0;a<e.length;a++){const l=e[a];if(!t[l.attribute])continue;const c=l.effects&&l.effects[r];c?c(t,r,i):l.onAttrChange&&(!l.declared||l.declared.has(r))&&l.onAttrChange(t,r,i)}}function st(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,i=De(),a=i.byAttr.get(t),l=be()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!r&&!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++)qe(d[w].spec,s,t,d[w].componentTag,c)}if(window.lnCore._debugSink&&(r||a)&&window.lnCore._debugSink("attr",t,c,{oldValue:e.oldValue,newValue:c.getAttribute(t)}),r){const d=i.byReactive.get(t);d&&Re(d,c,t,e.oldValue),i.reactiveWildcard.length&&Re(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):(Le(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,X(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{st(t[r])}catch(i){console.error("[ln-core] mutation handler failed",t[r].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 r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Ne(e){const t=ue();if(!t.length)return;const r=e.target;if(r){const a=r.nodeType===1?r:r.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)&&W(l,s);else if(l.matches&&l.matches(s.query)&&W(l,s),l.querySelectorAll){const w=l.querySelectorAll(s.query);for(let b=0;b<w.length;b++)W(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 Te(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,X(function(){const e=new MutationObserver(function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.type==="childList")try{Ne(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 r=t.takeRecords();for(let i=0;i<r.length;i++){const a=r[i];if(a.type==="childList")try{Ne(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),Te()}function ze(e,t,r,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,M=_?new Set(Object.keys(_)):null,$=a.persist||null;function m(L){const D=L||document.body;if(Le(D,e,t,r),_&&be())for(const B in _){const ye=_[B],K=Array.from(D.querySelectorAll("["+B+"]"));D.matches&&D.matches("["+B+"]")&&K.push(D);for(let j=0;j<K.length;j++){const Q=K[j];oe(Q)&&qe(ye,Q.getAttribute(B),B,i,Q)}}s&&s(D)}const A=[];if(e.indexOf("[")!==-1){const L=/\[([\w-]+)/g;let D;for(;(D=L.exec(e))!==null;)A.push(D[1])}else A.push(e);at({selector:e,attribute:t,componentTag:i,attributes:_,ComponentFn:r,onInit:s,observed:A.concat(l),onAttributeChange:c,onAttrChange:w,effects:x,declared:M,persist:$}),lt();const I=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,k=a.subtreeQuery||(I?e:"["+e+"]"),v={selector:e,attribute:t,ComponentFn:r,onInit:s,onSubtreeChange:d,query:k};ue().push(v),d&&k&&de().push(v),Te(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ze,window.lnCore.observeLifecycle=ut,window.lnCore.withoutLifecycle=ct);function q(){ot()>0?it(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",q):q(),m}function dt(e){let t=!1;for(let r=0;r<e.length;r++){const i=e[r];if(!(i===""||i==null)&&(t=!0,!Number.isFinite(Number(i))))return"string"}return t?"number":"string"}function ft(e,t,r,i){if(r==="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 Oe(e){return(e||"").replace(/^#/,"")}function he(e){const t=e===void 0?location.hash:e,r={},i=Oe(t);if(!i)return r;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{r[s]=decodeURIComponent(w)}catch{r[s]=w}}return r}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 r=he();t==null?delete r[e]:r[e]=String(t);const a=Object.keys(r).map(function(l){const c=r[l];return c===""?l:l+":"+encodeURIComponent(c)}).join("&");Oe(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 r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.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 gt(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 r=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:r,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=mt,window.lnCore.hashSortDecode=gt,window.lnCore.hashFilterEncode=bt,window.lnCore.hashFilterDecode=_t);function Ct(e){return(e||"").replace(/^\?/,"")}function St(e){const t=e===void 0?typeof window<"u"?window.location.search:"":e,r={},i=Ct(t);if(!i)return r;const a=new URLSearchParams(i);for(const[l,c]of a.entries())r[l]=c;return r}function At(e){if(!e||typeof window>"u")return null;const t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):null}function vt(e,t){if(!e||typeof window>"u")return;const r=new URL(window.location.href);if(t==null||t===""?r.searchParams.delete(e):r.searchParams.set(e,String(t)),r.search===window.location.search)return;const i=r.pathname+r.search+r.hash;window.history.replaceState(window.history.state,"",i)}function xt(e,t){if(!e||!e.hasAttribute("data-ln-query"))return null;const r=e.getAttribute("data-ln-query");if(r&&r.trim()!=="")return r.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 kt(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function qt(e,t){if(e&&typeof e=="string"){if(e.endsWith(".asc"))return{fieldOrColumn:e.slice(0,-4),direction:"asc"};if(e.endsWith(".desc"))return{fieldOrColumn:e.slice(0,-5),direction:"desc"}}if(t&&typeof t=="object"){const r=t.sort_field||t.sort_by;if(r){const i=t.sort_dir&&String(t.sort_dir).toLowerCase()==="desc"?"desc":"asc";return{fieldOrColumn:r,direction:i}}}return null}function Et(e){return!Array.isArray(e)||e.length===0?null:e.map(encodeURIComponent).join(",")}function It(e){return!e||typeof e!="string"?[]:e.split(",").map(function(t){try{return decodeURIComponent(t.trim())}catch{return t.trim()}}).filter(Boolean)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.queryParse=St,window.lnCore.queryGet=At,window.lnCore.querySet=vt,window.lnCore.resolveQueryParam=xt,window.lnCore.querySortEncode=kt,window.lnCore.querySortDecode=qt,window.lnCore.queryFilterEncode=Et,window.lnCore.queryFilterDecode=It);let H=null;const Lt="ln-ashlar:storage-salt:v1",Pe=32768;function Fe(e){let t="";const r=e.byteLength;for(let i=0;i<r;i+=Pe)t+=String.fromCharCode.apply(null,e.subarray(i,Math.min(i+Pe,r)));return btoa(t)}function Me(e){const t=atob(e),r=t.length,i=new Uint8Array(r);for(let a=0;a<r;a++)i[a]=t.charCodeAt(a);return i}function Be(e,t){let r=H,i={};return typeof CryptoKey<"u"&&e instanceof CryptoKey?r=e:e&&typeof e=="object"&&(i=e,typeof CryptoKey<"u"&&i.key instanceof CryptoKey&&(r=i.key)),{key:r,options:i}}async function Dt(e,t={}){if(!e)throw new Error("[ln-crypto] Key derivation failed: Secret string is required");const r=t.method||"pbkdf2",i=new TextEncoder;if(r==="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||Lt,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 je(e,t={}){if(!e){H=null;return}try{const r=t.method||"sha256";H=await Dt(e,{...t,method:r})}catch(r){throw console.error("[ln-core/crypto] Key derivation failed:",r),H=null,r}}function F(){return H}async function Rt(e,t,r){const{key:i}=Be(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:Fe(l),data:Fe(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 Nt(e,t,r){const{key:i,options:a}=Be(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=Me(e.iv),s=Me(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 Tt(){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=Tt);function zt(e){return String(e||"").trim().toLowerCase()}function Ot(e){const t=zt(e);return t?t.split(/\s+/).filter(Boolean):[]}function Pt(e,t){if(!t||t.length===0)return!0;if(!e)return!1;const r=String(e).toLowerCase();for(let i=0;i<t.length;i++)if(r.indexOf(t[i])===-1)return!1;return!0}function Ft(e,t){if(!t||t.length===0)return!0;if(e==null)return!1;const r=String(e).trim().toLowerCase();for(let i=0;i<t.length;i++)if(String(t[i]).trim().toLowerCase()===r)return!0;return!1}function Mt(e={}){let t=e.windowSize>0?e.windowSize:1e3,r=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(m,A){l.delete(m),l.set(m,A)}function M(){if(l.size<=t)return[];const m=[];for(;l.size>t;){const I=l.keys().next().value;m.push(l.get(I)),l.delete(I)}const A=new Set(l.values());return m.filter(I=>!A.has(I))}function $(m,A){c.add(m),clearTimeout(_),_=setTimeout(()=>a(m,r,A),i)}return{get logicalTotal(){return d},set logicalTotal(m){d=m},get grandTotal(){return s},set grandTotal(m){s=m},get queryGen(){return w},set queryGen(m){w=m},get size(){return l.size},get hasLoaded(){return b},getId:m=>{if(!l.has(m))return;const A=l.get(m);return x(m,A),A},ensure:(m,A,I)=>{if(!b&&!c.has(0))return $(0,I);if(d<=0)return;const k=Math.max(0,m),v=Math.min(d,A);for(let q=k;q<v;q++)if(!l.has(q)){const L=Math.floor(q/r)*r;if(!c.has(L))return $(L,I)}},ingest:(m,A,I,k,v)=>{if(v!=null&&v!==w)return[];b=!0,I!=null&&(s=I),k!=null&&(d=k);for(let q=0;q<A.length;q++)x(m+q,A[q]);return c.delete(m),M()},reset:function(){w++,this.clear()},clear:()=>{b=!1,l.clear(),c.clear(),clearTimeout(_)},configure:(m={})=>{let A=[];return m.windowSize>0&&m.windowSize!==t&&(t=m.windowSize,A=M()),m.pageSize>0&&(r=m.pageSize),m.fetchDebounce>=0&&(i=m.fetchDebounce),A}}}function Bt(e,t,r){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,r);return l?-x:x})}function we(e,t){if(!Array.isArray(e)||!t||typeof t!="object")return e;const r=Object.keys(t).filter(i=>Array.isArray(t[i])&&t[i].length>0);return r.length?e.filter(i=>i?r.every(a=>Ft(i[a],t[a])):!1):e}function jt(e,t,r){if(!Array.isArray(e)||!t||!r||!r.length)return e;const i=Ot(t);return i.length?e.filter(a=>a?i.every(l=>r.some(c=>{const d=a[c];return d!=null&&Pt(String(d),[l])})):!1):e}function $t(e,t,r){if(!Array.isArray(e)||!e.length)return 0;if(r==="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 r==="sum"?a:r==="avg"&&i.length?a/i.length:0}function Kt(e,t={},r=[],i){if(!Array.isArray(e))return{records:[],total:0,filtered:0};const a=e.length;let l=e;t.filters&&(l=we(l,t.filters)),t.search&&(l=jt(l,t.search,r));const c=l.length;if(t.sort&&(l=Bt(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 Ut(e,t){return!Array.isArray(e)||!t||typeof t!="object"?e:e.map(r=>{if(!r)return null;const i={...r};for(const[a,l]of Object.entries(t))if(typeof l=="function")try{i[a]=l(r)}catch{i[a]=void 0}return i})}function Gt(e,t,r,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=r&&r[a]||[];if(l.some(d=>!c.includes(d)))return!0}return!1}function Vt(e){return{ok:!1,error:e&&e.message?e.message:String(e)}}function Wt(e){if(!e||typeof e!="string")return null;const t=e.trim();if(!t)return null;try{const r=JSON.parse(t);return Array.isArray(r)?r:null}catch{return null}}(function(){const e="data-ln-data-store",t="lnDataStore";if(window[t]!==void 0)return;function r(n,o,u){const f=n.getAttribute(o);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-seed":{type:"string",description:"Selector or element ID of an external seed script block"},"data-ln-data-store-stale":{prop:"_staleThreshold",type:"integer",read:r,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:Y,fallback:1e3,min:10,effect:yn,description:"Virtual scrolling cache window size in records"},"data-ln-data-store-window-page":{prop:"_windowPageSize",type:"integer",read:Y,fallback:200,min:5,effect:pn,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=Ie(i),l="ln_app_cache",c="_meta",d="1.0";let s=null,w=null;const b={};function _(n){n&&n.name==="QuotaExceededError"&&C(document,"ln-data-store:quota-exceeded",{error:n})}function x(){const n={};for(const o of document.querySelectorAll(`[${e}]`)){const u=o.id;if(u){const f=o.getAttribute("data-ln-data-store-indexes")||"";n[u]={indexes:f.split(",").map(h=>h.trim()).filter(Boolean)}}}return n}function M(){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 o=x(),u=Object.keys(o),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),g=u.filter(N=>p.includes(N));let S={};if(g.length>0){const N=y.transaction(g,"readonly");for(const T of g)S[T]=Array.from(N.objectStore(T).indexNames)}if(!Gt(p,o,S,c))return $(y),s=y,n(y);const U=y.version;y.close();const P=indexedDB.open(l,U+1);let z=!1,O=null;P.onblocked=()=>{console.warn("[ln-data-store] Database upgrade blocked — waiting for other tabs to close connection"),C(document,"ln-data-store:blocked",{db:l}),O||(O=setTimeout(()=>{z||(console.warn("[ln-data-store] Database upgrade timed out while blocked"),z=!0,w=null,n(null))},5e3))},P.onerror=()=>{z||(O&&clearTimeout(O),z=!0,w=null,console.warn("[ln-data-store] Database upgrade failed"),n(null))},P.onupgradeneeded=N=>{const T=N.target.result,mn=N.target.transaction;T.objectStoreNames.contains(c)||T.createObjectStore(c,{keyPath:"key"});for(const Z of u)if(T.objectStoreNames.contains(Z)){const re=mn.objectStore(Z);for(const V of o[Z].indexes)re.indexNames.contains(V)||re.createIndex(V,V,{unique:!1})}else{const re=T.createObjectStore(Z,{keyPath:"id"});for(const V of o[Z].indexes)re.createIndex(V,V,{unique:!1})}},P.onsuccess=N=>{if(z){N.target.result&&N.target.result.close();return}O&&clearTimeout(O),z=!0;const T=N.target.result;$(T),s=T,n(T)}}}),w)}function $(n){n.onversionchange=()=>{n.close(),s=null,w=null}}function m(){return s?Promise.resolve(s):(w=null,M())}async function A(n){if(!F()||!n)return n;const o={...n},u=o.id,f=await Rt(o);return!f||!f.encrypted?n:{...f,id:u}}async function I(n){return!n||!n.encrypted||!F()?n:Nt(n,{silent:!0})}const k=(n,o)=>m().then(u=>u?u.transaction(n,o).objectStore(n):null);function v(n){return new Promise((o,u)=>{n.onsuccess=()=>o(n.result),n.onerror=()=>{_(n.error),u(n.error)}})}const q=n=>k(n,"readonly").then(o=>o?v(o.getAll()):[]).then(o=>F()?Promise.all(o.map(u=>I(u))):o),L=(n,o)=>k(n,"readonly").then(u=>u?v(u.get(o)).then(f=>f!==void 0?f:typeof o=="string"&&o.trim()!==""&&!isNaN(Number(o))?v(u.get(Number(o))):typeof o=="number"?v(u.get(String(o))):null):null).then(u=>u?I(u):null),D=(n,o)=>m().then(u=>{if(!u)return[];const h=u.transaction(n,"readonly").objectStore(n),y=o.map(p=>v(h.get(p)).then(g=>g!==void 0?g:typeof p=="string"&&p.trim()!==""&&!isNaN(Number(p))?v(h.get(Number(p))):typeof p=="number"?v(h.get(String(p))):null));return Promise.all(y).then(p=>F()?Promise.all(p.map(g=>g?I(g):null)):p)}),B=(n,o)=>(F()?A(o):Promise.resolve(o)).then(f=>k(n,"readwrite").then(h=>h?v(h.put(f)):null)),ye=(n,o)=>k(n,"readwrite").then(u=>u?v(u.delete(o)).then(()=>{if(typeof o=="string"&&o.trim()!==""&&!isNaN(Number(o)))return v(u.delete(Number(o)));if(typeof o=="number")return v(u.delete(String(o)))}):null),K=n=>k(n,"readwrite").then(o=>o?v(o.clear()):null),j=n=>k(n,"readonly").then(o=>o?v(o.count()):0),Q=n=>k(c,"readonly").then(o=>o?v(o.get(n)):null),J=(n,o)=>k(c,"readwrite").then(u=>{if(u)return o.key=n,v(u.put(o))});function R(n){return this.dom=n,this._name=n.id,this._name||console.warn("[ln-data-store] missing id — the store cannot be addressed",n),Ee(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=Mt({windowSize:this._windowSize,pageSize:this._windowPageSize,requestPage:(o,u,f)=>{C(this.dom,"ln-data-store:request-page",{store:this._name,offset:o,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,Ht(this),this.ready=tn(this),this}function Ht(n){n._handlers={create:o=>ee(n,"create",o.detail,()=>Qt(n,o.detail)),update:o=>ee(n,"update",o.detail,()=>Jt(n,o.detail)),delete:o=>ee(n,"delete",o.detail,()=>Zt(n,o.detail)),"bulk-delete":o=>ee(n,"bulk-delete",o.detail,()=>Xt(n,o.detail)),"sync-failed":o=>{n.isSyncing=!1,C(n.dom,"ln-data-store:sync-error",{store:n._name,error:o.detail&&o.detail.error,status:o.detail&&o.detail.status})}};for(const[o,u]of Object.entries(n._handlers))n.dom.addEventListener(`ln-data-store:request-${o}`,u);n._queryHandlers={"ln-search:change":o=>{o.preventDefault();const u=o.detail&&o.detail.term!=null?o.detail.term:"";u!==n.query.search&&(n.query.search=u,ge(n))},"ln-filter:change":o=>{o.preventDefault();const u=o.detail&&o.detail.key;if(!u)return;const f=(o.detail.values||[]).slice(),h=n.query.filters[u];(h?h.length===f.length&&h.every((p,g)=>p===f[g]):!f.length)||(f.length?n.query.filters[u]=f:delete n.query.filters[u],ge(n))},"ln-sort:change":o=>{o.preventDefault();const u=o.detail&&o.detail.field,f=o.detail&&o.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,ge(n))}};for(const[o,u]of Object.entries(n._queryHandlers))n.dom.addEventListener(o,u)}function ee(n,o,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=>Yt(n,o,h,y)),n._mutationChain}function te(n,o=0){return j(n._name).then(u=>{if(n._windowIndex||n.windowed){const f=n.totalCount!=null?n.totalCount:u;n.totalCount=Math.max(0,f+o)}else n.totalCount=u;return n.hasCache=!0,n.isLoaded=!0,n.canServe=!0,J(n._name,{schema_version:d,last_synced_at:n.lastSyncedAt,has_cache:!0,record_count:n.totalCount})})}function Qt(n,{tempId:o,data:u={},requestId:f}={}){const h={...u,id:o};return B(n._name,h).then(()=>te(n,1)).then(()=>{C(n.dom,"ln-data-store:created",{store:n._name,record:h,tempId:o,requestId:f})})}function Jt(n,{id:o,data:u={},requestId:f}={}){return L(n._name,o).then(h=>{if(!h)throw new Error(`Record not found: ${o}`);const y=h.id,p={...h,...u,id:y},g=u.id,S=g!==void 0&&g!==y;return(S?nn(n._name,y,{...p,id:g}):B(n._name,p)).then(()=>te(n,0)).then(()=>{C(n.dom,"ln-data-store:updated",{store:n._name,record:S?{...p,id:g}:p,previous:h,requestId:f})})})}function Zt(n,{id:o,requestId:u}={}){return L(n._name,o).then(f=>{if(!f){C(n.dom,"ln-data-store:deleted",{store:n._name,id:o,requestId:u,missing:!0});return}const h=f.id;return ye(n._name,h).then(()=>te(n,-1)).then(()=>{C(n.dom,"ln-data-store:deleted",{store:n._name,id:h,requestId:u})})})}function Xt(n,{ids:o=[],requestId:u}={}){return o.length?Promise.all(o.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(()=>{C(n.dom,"ln-data-store:deleted",{store:n._name,ids:h,requestId:u})})}):(C(n.dom,"ln-data-store:deleted",{store:n._name,ids:[],requestId:u}),Promise.resolve())}function Yt(n,o,u,f){console.error("[ln-data-store] "+o+" failed:",f),C(n.dom,"ln-data-store:mutation-error",{store:n._name,action:o,requestId:u,error:f})}function en(n){let o=null;const u=n.dom.getAttribute("data-ln-data-store-seed");if(u&&(o=document.getElementById(u),!o))try{o=document.querySelector(u)}catch{}return o||(o=n.dom.querySelector('script[type="application/json"]')||n.dom.querySelector("script")),o&&o.textContent?Wt(o.textContent):null}function tn(n){const o=en(n);return n._seedRecords=o,o?(n.lastSyncedAt=Math.floor(Date.now()/1e3),n.totalCount=o.length,n.hasCache=!0,n.isLoaded=!0,n.canServe=!0,n.isInitialized=!0,setTimeout(()=>{C(n.dom,"ln-data-store:ready",{store:n._name,count:n.totalCount,source:"seed"}),C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!0,lastSyncedAt:n.lastSyncedAt,count:n.totalCount,source:"seed"})},0),M().then(u=>{if(u)return K(n._name).then(()=>pe(n._name,o)).then(()=>J(n._name,{schema_version:d,last_synced_at:n.lastSyncedAt,has_cache:!0,record_count:n.totalCount}))}).catch(()=>{}),Promise.resolve({ok:!0,source:"seed"})):M().then(u=>{if(!u)throw new Error("IndexedDB is unavailable");return Q(n._name)}).then(u=>{if(!o)if(n.initializationError=null,u&&u.schema_version===d)n.lastSyncedAt=u.last_synced_at||null,n.totalCount=u.record_count||0,n.hasCache=u.has_cache===!0||n.totalCount>0,n.hasCache&&(n.isLoaded=!0,n.canServe=!0,C(n.dom,"ln-data-store:ready",{store:n._name,count:n.totalCount,source:"cache"})),n.isInitialized=!0,C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:n.hasCache,lastSyncedAt:n.lastSyncedAt,count:n.totalCount});else{if(u&&u.schema_version!==d)return K(n._name).then(()=>J(n._name,{schema_version:d,last_synced_at:null,has_cache:!1,record_count:0})).then(()=>{n.isInitialized=!0,n.hasCache=!1,C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!1,lastSyncedAt:null,count:0})});n.isInitialized=!0,n.hasCache=!1,C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!1,lastSyncedAt:null,count:0})}}).catch(u=>o?(n.lastSyncedAt=Math.floor(Date.now()/1e3),n.totalCount=o.length,n.hasCache=!0,n.isLoaded=!0,n.canServe=!0,n.isInitialized=!0,C(n.dom,"ln-data-store:ready",{store:n._name,count:n.totalCount,source:"seed"}),C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!0,lastSyncedAt:n.lastSyncedAt,count:n.totalCount,source:"seed"}),{ok:!0,source:"seed"}):(n.isInitialized=!0,n.isLoaded=!1,n.canServe=!1,n.hasCache=!1,n.isSyncing=!1,n.initializationError=u,C(n.dom,"ln-data-store:initialization-error",{store:n._name,error:u}),{ok:!1,error:u}))}function $e(n){n.isSyncing=!0,C(n.dom,"ln-data-store:request-remote-sync",{since:n.lastSyncedAt})}function pe(n,o){return m().then(u=>u?(F()?Promise.all(o.map(h=>A(h))):Promise.resolve(o)).then(h=>new Promise((y,p)=>{const g=u.transaction(n,"readwrite"),S=g.objectStore(n);h.forEach(E=>S.put(E)),g.oncomplete=()=>y(),g.onerror=()=>{_(g.error),p(g.error)}})):void 0)}function ne(n,o){return m().then(u=>{if(u)return new Promise((f,h)=>{const y=u.transaction(n,"readwrite"),p=y.objectStore(n);o.forEach(g=>{p.delete(g),typeof g=="string"&&g.trim()!==""&&!isNaN(Number(g))?p.delete(Number(g)):typeof g=="number"&&p.delete(String(g))}),y.oncomplete=()=>f(),y.onerror=()=>h(y.error)})})}function nn(n,o,u){return(F()?A(u):Promise.resolve(u)).then(h=>m().then(y=>{if(y)return new Promise((p,g)=>{const S=y.transaction(n,"readwrite"),E=S.objectStore(n);E.put(h),E.delete(o),S.oncomplete=()=>p(),S.onerror=()=>{_(S.error),g(S.error)}})}))}const rn=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function on(n){return n?Object.keys(n).filter(o=>Array.isArray(n[o])&&n[o].length>0):[]}function an(n,o,u){return o.every(f=>u[f].map(String).includes(String(n[f])))}function sn(n){return String(n||"").toLowerCase().split(/\s+/).filter(Boolean)}function ln(n,o,u){return o.every(f=>u.some(h=>{const y=n[h];return y!=null&&String(y).toLowerCase().includes(f)}))}function cn(n,o,u){return $t(n,o,u)}function G(n,o){return Ut(o,n.presenters&&n.presenters.computed)}function un(n){return!n.sort&&!F()}function dn(n,o,u){const f=on(o.filters),h=o.search?sn(o.search):[],y=n._searchFields,p=h.length>0&&y&&y.length>0;return k(n._name,"readonly").then(g=>g?new Promise((S,E)=>{const U=[],P=g.openCursor();P.onsuccess=()=>{const z=P.result;if(!z||U.length>=u){S(U);return}const O=z.value;(!f.length||an(O,f,o.filters))&&(!p||ln(O,h,y))&&U.push(O),z.continue()},P.onerror=()=>E(P.error)}):[])}function me(n,o,u){return Kt(o,u,n._searchFields,rn)}function fn(n,o,u){const f=[];for(let y=o;y<o+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 S=0;S<y.length;S++){const E=y[S];E&&p.set(String(E.id),E)}const g=[];for(let S=0;S<f.length;S++){const E=f[S];if(E===void 0)g.push(null);else{const U=p.get(String(E));g.push(U||null)}}return{data:G(n,g),total:n._windowIndex.grandTotal,filtered:n._windowIndex.logicalTotal,offset:o,queryGen:n._windowIndex.queryGen}})}R.prototype.getAll=function(n={}){const o=this;if(o._seedRecords){const u=me(o,o._seedRecords,n);return Promise.resolve({data:G(o,u.records),total:u.total,filtered:u.filtered})}if(o._windowIndex){const u=n.offset||0,f=n.limit||200;if(o._windowIndex.ensure(u,u+f,n),!o._windowIndex.hasLoaded&&!o.noLocalQuery){const h=u+f,y=p=>({data:G(o,p),offset:u,queryGen:o._windowIndex.queryGen,provisional:!0});return un(n)?dn(o,n,h).then(p=>y(p.slice(u,h))):q(o._name).then(p=>y(me(o,p,n).records))}return fn(o,u,f)}return q(o._name).then(u=>{const f=me(o,u,n);return{data:G(o,f.records),total:f.total,filtered:f.filtered}})},R.prototype.getById=function(n){return L(this._name,n).then(o=>o?G(this,[o])[0]:null)},R.prototype.count=function(n){if(this._seedRecords){const u=n&&Object.keys(n).length>0;return Promise.resolve(u?we(this._seedRecords,n).length:this._seedRecords.length)}return n&&Object.keys(n).length>0?q(this._name).then(u=>we(u,n).length):this.windowed&&this.totalCount!=null?Promise.resolve(this.totalCount):j(this._name)},R.prototype.aggregate=function(n,o){return q(this._name).then(u=>cn(u,n,o))},R.prototype.setPresenters=function(n){this.presenters=n},R.prototype.applySync=function(n,o,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=m().then(p=>{if(!p)throw new Error("IndexedDB unavailable")});return n.length>0&&(y=y.then(()=>pe(h._name,n))),o.length>0&&(y=y.then(()=>ne(h._name,o))),y.then(()=>{if(h._windowIndex&&(f.offset!=null||f.total!=null)){const p=f.offset!=null?f.offset:0,g=n.map(E=>E.id),S=h._windowIndex.ingest(p,g,f.total,f.filtered,f.queryGen);if(S&&S.length)return ne(h._name,S)}}).then(()=>j(h._name)).then(p=>(h.totalCount=f.total!==void 0?f.total:p,h.hasCache=!0,J(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?(C(h.dom,"ln-data-store:loaded",{store:h._name,count:h.totalCount,meta:f}),C(h.dom,"ln-data-store:ready",{store:h._name,count:h.totalCount,source:"server",meta:f})):C(h.dom,"ln-data-store:synced",{store:h._name,added:n.length,deleted:o.length,changed:!0,meta:f}),{ok:!0}}).catch(p=>{h.isSyncing=!1;const g=p&&p.message?p.message:String(p);return console.error("[ln-data-store] applySync failed:",p),C(h.dom,"ln-data-store:sync-error",{store:h._name,error:g}),Vt(p)})},R.prototype.applyQuery=function(n,o){o=o||{};const u=this;let f=Promise.resolve();return n.length>0&&(f=f.then(()=>pe(u._name,n))),f.then(()=>j(u._name)).then(h=>(u.totalCount=o.total!==void 0?o.total:h,n.length>0&&(u.canServe=!0),G(u,n))).catch(h=>(console.error("[ln-data-store] applyQuery failed:",h),[]))},R.prototype.forceSync=function(){this.isSyncing||$e(this)},R.prototype.fullReload=function(){const n=this;return K(n._name).then(()=>J(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,$e(n)})},R.prototype.destroy=function(){if(this._windowIndex&&(this._windowIndex.clear(),this._windowIndex=null,this.windowed=!1),this._handlers){for(const[n,o]of Object.entries(this._handlers))this.dom.removeEventListener(`ln-data-store:request-${n}`,o);this._handlers=null}if(this._queryHandlers){for(const[n,o]of Object.entries(this._queryHandlers))this.dom.removeEventListener(n,o);this._queryHandlers=null}delete b[this._name],delete this.dom[t]};function hn(){return m().then(n=>{if(!n)return;const o=Array.from(n.objectStoreNames);return new Promise((u,f)=>{const h=n.transaction(o,"readwrite");o.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 ge(n){n._windowIndex&&n._windowIndex.reset(),C(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 wn="data-ln-data-store-frozen";function Ke(n,o){n.setAttribute(wn,o)}function yn(n){const o=n[t];if(!o._windowIndex)return;const u=o._windowIndex.configure({windowSize:o._windowSize});u.length&&ne(o._name,u).catch(f=>{console.error("[ln-data-store] window shrink eviction failed:",f)})}function pn(n){const o=n[t];o._windowIndex&&o._windowIndex.configure({pageSize:o._windowPageSize})}ze(e,t,R,"ln-data-store",{attributes:i}),window[t].clearAll=hn,window[t].init=window[t],window[t].setStorageKey=je,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.setStorageKey=je)})()})();
1
+ (function(){"use strict";function ge(){if(typeof window>"u")return!1;if(window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink)return!0;if(typeof document<"u"){if(document.documentElement&&document.documentElement.hasAttribute("data-ln-debug"))return!0;if(document.body)return document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null}return!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 C(e,t,r){const i=r||{};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 Ge(e,t){const r=!!(t&&t.typed),i=t&&t.exclude,a={},l=e.elements,c={};if(r)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")r&&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(r&&s.type==="hidden")a[s.name]=s.value;else if(r&&(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 Ve(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 r=e.elements,i=[],a={};for(let l=0;l<r.length;l++){const c=r[l];c.name&&c.type==="checkbox"&&(a[c.name]=(a[c.name]||0)+1)}for(let l=0;l<r.length;l++){const c=r[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(_){return _.trim()});c.checked=w.indexOf(c.value)!==-1}else c.checked=Ve(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=Ue);const be={};function He(e,t){be[e]=t}function Qe(e){return be[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=He,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(){C(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const _e={};function Ze(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];_e[r]=t}function Xe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return _e[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 r=ie[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function Ce(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let c=0;c<r.length;c++){const d=r[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 _=s[w].trim().split(":");if(_.length!==2)continue;const b=_[0].trim(),x=_[1].trim();t[x]!=null&&d.setAttribute(b,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 _=s[w].trim().split(":");if(_.length!==2)continue;const b=_[0].trim(),x=_[1].trim();x in t&&d.classList.toggle(b,!!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 r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<r.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[i],t??null),r[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)Ce(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function Se(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const l=r.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,r,i,a,l){const c={};for(let s=0;s<e.children.length;s++){const w=e.children[s],_=w.getAttribute("data-ln-render-key");_&&(c[_]=w)}const d=document.createDocumentFragment();for(let s=0;s<t.length;s++){const w=t[s],_=String(i(w));let b=c[_];if(b)a(b,w,s);else{const x=Ye(r,l);if(!x||(Se(x,w),b=x.firstElementChild,!b))continue;b.setAttribute("data-ln-render-key",_),a(b,w,s)}d.appendChild(b)}e.textContent="",e.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=Se,window.lnCore.fill=Ce,window.lnCore.lnFill=et,window.lnCore.renderList=tt);function ae(e,t,r){const i=e.getAttribute(t);return i===null?r:i}function X(e,t,r){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?r:i}function se(e,t,r=!1){const i=e.getAttribute(t);if(i===null)return!!r;const a=i.trim().toLowerCase();return!(a==="false"||a==="0")}function le(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const ce=new Map;function Ae(e,t){const r=(e?e.join("|"):"")+"::"+t;if(ce.has(r))return ce.get(r);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(r,a),a}function ve(e,t,r){const i=parseFloat(e.getAttribute(t));return isNaN(i)?r:i}function xe(e,t,r){const i=e.getAttribute(t);if(!i)return r;try{return JSON.parse(i)}catch{return r}}function ke(e,t,r,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 "${r}". 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 "${r}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return d(`[${l}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(d(`[${l}] Value ${s} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(d(`[${l}] Value ${s} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(d(`[${l}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(s){return d(`[${l}] Invalid JSON for attribute "${r}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function Ee(e,t,r){for(const i in r){const[a,l,c]=r[i];Object.defineProperty(e,i,{get:function(){return a(t,l,c)},enumerable:!0,configurable:!0})}return e}function qe(e){const t={};for(const r in e){const i=e[r];if(!i||!i.prop)continue;let a=i.read;if(!a&&i.type)switch(i.type){case"enum":a=Ae(i.values,i.fallback);break;case"integer":a=X;break;case"float":a=ve;break;case"boolean":a=se;break;case"list":a=le;break;case"json":a=xe;break;case"string":default:a=ae;break}a||(a=ae),t[i.prop]=[a,r,i.fallback]}return t}function nt(e){const t={};for(const r in e){const i=e[r];i&&i.effect&&(t[r]=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 r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=Ee,window.lnCore.attrSpec=qe,window.lnCore.attrStr=ae,window.lnCore.attrInt=X,window.lnCore.attrBool=se,window.lnCore.attrList=le,window.lnCore.attrEnum=Ae,window.lnCore.attrFloat=ve,window.lnCore.attrJson=xe);function Y(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(r){console.error("["+t.attribute+"] init failed",e,r)}}}function Ie(e,t,r,i){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c={selector:t,attribute:r,ComponentFn:i};if(e.matches&&e.matches(l)&&Y(e,c),e.querySelectorAll){const d=e.querySelectorAll(l);for(let s=0;s<d.length;s++)Y(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 Le(){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=Le(),r=e.observed||[];for(let i=0;i<r.length;i++){const a=r[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 De(e,t,r,i){for(let a=0;a<e.length;a++){const l=e[a];if(!t[l.attribute])continue;const c=l.effects&&l.effects[r];c?c(t,r,i):l.onAttrChange&&(!l.declared||l.declared.has(r))&&l.onAttrChange(t,r,i)}}function st(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,i=Le(),a=i.byAttr.get(t),l=ge()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!r&&!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++)ke(d[w].spec,s,t,d[w].componentTag,c)}if(window.lnCore._debugSink&&(r||a)&&window.lnCore._debugSink("attr",t,c,{oldValue:e.oldValue,newValue:c.getAttribute(t)}),r){const d=i.byReactive.get(t);d&&De(d,c,t,e.oldValue),i.reactiveWildcard.length&&De(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):(Ie(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 r=0;r<t.length;r++)try{st(t[r])}catch(i){console.error("[ln-core] mutation handler failed",t[r].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 Re(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Ne(e){const t=ue();if(!t.length)return;const r=e.target;if(r){const a=r.nodeType===1?r:r.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)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&&(l.matches&&l.matches(w)&&(s.ComponentFn&&Y(l,s),s.onInit&&s.onInit(l)),c&&l.querySelectorAll)){const _=l.querySelectorAll(w);for(let b=0;b<_.length;b++)s.ComponentFn&&Y(_[b],s),s.onInit&&s.onInit(_[b])}}}for(let a=0;a<e.removedNodes.length;a++){const l=e.removedNodes[a];if(l.nodeType!==1||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&&(l.matches&&l.matches(w)&&Re(l,s),c&&l.querySelectorAll)){const _=l.querySelectorAll(w);for(let b=0;b<_.length;b++)Re(_[b],s)}}}}function Te(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,Z(function(){const e=new MutationObserver(function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.type==="childList")try{Ne(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 r=t.takeRecords();for(let i=0;i<r.length;i++){const a=r[i];if(a.type==="childList")try{Ne(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),Te()}function ze(e,t,r,i,a={}){const l=a.extraAttributes||[],c=a.onAttributeChange||null,d=a.onSubtreeChange||null,s=a.onInit||null,w=a.onAttrChange||null,_=a.effects||null,b=a.attributes||null,x=b?nt(b):_,M=b?new Set(Object.keys(b)):null,$=a.persist||null;function m(L){const D=L||document.body;if(Ie(D,e,t,r),b&&ge())for(const B in b){const we=b[B],K=Array.from(D.querySelectorAll("["+B+"]"));D.matches&&D.matches("["+B+"]")&&K.push(D);for(let j=0;j<K.length;j++){const H=K[j];oe(H)&&ke(we,H.getAttribute(B),B,i,H)}}s&&s(D)}const A=[];if(e.indexOf("[")!==-1){const L=/\[([\w-]+)/g;let D;for(;(D=L.exec(e))!==null;)A.push(D[1])}else A.push(e);at({selector:e,attribute:t,componentTag:i,attributes:b,ComponentFn:r,onInit:s,observed:A.concat(l),onAttributeChange:c,onAttrChange:w,effects:x,declared:M,persist:$}),lt();const I=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,k=a.subtreeQuery||(I?e:"["+e+"]"),v={selector:e,attribute:t,ComponentFn:r,onInit:s,onSubtreeChange:d,query:k};ue().push(v),d&&k&&de().push(v),Te(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ze,window.lnCore.observeLifecycle=ut,window.lnCore.withoutLifecycle=ct);function E(){ot()>0?it(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E):E(),m}function dt(e){let t=!1;for(let r=0;r<e.length;r++){const i=e[r];if(!(i===""||i==null)&&(t=!0,!Number.isFinite(Number(i))))return"string"}return t?"number":"string"}function ft(e,t,r,i){if(r==="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 Oe(e){return(e||"").replace(/^#/,"")}function fe(e){const t=e===void 0?location.hash:e,r={},i=Oe(t);if(!i)return r;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{r[s]=decodeURIComponent(w)}catch{r[s]=w}}return r}function ht(e){if(!e)return null;const t=fe();return e in t?t[e]:null}function wt(e,t){if(!e)return;const r=fe();t==null?delete r[e]:r[e]=String(t);const a=Object.keys(r).map(function(l){const c=r[l];return c===""?l:l+":"+encodeURIComponent(c)}).join("&");Oe(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 r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.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 gt(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 r=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:r,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=fe,window.lnCore.hashGet=ht,window.lnCore.hashSet=wt,window.lnCore.hashLinkClick=yt,window.lnCore.resolveHashNamespace=pt,window.lnCore.hashSortEncode=mt,window.lnCore.hashSortDecode=gt,window.lnCore.hashFilterEncode=bt,window.lnCore.hashFilterDecode=_t);function Ct(e){return(e||"").replace(/^\?/,"")}function St(e){const t=e===void 0?typeof window<"u"?window.location.search:"":e,r={},i=Ct(t);if(!i)return r;const a=new URLSearchParams(i);for(const[l,c]of a.entries())r[l]=c;return r}function At(e){if(!e||typeof window>"u")return null;const t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):null}function vt(e,t){if(!e||typeof window>"u")return;const r=new URL(window.location.href);if(t==null||t===""?r.searchParams.delete(e):r.searchParams.set(e,String(t)),r.search===window.location.search)return;const i=r.pathname+r.search+r.hash;window.history.replaceState(window.history.state,"",i)}function xt(e,t){if(!e||!e.hasAttribute("data-ln-query"))return null;const r=e.getAttribute("data-ln-query");if(r&&r.trim()!=="")return r.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 kt(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Et(e,t){if(e&&typeof e=="string"){if(e.endsWith(".asc"))return{fieldOrColumn:e.slice(0,-4),direction:"asc"};if(e.endsWith(".desc"))return{fieldOrColumn:e.slice(0,-5),direction:"desc"}}if(t&&typeof t=="object"){const r=t.sort_field||t.sort_by;if(r){const i=t.sort_dir&&String(t.sort_dir).toLowerCase()==="desc"?"desc":"asc";return{fieldOrColumn:r,direction:i}}}return null}function qt(e){return!Array.isArray(e)||e.length===0?null:e.map(encodeURIComponent).join(",")}function It(e){return!e||typeof e!="string"?[]:e.split(",").map(function(t){try{return decodeURIComponent(t.trim())}catch{return t.trim()}}).filter(Boolean)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.queryParse=St,window.lnCore.queryGet=At,window.lnCore.querySet=vt,window.lnCore.resolveQueryParam=xt,window.lnCore.querySortEncode=kt,window.lnCore.querySortDecode=Et,window.lnCore.queryFilterEncode=qt,window.lnCore.queryFilterDecode=It);let W=null;const Lt="ln-ashlar:storage-salt:v1",Fe=32768;function Pe(e){let t="";const r=e.byteLength;for(let i=0;i<r;i+=Fe)t+=String.fromCharCode.apply(null,e.subarray(i,Math.min(i+Fe,r)));return btoa(t)}function Me(e){const t=atob(e),r=t.length,i=new Uint8Array(r);for(let a=0;a<r;a++)i[a]=t.charCodeAt(a);return i}function Be(e,t){let r=W,i={};return typeof CryptoKey<"u"&&e instanceof CryptoKey?r=e:e&&typeof e=="object"&&(i=e,typeof CryptoKey<"u"&&i.key instanceof CryptoKey&&(r=i.key)),{key:r,options:i}}async function Dt(e,t={}){if(!e)throw new Error("[ln-crypto] Key derivation failed: Secret string is required");const r=t.method||"pbkdf2",i=new TextEncoder;if(r==="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||Lt,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 je(e,t={}){if(!e){W=null;return}try{const r=t.method||"sha256";W=await Dt(e,{...t,method:r})}catch(r){throw console.error("[ln-core/crypto] Key derivation failed:",r),W=null,r}}function P(){return W}async function Rt(e,t,r){const{key:i}=Be(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:Pe(l),data:Pe(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 Nt(e,t,r){const{key:i,options:a}=Be(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=Me(e.iv),s=Me(e.data),w=await crypto.subtle.decrypt({name:"AES-GCM",iv:d},i,s),_=c.decode(w);try{return JSON.parse(_)}catch{return _}}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 Tt(){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=Tt);function zt(e){return String(e||"").trim().toLowerCase()}function Ot(e){const t=zt(e);return t?t.split(/\s+/).filter(Boolean):[]}function Ft(e,t){if(!t||t.length===0)return!0;if(!e)return!1;const r=String(e).toLowerCase();for(let i=0;i<t.length;i++)if(r.indexOf(t[i])===-1)return!1;return!0}function Pt(e,t){if(!t||t.length===0)return!0;if(e==null)return!1;const r=String(e).trim().toLowerCase();for(let i=0;i<t.length;i++)if(String(t[i]).trim().toLowerCase()===r)return!0;return!1}function Mt(e={}){let t=e.windowSize>0?e.windowSize:1e3,r=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,_=!1,b=null;function x(m,A){l.delete(m),l.set(m,A)}function M(){if(l.size<=t)return[];const m=[];for(;l.size>t;){const I=l.keys().next().value;m.push(l.get(I)),l.delete(I)}const A=new Set(l.values());return m.filter(I=>!A.has(I))}function $(m,A){c.add(m),clearTimeout(b),b=setTimeout(()=>a(m,r,A),i)}return{get logicalTotal(){return d},set logicalTotal(m){d=m},get grandTotal(){return s},set grandTotal(m){s=m},get queryGen(){return w},set queryGen(m){w=m},get size(){return l.size},get hasLoaded(){return _},getId:m=>{if(!l.has(m))return;const A=l.get(m);return x(m,A),A},ensure:(m,A,I)=>{if(!_&&!c.has(0))return $(0,I);if(d<=0)return;const k=Math.max(0,m),v=Math.min(d,A);for(let E=k;E<v;E++)if(!l.has(E)){const L=Math.floor(E/r)*r;if(!c.has(L))return $(L,I)}},ingest:(m,A,I,k,v)=>{if(v!=null&&v!==w)return[];_=!0,I!=null&&(s=I),k!=null&&(d=k);for(let E=0;E<A.length;E++)x(m+E,A[E]);return c.delete(m),M()},reset:function(){w++,this.clear()},clear:()=>{_=!1,l.clear(),c.clear(),clearTimeout(b)},configure:(m={})=>{let A=[];return m.windowSize>0&&m.windowSize!==t&&(t=m.windowSize,A=M()),m.pageSize>0&&(r=m.pageSize),m.fetchDebounce>=0&&(i=m.fetchDebounce),A}}}function Bt(e,t,r){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 _=s?s[i]:void 0,b=w?w[i]:void 0,x=ft(_,b,d,r);return l?-x:x})}function he(e,t){if(!Array.isArray(e)||!t||typeof t!="object")return e;const r=Object.keys(t).filter(i=>Array.isArray(t[i])&&t[i].length>0);return r.length?e.filter(i=>i?r.every(a=>Pt(i[a],t[a])):!1):e}function jt(e,t,r){if(!Array.isArray(e)||!t||!r||!r.length)return e;const i=Ot(t);return i.length?e.filter(a=>a?i.every(l=>r.some(c=>{const d=a[c];return d!=null&&Ft(String(d),[l])})):!1):e}function $t(e,t,r){if(!Array.isArray(e)||!e.length)return 0;if(r==="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 r==="sum"?a:r==="avg"&&i.length?a/i.length:0}function Kt(e,t={},r=[],i){if(!Array.isArray(e))return{records:[],total:0,filtered:0};const a=e.length;let l=e;t.filters&&(l=he(l,t.filters)),t.search&&(l=jt(l,t.search,r));const c=l.length;if(t.sort&&(l=Bt(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 Ut(e,t){return!Array.isArray(e)||!t||typeof t!="object"?e:e.map(r=>{if(!r)return null;const i={...r};for(const[a,l]of Object.entries(t))if(typeof l=="function")try{i[a]=l(r)}catch{i[a]=void 0}return i})}function Gt(e,t,r,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=r&&r[a]||[];if(l.some(d=>!c.includes(d)))return!0}return!1}function Vt(e){return{ok:!1,error:e&&e.message?e.message:String(e)}}function Wt(e){if(!e||typeof e!="string")return null;const t=e.trim();if(!t)return null;try{const r=JSON.parse(t);return Array.isArray(r)?r:null}catch{return null}}(function(){const e="data-ln-data-store",t="lnDataStore";if(window[t]!==void 0)return;function r(n,o,u){const f=n.getAttribute(o);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-seed":{type:"string",description:"Selector or element ID of an external seed script block"},"data-ln-data-store-stale":{prop:"_staleThreshold",type:"integer",read:r,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:yn,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:pn,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=qe(i),l="ln_app_cache",c="_meta",d="1.0";let s=null,w=null;const _={};function b(n){n&&n.name==="QuotaExceededError"&&C(document,"ln-data-store:quota-exceeded",{error:n})}function x(){const n={};for(const o of document.querySelectorAll(`[${e}]`)){const u=o.id;if(u){const f=o.getAttribute("data-ln-data-store-indexes")||"";n[u]={indexes:f.split(",").map(h=>h.trim()).filter(Boolean)}}}return n}function M(){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 o=x(),u=Object.keys(o),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),g=u.filter(N=>p.includes(N));let S={};if(g.length>0){const N=y.transaction(g,"readonly");for(const T of g)S[T]=Array.from(N.objectStore(T).indexNames)}if(!Gt(p,o,S,c))return $(y),s=y,n(y);const U=y.version;y.close();const F=indexedDB.open(l,U+1);let z=!1,O=null;F.onblocked=()=>{console.warn("[ln-data-store] Database upgrade blocked — waiting for other tabs to close connection"),C(document,"ln-data-store:blocked",{db:l}),O||(O=setTimeout(()=>{z||(console.warn("[ln-data-store] Database upgrade timed out while blocked"),z=!0,w=null,n(null))},5e3))},F.onerror=()=>{z||(O&&clearTimeout(O),z=!0,w=null,console.warn("[ln-data-store] Database upgrade failed"),n(null))},F.onupgradeneeded=N=>{const T=N.target.result,mn=N.target.transaction;T.objectStoreNames.contains(c)||T.createObjectStore(c,{keyPath:"key"});for(const J of u)if(T.objectStoreNames.contains(J)){const re=mn.objectStore(J);for(const V of o[J].indexes)re.indexNames.contains(V)||re.createIndex(V,V,{unique:!1})}else{const re=T.createObjectStore(J,{keyPath:"id"});for(const V of o[J].indexes)re.createIndex(V,V,{unique:!1})}},F.onsuccess=N=>{if(z){N.target.result&&N.target.result.close();return}O&&clearTimeout(O),z=!0;const T=N.target.result;$(T),s=T,n(T)}}}),w)}function $(n){n.onversionchange=()=>{n.close(),s=null,w=null}}function m(){return s?Promise.resolve(s):(w=null,M())}async function A(n){if(!P()||!n)return n;const o={...n},u=o.id,f=await Rt(o);return!f||!f.encrypted?n:{...f,id:u}}async function I(n){return!n||!n.encrypted||!P()?n:Nt(n,{silent:!0})}const k=(n,o)=>m().then(u=>u?u.transaction(n,o).objectStore(n):null);function v(n){return new Promise((o,u)=>{n.onsuccess=()=>o(n.result),n.onerror=()=>{b(n.error),u(n.error)}})}const E=n=>k(n,"readonly").then(o=>o?v(o.getAll()):[]).then(o=>P()?Promise.all(o.map(u=>I(u))):o),L=(n,o)=>k(n,"readonly").then(u=>u?v(u.get(o)).then(f=>f!==void 0?f:typeof o=="string"&&o.trim()!==""&&!isNaN(Number(o))?v(u.get(Number(o))):typeof o=="number"?v(u.get(String(o))):null):null).then(u=>u?I(u):null),D=(n,o)=>m().then(u=>{if(!u)return[];const h=u.transaction(n,"readonly").objectStore(n),y=o.map(p=>v(h.get(p)).then(g=>g!==void 0?g:typeof p=="string"&&p.trim()!==""&&!isNaN(Number(p))?v(h.get(Number(p))):typeof p=="number"?v(h.get(String(p))):null));return Promise.all(y).then(p=>P()?Promise.all(p.map(g=>g?I(g):null)):p)}),B=(n,o)=>(P()?A(o):Promise.resolve(o)).then(f=>k(n,"readwrite").then(h=>h?v(h.put(f)):null)),we=(n,o)=>k(n,"readwrite").then(u=>u?v(u.delete(o)).then(()=>{if(typeof o=="string"&&o.trim()!==""&&!isNaN(Number(o)))return v(u.delete(Number(o)));if(typeof o=="number")return v(u.delete(String(o)))}):null),K=n=>k(n,"readwrite").then(o=>o?v(o.clear()):null),j=n=>k(n,"readonly").then(o=>o?v(o.count()):0),H=n=>k(c,"readonly").then(o=>o?v(o.get(n)):null),Q=(n,o)=>k(c,"readwrite").then(u=>{if(u)return o.key=n,v(u.put(o))});function R(n){return this.dom=n,this._name=n.id,this._name||console.warn("[ln-data-store] missing id — the store cannot be addressed",n),Ee(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=Mt({windowSize:this._windowSize,pageSize:this._windowPageSize,requestPage:(o,u,f)=>{C(this.dom,"ln-data-store:request-page",{store:this._name,offset:o,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(),_[this._name]=this,Ht(this),this.ready=tn(this),this}function Ht(n){n._handlers={create:o=>ee(n,"create",o.detail,()=>Qt(n,o.detail)),update:o=>ee(n,"update",o.detail,()=>Jt(n,o.detail)),delete:o=>ee(n,"delete",o.detail,()=>Zt(n,o.detail)),"bulk-delete":o=>ee(n,"bulk-delete",o.detail,()=>Xt(n,o.detail)),"sync-failed":o=>{n.isSyncing=!1,C(n.dom,"ln-data-store:sync-error",{store:n._name,error:o.detail&&o.detail.error,status:o.detail&&o.detail.status})}};for(const[o,u]of Object.entries(n._handlers))n.dom.addEventListener(`ln-data-store:request-${o}`,u);n._queryHandlers={"ln-search:change":o=>{o.preventDefault();const u=o.detail&&o.detail.term!=null?o.detail.term:"";u!==n.query.search&&(n.query.search=u,me(n))},"ln-filter:change":o=>{o.preventDefault();const u=o.detail&&o.detail.key;if(!u)return;const f=(o.detail.values||[]).slice(),h=n.query.filters[u];(h?h.length===f.length&&h.every((p,g)=>p===f[g]):!f.length)||(f.length?n.query.filters[u]=f:delete n.query.filters[u],me(n))},"ln-sort:change":o=>{o.preventDefault();const u=o.detail&&o.detail.field,f=o.detail&&o.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,me(n))}};for(const[o,u]of Object.entries(n._queryHandlers))n.dom.addEventListener(o,u)}function ee(n,o,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=>Yt(n,o,h,y)),n._mutationChain}function te(n,o=0){return j(n._name).then(u=>{if(n._windowIndex||n.windowed){const f=n.totalCount!=null?n.totalCount:u;n.totalCount=Math.max(0,f+o)}else n.totalCount=u;return n.hasCache=!0,n.isLoaded=!0,n.canServe=!0,Q(n._name,{schema_version:d,last_synced_at:n.lastSyncedAt,has_cache:!0,record_count:n.totalCount})})}function Qt(n,{tempId:o,data:u={},requestId:f}={}){const h={...u,id:o};return B(n._name,h).then(()=>te(n,1)).then(()=>{C(n.dom,"ln-data-store:created",{store:n._name,record:h,tempId:o,requestId:f})})}function Jt(n,{id:o,data:u={},requestId:f}={}){return L(n._name,o).then(h=>{if(!h)throw new Error(`Record not found: ${o}`);const y=h.id,p={...h,...u,id:y},g=u.id,S=g!==void 0&&g!==y;return(S?nn(n._name,y,{...p,id:g}):B(n._name,p)).then(()=>te(n,0)).then(()=>{C(n.dom,"ln-data-store:updated",{store:n._name,record:S?{...p,id:g}:p,previous:h,requestId:f})})})}function Zt(n,{id:o,requestId:u}={}){return L(n._name,o).then(f=>{if(!f){C(n.dom,"ln-data-store:deleted",{store:n._name,id:o,requestId:u,missing:!0});return}const h=f.id;return we(n._name,h).then(()=>te(n,-1)).then(()=>{C(n.dom,"ln-data-store:deleted",{store:n._name,id:h,requestId:u})})})}function Xt(n,{ids:o=[],requestId:u}={}){return o.length?Promise.all(o.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(()=>{C(n.dom,"ln-data-store:deleted",{store:n._name,ids:h,requestId:u})})}):(C(n.dom,"ln-data-store:deleted",{store:n._name,ids:[],requestId:u}),Promise.resolve())}function Yt(n,o,u,f){console.error("[ln-data-store] "+o+" failed:",f),C(n.dom,"ln-data-store:mutation-error",{store:n._name,action:o,requestId:u,error:f})}function en(n){let o=null;const u=n.dom.getAttribute("data-ln-data-store-seed");if(u&&(o=document.getElementById(u),!o))try{o=document.querySelector(u)}catch{}return o||(o=n.dom.querySelector('script[type="application/json"]')||n.dom.querySelector("script")),o&&o.textContent?Wt(o.textContent):null}function tn(n){const o=en(n);return n._seedRecords=o,o?(n.lastSyncedAt=Math.floor(Date.now()/1e3),n.totalCount=o.length,n.hasCache=!0,n.isLoaded=!0,n.canServe=!0,n.isInitialized=!0,setTimeout(()=>{C(n.dom,"ln-data-store:ready",{store:n._name,count:n.totalCount,source:"seed"}),C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!0,lastSyncedAt:n.lastSyncedAt,count:n.totalCount,source:"seed"})},0),M().then(u=>{if(u)return K(n._name).then(()=>ye(n._name,o)).then(()=>Q(n._name,{schema_version:d,last_synced_at:n.lastSyncedAt,has_cache:!0,record_count:n.totalCount}))}).catch(()=>{}),Promise.resolve({ok:!0,source:"seed"})):M().then(u=>{if(!u)throw new Error("IndexedDB is unavailable");return H(n._name)}).then(u=>{if(!o)if(n.initializationError=null,u&&u.schema_version===d)n.lastSyncedAt=u.last_synced_at||null,n.totalCount=u.record_count||0,n.hasCache=u.has_cache===!0||n.totalCount>0,n.hasCache&&(n.isLoaded=!0,n.canServe=!0,C(n.dom,"ln-data-store:ready",{store:n._name,count:n.totalCount,source:"cache"})),n.isInitialized=!0,C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:n.hasCache,lastSyncedAt:n.lastSyncedAt,count:n.totalCount});else{if(u&&u.schema_version!==d)return K(n._name).then(()=>Q(n._name,{schema_version:d,last_synced_at:null,has_cache:!1,record_count:0})).then(()=>{n.isInitialized=!0,n.hasCache=!1,C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!1,lastSyncedAt:null,count:0})});n.isInitialized=!0,n.hasCache=!1,C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!1,lastSyncedAt:null,count:0})}}).catch(u=>o?(n.lastSyncedAt=Math.floor(Date.now()/1e3),n.totalCount=o.length,n.hasCache=!0,n.isLoaded=!0,n.canServe=!0,n.isInitialized=!0,C(n.dom,"ln-data-store:ready",{store:n._name,count:n.totalCount,source:"seed"}),C(n.dom,"ln-data-store:initialized",{store:n._name,hasCache:!0,lastSyncedAt:n.lastSyncedAt,count:n.totalCount,source:"seed"}),{ok:!0,source:"seed"}):(n.isInitialized=!0,n.isLoaded=!1,n.canServe=!1,n.hasCache=!1,n.isSyncing=!1,n.initializationError=u,C(n.dom,"ln-data-store:initialization-error",{store:n._name,error:u}),{ok:!1,error:u}))}function $e(n){n.isSyncing=!0,C(n.dom,"ln-data-store:request-remote-sync",{since:n.lastSyncedAt})}function ye(n,o){return m().then(u=>u?(P()?Promise.all(o.map(h=>A(h))):Promise.resolve(o)).then(h=>new Promise((y,p)=>{const g=u.transaction(n,"readwrite"),S=g.objectStore(n);h.forEach(q=>S.put(q)),g.oncomplete=()=>y(),g.onerror=()=>{b(g.error),p(g.error)}})):void 0)}function ne(n,o){return m().then(u=>{if(u)return new Promise((f,h)=>{const y=u.transaction(n,"readwrite"),p=y.objectStore(n);o.forEach(g=>{p.delete(g),typeof g=="string"&&g.trim()!==""&&!isNaN(Number(g))?p.delete(Number(g)):typeof g=="number"&&p.delete(String(g))}),y.oncomplete=()=>f(),y.onerror=()=>h(y.error)})})}function nn(n,o,u){return(P()?A(u):Promise.resolve(u)).then(h=>m().then(y=>{if(y)return new Promise((p,g)=>{const S=y.transaction(n,"readwrite"),q=S.objectStore(n);q.put(h),q.delete(o),S.oncomplete=()=>p(),S.onerror=()=>{b(S.error),g(S.error)}})}))}const rn=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function on(n){return n?Object.keys(n).filter(o=>Array.isArray(n[o])&&n[o].length>0):[]}function an(n,o,u){return o.every(f=>u[f].map(String).includes(String(n[f])))}function sn(n){return String(n||"").toLowerCase().split(/\s+/).filter(Boolean)}function ln(n,o,u){return o.every(f=>u.some(h=>{const y=n[h];return y!=null&&String(y).toLowerCase().includes(f)}))}function cn(n,o,u){return $t(n,o,u)}function G(n,o){return Ut(o,n.presenters&&n.presenters.computed)}function un(n){return!n.sort&&!P()}function dn(n,o,u){const f=on(o.filters),h=o.search?sn(o.search):[],y=n._searchFields,p=h.length>0&&y&&y.length>0;return k(n._name,"readonly").then(g=>g?new Promise((S,q)=>{const U=[],F=g.openCursor();F.onsuccess=()=>{const z=F.result;if(!z||U.length>=u){S(U);return}const O=z.value;(!f.length||an(O,f,o.filters))&&(!p||ln(O,h,y))&&U.push(O),z.continue()},F.onerror=()=>q(F.error)}):[])}function pe(n,o,u){return Kt(o,u,n._searchFields,rn)}function fn(n,o,u){const f=[];for(let y=o;y<o+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 S=0;S<y.length;S++){const q=y[S];q&&p.set(String(q.id),q)}const g=[];for(let S=0;S<f.length;S++){const q=f[S];if(q===void 0)g.push(null);else{const U=p.get(String(q));g.push(U||null)}}return{data:G(n,g),total:n._windowIndex.grandTotal,filtered:n._windowIndex.logicalTotal,offset:o,queryGen:n._windowIndex.queryGen}})}R.prototype.getAll=function(n={}){const o=this;if(o._seedRecords){const u=pe(o,o._seedRecords,n);return Promise.resolve({data:G(o,u.records),total:u.total,filtered:u.filtered})}if(o._windowIndex){const u=n.offset||0,f=n.limit||200;if(o._windowIndex.ensure(u,u+f,n),!o._windowIndex.hasLoaded&&!o.noLocalQuery){const h=u+f,y=p=>({data:G(o,p),offset:u,queryGen:o._windowIndex.queryGen,provisional:!0});return un(n)?dn(o,n,h).then(p=>y(p.slice(u,h))):E(o._name).then(p=>y(pe(o,p,n).records))}return fn(o,u,f)}return E(o._name).then(u=>{const f=pe(o,u,n);return{data:G(o,f.records),total:f.total,filtered:f.filtered}})},R.prototype.getById=function(n){return L(this._name,n).then(o=>o?G(this,[o])[0]:null)},R.prototype.count=function(n){if(this._seedRecords){const u=n&&Object.keys(n).length>0;return Promise.resolve(u?he(this._seedRecords,n).length:this._seedRecords.length)}return n&&Object.keys(n).length>0?E(this._name).then(u=>he(u,n).length):this.windowed&&this.totalCount!=null?Promise.resolve(this.totalCount):j(this._name)},R.prototype.aggregate=function(n,o){return E(this._name).then(u=>cn(u,n,o))},R.prototype.setPresenters=function(n){this.presenters=n},R.prototype.applySync=function(n,o,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=m().then(p=>{if(!p)throw new Error("IndexedDB unavailable")});return n.length>0&&(y=y.then(()=>ye(h._name,n))),o.length>0&&(y=y.then(()=>ne(h._name,o))),y.then(()=>{if(h._windowIndex&&(f.offset!=null||f.total!=null)){const p=f.offset!=null?f.offset:0,g=n.map(q=>q.id),S=h._windowIndex.ingest(p,g,f.total,f.filtered,f.queryGen);if(S&&S.length)return ne(h._name,S)}}).then(()=>j(h._name)).then(p=>(h.totalCount=f.total!==void 0?f.total:p,h.hasCache=!0,Q(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?(C(h.dom,"ln-data-store:loaded",{store:h._name,count:h.totalCount,meta:f}),C(h.dom,"ln-data-store:ready",{store:h._name,count:h.totalCount,source:"server",meta:f})):C(h.dom,"ln-data-store:synced",{store:h._name,added:n.length,deleted:o.length,changed:!0,meta:f}),{ok:!0}}).catch(p=>{h.isSyncing=!1;const g=p&&p.message?p.message:String(p);return console.error("[ln-data-store] applySync failed:",p),C(h.dom,"ln-data-store:sync-error",{store:h._name,error:g}),Vt(p)})},R.prototype.applyQuery=function(n,o){o=o||{};const u=this;let f=Promise.resolve();return n.length>0&&(f=f.then(()=>ye(u._name,n))),f.then(()=>j(u._name)).then(h=>(u.totalCount=o.total!==void 0?o.total:h,n.length>0&&(u.canServe=!0),G(u,n))).catch(h=>(console.error("[ln-data-store] applyQuery failed:",h),[]))},R.prototype.forceSync=function(){this.isSyncing||$e(this)},R.prototype.fullReload=function(){const n=this;return K(n._name).then(()=>Q(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,$e(n)})},R.prototype.destroy=function(){if(this._windowIndex&&(this._windowIndex.clear(),this._windowIndex=null,this.windowed=!1),this._handlers){for(const[n,o]of Object.entries(this._handlers))this.dom.removeEventListener(`ln-data-store:request-${n}`,o);this._handlers=null}if(this._queryHandlers){for(const[n,o]of Object.entries(this._queryHandlers))this.dom.removeEventListener(n,o);this._queryHandlers=null}delete _[this._name],delete this.dom[t]};function hn(){return m().then(n=>{if(!n)return;const o=Array.from(n.objectStoreNames);return new Promise((u,f)=>{const h=n.transaction(o,"readwrite");o.forEach(y=>h.objectStore(y).clear()),h.oncomplete=()=>u(),h.onerror=()=>f(h.error)})}).then(()=>{Object.values(_).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 me(n){n._windowIndex&&n._windowIndex.reset(),C(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 wn="data-ln-data-store-frozen";function Ke(n,o){n.setAttribute(wn,o)}function yn(n){const o=n[t];if(!o._windowIndex)return;const u=o._windowIndex.configure({windowSize:o._windowSize});u.length&&ne(o._name,u).catch(f=>{console.error("[ln-data-store] window shrink eviction failed:",f)})}function pn(n){const o=n[t];o._windowIndex&&o._windowIndex.configure({pageSize:o._windowPageSize})}ze(e,t,R,"ln-data-store",{attributes:i}),window[t].clearAll=hn,window[t].init=window[t],window[t].setStorageKey=je,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.setStorageKey=je)})()})();
@@ -1 +1 @@
1
- (function(){"use strict";function Q(){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 q(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 r=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){r=t[o];break}if(!q(r))return}e.apply(console,t)}}function K(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function I(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){I(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function we(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function pe(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,o={},s=e.elements,l={};if(n)for(let c=0;c<s.length;c++){const i=s[c];i.name&&i.type==="checkbox"&&!i.disabled&&(l[i.name]=(l[i.name]||0)+1)}for(let c=0;c<s.length;c++){const i=s[c];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(r&&i.matches&&i.matches(r)))if(i.type==="checkbox")n&&l[i.name]===1?o[i.name]=i.checked:(o[i.name]||(o[i.name]=[]),i.checked&&o[i.name].push(i.value));else if(i.type==="radio")i.checked&&(o[i.name]=i.value);else if(i.type==="select-multiple"){o[i.name]=[];for(let u=0;u<i.options.length;u++)i.options[u].selected&&o[i.name].push(i.options[u].value)}else if(n&&i.type==="hidden")o[i.name]=i.value;else if(n&&(i.type==="number"||i.type==="range")){const u=Number(i.value);o[i.name]=i.value===""||isNaN(u)?null:u}else o[i.name]=i.value}return o}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 be(e,t){const n=e.elements,r=[],o={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(o[l.name]=(o[l.name]||0)+1)}for(let s=0;s<n.length;s++){const l=n[s];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const c=l.getAttribute("data-ln-fill-as")||l.name;if(!c||!(c in t))continue;const i=t[c];if(l.type==="checkbox"){if(Array.isArray(i))l.checked=i.indexOf(l.value)!==-1;else if(o[l.name]>1){const u=String(i).split(",").map(function(w){return w.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=ge(i);r.push(l)}else if(l.type==="radio")l.checked=l.value===String(i),r.push(l);else if(l.type==="select-multiple"){if(Array.isArray(i))for(let u=0;u<l.options.length;u++)l.options[u].selected=i.indexOf(l.options[u].value)!==-1;r.push(l)}else l.value=i,l.tagName==="SELECT"&&i!=null&&l.setAttribute("data-ln-value",i),r.push(l)}return r}function ye(e,t,{get:n,set:r}){Object.defineProperty(e,"value",{get:function(){return n?n.call(this):t.get.call(this)},set:function(o){r?r.call(this,o,s=>t.set.call(this,s)):t.set.call(this,o)},configurable:!0})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=be,window.lnCore.serializeForm=pe,window.lnCore.resolveFormMethod=we);const Y={};function Ce(e,t){Y[e]=t}function _e(e){return Y[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=Ce,window.lnCore.getDataMapper=_e);function M(e){const t=e?e.closest("[lang]"):null,n=(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 n?n.trim():"en-US"}function J(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,I(function(){new MutationObserver(function(){K(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const G={};function z(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];G[n]=t}function O(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return G[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=z,window.lnCore.getLocaleFallback=O,window.lnCore.ensureLocaleObserver=J);const R={};function Ae(e,t){R[e]||(R[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=R[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function X(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const c=n[l],i=c.getAttribute("data-ln-field");t[i]!=null&&(c.textContent=t[i])}const r=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<r.length;l++){const c=r[l],i=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<i.length;u++){const w=i[u].trim().split(":");if(w.length!==2)continue;const m=w[0].trim(),a=w[1].trim();t[a]!=null&&c.setAttribute(m,t[a])}}const o=e.querySelectorAll("[data-ln-show]");for(let l=0;l<o.length;l++){const c=o[l],i=c.getAttribute("data-ln-show");i in t&&c.classList.toggle("hidden",!t[i])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],i=c.getAttribute("data-ln-class").split(",");for(let u=0;u<i.length;u++){const w=i[u].trim().split(":");if(w.length!==2)continue;const m=w[0].trim(),a=w[1].trim();a in t&&c.classList.toggle(m,!!t[a])}}return e}function ve(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 n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].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)X(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function Z(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,c){return t[c]!==void 0?t[c]:""}))}const r=function(s,l){return t[l]!==void 0?t[l]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let s=0;s<o.length;s++){const l=o[s],c=l.attributes;for(let i=0;i<c.length;i++){const u=c[i];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function Se(e,t,n,r,o,s){const l={};for(let i=0;i<e.children.length;i++){const u=e.children[i],w=u.getAttribute("data-ln-render-key");w&&(l[w]=u)}const c=document.createDocumentFragment();for(let i=0;i<t.length;i++){const u=t[i],w=String(r(u));let m=l[w];if(m)o(m,u,i);else{const a=Ae(n,s);if(!a||(Z(a,u),m=a.firstElementChild,!m))continue;m.setAttribute("data-ln-render-key",w),o(m,u,i)}c.appendChild(m)}e.textContent="",e.appendChild(c)}function xe(e,t){const n={},r=e.querySelectorAll("["+t+"]");for(let o=0;o<r.length;o++)n[r[o].getAttribute(t)]=r[o].textContent,r[o].remove();return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=Z,window.lnCore.fill=X,window.lnCore.lnFill=ve,window.lnCore.renderList=Se);function B(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function ee(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function te(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const o=r.trim().toLowerCase();return!(o==="false"||o==="0")}function ne(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const $=new Map;function re(e,t){const n=(e?e.join("|"):"")+"::"+t;if($.has(n))return $.get(n);const r=new Set(e||[]),o=function(s,l){const c=s.getAttribute(l);return c!==null&&r.has(c)?c:t};return $.set(n,o),o}function oe(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function ie(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function le(e,t,n,r,o){if(!e||t===null)return!0;const s=r||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=i=>{o?console.warn(i,o):console.warn(i)};if(l==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const i=e.values||[];return i.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(c(`[${s}] Value ${i} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(c(`[${s}] Value ${i} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(i){return c(`[${s}] Invalid JSON for attribute "${n}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function ke(e,t,n){for(const r in n){const[o,s,l]=n[r];Object.defineProperty(e,r,{get:function(){return o(t,s,l)},enumerable:!0,configurable:!0})}return e}function Ee(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let o=r.read;if(!o&&r.type)switch(r.type){case"enum":o=re(r.values,r.fallback);break;case"integer":o=ee;break;case"float":o=oe;break;case"boolean":o=te;break;case"list":o=ne;break;case"json":o=ie;break;case"string":default:o=B;break}o||(o=B),t[r.prop]=[o,n,r.fallback]}return t}function De(e){const t={};for(const n in e){const r=e[n];r&&r.effect&&(t[n]=r.effect)}return Object.keys(t).length?t:null}function Le(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ke,window.lnCore.attrSpec=Ee,window.lnCore.attrStr=B,window.lnCore.attrInt=ee,window.lnCore.attrBool=te,window.lnCore.attrList=ne,window.lnCore.attrEnum=re,window.lnCore.attrFloat=oe,window.lnCore.attrJson=ie);function T(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(n){console.error("["+t.attribute+"] init failed",e,n)}}}function se(e,t,n,r){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:n,ComponentFn:r};if(e.matches&&e.matches(s)&&T(e,l),e.querySelectorAll){const c=e.querySelectorAll(s);for(let i=0;i<c.length;i++)T(c[i],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Oe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Te(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 ae(){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 Fe(e){const t=ae(),n=e.observed||[];for(let r=0;r<n.length;r++){const o=n[r];t.byAttr.has(o)||t.byAttr.set(o,[]),t.byAttr.get(o).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const o=t.byDeclaredAttr.get(r);o.some(s=>s.componentTag===e.componentTag)||o.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=Le(e);if(r===null)t.reactiveWildcard.push(e);else for(const o of r)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function ce(e,t,n,r){for(let o=0;o<e.length;o++){const s=e[o];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,r):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,r)}}function Ie(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,r=ae(),o=r.byAttr.get(t),s=Q()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!n&&!o&&!s)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(s&&q(l)){const c=r.byDeclaredAttr.get(t),i=l.getAttribute(t);for(let u=0;u<c.length;u++)le(c[u].spec,i,t,c[u].componentTag,l)}if(window.lnCore._debugSink&&(n||o)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),n){const c=r.byReactive.get(t);c&&ce(c,l,t,e.oldValue),r.reactiveWildcard.length&&ce(r.reactiveWildcard,l,t,e.oldValue)}if(o)for(let c=0;c<o.length;c++){const i=o[c];if(i.handler){i.handler(l,t,e.oldValue);continue}i.onAttributeChange&&l[i.attribute]?i.onAttributeChange(l,t):(se(l,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(l))}}}function Me(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,I(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{Ie(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function j(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function V(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function P(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ue(e){const t=j();if(!t.length)return;const n=e.target;if(n){const o=n.nodeType===1?n:n.parentElement;if(o&&(o.isContentEditable||o.closest&&o.closest('[contenteditable]:not([contenteditable="false"])')))return}const r=V();if(e.target&&r.length)for(let o=0;o<r.length;o++){const s=r[o],l=s.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;c&&s.onSubtreeChange(c,e)}for(let o=0;o<e.addedNodes.length;o++){const s=e.addedNodes[o];if(s.nodeType===1){const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const i=t[c];if(i.selector&&i.attribute&&i.ComponentFn){if(!l)s.matches&&s.matches(i.query)&&T(s,i);else if(s.matches&&s.matches(i.query)&&T(s,i),s.querySelectorAll){const u=s.querySelectorAll(i.query);for(let w=0;w<u.length;w++)T(u[w],i)}}i.onInit&&i.onInit(s)}}}for(let o=0;o<e.removedNodes.length;o++){const s=e.removedNodes[o];if(s.nodeType===1){if(document.contains(s))continue;const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const i=t[c],u=i.query;if(u){if(!l)s.matches&&s.matches(u)&&P(s,i);else if(s.matches&&s.matches(u)&&P(s,i),s.querySelectorAll){const w=s.querySelectorAll(u);for(let m=0;m<w.length;m++)P(w[m],i)}}}}}}function de(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,I(function(){const e=new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{ue(r)}catch(o){console.error("[ln-core] lifecycle handler failed",r.target,o)}}});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 n=t.takeRecords();for(let r=0;r<n.length;r++){const o=n[r];if(o.type==="childList")try{ue(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function qe(e){j().push(e),e.onSubtreeChange&&e.query&&V().push(e),de()}function fe(e,t,n,r,o={}){const s=o.extraAttributes||[],l=o.onAttributeChange||null,c=o.onSubtreeChange||null,i=o.onInit||null,u=o.onAttrChange||null,w=o.effects||null,m=o.attributes||null,a=m?De(m):w,d=m?new Set(Object.keys(m)):null,h=o.persist||null;function g(D){const f=D||document.body;if(se(f,e,t,n),m&&Q())for(const p in m){const b=m[p],_=Array.from(f.querySelectorAll("["+p+"]"));f.matches&&f.matches("["+p+"]")&&_.push(f);for(let x=0;x<_.length;x++){const E=_[x];q(E)&&le(b,E.getAttribute(p),p,r,E)}}i&&i(f)}const y=[];if(e.indexOf("[")!==-1){const D=/\[([\w-]+)/g;let f;for(;(f=D.exec(e))!==null;)y.push(f[1])}else y.push(e);Fe({selector:e,attribute:t,componentTag:r,attributes:m,ComponentFn:n,onInit:i,observed:y.concat(s),onAttributeChange:l,onAttrChange:u,effects:a,declared:d,persist:h}),Me();const v=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,C=o.subtreeQuery||(v?e:"["+e+"]"),S={selector:e,attribute:t,ComponentFn:n,onInit:i,onSubtreeChange:c,query:C};j().push(S),c&&C&&V().push(S),de(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=fe,window.lnCore.observeLifecycle=qe,window.lnCore.withoutLifecycle=Ne);function k(){Oe()>0?Te(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k(),g}function he(e){return(e||"").replace(/^#/,"")}function H(e){const t=e===void 0?location.hash:e,n={},r=he(t);if(!r)return n;const o=r.split("&");for(let s=0;s<o.length;s++){const l=o[s];if(!l)continue;const c=l.indexOf(":"),i=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(i)try{n[i]=decodeURIComponent(u)}catch{n[i]=u}}return n}function Re(e){if(!e)return null;const t=H();return e in t?t[e]:null}function Be(e,t){if(!e)return;const n=H();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");he(location.hash)!==o&&(location.hash=o)}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 n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function Ve(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Pe(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 He(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ue(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),o=r?r.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=H,window.lnCore.hashGet=Re,window.lnCore.hashSet=Be,window.lnCore.hashLinkClick=$e,window.lnCore.resolveHashNamespace=je,window.lnCore.hashSortEncode=Ve,window.lnCore.hashSortDecode=Pe,window.lnCore.hashFilterEncode=He,window.lnCore.hashFilterDecode=Ue);function We(e){return(e||"").replace(/^\?/,"")}function Qe(e){const t=e===void 0?typeof window<"u"?window.location.search:"":e,n={},r=We(t);if(!r)return n;const o=new URLSearchParams(r);for(const[s,l]of o.entries())n[s]=l;return n}function Ke(e){if(!e||typeof window>"u")return null;const t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):null}function Ye(e,t){if(!e||typeof window>"u")return;const n=new URL(window.location.href);if(t==null||t===""?n.searchParams.delete(e):n.searchParams.set(e,String(t)),n.search===window.location.search)return;const r=n.pathname+n.search+n.hash;window.history.replaceState(window.history.state,"",r)}function Je(e,t){if(!e||!e.hasAttribute("data-ln-query"))return null;const n=e.getAttribute("data-ln-query");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"_"+t:r:t||null}function Ge(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ze(e,t){if(e&&typeof e=="string"){if(e.endsWith(".asc"))return{fieldOrColumn:e.slice(0,-4),direction:"asc"};if(e.endsWith(".desc"))return{fieldOrColumn:e.slice(0,-5),direction:"desc"}}if(t&&typeof t=="object"){const n=t.sort_field||t.sort_by;if(n){const r=t.sort_dir&&String(t.sort_dir).toLowerCase()==="desc"?"desc":"asc";return{fieldOrColumn:n,direction:r}}}return null}function Xe(e){return!Array.isArray(e)||e.length===0?null:e.map(encodeURIComponent).join(",")}function Ze(e){return!e||typeof e!="string"?[]:e.split(",").map(function(t){try{return decodeURIComponent(t.trim())}catch{return t.trim()}}).filter(Boolean)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.queryParse=Qe,window.lnCore.queryGet=Ke,window.lnCore.querySet=Ye,window.lnCore.resolveQueryParam=Je,window.lnCore.querySortEncode=Ge,window.lnCore.querySortDecode=ze,window.lnCore.queryFilterEncode=Xe,window.lnCore.queryFilterDecode=Ze);function et(){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=et);function A(e){if(e==null||e==="")return null;if(e instanceof Date)return isNaN(e.getTime())?null:e;const t=Number(e);if(!isNaN(t)&&t>0){const n=t<1e11?t*1e3:t,r=new Date(n);return isNaN(r.getTime())?null:r}if(typeof e=="string"){const n=e.trim();if(!n)return null;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);if(r){const s=+r[1],l=+r[2],c=+r[3],i=new Date(s,l-1,c);return i.getFullYear()!==s||i.getMonth()!==l-1||i.getDate()!==c?null:i}const o=new Date(n);return isNaN(o.getTime())?null:o}return null}function L(e){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return t+"-"+n+"-"+r}const U=/^(short|medium|long)(\s+datetime)?$/,tt={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},"short datetime":{dateStyle:"short",timeStyle:"short"},"medium datetime":{dateStyle:"medium",timeStyle:"short"},"long datetime":{dateStyle:"long",timeStyle:"short"}};function nt(e){return!e||e===""?{dateStyle:"medium"}:String(e).trim().match(U)?tt[e.trim()]:null}function F(e){if(!e||typeof e!="string")return null;const t=e.trim();if(t.length<6)return null;let n,r;if(t.indexOf(".")!==-1)n=".",r=t.split(".");else if(t.indexOf("/")!==-1)n="/",r=t.split("/");else if(t.indexOf("-")!==-1)n="-",r=t.split("-");else return null;if(r.length!==3)return null;const o=[];for(let u=0;u<3;u++){const w=parseInt(r[u],10);if(isNaN(w))return null;o.push(w)}let s,l,c;n==="."?(s=o[0],l=o[1],c=o[2]):n==="/"?(l=o[0],s=o[1],c=o[2]):r[0].length===4?(c=o[0],l=o[1],s=o[2]):(s=o[0],l=o[1],c=o[2]),c<100&&(c+=c<50?2e3:1900);const i=new Date(c,l-1,s);return i.getFullYear()!==c||i.getMonth()!==l-1||i.getDate()!==s?null:i}function W(e,t,n,r){if(!e||!(e instanceof Date)||isNaN(e.getTime())||!t||typeof t!="string")return"";const o=e.getDate(),s=e.getMonth(),l=e.getFullYear(),c=e.getHours(),i=e.getMinutes();let u,w;const m=(n||"").toLowerCase().split("-")[0];let a=!1;try{const g=new Intl.DateTimeFormat(n,{month:"long"}).resolvedOptions().locale.toLowerCase().split("-")[0];a=!!(r&&g!==m)}catch{a=!!r}if(a&&r&&r.monthsLong)u=r.monthsLong[s];else try{u=new Intl.DateTimeFormat(n,{month:"long"}).format(e)}catch{u=String(s+1)}if(a&&r&&r.monthsShort)w=r.monthsShort[s];else try{w=new Intl.DateTimeFormat(n,{month:"short"}).format(e)}catch{w=String(s+1)}const d={yyyy:String(l),yy:String(l).slice(-2),MMMM:u,MMM:w,MM:String(s+1).padStart(2,"0"),M:String(s+1),dd:String(o).padStart(2,"0"),d:String(o),HH:String(c).padStart(2,"0"),mm:String(i).padStart(2,"0")};return t.replace(/yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|mm/g,function(h){return d[h]!==void 0?d[h]:h})}function N(e,t,n,r){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const o=nt(t);if(o)try{const s=new Intl.DateTimeFormat(n,o),l=(n||"").toLowerCase().split("-")[0],c=s.resolvedOptions().locale.toLowerCase().split("-")[0];return r&&c!==l?W(e,"dd.MM.yyyy",n,r):s.format(e)}catch{return W(e,"dd.MM.yyyy",n,r)}return W(e,t||"dd.MM.yyyy",n,r)}(function(){const e="data-ln-date",t="lnDate";if(window[t]!==void 0)return;function n(a){const d=a[t];if(d){if(d.isTextElement)d._initTextElement();else if(d.value){const h=A(d.value);h&&d._displayFormatted(h)}}}const r={"data-ln-date":{type:"enum",values:["short","medium","long","full","iso"],fallback:"medium",effect:n,description:"Date display style preset or activator"},"data-ln-date-format":{type:"string",effect:n,description:"Custom Intl.DateTimeFormat pattern or options"},"data-ln-date-locale":{type:"string",effect:n,description:"BCP 47 language tag override for date formatting"},"data-ln-value":{type:"string",effect:n,description:"Raw ISO date string or timestamp for non-time elements (td, span)"},"data-ln-date-dict":{type:"marker",description:"Container for date translation dictionary"},"data-ln-date-dict-key":{type:"string",description:"Dictionary key for relative time or custom date formatting"},"data-ln-date-field":{type:"string",description:"Field name mapping for date record binding"},"data-ln-date-label":{type:"string",description:"Accessible label text for the date input"}},o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");function s(a,d,h){K(a.dom,"ln-date:change",{value:d,formatted:a.dom.value,date:h}),a.dom.dispatchEvent(new Event("change",{bubbles:!0}))}function l(a,d,h,g){a._setHiddenRaw(d),o.set.call(a._picker,d),a._lastISO=d,g!==void 0?(a._isFormatting=!0,a.dom.value=g,a._isFormatting=!1):h&&a._displayFormatted(h),s(a,d,h)}function c(a){a._setHiddenRaw(""),o.set.call(a._picker,""),a._isFormatting=!0,a.dom.value="",a._isFormatting=!1,a._lastISO="",s(a,"",null)}const i=new Set;let u=!1;function w(){J(),!u&&(u=!0,document.addEventListener("ln-core:locale-change",function(){i.forEach(function(a){if(a.isTextElement)a._formatTextContent();else if(a.value){const d=A(a.value);d&&a._displayFormatted(d)}})}))}function m(a){if(a[t])return a[t];a[t]=this,this.dom=a;const d=this;if(i.add(this),w(),a.tagName!=="INPUT")return this.isTextElement=!0,this._initTextElement(),this;this.isTextElement=!1;const h=a.value,g=a.name,y=a.closest(".form-element, form")||a.parentNode;if(y){const f=y.querySelectorAll("[data-ln-date-dict]");for(let p=0;p<f.length;p++){const b=f[p].getAttribute("data-ln-date-dict");if(b){const _=xe(f[p],"data-ln-date-dict-key");_["months-long"]&&(_.monthsLong=_["months-long"].split(",").map(x=>x.trim())),_["months-short"]&&(_.monthsShort=_["months-short"].split(",").map(x=>x.trim())),z(b,_)}}}const v=document.createElement("span");v.setAttribute("data-ln-date-field",""),a.parentNode.insertBefore(v,a),v.appendChild(a),this._wrapper=v;const C=document.createElement("input");C.type="hidden",C.name=g,a.removeAttribute("name"),a.hasAttribute("data-ln-fill-as")&&C.setAttribute("data-ln-fill-as",a.getAttribute("data-ln-fill-as")),a.insertAdjacentElement("afterend",C),this._hidden=C;const S=document.createElement("input");S.type="date",S.tabIndex=-1,S.setAttribute("tabindex","-1"),S.setAttribute("aria-hidden","true"),S.setAttribute("aria-label",a.getAttribute("data-ln-date-label")||"Date picker"),S.style.cssText="position:absolute;opacity:0;width:0;height:0;overflow:hidden;pointer-events:none",C.insertAdjacentElement("afterend",S),this._picker=S,a.type="text";const k=document.createElement("button");k.type="button",k.setAttribute("aria-label",a.getAttribute("data-ln-date-label")||"Open date picker"),k.innerHTML='<svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-calendar"></use></svg>',S.insertAdjacentElement("afterend",k),this._btn=k,this._lastISO="",Object.defineProperty(C,"value",{get:function(){return o.get.call(C)},set:function(f){if(o.set.call(C,f),f&&f!==""){const p=A(f);p&&l(d,f,p)}else f===""&&c(d)}}),ye(a,o,{get:function(){return o.get.call(a)},set:function(f,p){if(d._isFormatting){p(f);return}if(!f||f===""){p(""),c(d);return}const b=A(f)||F(f);if(b){const _=L(b),x=a.getAttribute(e)||"",E=M(a),rt=O(E),me=N(b,x,E,rt);p(me),l(d,_,b,me)}else p(String(f)),c(d)}}),this._onPickerChange=function(){const f=S.value;if(f){const p=A(f);p&&l(d,f,p)}else c(d)},S.addEventListener("change",this._onPickerChange),this._onBlur=function(){const f=d.dom.value.trim();if(f===""){d._lastISO!==""&&c(d);return}if(d._lastISO){const b=A(d._lastISO);if(b){const _=d.dom.getAttribute(e)||"",x=M(d.dom),E=O(x);if(f===N(b,_,x,E))return}}const p=F(f);if(p){const b=L(p);l(d,b,p)}else if(d._lastISO){const b=A(d._lastISO);b&&d._displayFormatted(b)}else d.dom.value=""},a.addEventListener("blur",this._onBlur),this._onBtnClick=function(){d._openPicker()},k.addEventListener("click",this._onBtnClick);const D=a.form;if(D&&(this._form=D,this._onFormReset=function(){setTimeout(function(){const f=d.dom.value;if(f){const p=A(f)||F(f);if(p){const b=L(p);l(d,b,p);return}}c(d)},0)},D.addEventListener("reset",this._onFormReset)),h&&h!==""){const f=A(h);f&&l(d,h,f)}return this}m.prototype._initTextElement=function(){const a=this.dom,d=a.getAttribute("data-ln-value"),h=a.getAttribute("data-ln-date"),g=a.getAttribute("datetime");let y=null;a.tagName==="TIME"&&g!==null&&g!==""?y=g:d!==null&&d!==""?y=d:g!==null&&g!==""?y=g:h!==null&&h!==""&&h!=="true"&&!U.test(h)?y=h:y=a.textContent.trim();const v=A(y)||F(y);if(v&&!isNaN(v.getTime())){const C=L(v);this._rawValue=C,a.tagName!=="TIME"&&!a.hasAttribute("data-ln-value")&&a.setAttribute("data-ln-value",C),this._formatTextContent()}else this._rawValue=null},m.prototype._formatTextContent=function(){if(this._rawValue){const a=A(this._rawValue);if(a){let h=this.dom.getAttribute("data-ln-date-format");if(!h){const v=this.dom.getAttribute("data-ln-date");v&&U.test(v)&&(h=v)}const g=M(this.dom),y=O(g);this.dom.textContent=N(a,h||"medium",g,y)}}},m.prototype._openPicker=function(){if(typeof this._picker.showPicker=="function")try{this._picker.showPicker()}catch{this._picker.click()}else this._picker.click()},m.prototype._setHiddenRaw=function(a){o.set.call(this._hidden,a)},m.prototype._displayFormatted=function(a){const d=this.dom.getAttribute(e)||"",h=M(this.dom),g=O(h);this._isFormatting=!0,this.dom.value=N(a,d,h,g),this._isFormatting=!1},Object.defineProperty(m.prototype,"value",{get:function(){return this.isTextElement?this._rawValue||"":o.get.call(this._hidden)},set:function(a){if(this.isTextElement){if(!a||a===""){this._rawValue=null,this.dom.removeAttribute("data-ln-value"),this.dom.tagName==="TIME"&&this.dom.removeAttribute("datetime"),this.dom.textContent="";return}const h=A(a)||F(a);if(!h)return;const g=L(h);this._rawValue=g,this.dom.tagName==="TIME"?this.dom.setAttribute("datetime",g):this.dom.setAttribute("data-ln-value",g),this._formatTextContent();return}if(!a||a===""){c(this);return}const d=A(a);d&&l(this,a,d)}}),Object.defineProperty(m.prototype,"date",{get:function(){const a=this.value;return a?A(a):null},set:function(a){if(!a||!(a instanceof Date)||isNaN(a.getTime())){this.value="";return}this.value=L(a)}}),Object.defineProperty(m.prototype,"formatted",{get:function(){return this.isTextElement?this.dom.textContent:this.dom.value}}),m.prototype.destroy=function(){if(!this.dom[t])return;if(i.delete(this),this._onLocaleChange&&document.removeEventListener("ln-core:locale-change",this._onLocaleChange),this.isTextElement){delete this.dom[t];return}this._form&&this._onFormReset&&this._form.removeEventListener("reset",this._onFormReset),this._picker.removeEventListener("change",this._onPickerChange),this.dom.removeEventListener("blur",this._onBlur),this._btn.removeEventListener("click",this._onBtnClick);const a=this.value;this._hidden.remove(),this._picker.remove(),this._btn.remove(),this._wrapper&&this._wrapper.parentNode&&(this._wrapper.parentNode.insertBefore(this.dom,this._wrapper),this._wrapper.remove()),delete this.dom.value,this.dom.name=this._hidden.name,this.dom.type="date",a&&(this.dom.value=a),delete this.dom[t]},fe(e,t,m,"ln-date",{attributes:r,extraAttributes:["datetime","lang"],onAttributeChange:n})})()})();
1
+ (function(){"use strict";function W(){if(typeof window>"u")return!1;if(window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink)return!0;if(typeof document<"u"){if(document.documentElement&&document.documentElement.hasAttribute("data-ln-debug"))return!0;if(document.body)return document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null}return!1}function q(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 r=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){r=t[o];break}if(!q(r))return}e.apply(console,t)}}function Q(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function F(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){F(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function we(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function pe(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,o={},s=e.elements,l={};if(n)for(let c=0;c<s.length;c++){const i=s[c];i.name&&i.type==="checkbox"&&!i.disabled&&(l[i.name]=(l[i.name]||0)+1)}for(let c=0;c<s.length;c++){const i=s[c];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(r&&i.matches&&i.matches(r)))if(i.type==="checkbox")n&&l[i.name]===1?o[i.name]=i.checked:(o[i.name]||(o[i.name]=[]),i.checked&&o[i.name].push(i.value));else if(i.type==="radio")i.checked&&(o[i.name]=i.value);else if(i.type==="select-multiple"){o[i.name]=[];for(let u=0;u<i.options.length;u++)i.options[u].selected&&o[i.name].push(i.options[u].value)}else if(n&&i.type==="hidden")o[i.name]=i.value;else if(n&&(i.type==="number"||i.type==="range")){const u=Number(i.value);o[i.name]=i.value===""||isNaN(u)?null:u}else o[i.name]=i.value}return o}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 be(e,t){const n=e.elements,r=[],o={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(o[l.name]=(o[l.name]||0)+1)}for(let s=0;s<n.length;s++){const l=n[s];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const c=l.getAttribute("data-ln-fill-as")||l.name;if(!c||!(c in t))continue;const i=t[c];if(l.type==="checkbox"){if(Array.isArray(i))l.checked=i.indexOf(l.value)!==-1;else if(o[l.name]>1){const u=String(i).split(",").map(function(w){return w.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=ge(i);r.push(l)}else if(l.type==="radio")l.checked=l.value===String(i),r.push(l);else if(l.type==="select-multiple"){if(Array.isArray(i))for(let u=0;u<l.options.length;u++)l.options[u].selected=i.indexOf(l.options[u].value)!==-1;r.push(l)}else l.value=i,l.tagName==="SELECT"&&i!=null&&l.setAttribute("data-ln-value",i),r.push(l)}return r}function ye(e,t,{get:n,set:r}){Object.defineProperty(e,"value",{get:function(){return n?n.call(this):t.get.call(this)},set:function(o){r?r.call(this,o,s=>t.set.call(this,s)):t.set.call(this,o)},configurable:!0})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=be,window.lnCore.serializeForm=pe,window.lnCore.resolveFormMethod=we);const K={};function Ce(e,t){K[e]=t}function _e(e){return K[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=Ce,window.lnCore.getDataMapper=_e);function I(e){const t=e?e.closest("[lang]"):null,n=(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 n?n.trim():"en-US"}function Y(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,F(function(){new MutationObserver(function(){Q(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const J={};function G(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];J[n]=t}function L(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return J[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=G,window.lnCore.getLocaleFallback=L,window.lnCore.ensureLocaleObserver=Y);const R={};function Ae(e,t){R[e]||(R[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=R[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function z(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const c=n[l],i=c.getAttribute("data-ln-field");t[i]!=null&&(c.textContent=t[i])}const r=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<r.length;l++){const c=r[l],i=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<i.length;u++){const w=i[u].trim().split(":");if(w.length!==2)continue;const f=w[0].trim(),a=w[1].trim();t[a]!=null&&c.setAttribute(f,t[a])}}const o=e.querySelectorAll("[data-ln-show]");for(let l=0;l<o.length;l++){const c=o[l],i=c.getAttribute("data-ln-show");i in t&&c.classList.toggle("hidden",!t[i])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],i=c.getAttribute("data-ln-class").split(",");for(let u=0;u<i.length;u++){const w=i[u].trim().split(":");if(w.length!==2)continue;const f=w[0].trim(),a=w[1].trim();a in t&&c.classList.toggle(f,!!t[a])}}return e}function ve(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 n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].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 n=0;n<t.length;n++)t[n].textContent=""}})));function X(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,c){return t[c]!==void 0?t[c]:""}))}const r=function(s,l){return t[l]!==void 0?t[l]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let s=0;s<o.length;s++){const l=o[s],c=l.attributes;for(let i=0;i<c.length;i++){const u=c[i];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function Se(e,t,n,r,o,s){const l={};for(let i=0;i<e.children.length;i++){const u=e.children[i],w=u.getAttribute("data-ln-render-key");w&&(l[w]=u)}const c=document.createDocumentFragment();for(let i=0;i<t.length;i++){const u=t[i],w=String(r(u));let f=l[w];if(f)o(f,u,i);else{const a=Ae(n,s);if(!a||(X(a,u),f=a.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",w),o(f,u,i)}c.appendChild(f)}e.textContent="",e.appendChild(c)}function xe(e,t){const n={},r=e.querySelectorAll("["+t+"]");for(let o=0;o<r.length;o++)n[r[o].getAttribute(t)]=r[o].textContent,r[o].remove();return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=X,window.lnCore.fill=z,window.lnCore.lnFill=ve,window.lnCore.renderList=Se);function B(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function Z(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function ee(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const o=r.trim().toLowerCase();return!(o==="false"||o==="0")}function te(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const $=new Map;function ne(e,t){const n=(e?e.join("|"):"")+"::"+t;if($.has(n))return $.get(n);const r=new Set(e||[]),o=function(s,l){const c=s.getAttribute(l);return c!==null&&r.has(c)?c:t};return $.set(n,o),o}function re(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function oe(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function ie(e,t,n,r,o){if(!e||t===null)return!0;const s=r||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=i=>{o?console.warn(i,o):console.warn(i)};if(l==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const i=e.values||[];return i.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(c(`[${s}] Value ${i} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(c(`[${s}] Value ${i} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(i){return c(`[${s}] Invalid JSON for attribute "${n}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function Ee(e,t,n){for(const r in n){const[o,s,l]=n[r];Object.defineProperty(e,r,{get:function(){return o(t,s,l)},enumerable:!0,configurable:!0})}return e}function ke(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let o=r.read;if(!o&&r.type)switch(r.type){case"enum":o=ne(r.values,r.fallback);break;case"integer":o=Z;break;case"float":o=re;break;case"boolean":o=ee;break;case"list":o=te;break;case"json":o=oe;break;case"string":default:o=B;break}o||(o=B),t[r.prop]=[o,n,r.fallback]}return t}function De(e){const t={};for(const n in e){const r=e[n];r&&r.effect&&(t[n]=r.effect)}return Object.keys(t).length?t:null}function Oe(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=Ee,window.lnCore.attrSpec=ke,window.lnCore.attrStr=B,window.lnCore.attrInt=Z,window.lnCore.attrBool=ee,window.lnCore.attrList=te,window.lnCore.attrEnum=ne,window.lnCore.attrFloat=re,window.lnCore.attrJson=oe);function M(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(n){console.error("["+t.attribute+"] init failed",e,n)}}}function le(e,t,n,r){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:n,ComponentFn:r};if(e.matches&&e.matches(s)&&M(e,l),e.querySelectorAll){const c=e.querySelectorAll(s);for(let i=0;i<c.length;i++)M(c[i],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Le(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Te(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 se(){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 Fe(e){const t=se(),n=e.observed||[];for(let r=0;r<n.length;r++){const o=n[r];t.byAttr.has(o)||t.byAttr.set(o,[]),t.byAttr.get(o).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const o=t.byDeclaredAttr.get(r);o.some(s=>s.componentTag===e.componentTag)||o.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=Oe(e);if(r===null)t.reactiveWildcard.push(e);else for(const o of r)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function ae(e,t,n,r){for(let o=0;o<e.length;o++){const s=e[o];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,r):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,r)}}function Ie(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,r=se(),o=r.byAttr.get(t),s=W()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!n&&!o&&!s)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(s&&q(l)){const c=r.byDeclaredAttr.get(t),i=l.getAttribute(t);for(let u=0;u<c.length;u++)ie(c[u].spec,i,t,c[u].componentTag,l)}if(window.lnCore._debugSink&&(n||o)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),n){const c=r.byReactive.get(t);c&&ae(c,l,t,e.oldValue),r.reactiveWildcard.length&&ae(r.reactiveWildcard,l,t,e.oldValue)}if(o)for(let c=0;c<o.length;c++){const i=o[c];if(i.handler){i.handler(l,t,e.oldValue);continue}i.onAttributeChange&&l[i.attribute]?i.onAttributeChange(l,t):(le(l,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(l))}}}function Me(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,F(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{Ie(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function j(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function V(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function ce(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ue(e){const t=j();if(!t.length)return;const n=e.target;if(n){const o=n.nodeType===1?n:n.parentElement;if(o&&(o.isContentEditable||o.closest&&o.closest('[contenteditable]:not([contenteditable="false"])')))return}const r=V();if(e.target&&r.length)for(let o=0;o<r.length;o++){const s=r[o],l=s.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;c&&s.onSubtreeChange(c,e)}for(let o=0;o<e.addedNodes.length;o++){const s=e.addedNodes[o];if(s.nodeType!==1)continue;const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const i=t[c],u=i.query;if(u&&(s.matches&&s.matches(u)&&(i.ComponentFn&&M(s,i),i.onInit&&i.onInit(s)),l&&s.querySelectorAll)){const w=s.querySelectorAll(u);for(let f=0;f<w.length;f++)i.ComponentFn&&M(w[f],i),i.onInit&&i.onInit(w[f])}}}for(let o=0;o<e.removedNodes.length;o++){const s=e.removedNodes[o];if(s.nodeType!==1||document.contains(s))continue;const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const i=t[c],u=i.query;if(u&&(s.matches&&s.matches(u)&&ce(s,i),l&&s.querySelectorAll)){const w=s.querySelectorAll(u);for(let f=0;f<w.length;f++)ce(w[f],i)}}}}function de(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,F(function(){const e=new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{ue(r)}catch(o){console.error("[ln-core] lifecycle handler failed",r.target,o)}}});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 n=t.takeRecords();for(let r=0;r<n.length;r++){const o=n[r];if(o.type==="childList")try{ue(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function qe(e){j().push(e),e.onSubtreeChange&&e.query&&V().push(e),de()}function fe(e,t,n,r,o={}){const s=o.extraAttributes||[],l=o.onAttributeChange||null,c=o.onSubtreeChange||null,i=o.onInit||null,u=o.onAttrChange||null,w=o.effects||null,f=o.attributes||null,a=f?De(f):w,d=f?new Set(Object.keys(f)):null,m=o.persist||null;function g(D){const h=D||document.body;if(le(h,e,t,n),f&&W())for(const p in f){const b=f[p],_=Array.from(h.querySelectorAll("["+p+"]"));h.matches&&h.matches("["+p+"]")&&_.push(h);for(let x=0;x<_.length;x++){const k=_[x];q(k)&&ie(b,k.getAttribute(p),p,r,k)}}i&&i(h)}const y=[];if(e.indexOf("[")!==-1){const D=/\[([\w-]+)/g;let h;for(;(h=D.exec(e))!==null;)y.push(h[1])}else y.push(e);Fe({selector:e,attribute:t,componentTag:r,attributes:f,ComponentFn:n,onInit:i,observed:y.concat(s),onAttributeChange:l,onAttrChange:u,effects:a,declared:d,persist:m}),Me();const v=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,C=o.subtreeQuery||(v?e:"["+e+"]"),S={selector:e,attribute:t,ComponentFn:n,onInit:i,onSubtreeChange:c,query:C};j().push(S),c&&C&&V().push(S),de(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=fe,window.lnCore.observeLifecycle=qe,window.lnCore.withoutLifecycle=Ne);function E(){Le()>0?Te(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E):E(),g}function he(e){return(e||"").replace(/^#/,"")}function P(e){const t=e===void 0?location.hash:e,n={},r=he(t);if(!r)return n;const o=r.split("&");for(let s=0;s<o.length;s++){const l=o[s];if(!l)continue;const c=l.indexOf(":"),i=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(i)try{n[i]=decodeURIComponent(u)}catch{n[i]=u}}return n}function Re(e){if(!e)return null;const t=P();return e in t?t[e]:null}function Be(e,t){if(!e)return;const n=P();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");he(location.hash)!==o&&(location.hash=o)}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 n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function Ve(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Pe(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 He(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ue(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),o=r?r.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=P,window.lnCore.hashGet=Re,window.lnCore.hashSet=Be,window.lnCore.hashLinkClick=$e,window.lnCore.resolveHashNamespace=je,window.lnCore.hashSortEncode=Ve,window.lnCore.hashSortDecode=Pe,window.lnCore.hashFilterEncode=He,window.lnCore.hashFilterDecode=Ue);function We(e){return(e||"").replace(/^\?/,"")}function Qe(e){const t=e===void 0?typeof window<"u"?window.location.search:"":e,n={},r=We(t);if(!r)return n;const o=new URLSearchParams(r);for(const[s,l]of o.entries())n[s]=l;return n}function Ke(e){if(!e||typeof window>"u")return null;const t=new URLSearchParams(window.location.search);return t.has(e)?t.get(e):null}function Ye(e,t){if(!e||typeof window>"u")return;const n=new URL(window.location.href);if(t==null||t===""?n.searchParams.delete(e):n.searchParams.set(e,String(t)),n.search===window.location.search)return;const r=n.pathname+n.search+n.hash;window.history.replaceState(window.history.state,"",r)}function Je(e,t){if(!e||!e.hasAttribute("data-ln-query"))return null;const n=e.getAttribute("data-ln-query");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"_"+t:r:t||null}function Ge(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ze(e,t){if(e&&typeof e=="string"){if(e.endsWith(".asc"))return{fieldOrColumn:e.slice(0,-4),direction:"asc"};if(e.endsWith(".desc"))return{fieldOrColumn:e.slice(0,-5),direction:"desc"}}if(t&&typeof t=="object"){const n=t.sort_field||t.sort_by;if(n){const r=t.sort_dir&&String(t.sort_dir).toLowerCase()==="desc"?"desc":"asc";return{fieldOrColumn:n,direction:r}}}return null}function Xe(e){return!Array.isArray(e)||e.length===0?null:e.map(encodeURIComponent).join(",")}function Ze(e){return!e||typeof e!="string"?[]:e.split(",").map(function(t){try{return decodeURIComponent(t.trim())}catch{return t.trim()}}).filter(Boolean)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.queryParse=Qe,window.lnCore.queryGet=Ke,window.lnCore.querySet=Ye,window.lnCore.resolveQueryParam=Je,window.lnCore.querySortEncode=Ge,window.lnCore.querySortDecode=ze,window.lnCore.queryFilterEncode=Xe,window.lnCore.queryFilterDecode=Ze);function et(){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=et);function A(e){if(e==null||e==="")return null;if(e instanceof Date)return isNaN(e.getTime())?null:e;const t=Number(e);if(!isNaN(t)&&t>0){const n=t<1e11?t*1e3:t,r=new Date(n);return isNaN(r.getTime())?null:r}if(typeof e=="string"){const n=e.trim();if(!n)return null;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);if(r){const s=+r[1],l=+r[2],c=+r[3],i=new Date(s,l-1,c);return i.getFullYear()!==s||i.getMonth()!==l-1||i.getDate()!==c?null:i}const o=new Date(n);return isNaN(o.getTime())?null:o}return null}function O(e){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return t+"-"+n+"-"+r}const H=/^(short|medium|long)(\s+datetime)?$/,tt={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},"short datetime":{dateStyle:"short",timeStyle:"short"},"medium datetime":{dateStyle:"medium",timeStyle:"short"},"long datetime":{dateStyle:"long",timeStyle:"short"}};function nt(e){return!e||e===""?{dateStyle:"medium"}:String(e).trim().match(H)?tt[e.trim()]:null}function T(e){if(!e||typeof e!="string")return null;const t=e.trim();if(t.length<6)return null;let n,r;if(t.indexOf(".")!==-1)n=".",r=t.split(".");else if(t.indexOf("/")!==-1)n="/",r=t.split("/");else if(t.indexOf("-")!==-1)n="-",r=t.split("-");else return null;if(r.length!==3)return null;const o=[];for(let u=0;u<3;u++){const w=parseInt(r[u],10);if(isNaN(w))return null;o.push(w)}let s,l,c;n==="."?(s=o[0],l=o[1],c=o[2]):n==="/"?(l=o[0],s=o[1],c=o[2]):r[0].length===4?(c=o[0],l=o[1],s=o[2]):(s=o[0],l=o[1],c=o[2]),c<100&&(c+=c<50?2e3:1900);const i=new Date(c,l-1,s);return i.getFullYear()!==c||i.getMonth()!==l-1||i.getDate()!==s?null:i}function U(e,t,n,r){if(!e||!(e instanceof Date)||isNaN(e.getTime())||!t||typeof t!="string")return"";const o=e.getDate(),s=e.getMonth(),l=e.getFullYear(),c=e.getHours(),i=e.getMinutes();let u,w;const f=(n||"").toLowerCase().split("-")[0];let a=!1;try{const g=new Intl.DateTimeFormat(n,{month:"long"}).resolvedOptions().locale.toLowerCase().split("-")[0];a=!!(r&&g!==f)}catch{a=!!r}if(a&&r&&r.monthsLong)u=r.monthsLong[s];else try{u=new Intl.DateTimeFormat(n,{month:"long"}).format(e)}catch{u=String(s+1)}if(a&&r&&r.monthsShort)w=r.monthsShort[s];else try{w=new Intl.DateTimeFormat(n,{month:"short"}).format(e)}catch{w=String(s+1)}const d={yyyy:String(l),yy:String(l).slice(-2),MMMM:u,MMM:w,MM:String(s+1).padStart(2,"0"),M:String(s+1),dd:String(o).padStart(2,"0"),d:String(o),HH:String(c).padStart(2,"0"),mm:String(i).padStart(2,"0")};return t.replace(/yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|mm/g,function(m){return d[m]!==void 0?d[m]:m})}function N(e,t,n,r){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const o=nt(t);if(o)try{const s=new Intl.DateTimeFormat(n,o),l=(n||"").toLowerCase().split("-")[0],c=s.resolvedOptions().locale.toLowerCase().split("-")[0];return r&&c!==l?U(e,"dd.MM.yyyy",n,r):s.format(e)}catch{return U(e,"dd.MM.yyyy",n,r)}return U(e,t||"dd.MM.yyyy",n,r)}(function(){const e="data-ln-date",t="lnDate";if(window[t]!==void 0)return;function n(a){const d=a[t];if(d){if(d.isTextElement)d._initTextElement();else if(d.value){const m=A(d.value);m&&d._displayFormatted(m)}}}const r={"data-ln-date":{type:"enum",values:["short","medium","long","full","iso"],fallback:"medium",effect:n,description:"Date display style preset or activator"},"data-ln-date-format":{type:"string",effect:n,description:"Custom Intl.DateTimeFormat pattern or options"},"data-ln-date-locale":{type:"string",effect:n,description:"BCP 47 language tag override for date formatting"},"data-ln-value":{type:"string",effect:n,description:"Raw ISO date string or timestamp for non-time elements (td, span)"},"data-ln-date-dict":{type:"marker",description:"Container for date translation dictionary"},"data-ln-date-dict-key":{type:"string",description:"Dictionary key for relative time or custom date formatting"},"data-ln-date-field":{type:"string",description:"Field name mapping for date record binding"},"data-ln-date-label":{type:"string",description:"Accessible label text for the date input"}},o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");function s(a,d,m){Q(a.dom,"ln-date:change",{value:d,formatted:a.dom.value,date:m}),a.dom.dispatchEvent(new Event("change",{bubbles:!0}))}function l(a,d,m,g){a._setHiddenRaw(d),o.set.call(a._picker,d),a._lastISO=d,g!==void 0?(a._isFormatting=!0,a.dom.value=g,a._isFormatting=!1):m&&a._displayFormatted(m),s(a,d,m)}function c(a){a._setHiddenRaw(""),o.set.call(a._picker,""),a._isFormatting=!0,a.dom.value="",a._isFormatting=!1,a._lastISO="",s(a,"",null)}const i=new Set;let u=!1;function w(){Y(),!u&&(u=!0,document.addEventListener("ln-core:locale-change",function(){i.forEach(function(a){if(a.isTextElement)a._formatTextContent();else if(a.value){const d=A(a.value);d&&a._displayFormatted(d)}})}))}function f(a){if(a[t])return a[t];a[t]=this,this.dom=a;const d=this;if(i.add(this),w(),a.tagName!=="INPUT")return this.isTextElement=!0,this._initTextElement(),this;this.isTextElement=!1;const m=a.value,g=a.name,y=a.closest(".form-element, form")||a.parentNode;if(y){const h=y.querySelectorAll("[data-ln-date-dict]");for(let p=0;p<h.length;p++){const b=h[p].getAttribute("data-ln-date-dict");if(b){const _=xe(h[p],"data-ln-date-dict-key");_["months-long"]&&(_.monthsLong=_["months-long"].split(",").map(x=>x.trim())),_["months-short"]&&(_.monthsShort=_["months-short"].split(",").map(x=>x.trim())),G(b,_)}}}const v=document.createElement("span");v.setAttribute("data-ln-date-field",""),a.parentNode.insertBefore(v,a),v.appendChild(a),this._wrapper=v;const C=document.createElement("input");C.type="hidden",C.name=g,a.removeAttribute("name"),a.hasAttribute("data-ln-fill-as")&&C.setAttribute("data-ln-fill-as",a.getAttribute("data-ln-fill-as")),a.insertAdjacentElement("afterend",C),this._hidden=C;const S=document.createElement("input");S.type="date",S.tabIndex=-1,S.setAttribute("tabindex","-1"),S.setAttribute("aria-hidden","true"),S.setAttribute("aria-label",a.getAttribute("data-ln-date-label")||"Date picker"),S.style.cssText="position:absolute;opacity:0;width:0;height:0;overflow:hidden;pointer-events:none",C.insertAdjacentElement("afterend",S),this._picker=S,a.type="text";const E=document.createElement("button");E.type="button",E.setAttribute("aria-label",a.getAttribute("data-ln-date-label")||"Open date picker"),E.innerHTML='<svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-calendar"></use></svg>',S.insertAdjacentElement("afterend",E),this._btn=E,this._lastISO="",Object.defineProperty(C,"value",{get:function(){return o.get.call(C)},set:function(h){if(o.set.call(C,h),h&&h!==""){const p=A(h);p&&l(d,h,p)}else h===""&&c(d)}}),ye(a,o,{get:function(){return o.get.call(a)},set:function(h,p){if(d._isFormatting){p(h);return}if(!h||h===""){p(""),c(d);return}const b=A(h)||T(h);if(b){const _=O(b),x=a.getAttribute(e)||"",k=I(a),rt=L(k),me=N(b,x,k,rt);p(me),l(d,_,b,me)}else p(String(h)),c(d)}}),this._onPickerChange=function(){const h=S.value;if(h){const p=A(h);p&&l(d,h,p)}else c(d)},S.addEventListener("change",this._onPickerChange),this._onBlur=function(){const h=d.dom.value.trim();if(h===""){d._lastISO!==""&&c(d);return}if(d._lastISO){const b=A(d._lastISO);if(b){const _=d.dom.getAttribute(e)||"",x=I(d.dom),k=L(x);if(h===N(b,_,x,k))return}}const p=T(h);if(p){const b=O(p);l(d,b,p)}else if(d._lastISO){const b=A(d._lastISO);b&&d._displayFormatted(b)}else d.dom.value=""},a.addEventListener("blur",this._onBlur),this._onBtnClick=function(){d._openPicker()},E.addEventListener("click",this._onBtnClick);const D=a.form;if(D&&(this._form=D,this._onFormReset=function(){setTimeout(function(){const h=d.dom.value;if(h){const p=A(h)||T(h);if(p){const b=O(p);l(d,b,p);return}}c(d)},0)},D.addEventListener("reset",this._onFormReset)),m&&m!==""){const h=A(m);h&&l(d,m,h)}return this}f.prototype._initTextElement=function(){const a=this.dom,d=a.getAttribute("data-ln-value"),m=a.getAttribute("data-ln-date"),g=a.getAttribute("datetime");let y=null;a.tagName==="TIME"&&g!==null&&g!==""?y=g:d!==null&&d!==""?y=d:g!==null&&g!==""?y=g:m!==null&&m!==""&&m!=="true"&&!H.test(m)?y=m:y=a.textContent.trim();const v=A(y)||T(y);if(v&&!isNaN(v.getTime())){const C=O(v);this._rawValue=C,a.tagName!=="TIME"&&!a.hasAttribute("data-ln-value")&&a.setAttribute("data-ln-value",C),this._formatTextContent()}else this._rawValue=null},f.prototype._formatTextContent=function(){if(this._rawValue){const a=A(this._rawValue);if(a){let m=this.dom.getAttribute("data-ln-date-format");if(!m){const v=this.dom.getAttribute("data-ln-date");v&&H.test(v)&&(m=v)}const g=I(this.dom),y=L(g);this.dom.textContent=N(a,m||"medium",g,y)}}},f.prototype._openPicker=function(){if(typeof this._picker.showPicker=="function")try{this._picker.showPicker()}catch{this._picker.click()}else this._picker.click()},f.prototype._setHiddenRaw=function(a){o.set.call(this._hidden,a)},f.prototype._displayFormatted=function(a){const d=this.dom.getAttribute(e)||"",m=I(this.dom),g=L(m);this._isFormatting=!0,this.dom.value=N(a,d,m,g),this._isFormatting=!1},Object.defineProperty(f.prototype,"value",{get:function(){return this.isTextElement?this._rawValue||"":o.get.call(this._hidden)},set:function(a){if(this.isTextElement){if(!a||a===""){this._rawValue=null,this.dom.removeAttribute("data-ln-value"),this.dom.tagName==="TIME"&&this.dom.removeAttribute("datetime"),this.dom.textContent="";return}const m=A(a)||T(a);if(!m)return;const g=O(m);this._rawValue=g,this.dom.tagName==="TIME"?this.dom.setAttribute("datetime",g):this.dom.setAttribute("data-ln-value",g),this._formatTextContent();return}if(!a||a===""){c(this);return}const d=A(a);d&&l(this,a,d)}}),Object.defineProperty(f.prototype,"date",{get:function(){const a=this.value;return a?A(a):null},set:function(a){if(!a||!(a instanceof Date)||isNaN(a.getTime())){this.value="";return}this.value=O(a)}}),Object.defineProperty(f.prototype,"formatted",{get:function(){return this.isTextElement?this.dom.textContent:this.dom.value}}),f.prototype.destroy=function(){if(!this.dom[t])return;if(i.delete(this),this._onLocaleChange&&document.removeEventListener("ln-core:locale-change",this._onLocaleChange),this.isTextElement){delete this.dom[t];return}this._form&&this._onFormReset&&this._form.removeEventListener("reset",this._onFormReset),this._picker.removeEventListener("change",this._onPickerChange),this.dom.removeEventListener("blur",this._onBlur),this._btn.removeEventListener("click",this._onBtnClick);const a=this.value;this._hidden.remove(),this._picker.remove(),this._btn.remove(),this._wrapper&&this._wrapper.parentNode&&(this._wrapper.parentNode.insertBefore(this.dom,this._wrapper),this._wrapper.remove()),delete this.dom.value,this.dom.name=this._hidden.name,this.dom.type="date",a&&(this.dom.value=a),delete this.dom[t]},fe(e,t,f,"ln-date",{attributes:r,extraAttributes:["datetime","lang"],onAttributeChange:n})})()})();