@livenetworks/ashlar 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/components/ln-accordion/ln-accordion.js +1 -1
  2. package/components/ln-accordion/src/ln-accordion.js +1 -0
  3. package/components/ln-couchdb-connector/README.md +4 -0
  4. package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
  5. package/components/ln-couchdb-connector/src/ln-couchdb-connector.js +18 -1
  6. package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
  7. package/components/ln-data-coordinator/src/ln-data-coordinator.js +15 -6
  8. package/components/ln-data-store/README.md +3 -2
  9. package/components/ln-data-store/ln-data-store.js +1 -1
  10. package/components/ln-data-store/src/data-store-model.js +29 -0
  11. package/components/ln-data-store/src/ln-data-store.js +57 -10
  12. package/components/ln-date/README.md +4 -0
  13. package/components/ln-date/ln-date.js +1 -1
  14. package/components/ln-date/src/ln-date.js +3 -3
  15. package/components/ln-fill/README.md +14 -11
  16. package/components/ln-fill/ln-fill.js +1 -1
  17. package/components/ln-fill/src/ln-fill.js +0 -6
  18. package/components/ln-list/ln-list.js +1 -1
  19. package/components/ln-list/src/ln-list.js +4 -4
  20. package/components/ln-modal/README.md +33 -14
  21. package/components/ln-modal/ln-modal.js +1 -1
  22. package/components/ln-modal/ln-modal.schema.json +8 -1
  23. package/components/ln-modal/src/ln-modal.js +39 -8
  24. package/components/ln-options/ln-options.js +1 -1
  25. package/components/ln-options/src/ln-options.js +1 -0
  26. package/components/ln-popover/README.md +4 -0
  27. package/components/ln-popover/ln-popover.js +1 -1
  28. package/components/ln-popover/src/ln-popover.js +9 -0
  29. package/components/ln-table/ln-table.js +1 -1
  30. package/components/ln-table/src/ln-table.js +2 -0
  31. package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
  32. package/components/ln-table-coordinator/src/ln-table-coordinator.js +3 -3
  33. package/components/ln-tabs/README.md +2 -2
  34. package/components/ln-tabs/ln-tabs.js +1 -1
  35. package/components/ln-tabs/src/ln-tabs.js +1 -0
  36. package/ln-ashlar.html-data.json +9 -1
  37. package/package.json +1 -1
  38. package/web-types.json +7 -3
@@ -24,15 +24,33 @@ In `ln-ashlar`, the core design principle is **Three-Layer Architecture** and **
24
24
  Triggers and modals are paired by ID. The overlay has `class="ln-modal"` and `data-ln-modal`.
25
25
 
26
26
  ```html
27
- <!-- Trigger button -->
28
- <button data-ln-modal-for="user-modal">Add User</button>
27
+ <!-- Trigger: New (opens modal in "new" mode and resets form) -->
28
+ <button type="button"
29
+ data-ln-modal-for="user-modal"
30
+ data-ln-modal-mode="new"
31
+ data-ln-fill-form="user-form">
32
+ Add User
33
+ </button>
34
+
35
+ <!-- Trigger: Edit (opens modal in "edit" mode and fills form) -->
36
+ <button type="button"
37
+ data-ln-modal-for="user-modal"
38
+ data-ln-modal-mode="edit"
39
+ data-ln-fill-form="user-form"
40
+ data-ln-fill-id="42"
41
+ data-ln-fill-name="Ada Lovelace">
42
+ Edit User
43
+ </button>
29
44
 
30
45
  <!-- Modal overlay -->
31
- <dialog class="ln-modal" data-ln-modal id="user-modal">
32
- <form>
33
- <!-- Header -->
46
+ <dialog class="ln-modal" data-ln-modal data-ln-modal-mode="new" id="user-modal">
47
+ <form id="user-form" data-ln-form>
48
+ <!-- Header with mode-conditional title -->
34
49
  <header>
35
- <h3>Add User</h3>
50
+ <h3 data-ln-fillable>
51
+ <span data-ln-modal-when="new">Add User</span>
52
+ <span data-ln-modal-when="edit">Edit User — <span data-ln-field="name"></span></span>
53
+ </h3>
36
54
  <button type="button" data-ln-modal-close aria-label="Close">
37
55
  <svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-x"></use></svg>
38
56
  </button>
@@ -40,6 +58,7 @@ Triggers and modals are paired by ID. The overlay has `class="ln-modal"` and `da
40
58
 
41
59
  <!-- Scrollable content -->
42
60
  <main>
61
+ <input type="hidden" name="id">
43
62
  <label>Name <input type="text" name="name" autofocus></label>
44
63
  </main>
45
64
 
@@ -54,7 +73,8 @@ Triggers and modals are paired by ID. The overlay has `class="ln-modal"` and `da
54
73
 
55
74
  ### Key Anatomy Rules
56
75
  - **The Overlay (`data-ln-modal`)**: Driven by the value `"open"` (open) and `"close"` (closed).
57
- - **The Trigger (`data-ln-modal-for="id"`)**: Placed on buttons/links to request toggling modal display.
76
+ - **The Trigger (`data-ln-modal-for="id"`)**: Placed on buttons/links to open target modal directly.
77
+ - **The Mode Switch (`data-ln-modal-mode="new|edit"`)**: Transferred from trigger to modal on click. Displays child elements with matching `[data-ln-modal-when="new|edit"]`. Automatically resets to `"new"` upon closing.
58
78
  - **The Dismiss button (`data-ln-modal-close`)**: Placed on cancel or close buttons to request close.
59
79
  - **Focus Override (`autofocus`)**: Place on any form field to override default focus placement on open.
60
80
 
@@ -87,6 +107,7 @@ const isOpen = modal.lnModal.isOpen; // Returns true/false
87
107
  ### Attributes
88
108
  - `data-ln-modal`: Placed on the overlay element. Value `"open"` = open; `"close"` = closed.
89
109
  - `data-ln-modal-for="id"`: Placed on trigger elements referencing the modal ID.
110
+ - `data-ln-modal-mode="new|edit"`: Placed on trigger elements or modal dialog to specify mode (toggles `[data-ln-modal-when="new|edit"]` child elements).
90
111
  - `data-ln-modal-close`: Placed on any close trigger inside the modal.
91
112
 
92
113
  ---
@@ -148,9 +169,7 @@ Do not use visual layout utility classes in your markup. Apply structural sizing
148
169
  ## 6. Hash Addressing & Deep-Linking
149
170
 
150
171
  Any modal with an `id` is hash-addressable (e.g. `#user-modal` or `#user-modal:42`).
151
- When an `id` modal opens, `ln-modal` emits `ln-modal:open` containing `{ hashNs, param }` in `e.detail`.
152
-
153
- Coordinators (such as `ln-ui-coordinator`) intercept hash changes and coordinate data fetching / form populating via `ln-fill`.
172
+ Coordinators (such as `ln-ui-coordinator`) intercept hash changes, request modal opening, and coordinate data fetching / form populating via `ln-fill`. Modal lifecycle events (`ln-modal:open`, `ln-modal:close`) emit `{ modalId, target }`.
154
173
 
155
174
  ---
156
175
 
@@ -163,7 +182,7 @@ Coordinators (such as `ln-ui-coordinator`) intercept hash changes and coordinate
163
182
 
164
183
  ## 🔧 Internals
165
184
 
166
- Source: `components/ln-modal/src/ln-modal.js` (native `<dialog>`-backed). `ln-modal` operates autonomously: trigger buttons (`data-ln-modal-for`), dismiss buttons (`data-ln-modal-close`), and backdrop dismissals are handled directly by the component without requiring external coordinators. Hash-addressing and form-fill orchestration remain optional enhancements handled when `components/ln-ui-coordinator/src/ln-ui-coordinator.js` is present.
185
+ Source: `components/ln-modal/src/ln-modal.js` (native `<dialog>`-backed). `ln-modal` operates autonomously: trigger buttons (`data-ln-modal-for`), dismiss buttons (`data-ln-modal-close`), and native ESC cancellation are handled directly by the component without requiring external coordinators. Mode switching (`data-ln-modal-mode="new|edit"`) is synchronized declaratively from triggers to modal dialogs.
167
186
 
168
187
  ### Single source of truth
169
188
 
@@ -173,11 +192,11 @@ Source: `components/ln-modal/src/ln-modal.js` (native `<dialog>`-backed). `ln-mo
173
192
 
174
193
  Open: cancelable `:before-open` → `instance.isOpen = true` → `body.ln-modal-open` class → `el.showModal()` (native `<dialog>` — top-layer stacking and backdrop are the platform's) → focus priority `[autofocus]` → first non-disabled input/select/textarea → first link/button, each filtered through `isVisible` → `:open`.
175
194
 
176
- Close: cancelable `:before-close` → `instance.isOpen = false` → `:close` → `el.close()` (native — restores focus to the pre-open `document.activeElement` automatically) → if no other `[data-ln-modal="open"]` remains, remove `body.ln-modal-open`.
195
+ Close: cancelable `:before-close` (skipped for native close where dialog has already closed) → `instance.isOpen = false` → `el.close()` (native — restores focus to the pre-open `document.activeElement` automatically) → if no other `[data-ln-modal="open"]` remains, remove `body.ln-modal-open` → `:close`.
177
196
 
178
- ### ESC handling
197
+ ### ESC & native close handling
179
198
 
180
- Not a custom keydown listener — the native `<dialog>` fires its own `cancel` event on ESC. `_onCancel` calls `preventDefault()` (so the dialog doesn't close ahead of the attribute-driven flow) and writes `data-ln-modal="close"`, routing ESC through the same single attribute path as every other close trigger.
199
+ Not a custom keydown listener — the native `<dialog>` fires its own `cancel` event on ESC. `_onCancel` calls `preventDefault()` (so the dialog doesn't close ahead of the attribute-driven flow) and writes `data-ln-modal="close"`, routing ESC through the cancelable `before-close` lifecycle path. Furthermore, `_onClose` listens to the native `close` event (fired when `<form method="dialog">` is submitted or `dialog.close()` is called), resynchronizing `data-ln-modal="close"` and releasing scroll locks without stranded UI state.
181
200
 
182
201
  ### Trigger/close wiring
183
202
 
@@ -1 +1 @@
1
- (function(){"use strict";function x(){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 k(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){o=t[l];break}if(!k(o))return}e.apply(console,t)}}function y(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function R(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o);const l=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:o});return e.dispatchEvent(l),l}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function S(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}function K(e){return!!(!e||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||typeof e.button=="number"&&e.button!==0)}function U(e){return!!(!e||e.disabled||typeof e.getAttribute=="function"&&e.getAttribute("aria-disabled")==="true"||typeof e.closest=="function"&&e.closest("[inert]"))}const D={};function G(e,t){D[e]=t}function Q(e){return D[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=G,window.lnCore.getDataMapper=Q);function P(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){y(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function J(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];$[n]=t}function z(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=J,window.lnCore.getLocaleFallback=z,window.lnCore.ensureLocaleObserver=P);const O={};function X(e,t){O[e]||(O[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=O[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function M(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let r=0;r<n.length;r++){const c=n[r],s=c.getAttribute("data-ln-field");t[s]!=null&&(c.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<o.length;r++){const c=o[r],s=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<s.length;u++){const f=s[u].trim().split(":");if(f.length!==2)continue;const d=f[0].trim(),a=f[1].trim();t[a]!=null&&c.setAttribute(d,t[a])}}const l=e.querySelectorAll("[data-ln-show]");for(let r=0;r<l.length;r++){const c=l[r],s=c.getAttribute("data-ln-show");s in t&&c.classList.toggle("hidden",!t[s])}const i=e.querySelectorAll("[data-ln-class]");for(let r=0;r<i.length;r++){const c=i[r],s=c.getAttribute("data-ln-class").split(",");for(let u=0;u<s.length;u++){const f=s[u].trim().split(":");if(f.length!==2)continue;const d=f[0].trim(),a=f[1].trim();a in t&&c.classList.toggle(d,!!t[a])}}return e}function Y(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 o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)M(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 B(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,c){return t[c]!==void 0?t[c]:""}))}const o=function(i,r){return t[r]!==void 0?t[r]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let i=0;i<l.length;i++){const r=l[i],c=r.attributes;for(let s=0;s<c.length;s++){const u=c[s];u.value.indexOf("{{")!==-1&&r.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function Z(e,t,n,o,l,i){const r={};for(let s=0;s<e.children.length;s++){const u=e.children[s],f=u.getAttribute("data-ln-render-key");f&&(r[f]=u)}const c=document.createDocumentFragment();for(let s=0;s<t.length;s++){const u=t[s],f=String(o(u));let d=r[f];if(d)l(d,u,s);else{const a=X(n,i);if(!a||(B(a,u),d=a.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",f),l(d,u,s)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=B,window.lnCore.fill=M,window.lnCore.lnFill=Y,window.lnCore.renderList=Z);function F(e,t,n,o,l){if(!e||t===null)return!0;const i=o||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const c=s=>{l?console.warn(s,l):console.warn(s)};if(r==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(c(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const s=e.values||[];return s.includes(t)?!0:(c(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return c(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(c(`[${i}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(c(`[${i}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(c(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(s){return c(`[${i}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function ee(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function te(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}function E(e,t,n,o){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&r.push(e);for(const c of r)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(s){console.error("["+n+"] init failed",c,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ne(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function oe(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 W(){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 re(e){const t=W(),n=e.observed||[];for(let o=0;o<n.length;o++){const l=n[o];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const l=t.byDeclaredAttr.get(o);l.some(i=>i.componentTag===e.componentTag)||l.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=te(e);if(o===null)t.reactiveWildcard.push(e);else for(const l of o)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function j(e,t,n,o){for(let l=0;l<e.length;l++){const i=e[l];if(!t[i.attribute])continue;const r=i.effects&&i.effects[n];r?r(t,n,o):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,o)}}function ie(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=W(),l=o.byAttr.get(n);if(x()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&k(t)){const i=o.byDeclaredAttr.get(n),r=t.getAttribute(n);for(let c=0;c<i.length;c++)F(i[c].spec,r,n,i[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=o.byReactive.get(n);i&&j(i,t,n,e.oldValue),o.reactiveWildcard.length&&j(o.reactiveWildcard,t,n,e.oldValue)}if(l)for(let i=0;i<l.length;i++){const r=l[i];if(r.handler){r.handler(t,n,e.oldValue);continue}r.onAttributeChange&&t[r.attribute]?r.onAttributeChange(t,n):(E(t,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(t))}}function le(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ie(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function N(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function se(e){const t=N();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const l=o.query,i=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;i&&o.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l];E(o,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l],r=i.query,c=Array.from(o.querySelectorAll(r));o.matches&&o.matches(r)&&c.push(o);for(let s=0;s<c.length;s++){const u=c[s];if(!document.contains(u)){const f=u[i.attribute];if(f&&typeof f.destroy=="function")try{f.destroy()}catch(d){console.error("["+i.attribute+"] destroy failed",u,d)}delete u[i.attribute]}}}}}}function de(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{se(o)}catch(l){console.error("[ln-core] lifecycle handler failed",o.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function ce(e,t,n,o,l={}){const i=l.extraAttributes||[],r=l.onAttributeChange||null,c=l.onSubtreeChange||null,s=l.onInit||null,u=l.onAttrChange||null,f=l.effects||null,d=l.attributes||null,a=d?ee(d):f,w=d?new Set(Object.keys(d)):null,b=l.persist||null;function g(m){const h=m||document.body;if(E(h,e,t,n),d&&x())for(const C in d){const me=d[C],I=Array.from(h.querySelectorAll("["+C+"]"));h.matches&&h.matches("["+C+"]")&&I.push(h);for(let q=0;q<I.length;q++){const T=I[q];k(T)&&F(me,T.getAttribute(C),C,o,T)}}s&&s(h)}const p=[];if(e.indexOf("[")!==-1){const m=/\[([\w-]+)/g;let h;for(;(h=m.exec(e))!==null;)p.push(h[1])}else p.push(e);re({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:n,onInit:s,observed:p.concat(i),onAttributeChange:r,onAttrChange:u,effects:a,declared:w,persist:b}),le();const _=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";N().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:c,query:_}),de(),window[t]=g;function v(){ne()>0?oe(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",v):v(),g}function V(e){return(e||"").replace(/^#/,"")}function L(e){const t=e===void 0?location.hash:e,n={},o=V(t);if(!o)return n;const l=o.split("&");for(let i=0;i<l.length;i++){const r=l[i];if(!r)continue;const c=r.indexOf(":"),s=c>-1?r.slice(0,c):r,u=c>-1?r.slice(c+1):"";if(s)try{n[s]=decodeURIComponent(u)}catch{n[s]=u}}return n}function ue(e){if(!e)return null;const t=L();return e in t?t[e]:null}function ae(e,t){if(!e)return;const n=L();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(i){const r=n[i];return r===""?i:i+":"+encodeURIComponent(r)}).join("&");V(location.hash)!==l&&(location.hash=l)}function fe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function we(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 o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function be(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function he(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 pe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function ge(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),l=o?o.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=L,window.lnCore.hashGet=ue,window.lnCore.hashSet=ae,window.lnCore.hashLinkClick=fe,window.lnCore.resolveHashNamespace=we,window.lnCore.hashSortEncode=be,window.lnCore.hashSortDecode=he,window.lnCore.hashFilterEncode=pe,window.lnCore.hashFilterDecode=ge),(function(){const e="data-ln-modal",t="lnModal",n="data-ln-modal-for",o="data-ln-modal-close";if(window[t]!==void 0)return;const l={"data-ln-modal":{type:"enum",values:["open","close"],fallback:"close",effect:f,description:"Control state of the modal dialog"},"data-ln-modal-for":{type:"string",description:"Target modal ID to open on trigger click"},"data-ln-modal-close":{type:"trigger",description:"Click dismiss trigger inside the modal"}},i=new Set;let r=null;function c(){r||(r=function(d){if(K(d))return;const a=d.target.closest("["+n+"]");if(!a||U(a))return;const w=a.getAttribute(n);if(!w)return;const b=document.getElementById(w)||document.querySelector("["+e+'="'+w+'"]');!b||!b[t]||(d.preventDefault(),a.hasAttribute("data-ln-modal-mode")&&b.setAttribute("data-ln-modal-mode",a.getAttribute("data-ln-modal-mode")),b.setAttribute(e,"open"))},document.addEventListener("click",r))}function s(){i.size>0||!r||(document.removeEventListener("click",r),r=null)}function u(d){this.dom=d,this.isOpen=d.getAttribute(e)==="open";const a=this;return this._onRequestOpen=function(){a.dom.setAttribute(e,"open")},this._onRequestClose=function(){a.dom.setAttribute(e,"close")},this._onCancel=function(w){w.preventDefault(),a.dom.setAttribute(e,"close")},this._onClickClose=function(w){const b=w.target.closest("["+o+"]");b&&a.dom.contains(b)&&(w.preventDefault(),a.dom.setAttribute(e,"close"))},this.dom.addEventListener("ln-modal:request-open",this._onRequestOpen),this.dom.addEventListener("ln-modal:request-close",this._onRequestClose),this.dom.addEventListener("cancel",this._onCancel),this.dom.addEventListener("click",this._onClickClose),i.add(this),c(),this.isOpen&&(typeof this.dom.showModal=="function"&&this.dom.showModal(),document.body.classList.add("ln-modal-open"),y(this.dom,"ln-modal:open",{modalId:this.dom.id,target:this.dom})),this}u.prototype.open=function(){this.dom.setAttribute(e,"open")},u.prototype.close=function(){this.dom.setAttribute(e,"close")},u.prototype.toggle=function(){const d=this.dom.getAttribute(e);this.dom.setAttribute(e,d==="open"?"close":"open")},u.prototype.destroy=function(){if(this.dom[t]){if(this.dom.removeEventListener("ln-modal:request-open",this._onRequestOpen),this.dom.removeEventListener("ln-modal:request-close",this._onRequestClose),this.dom.removeEventListener("cancel",this._onCancel),this.dom.removeEventListener("click",this._onClickClose),i.delete(this),s(),this.isOpen){const d=this.dom;Array.prototype.some.call(document.querySelectorAll("["+e+'="open"]'),function(w){return w!==d})||document.body.classList.remove("ln-modal-open")}delete this.dom[t]}};function f(d){const a=d[t];if(!a)return;const b=d.getAttribute(e)==="open";if(b!==a.isOpen)if(b){if(R(d,"ln-modal:before-open",{modalId:d.id,target:d}).defaultPrevented){d.setAttribute(e,"close");return}a.isOpen=!0,document.body.classList.add("ln-modal-open"),typeof d.showModal=="function"&&d.showModal();const p=d.querySelector("[autofocus]");if(p&&S(p))p.focus();else{const H=d.querySelectorAll('input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled])'),_=Array.prototype.find.call(H,S);if(_)_.focus();else{const v=d.querySelectorAll("a[href], button:not([disabled])"),m=Array.prototype.find.call(v,S);m&&m.focus()}}y(d,"ln-modal:open",{modalId:d.id,target:d})}else{if(R(d,"ln-modal:before-close",{modalId:d.id,target:d}).defaultPrevented){d.setAttribute(e,"open");return}a.isOpen=!1,y(d,"ln-modal:close",{modalId:d.id,target:d}),typeof d.close=="function"&&d.close(),document.querySelector("["+e+'="open"]')||document.body.classList.remove("ln-modal-open")}}ce(e,t,u,"ln-modal",{attributes:l})})()})();
1
+ (function(){"use strict";function R(){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 k(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){o=t[l];break}if(!k(o))return}e.apply(console,t)}}function A(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function D(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o);const l=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:o});return e.dispatchEvent(l),l}function _(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){_(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function S(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}function K(e){return!!(!e||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||typeof e.button=="number"&&e.button!==0)}function U(e){return!!(!e||e.disabled||typeof e.getAttribute=="function"&&e.getAttribute("aria-disabled")==="true"||typeof e.closest=="function"&&e.closest("[inert]"))}const $={};function G(e,t){$[e]=t}function Q(e){return $[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=G,window.lnCore.getDataMapper=Q);function P(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,_(function(){new MutationObserver(function(){A(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const M={};function J(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];M[n]=t}function z(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return M[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=J,window.lnCore.getLocaleFallback=z,window.lnCore.ensureLocaleObserver=P);const O={};function X(e,t){O[e]||(O[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=O[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function B(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let r=0;r<n.length;r++){const c=n[r],d=c.getAttribute("data-ln-field");t[d]!=null&&(c.textContent=t[d])}const o=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<o.length;r++){const c=o[r],d=c.getAttribute("data-ln-attr").split(",");for(let a=0;a<d.length;a++){const f=d[a].trim().split(":");if(f.length!==2)continue;const s=f[0].trim(),u=f[1].trim();t[u]!=null&&c.setAttribute(s,t[u])}}const l=e.querySelectorAll("[data-ln-show]");for(let r=0;r<l.length;r++){const c=l[r],d=c.getAttribute("data-ln-show");d in t&&c.classList.toggle("hidden",!t[d])}const i=e.querySelectorAll("[data-ln-class]");for(let r=0;r<i.length;r++){const c=i[r],d=c.getAttribute("data-ln-class").split(",");for(let a=0;a<d.length;a++){const f=d[a].trim().split(":");if(f.length!==2)continue;const s=f[0].trim(),u=f[1].trim();u in t&&c.classList.toggle(s,!!t[u])}}return e}function Y(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 o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)B(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 F(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,c){return t[c]!==void 0?t[c]:""}))}const o=function(i,r){return t[r]!==void 0?t[r]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let i=0;i<l.length;i++){const r=l[i],c=r.attributes;for(let d=0;d<c.length;d++){const a=c[d];a.value.indexOf("{{")!==-1&&r.setAttribute(a.name,a.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function Z(e,t,n,o,l,i){const r={};for(let d=0;d<e.children.length;d++){const a=e.children[d],f=a.getAttribute("data-ln-render-key");f&&(r[f]=a)}const c=document.createDocumentFragment();for(let d=0;d<t.length;d++){const a=t[d],f=String(o(a));let s=r[f];if(s)l(s,a,d);else{const u=X(n,i);if(!u||(F(u,a),s=u.firstElementChild,!s))continue;s.setAttribute("data-ln-render-key",f),l(s,a,d)}c.appendChild(s)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=F,window.lnCore.fill=B,window.lnCore.lnFill=Y,window.lnCore.renderList=Z);function N(e,t,n,o,l){if(!e||t===null)return!0;const i=o||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const c=d=>{l?console.warn(d,l):console.warn(d)};if(r==="boolean"){const d=t.trim().toLowerCase();return d!==""&&d!=="true"&&d!=="false"&&d!=="1"&&d!=="0"?(c(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const d=e.values||[];return d.includes(t)?!0:(c(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${d.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return c(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const d=parseInt(t,10);return e.min!==void 0&&d<e.min?(c(`[${i}] Value ${d} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&d>e.max?(c(`[${i}] Value ${d} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(c(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(d){return c(`[${i}] Invalid JSON for attribute "${n}": ${d.message}. Fallback: ${e.fallback}.`),!1}return!0}function ee(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function te(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}function E(e,t,n,o){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&r.push(e);for(const c of r)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(d){console.error("["+n+"] init failed",c,d)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ne(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function oe(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 W(){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 re(e){const t=W(),n=e.observed||[];for(let o=0;o<n.length;o++){const l=n[o];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const l=t.byDeclaredAttr.get(o);l.some(i=>i.componentTag===e.componentTag)||l.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=te(e);if(o===null)t.reactiveWildcard.push(e);else for(const l of o)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function j(e,t,n,o){for(let l=0;l<e.length;l++){const i=e[l];if(!t[i.attribute])continue;const r=i.effects&&i.effects[n];r?r(t,n,o):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,o)}}function ie(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=W(),l=o.byAttr.get(n);if(R()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&k(t)){const i=o.byDeclaredAttr.get(n),r=t.getAttribute(n);for(let c=0;c<i.length;c++)N(i[c].spec,r,n,i[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=o.byReactive.get(n);i&&j(i,t,n,e.oldValue),o.reactiveWildcard.length&&j(o.reactiveWildcard,t,n,e.oldValue)}if(l)for(let i=0;i<l.length;i++){const r=l[i];if(r.handler){r.handler(t,n,e.oldValue);continue}r.onAttributeChange&&t[r.attribute]?r.onAttributeChange(t,n):(E(t,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(t))}}function le(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,_(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ie(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function V(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function se(e){const t=V();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const l=o.query,i=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;i&&o.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l];E(o,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let l=0;l<t.length;l++){const i=t[l],r=i.query,c=Array.from(o.querySelectorAll(r));o.matches&&o.matches(r)&&c.push(o);for(let d=0;d<c.length;d++){const a=c[d];if(!document.contains(a)){const f=a[i.attribute];if(f&&typeof f.destroy=="function")try{f.destroy()}catch(s){console.error("["+i.attribute+"] destroy failed",a,s)}delete a[i.attribute]}}}}}}function de(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,_(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{se(o)}catch(l){console.error("[ln-core] lifecycle handler failed",o.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function ce(e,t,n,o,l={}){const i=l.extraAttributes||[],r=l.onAttributeChange||null,c=l.onSubtreeChange||null,d=l.onInit||null,a=l.onAttrChange||null,f=l.effects||null,s=l.attributes||null,u=s?ee(s):f,w=s?new Set(Object.keys(s)):null,b=l.persist||null;function p(C){const h=C||document.body;if(E(h,e,t,n),s&&R())for(const y in s){const ge=s[y],T=Array.from(h.querySelectorAll("["+y+"]"));h.matches&&h.matches("["+y+"]")&&T.push(h);for(let q=0;q<T.length;q++){const x=T[q];k(x)&&N(ge,x.getAttribute(y),y,o,x)}}d&&d(h)}const m=[];if(e.indexOf("[")!==-1){const C=/\[([\w-]+)/g;let h;for(;(h=C.exec(e))!==null;)m.push(h[1])}else m.push(e);re({selector:e,attribute:t,componentTag:o,attributes:s,ComponentFn:n,onInit:d,observed:m.concat(i),onAttributeChange:r,onAttrChange:a,effects:u,declared:w,persist:b}),le();const I=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";V().push({selector:e,attribute:t,ComponentFn:n,onInit:d,onSubtreeChange:c,query:I}),de(),window[t]=p;function g(){ne()>0?oe(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):g(),p}function H(e){return(e||"").replace(/^#/,"")}function L(e){const t=e===void 0?location.hash:e,n={},o=H(t);if(!o)return n;const l=o.split("&");for(let i=0;i<l.length;i++){const r=l[i];if(!r)continue;const c=r.indexOf(":"),d=c>-1?r.slice(0,c):r,a=c>-1?r.slice(c+1):"";if(d)try{n[d]=decodeURIComponent(a)}catch{n[d]=a}}return n}function ue(e){if(!e)return null;const t=L();return e in t?t[e]:null}function ae(e,t){if(!e)return;const n=L();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(i){const r=n[i];return r===""?i:i+":"+encodeURIComponent(r)}).join("&");H(location.hash)!==l&&(location.hash=l)}function fe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function we(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 o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function be(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function he(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 pe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function me(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),l=o?o.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=L,window.lnCore.hashGet=ue,window.lnCore.hashSet=ae,window.lnCore.hashLinkClick=fe,window.lnCore.resolveHashNamespace=we,window.lnCore.hashSortEncode=be,window.lnCore.hashSortDecode=he,window.lnCore.hashFilterEncode=pe,window.lnCore.hashFilterDecode=me),(function(){const e="data-ln-modal",t="lnModal",n="data-ln-modal-for",o="data-ln-modal-close";if(window[t]!==void 0)return;const l={"data-ln-modal":{type:"enum",values:["open","close"],fallback:"close",effect:f,description:"Control state of the modal dialog"},"data-ln-modal-for":{type:"string",description:"Target modal ID to open on trigger click"},"data-ln-modal-mode":{type:"enum",values:["new","edit"],fallback:"new",description:"Operational mode of the modal (new vs edit)"},"data-ln-modal-close":{type:"trigger",description:"Click dismiss trigger inside the modal"}},i=new Set;let r=null;function c(){r||(r=function(s){if(K(s))return;const u=s.target.closest("["+n+"]");if(!u||U(u))return;const w=u.getAttribute(n);if(!w)return;const b=document.getElementById(w);!b||!b[t]||(s.preventDefault(),u.hasAttribute("data-ln-modal-mode")?b.setAttribute("data-ln-modal-mode",u.getAttribute("data-ln-modal-mode")):b.hasAttribute("data-ln-modal-mode")&&b.setAttribute("data-ln-modal-mode","new"),b.setAttribute(e,"open"))},document.addEventListener("click",r))}function d(){i.size>0||!r||(document.removeEventListener("click",r),r=null)}function a(s){this.dom=s,this.isOpen=s.getAttribute(e)==="open";const u=this;return this._onRequestOpen=function(){u.dom.setAttribute(e,"open")},this._onRequestClose=function(){u.dom.setAttribute(e,"close")},this._onCancel=function(w){w.preventDefault(),u.dom.setAttribute(e,"close")},this._onClose=function(){!u.isOpen||u.dom.getAttribute(e)!=="open"||u.dom.open||(u._isNativeClosing=!0,u.dom.setAttribute(e,"close"))},this._onClickClose=function(w){const b=w.target.closest("["+o+"]");b&&u.dom.contains(b)&&(w.preventDefault(),u.dom.setAttribute(e,"close"))},this.dom.addEventListener("ln-modal:request-open",this._onRequestOpen),this.dom.addEventListener("ln-modal:request-close",this._onRequestClose),this.dom.addEventListener("cancel",this._onCancel),this.dom.addEventListener("close",this._onClose),this.dom.addEventListener("click",this._onClickClose),i.add(this),c(),this.isOpen&&(typeof this.dom.showModal=="function"&&this.dom.showModal(),document.body.classList.add("ln-modal-open"),A(this.dom,"ln-modal:open",{modalId:this.dom.id,target:this.dom})),this}a.prototype.open=function(){this.dom.setAttribute(e,"open")},a.prototype.close=function(){this.dom.setAttribute(e,"close")},a.prototype.toggle=function(){const s=this.dom.getAttribute(e);this.dom.setAttribute(e,s==="open"?"close":"open")},a.prototype.destroy=function(){if(this.dom[t]){if(this.dom.removeEventListener("ln-modal:request-open",this._onRequestOpen),this.dom.removeEventListener("ln-modal:request-close",this._onRequestClose),this.dom.removeEventListener("cancel",this._onCancel),this.dom.removeEventListener("close",this._onClose),this.dom.removeEventListener("click",this._onClickClose),i.delete(this),d(),this.isOpen){const s=this.dom;Array.prototype.some.call(document.querySelectorAll("["+e+'="open"]'),function(w){return w!==s})||document.body.classList.remove("ln-modal-open")}delete this.dom[t]}};function f(s){const u=s[t];if(!u)return;const w=!!u._isNativeClosing;u._isNativeClosing=!1;const p=s.getAttribute(e)==="open";if(p===u.isOpen){p&&s.isConnected&&!s.open&&typeof s.showModal=="function"&&s.showModal();return}if(p){if(D(s,"ln-modal:before-open",{modalId:s.id,target:s}).defaultPrevented){s.setAttribute(e,"close");return}u.isOpen=!0,document.body.classList.add("ln-modal-open"),typeof s.showModal=="function"&&s.showModal();const v=s.querySelector("[autofocus]");if(v&&S(v))v.focus();else{const I=s.querySelectorAll('input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled])'),g=Array.prototype.find.call(I,S);if(g)g.focus();else{const C=s.querySelectorAll("a[href], button:not([disabled])"),h=Array.prototype.find.call(C,S);h&&h.focus()}}A(s,"ln-modal:open",{modalId:s.id,target:s})}else{if(!w&&D(s,"ln-modal:before-close",{modalId:s.id,target:s}).defaultPrevented){s.setAttribute(e,"open");return}u.isOpen=!1,s.hasAttribute("data-ln-modal-mode")&&s.setAttribute("data-ln-modal-mode","new"),typeof s.close=="function"&&s.open&&s.close(),document.querySelector("["+e+'="open"]')||document.body.classList.remove("ln-modal-open"),A(s,"ln-modal:close",{modalId:s.id,target:s})}}ce(e,t,a,"ln-modal",{attributes:l})})()})();
@@ -46,7 +46,14 @@
46
46
  "sources": [
47
47
  "ln-modal.scss",
48
48
  "src/ln-modal.js"
49
- ]
49
+ ],
50
+ "type": "enum",
51
+ "values": [
52
+ "new",
53
+ "edit"
54
+ ],
55
+ "fallback": "new",
56
+ "description": "Operational mode of the modal (new vs edit)"
50
57
  },
51
58
  "data-ln-modal-when": {
52
59
  "direction": null,
@@ -21,6 +21,12 @@ import { registerComponent, dispatch, dispatchCancelable, isVisible, shouldIgnor
21
21
  type: 'string',
22
22
  description: 'Target modal ID to open on trigger click'
23
23
  },
24
+ 'data-ln-modal-mode': {
25
+ type: 'enum',
26
+ values: ['new', 'edit'],
27
+ fallback: 'new',
28
+ description: 'Operational mode of the modal (new vs edit)'
29
+ },
24
30
  'data-ln-modal-close': {
25
31
  type: 'trigger',
26
32
  description: 'Click dismiss trigger inside the modal'
@@ -41,12 +47,14 @@ import { registerComponent, dispatch, dispatchCancelable, isVisible, shouldIgnor
41
47
  const targetId = trigger.getAttribute(TRIGGER_ATTRIBUTE);
42
48
  if (!targetId) return;
43
49
 
44
- const target = document.getElementById(targetId) || document.querySelector('[' + DOM_SELECTOR + '="' + targetId + '"]');
50
+ const target = document.getElementById(targetId);
45
51
  if (!target || !target[DOM_ATTRIBUTE]) return;
46
52
 
47
53
  e.preventDefault();
48
54
  if (trigger.hasAttribute('data-ln-modal-mode')) {
49
55
  target.setAttribute('data-ln-modal-mode', trigger.getAttribute('data-ln-modal-mode'));
56
+ } else if (target.hasAttribute('data-ln-modal-mode')) {
57
+ target.setAttribute('data-ln-modal-mode', 'new');
50
58
  }
51
59
  target.setAttribute(DOM_SELECTOR, 'open');
52
60
  };
@@ -82,6 +90,13 @@ import { registerComponent, dispatch, dispatchCancelable, isVisible, shouldIgnor
82
90
  self.dom.setAttribute(DOM_SELECTOR, 'close');
83
91
  };
84
92
 
93
+ // Native dialog close synchronization (e.g. <form method="dialog"> or dialog.close())
94
+ this._onClose = function () {
95
+ if (!self.isOpen || self.dom.getAttribute(DOM_SELECTOR) !== 'open' || self.dom.open) return;
96
+ self._isNativeClosing = true;
97
+ self.dom.setAttribute(DOM_SELECTOR, 'close');
98
+ };
99
+
85
100
  // Dismiss trigger buttons inside modal [data-ln-modal-close]
86
101
  this._onClickClose = function (e) {
87
102
  const closeBtn = e.target.closest('[' + CLOSE_TRIGGER_ATTRIBUTE + ']');
@@ -94,6 +109,7 @@ import { registerComponent, dispatch, dispatchCancelable, isVisible, shouldIgnor
94
109
  this.dom.addEventListener('ln-modal:request-open', this._onRequestOpen);
95
110
  this.dom.addEventListener('ln-modal:request-close', this._onRequestClose);
96
111
  this.dom.addEventListener('cancel', this._onCancel);
112
+ this.dom.addEventListener('close', this._onClose);
97
113
  this.dom.addEventListener('click', this._onClickClose);
98
114
 
99
115
  instances.add(this);
@@ -128,6 +144,7 @@ import { registerComponent, dispatch, dispatchCancelable, isVisible, shouldIgnor
128
144
  this.dom.removeEventListener('ln-modal:request-open', this._onRequestOpen);
129
145
  this.dom.removeEventListener('ln-modal:request-close', this._onRequestClose);
130
146
  this.dom.removeEventListener('cancel', this._onCancel);
147
+ this.dom.removeEventListener('close', this._onClose);
131
148
  this.dom.removeEventListener('click', this._onClickClose);
132
149
 
133
150
  instances.delete(this);
@@ -153,10 +170,18 @@ import { registerComponent, dispatch, dispatchCancelable, isVisible, shouldIgnor
153
170
  const instance = el[DOM_ATTRIBUTE];
154
171
  if (!instance) return;
155
172
 
173
+ const isNativeClose = Boolean(instance._isNativeClosing);
174
+ instance._isNativeClosing = false;
175
+
156
176
  const value = el.getAttribute(DOM_SELECTOR);
157
177
  const shouldBeOpen = value === 'open';
158
178
 
159
- if (shouldBeOpen === instance.isOpen) return;
179
+ if (shouldBeOpen === instance.isOpen) {
180
+ if (shouldBeOpen && el.isConnected && !el.open && typeof el.showModal === 'function') {
181
+ el.showModal();
182
+ }
183
+ return;
184
+ }
160
185
 
161
186
  if (shouldBeOpen) {
162
187
  const before = dispatchCancelable(el, 'ln-modal:before-open', { modalId: el.id, target: el });
@@ -185,19 +210,25 @@ import { registerComponent, dispatch, dispatchCancelable, isVisible, shouldIgnor
185
210
 
186
211
  dispatch(el, 'ln-modal:open', { modalId: el.id, target: el });
187
212
  } else {
188
- const before = dispatchCancelable(el, 'ln-modal:before-close', { modalId: el.id, target: el });
189
- if (before.defaultPrevented) {
190
- el.setAttribute(DOM_SELECTOR, 'open');
191
- return;
213
+ if (!isNativeClose) {
214
+ const before = dispatchCancelable(el, 'ln-modal:before-close', { modalId: el.id, target: el });
215
+ if (before.defaultPrevented) {
216
+ el.setAttribute(DOM_SELECTOR, 'open');
217
+ return;
218
+ }
192
219
  }
193
220
  instance.isOpen = false;
194
- dispatch(el, 'ln-modal:close', { modalId: el.id, target: el });
221
+ if (el.hasAttribute('data-ln-modal-mode')) {
222
+ el.setAttribute('data-ln-modal-mode', 'new');
223
+ }
195
224
 
196
- if (typeof el.close === 'function') el.close();
225
+ if (typeof el.close === 'function' && el.open) el.close();
197
226
 
198
227
  if (!document.querySelector('[' + DOM_SELECTOR + '="open"]')) {
199
228
  document.body.classList.remove('ln-modal-open');
200
229
  }
230
+
231
+ dispatch(el, 'ln-modal:close', { modalId: el.id, target: el });
201
232
  }
202
233
  }
203
234
 
@@ -1 +1 @@
1
- (function(){"use strict";function D(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function m(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let r=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){r=t[o];break}if(!m(r))return}e.apply(console,t)}}function $(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 C(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}const F={};function V(e,t){F[e]=t}function H(e){return F[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=V,window.lnCore.getDataMapper=H);function U(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,C(function(){new MutationObserver(function(){$(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const T={};function Q(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];T[n]=t}function J(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=Q,window.lnCore.getLocaleFallback=J,window.lnCore.ensureLocaleObserver=U);const A={};function K(e,t){A[e]||(A[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=A[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function I(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const a=n[l],s=a.getAttribute("data-ln-field");t[s]!=null&&(a.textContent=t[s])}const r=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<r.length;l++){const a=r[l],s=a.getAttribute("data-ln-attr").split(",");for(let c=0;c<s.length;c++){const d=s[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();t[f]!=null&&a.setAttribute(u,t[f])}}const o=e.querySelectorAll("[data-ln-show]");for(let l=0;l<o.length;l++){const a=o[l],s=a.getAttribute("data-ln-show");s in t&&a.classList.toggle("hidden",!t[s])}const i=e.querySelectorAll("[data-ln-class]");for(let l=0;l<i.length;l++){const a=i[l],s=a.getAttribute("data-ln-class").split(",");for(let c=0;c<s.length;c++){const d=s[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();f in t&&a.classList.toggle(u,!!t[f])}}return e}function P(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)I(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 q(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,a){return t[a]!==void 0?t[a]:""}))}const r=function(i,l){return t[l]!==void 0?t[l]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let i=0;i<o.length;i++){const l=o[i],a=l.attributes;for(let s=0;s<a.length;s++){const c=a[s];c.value.indexOf("{{")!==-1&&l.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function G(e,t,n,r,o,i){const l={};for(let s=0;s<e.children.length;s++){const c=e.children[s],d=c.getAttribute("data-ln-render-key");d&&(l[d]=c)}const a=document.createDocumentFragment();for(let s=0;s<t.length;s++){const c=t[s],d=String(r(c));let u=l[d];if(u)o(u,c,s);else{const f=K(n,i);if(!f||(q(f,c),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),o(u,c,s)}a.appendChild(u)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=q,window.lnCore.fill=I,window.lnCore.lnFill=P,window.lnCore.renderList=G);function b(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function X(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function z(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 Y(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const _=new Map;function Z(e,t){const n=(e?e.join("|"):"")+"::"+t;if(_.has(n))return _.get(n);const r=new Set(e||[]),o=function(i,l){const a=i.getAttribute(l);return a!==null&&r.has(a)?a:t};return _.set(n,o),o}function ee(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function te(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function N(e,t,n,r,o){if(!e||t===null)return!0;const i=r||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const a=s=>{o?console.warn(s,o):console.warn(s)};if(l==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(a(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const s=e.values||[];return s.includes(t)?!0:(a(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return a(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(a(`[${i}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(a(`[${i}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(a(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(s){return a(`[${i}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function ne(e,t,n){for(const r in n){const[o,i,l]=n[r];Object.defineProperty(e,r,{get:function(){return o(t,i,l)},enumerable:!0,configurable:!0})}return e}function re(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=Z(r.values,r.fallback);break;case"integer":o=X;break;case"float":o=ee;break;case"boolean":o=z;break;case"list":o=Y;break;case"json":o=te;break;case"string":default:o=b;break}o||(o=b),t[r.prop]=[o,n,r.fallback]}return t}function oe(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 ie(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}function v(e,t,n,r){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&l.push(e);for(const a of l)if(!a[n]){window.lnCore._persistSink&&a.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(a,t);try{a[n]=new r(a)}catch(s){console.error("["+n+"] init failed",a,s)}}}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 se(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 R(){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 ae(e){const t=R(),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(i=>i.componentTag===e.componentTag)||o.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=ie(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 M(e,t,n,r){for(let o=0;o<e.length;o++){const i=e[o];if(!t[i.attribute])continue;const l=i.effects&&i.effects[n];l?l(t,n,r):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,r)}}function ce(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=R(),o=r.byAttr.get(n);if(D()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&m(t)){const i=r.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let a=0;a<i.length;a++)N(i[a].spec,l,n,i[a].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||o)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=r.byReactive.get(n);i&&M(i,t,n,e.oldValue),r.reactiveWildcard.length&&M(r.reactiveWildcard,t,n,e.oldValue)}if(o)for(let i=0;i<o.length;i++){const l=o[i];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(v(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function ue(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,C(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ce(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 B(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function de(e){const t=B();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange){const o=r.query,i=e.target.nodeType===1?e.target.matches(o)?e.target:e.target.closest(o):e.target.parentElement?e.target.parentElement.closest(o):null;i&&r.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1)for(let o=0;o<t.length;o++){const i=t[o];v(r,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(r)}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1)for(let o=0;o<t.length;o++){const i=t[o],l=i.query,a=Array.from(r.querySelectorAll(l));r.matches&&r.matches(l)&&a.push(r);for(let s=0;s<a.length;s++){const c=a[s];if(!document.contains(c)){const d=c[i.attribute];if(d&&typeof d.destroy=="function")try{d.destroy()}catch(u){console.error("["+i.attribute+"] destroy failed",c,u)}delete c[i.attribute]}}}}}}function fe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,C(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{de(r)}catch(o){console.error("[ln-core] lifecycle handler failed",r.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function we(e,t,n,r,o={}){const i=o.extraAttributes||[],l=o.onAttributeChange||null,a=o.onSubtreeChange||null,s=o.onInit||null,c=o.onAttrChange||null,d=o.effects||null,u=o.attributes||null,f=u?oe(u):d,h=u?new Set(Object.keys(u)):null,p=o.persist||null;function y(O){const w=O||document.body;if(v(w,e,t,n),u&&D())for(const g in u){const ve=u[g],x=Array.from(w.querySelectorAll("["+g+"]"));w.matches&&w.matches("["+g+"]")&&x.push(w);for(let E=0;E<x.length;E++){const L=x[E];m(L)&&N(ve,L.getAttribute(g),g,r,L)}}s&&s(w)}const k=[];if(e.indexOf("[")!==-1){const O=/\[([\w-]+)/g;let w;for(;(w=O.exec(e))!==null;)k.push(w[1])}else k.push(e);ae({selector:e,attribute:t,componentTag:r,attributes:u,ComponentFn:n,onInit:s,observed:k.concat(i),onAttributeChange:l,onAttrChange:c,effects:f,declared:h,persist:p}),ue();const _e=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";B().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:a,query:_e}),fe(),window[t]=y;function W(){le()>0?se(function(){y(document.body)}):y(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",W):W(),y}function j(e){return(e||"").replace(/^#/,"")}function S(e){const t=e===void 0?location.hash:e,n={},r=j(t);if(!r)return n;const o=r.split("&");for(let i=0;i<o.length;i++){const l=o[i];if(!l)continue;const a=l.indexOf(":"),s=a>-1?l.slice(0,a):l,c=a>-1?l.slice(a+1):"";if(s)try{n[s]=decodeURIComponent(c)}catch{n[s]=c}}return n}function be(e){if(!e)return null;const t=S();return e in t?t[e]:null}function he(e,t){if(!e)return;const n=S();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(i){const l=n[i];return l===""?i:i+":"+encodeURIComponent(l)}).join("&");j(location.hash)!==o&&(location.hash=o)}function pe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ge(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 Ce(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ye(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 me(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ae(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(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=S,window.lnCore.hashGet=be,window.lnCore.hashSet=he,window.lnCore.hashLinkClick=pe,window.lnCore.resolveHashNamespace=ge,window.lnCore.hashSortEncode=Ce,window.lnCore.hashSortDecode=ye,window.lnCore.hashFilterEncode=me,window.lnCore.hashFilterDecode=Ae),(function(){const e="data-ln-options",t="lnOptions";if(window[t]!==void 0)return;const n={"data-ln-options":{prop:"_storeName",type:"string",read:b,fallback:"",description:"Store or coordinator addressing to populate options from"},"data-ln-options-value":{prop:"_valueField",type:"string",read:b,fallback:"id",description:"Field name used for option value attribute"},"data-ln-options-label":{prop:"_labelField",type:"string",read:b,fallback:"name",description:"Field name used for option visible label text"}},r=re(n);function o(i){this.dom=i,ne(this,i,r);const l=this;return this._onSetData=function(a){l._rebuild(a.detail.data||[])},i.addEventListener("ln-options:set-data",this._onSetData),$(i,"ln-options:request-data",{options:this._storeName}),this}o.prototype._rebuild=function(i){const l=this.dom,a=this._valueField,s=this._labelField,c=l.value,d=l.querySelectorAll("option");for(let f=d.length-1;f>=0;f--)d[f].value!==""&&l.removeChild(d[f]);for(let f=0;f<i.length;f++){const h=i[f],p=document.createElement("option");p.value=String(h[a]),p.textContent=h[s]!=null?h[s]:"",l.appendChild(p)}const u=l.options;for(let f=0;f<u.length;f++)if(u[f].value===c){l.value=c;break}},o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-options:set-data",this._onSetData),delete this.dom[t])},we(e,t,o,"ln-options",{attributes:n})})()})();
1
+ (function(){"use strict";function D(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function m(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let r=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){r=t[o];break}if(!m(r))return}e.apply(console,t)}}function $(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 C(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){C(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}const F={};function V(e,t){F[e]=t}function H(e){return F[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=V,window.lnCore.getDataMapper=H);function U(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,C(function(){new MutationObserver(function(){$(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const T={};function Q(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];T[n]=t}function J(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=Q,window.lnCore.getLocaleFallback=J,window.lnCore.ensureLocaleObserver=U);const A={};function K(e,t){A[e]||(A[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=A[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function I(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const a=n[l],s=a.getAttribute("data-ln-field");t[s]!=null&&(a.textContent=t[s])}const r=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<r.length;l++){const a=r[l],s=a.getAttribute("data-ln-attr").split(",");for(let c=0;c<s.length;c++){const d=s[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();t[f]!=null&&a.setAttribute(u,t[f])}}const o=e.querySelectorAll("[data-ln-show]");for(let l=0;l<o.length;l++){const a=o[l],s=a.getAttribute("data-ln-show");s in t&&a.classList.toggle("hidden",!t[s])}const i=e.querySelectorAll("[data-ln-class]");for(let l=0;l<i.length;l++){const a=i[l],s=a.getAttribute("data-ln-class").split(",");for(let c=0;c<s.length;c++){const d=s[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();f in t&&a.classList.toggle(u,!!t[f])}}return e}function P(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)I(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 q(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,a){return t[a]!==void 0?t[a]:""}))}const r=function(i,l){return t[l]!==void 0?t[l]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let i=0;i<o.length;i++){const l=o[i],a=l.attributes;for(let s=0;s<a.length;s++){const c=a[s];c.value.indexOf("{{")!==-1&&l.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function G(e,t,n,r,o,i){const l={};for(let s=0;s<e.children.length;s++){const c=e.children[s],d=c.getAttribute("data-ln-render-key");d&&(l[d]=c)}const a=document.createDocumentFragment();for(let s=0;s<t.length;s++){const c=t[s],d=String(r(c));let u=l[d];if(u)o(u,c,s);else{const f=K(n,i);if(!f||(q(f,c),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),o(u,c,s)}a.appendChild(u)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=q,window.lnCore.fill=I,window.lnCore.lnFill=P,window.lnCore.renderList=G);function b(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function X(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function z(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 Y(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const _=new Map;function Z(e,t){const n=(e?e.join("|"):"")+"::"+t;if(_.has(n))return _.get(n);const r=new Set(e||[]),o=function(i,l){const a=i.getAttribute(l);return a!==null&&r.has(a)?a:t};return _.set(n,o),o}function ee(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function te(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function N(e,t,n,r,o){if(!e||t===null)return!0;const i=r||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const a=s=>{o?console.warn(s,o):console.warn(s)};if(l==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(a(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const s=e.values||[];return s.includes(t)?!0:(a(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return a(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(a(`[${i}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(a(`[${i}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(a(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(s){return a(`[${i}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function ne(e,t,n){for(const r in n){const[o,i,l]=n[r];Object.defineProperty(e,r,{get:function(){return o(t,i,l)},enumerable:!0,configurable:!0})}return e}function re(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=Z(r.values,r.fallback);break;case"integer":o=X;break;case"float":o=ee;break;case"boolean":o=z;break;case"list":o=Y;break;case"json":o=te;break;case"string":default:o=b;break}o||(o=b),t[r.prop]=[o,n,r.fallback]}return t}function oe(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 ie(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}function v(e,t,n,r){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&l.push(e);for(const a of l)if(!a[n]){window.lnCore._persistSink&&a.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(a,t);try{a[n]=new r(a)}catch(s){console.error("["+n+"] init failed",a,s)}}}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 se(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 R(){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 ae(e){const t=R(),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(i=>i.componentTag===e.componentTag)||o.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=ie(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 M(e,t,n,r){for(let o=0;o<e.length;o++){const i=e[o];if(!t[i.attribute])continue;const l=i.effects&&i.effects[n];l?l(t,n,r):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,r)}}function ce(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=R(),o=r.byAttr.get(n);if(D()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&m(t)){const i=r.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let a=0;a<i.length;a++)N(i[a].spec,l,n,i[a].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||o)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=r.byReactive.get(n);i&&M(i,t,n,e.oldValue),r.reactiveWildcard.length&&M(r.reactiveWildcard,t,n,e.oldValue)}if(o)for(let i=0;i<o.length;i++){const l=o[i];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(v(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function ue(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,C(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ce(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 B(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function de(e){const t=B();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange){const o=r.query,i=e.target.nodeType===1?e.target.matches(o)?e.target:e.target.closest(o):e.target.parentElement?e.target.parentElement.closest(o):null;i&&r.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1)for(let o=0;o<t.length;o++){const i=t[o];v(r,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(r)}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1)for(let o=0;o<t.length;o++){const i=t[o],l=i.query,a=Array.from(r.querySelectorAll(l));r.matches&&r.matches(l)&&a.push(r);for(let s=0;s<a.length;s++){const c=a[s];if(!document.contains(c)){const d=c[i.attribute];if(d&&typeof d.destroy=="function")try{d.destroy()}catch(u){console.error("["+i.attribute+"] destroy failed",c,u)}delete c[i.attribute]}}}}}}function fe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,C(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{de(r)}catch(o){console.error("[ln-core] lifecycle handler failed",r.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function we(e,t,n,r,o={}){const i=o.extraAttributes||[],l=o.onAttributeChange||null,a=o.onSubtreeChange||null,s=o.onInit||null,c=o.onAttrChange||null,d=o.effects||null,u=o.attributes||null,f=u?oe(u):d,h=u?new Set(Object.keys(u)):null,p=o.persist||null;function y(O){const w=O||document.body;if(v(w,e,t,n),u&&D())for(const g in u){const ve=u[g],x=Array.from(w.querySelectorAll("["+g+"]"));w.matches&&w.matches("["+g+"]")&&x.push(w);for(let E=0;E<x.length;E++){const L=x[E];m(L)&&N(ve,L.getAttribute(g),g,r,L)}}s&&s(w)}const k=[];if(e.indexOf("[")!==-1){const O=/\[([\w-]+)/g;let w;for(;(w=O.exec(e))!==null;)k.push(w[1])}else k.push(e);ae({selector:e,attribute:t,componentTag:r,attributes:u,ComponentFn:n,onInit:s,observed:k.concat(i),onAttributeChange:l,onAttrChange:c,effects:f,declared:h,persist:p}),ue();const _e=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";B().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:a,query:_e}),fe(),window[t]=y;function W(){le()>0?se(function(){y(document.body)}):y(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",W):W(),y}function j(e){return(e||"").replace(/^#/,"")}function S(e){const t=e===void 0?location.hash:e,n={},r=j(t);if(!r)return n;const o=r.split("&");for(let i=0;i<o.length;i++){const l=o[i];if(!l)continue;const a=l.indexOf(":"),s=a>-1?l.slice(0,a):l,c=a>-1?l.slice(a+1):"";if(s)try{n[s]=decodeURIComponent(c)}catch{n[s]=c}}return n}function be(e){if(!e)return null;const t=S();return e in t?t[e]:null}function he(e,t){if(!e)return;const n=S();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(i){const l=n[i];return l===""?i:i+":"+encodeURIComponent(l)}).join("&");j(location.hash)!==o&&(location.hash=o)}function pe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ge(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 Ce(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ye(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 me(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ae(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(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=S,window.lnCore.hashGet=be,window.lnCore.hashSet=he,window.lnCore.hashLinkClick=pe,window.lnCore.resolveHashNamespace=ge,window.lnCore.hashSortEncode=Ce,window.lnCore.hashSortDecode=ye,window.lnCore.hashFilterEncode=me,window.lnCore.hashFilterDecode=Ae),(function(){const e="data-ln-options",t="lnOptions";if(window[t]!==void 0)return;const n={"data-ln-options":{prop:"_storeName",type:"string",read:b,fallback:"",description:"Store or coordinator addressing to populate options from"},"data-ln-options-value":{prop:"_valueField",type:"string",read:b,fallback:"id",description:"Field name used for option value attribute"},"data-ln-options-label":{prop:"_labelField",type:"string",read:b,fallback:"name",description:"Field name used for option visible label text"}},r=re(n);function o(i){this.dom=i,ne(this,i,r);const l=this;return this._onSetData=function(a){a.detail&&l._rebuild(a.detail.data||[])},i.addEventListener("ln-options:set-data",this._onSetData),$(i,"ln-options:request-data",{options:this._storeName}),this}o.prototype._rebuild=function(i){const l=this.dom,a=this._valueField,s=this._labelField,c=l.value,d=l.querySelectorAll("option");for(let f=d.length-1;f>=0;f--)d[f].value!==""&&l.removeChild(d[f]);for(let f=0;f<i.length;f++){const h=i[f],p=document.createElement("option");p.value=String(h[a]),p.textContent=h[s]!=null?h[s]:"",l.appendChild(p)}const u=l.options;for(let f=0;f<u.length;f++)if(u[f].value===c){l.value=c;break}},o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-options:set-data",this._onSetData),delete this.dom[t])},we(e,t,o,"ln-options",{attributes:n})})()})();
@@ -23,6 +23,7 @@ import { registerComponent, dispatch, defineAttrs, attrSpec, attrStr } from '../
23
23
  const self = this;
24
24
 
25
25
  this._onSetData = function (e) {
26
+ if (!e.detail) return;
26
27
  self._rebuild(e.detail.data || []);
27
28
  };
28
29
  dom.addEventListener('ln-options:set-data', this._onSetData);
@@ -149,6 +149,10 @@ Set `isOpen = true`, store `trigger` (`null` if opened via direct attribute muta
149
149
 
150
150
  Clears `isOpen`, removes the outside-click/scroll/resize listeners, clears inline `top`/`left` and the placement attribute, sets `aria-expanded="false"`, exits the top layer via `hidePopover()`, splices itself from `openStack` (removing the ESC listener if the stack is now empty), then restores focus to the trigger **only if** the trigger was the previously-focused element (click→Escape, click→programmatic close) or `activeElement === document.body` (Escape from inside the popover, outside-click on inert whitespace) — an outside-click landing on another focusable element keeps that element's focus. Dispatches `ln-popover:close`.
151
151
 
152
+ ### Native Popover API Light Dismiss Synchronization
153
+
154
+ The component attaches a native `toggle` event listener to the popover element. When the browser closes the popover via native light dismiss (`e.newState === 'closed'`), `ln-popover` detects this change and immediately runs `_applyClose()` and updates `data-ln-popover="closed"`. This prevents state desynchronization without firing an impossible cancelable `before-close` event (the browser has already completed the closing operation).
155
+
152
156
  ### Focus management
153
157
 
154
158
  A disclosure pattern, not a modal — no Tab trap. Because the popover is promoted to the top layer purely for rendering, it remains in its authored DOM position, so Tab order follows the markup rather than jumping to the end of `<body>`. `tabindex="-1"` and `role="dialog"` are set automatically at construction so the container itself is a valid focus target when there's no focusable child.
@@ -1 +1 @@
1
- (function(){"use strict";function D(){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 k(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){o=t[s];break}if(!k(o))return}e.apply(console,t)}}function O(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function R(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o);const s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:o});return e.dispatchEvent(s),s}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function U(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}const I={};function Q(e,t){I[e]=t}function G(e){return I[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=Q,window.lnCore.getDataMapper=G);function z(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){O(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function J(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];$[n]=t}function X(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=J,window.lnCore.getLocaleFallback=X,window.lnCore.ensureLocaleObserver=z);const E={};function Y(e,t){E[e]||(E[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=E[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function F(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let r=0;r<n.length;r++){const u=n[r],l=u.getAttribute("data-ln-field");t[l]!=null&&(u.textContent=t[l])}const o=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<o.length;r++){const u=o[r],l=u.getAttribute("data-ln-attr").split(",");for(let d=0;d<l.length;d++){const p=l[d].trim().split(":");if(p.length!==2)continue;const f=p[0].trim(),c=p[1].trim();t[c]!=null&&u.setAttribute(f,t[c])}}const s=e.querySelectorAll("[data-ln-show]");for(let r=0;r<s.length;r++){const u=s[r],l=u.getAttribute("data-ln-show");l in t&&u.classList.toggle("hidden",!t[l])}const i=e.querySelectorAll("[data-ln-class]");for(let r=0;r<i.length;r++){const u=i[r],l=u.getAttribute("data-ln-class").split(",");for(let d=0;d<l.length;d++){const p=l[d].trim().split(":");if(p.length!==2)continue;const f=p[0].trim(),c=p[1].trim();c in t&&u.classList.toggle(f,!!t[c])}}return e}function Z(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 o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)F(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 B(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,u){return t[u]!==void 0?t[u]:""}))}const o=function(i,r){return t[r]!==void 0?t[r]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let i=0;i<s.length;i++){const r=s[i],u=r.attributes;for(let l=0;l<u.length;l++){const d=u[l];d.value.indexOf("{{")!==-1&&r.setAttribute(d.name,d.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function ee(e,t,n,o,s,i){const r={};for(let l=0;l<e.children.length;l++){const d=e.children[l],p=d.getAttribute("data-ln-render-key");p&&(r[p]=d)}const u=document.createDocumentFragment();for(let l=0;l<t.length;l++){const d=t[l],p=String(o(d));let f=r[p];if(f)s(f,d,l);else{const c=Y(n,i);if(!c||(B(c,d),f=c.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",p),s(f,d,l)}u.appendChild(f)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=B,window.lnCore.fill=F,window.lnCore.lnFill=Z,window.lnCore.renderList=ee);function M(e,t,n,o,s){if(!e||t===null)return!0;const i=o||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const u=l=>{s?console.warn(l,s):console.warn(l)};if(r==="boolean"){const l=t.trim().toLowerCase();return l!==""&&l!=="true"&&l!=="false"&&l!=="1"&&l!=="0"?(u(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const l=e.values||[];return l.includes(t)?!0:(u(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${l.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return u(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const l=parseInt(t,10);return e.min!==void 0&&l<e.min?(u(`[${i}] Value ${l} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&l>e.max?(u(`[${i}] Value ${l} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(u(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(l){return u(`[${i}] Invalid JSON for attribute "${n}": ${l.message}. Fallback: ${e.fallback}.`),!1}return!0}function te(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function ne(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}function S(e,t,n,o){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&r.push(e);for(const u of r)if(!u[n]){window.lnCore._persistSink&&u.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(u,t);try{u[n]=new o(u)}catch(l){console.error("["+n+"] init failed",u,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 ie(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 W(){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 re(e){const t=W(),n=e.observed||[];for(let o=0;o<n.length;o++){const s=n[o];t.byAttr.has(s)||t.byAttr.set(s,[]),t.byAttr.get(s).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const s=t.byDeclaredAttr.get(o);s.some(i=>i.componentTag===e.componentTag)||s.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ne(e);if(o===null)t.reactiveWildcard.push(e);else for(const s of o)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function j(e,t,n,o){for(let s=0;s<e.length;s++){const i=e[s];if(!t[i.attribute])continue;const r=i.effects&&i.effects[n];r?r(t,n,o):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,o)}}function se(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=W(),s=o.byAttr.get(n);if(D()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&k(t)){const i=o.byDeclaredAttr.get(n),r=t.getAttribute(n);for(let u=0;u<i.length;u++)M(i[u].spec,r,n,i[u].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||s)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=o.byReactive.get(n);i&&j(i,t,n,e.oldValue),o.reactiveWildcard.length&&j(o.reactiveWildcard,t,n,e.oldValue)}if(s)for(let i=0;i<s.length;i++){const r=s[i];if(r.handler){r.handler(t,n,e.oldValue);continue}r.onAttributeChange&&t[r.attribute]?r.onAttributeChange(t,n):(S(t,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(t))}}function le(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{se(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function H(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function ue(e){const t=H();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const s=o.query,i=e.target.nodeType===1?e.target.matches(s)?e.target:e.target.closest(s):e.target.parentElement?e.target.parentElement.closest(s):null;i&&o.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let s=0;s<t.length;s++){const i=t[s];S(o,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let s=0;s<t.length;s++){const i=t[s],r=i.query,u=Array.from(o.querySelectorAll(r));o.matches&&o.matches(r)&&u.push(o);for(let l=0;l<u.length;l++){const d=u[l];if(!document.contains(d)){const p=d[i.attribute];if(p&&typeof p.destroy=="function")try{p.destroy()}catch(f){console.error("["+i.attribute+"] destroy failed",d,f)}delete d[i.attribute]}}}}}}function ce(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{ue(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function N(e,t,n,o,s={}){const i=s.extraAttributes||[],r=s.onAttributeChange||null,u=s.onSubtreeChange||null,l=s.onInit||null,d=s.onAttrChange||null,p=s.effects||null,f=s.attributes||null,c=f?te(f):p,g=f?new Set(Object.keys(f)):null,w=s.persist||null;function b(m){const C=m||document.body;if(S(C,e,t,n),f&&D())for(const _ in f){const me=f[_],L=Array.from(C.querySelectorAll("["+_+"]"));C.matches&&C.matches("["+_+"]")&&L.push(C);for(let T=0;T<L.length;T++){const q=L[T];k(q)&&M(me,q.getAttribute(_),_,o,q)}}l&&l(C)}const a=[];if(e.indexOf("[")!==-1){const m=/\[([\w-]+)/g;let C;for(;(C=m.exec(e))!==null;)a.push(C[1])}else a.push(e);re({selector:e,attribute:t,componentTag:o,attributes:f,ComponentFn:n,onInit:l,observed:a.concat(i),onAttributeChange:r,onAttrChange:d,effects:c,declared:g,persist:w}),le();const v=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";H().push({selector:e,attribute:t,ComponentFn:n,onInit:l,onSubtreeChange:u,query:v}),ce(),window[t]=b;function h(){oe()>0?ie(function(){b(document.body)}):b(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",h):h(),b}function P(e){return(e||"").replace(/^#/,"")}function x(e){const t=e===void 0?location.hash:e,n={},o=P(t);if(!o)return n;const s=o.split("&");for(let i=0;i<s.length;i++){const r=s[i];if(!r)continue;const u=r.indexOf(":"),l=u>-1?r.slice(0,u):r,d=u>-1?r.slice(u+1):"";if(l)try{n[l]=decodeURIComponent(d)}catch{n[l]=d}}return n}function de(e){if(!e)return null;const t=x();return e in t?t[e]:null}function fe(e,t){if(!e)return;const n=x();t==null?delete n[e]:n[e]=String(t);const s=Object.keys(n).map(function(i){const r=n[i];return r===""?i:i+":"+encodeURIComponent(r)}).join("&");P(location.hash)!==s&&(location.hash=s)}function ae(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function pe(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 o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function he(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ge(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function be(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function we(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),s=o?o.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=x,window.lnCore.hashGet=de,window.lnCore.hashSet=fe,window.lnCore.hashLinkClick=ae,window.lnCore.resolveHashNamespace=pe,window.lnCore.hashSortEncode=he,window.lnCore.hashSortDecode=ge,window.lnCore.hashFilterEncode=be,window.lnCore.hashFilterDecode=we);function V(e,t,n,o){const s=o,i=window.innerWidth,r=window.innerHeight,u=t.width,l=t.height,d=(n||"bottom").split("-"),p=d[0],f=d[1]==="start"||d[1]==="end"?d[1]:"center",c={top:["top","bottom","right","left"],bottom:["bottom","top","right","left"],left:["left","right","top","bottom"],right:["right","left","top","bottom"]},g=c[p]||c.bottom;function w(h){return h==="top"||h==="bottom"?f==="start"?e.left:f==="end"?e.right-u:e.left+(e.width-u)/2:f==="start"?e.top:f==="end"?e.bottom-l:e.top+(e.height-l)/2}function b(h){let m,C,_=!0;return h==="top"?(m=e.top-s-l,C=w(h),m<0&&(_=!1)):h==="bottom"?(m=e.bottom+s,C=w(h),m+l>r&&(_=!1)):h==="left"?(m=w(h),C=e.left-s-u,C<0&&(_=!1)):(m=w(h),C=e.right+s,C+u>i&&(_=!1)),{top:m,left:C,side:h,fits:_}}let a=null;for(let h=0;h<g.length;h++){const m=b(g[h]);if(m.fits){a=m;break}}a||(a=b(g[0]));let y=a.top,v=a.left;return u>=i?v=0:(v<0&&(v=0),v+u>i&&(v=i-u)),l>=r?y=0:(y<0&&(y=0),y+l>r&&(y=r-l)),{top:y,left:v,placement:a.side}}function K(e){if(!e)return{width:0,height:0};const t=e.style,n=t.visibility,o=t.display,s=t.position;t.visibility="hidden",t.display="block",t.position="fixed";const i=e.offsetWidth,r=e.offsetHeight;return t.visibility=n,t.display=o,t.position=s,{width:i,height:r}}(function(){const e="data-ln-popover",t="lnPopover",n="data-ln-popover-for",o="data-ln-popover-position";if(window[t]!==void 0)return;const s={"data-ln-popover":{type:"enum",values:["open","close"],fallback:"close",effect:f,description:"Control state of the popover"},"data-ln-popover-for":{type:"string",description:"Target element ID that this trigger controls"},"data-ln-popover-position":{type:"enum",values:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],fallback:"bottom",description:"Preferred positioning anchor"},"data-ln-popover-placement":{type:"enum",values:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],description:"Active calculated placement applied at runtime"}},i=[];let r=null;function u(){r||(r=function(c){if(c.key!=="Escape"||i.length===0)return;i[i.length-1].close()},document.addEventListener("keydown",r))}function l(){i.length>0||r&&(document.removeEventListener("keydown",r),r=null)}function d(c){this.dom=c,this.isOpen=c.getAttribute(e)==="open",this.trigger=null,this._previousFocus=null,this._boundDocClick=null,this._docClickTimeout=null,this._boundReposition=null;const g=this;return this._onRequestOpen=function(w){const b=w.detail&&w.detail.trigger?w.detail.trigger:null;g.open(b)},this._onRequestClose=function(){g.close()},this._onRequestToggle=function(w){const b=w.detail&&w.detail.trigger?w.detail.trigger:null;g.toggle(b)},c.addEventListener("ln-popover:request-open",this._onRequestOpen),c.addEventListener("ln-popover:request-close",this._onRequestClose),c.addEventListener("ln-popover:request-toggle",this._onRequestToggle),c.hasAttribute("tabindex")||c.setAttribute("tabindex","-1"),c.hasAttribute("role")||c.setAttribute("role","dialog"),c.hasAttribute("popover")||c.setAttribute("popover","manual"),this.isOpen&&this._applyOpen(null),this}d.prototype.open=function(c){this.isOpen||(this.trigger=c||null,this.dom.setAttribute(e,"open"))},d.prototype.close=function(){this.isOpen&&this.dom.setAttribute(e,"closed")},d.prototype.toggle=function(c){this.isOpen?this.close():this.open(c)},d.prototype._applyOpen=function(c){this.isOpen=!0,c&&(this.trigger=c),this._previousFocus=document.activeElement,typeof this.dom.showPopover=="function"&&this.dom.showPopover();const g=K(this.dom);if(this.trigger){const y=this.trigger.getBoundingClientRect(),v=this.dom.getAttribute(o)||"bottom",h=V(y,g,v,8);this.dom.style.top=h.top+"px",this.dom.style.left=h.left+"px",this.dom.setAttribute("data-ln-popover-placement",h.placement),this.trigger.setAttribute("aria-expanded","true")}const w=this.dom.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),b=Array.prototype.find.call(w,U);b?b.focus():this.dom.focus();const a=this;this._boundDocClick=function(y){a.dom.contains(y.target)||a.trigger&&a.trigger.contains(y.target)||a.close()},a._docClickTimeout=setTimeout(function(){a._docClickTimeout=null,document.addEventListener("click",a._boundDocClick)},0),this._boundReposition=function(){if(!a.trigger)return;const y=a.trigger.getBoundingClientRect(),v=K(a.dom),h=a.dom.getAttribute(o)||"bottom",m=V(y,v,h,8);a.dom.style.top=m.top+"px",a.dom.style.left=m.left+"px",a.dom.setAttribute("data-ln-popover-placement",m.placement)},window.addEventListener("scroll",this._boundReposition,{passive:!0,capture:!0}),window.addEventListener("resize",this._boundReposition),i.push(this),u(),O(this.dom,"ln-popover:open",{popoverId:this.dom.id,target:this.dom,trigger:this.trigger})},d.prototype._applyClose=function(){this.isOpen=!1,this._docClickTimeout&&(clearTimeout(this._docClickTimeout),this._docClickTimeout=null),this._boundDocClick&&(document.removeEventListener("click",this._boundDocClick),this._boundDocClick=null),this._boundReposition&&(window.removeEventListener("scroll",this._boundReposition,{capture:!0}),window.removeEventListener("resize",this._boundReposition),this._boundReposition=null),this.dom.style.top="",this.dom.style.left="",this.dom.removeAttribute("data-ln-popover-placement"),this.trigger&&this.trigger.setAttribute("aria-expanded","false"),typeof this.dom.hidePopover=="function"&&this.dom.matches(":popover-open")&&this.dom.hidePopover();const c=i.indexOf(this);c!==-1&&i.splice(c,1),l(),this._previousFocus&&this.trigger&&this._previousFocus===this.trigger?this.trigger.focus():this.trigger&&document.activeElement===document.body&&this.trigger.focus(),this._previousFocus=null,O(this.dom,"ln-popover:close",{popoverId:this.dom.id,target:this.dom,trigger:this.trigger}),this.trigger=null},d.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-popover:request-open",this._onRequestOpen),this.dom.removeEventListener("ln-popover:request-close",this._onRequestClose),this.dom.removeEventListener("ln-popover:request-toggle",this._onRequestToggle),this.isOpen&&this._applyClose(),delete this.dom[t])};function p(c){this.dom=c;const g=c.getAttribute(n);return c.setAttribute("aria-haspopup","dialog"),c.setAttribute("aria-expanded","false"),c.setAttribute("aria-controls",g),this._onClick=function(w){if(w.ctrlKey||w.metaKey||w.button===1)return;w.preventDefault();const b=document.getElementById(g);if(!b)return;b[t]&&(b[t].trigger=c);const a=b.getAttribute(e);b.setAttribute(e,a==="open"?"closed":"open")},c.addEventListener("click",this._onClick),this}p.prototype.destroy=function(){this.dom.removeEventListener("click",this._onClick),delete this.dom[t+"Trigger"]};function f(c){const g=c[t];if(!g)return;const b=c.getAttribute(e)==="open";if(b!==g.isOpen)if(b){if(R(c,"ln-popover:before-open",{popoverId:c.id,target:c,trigger:g.trigger}).defaultPrevented){c.setAttribute(e,"closed");return}g._applyOpen(g.trigger)}else{if(R(c,"ln-popover:before-close",{popoverId:c.id,target:c,trigger:g.trigger}).defaultPrevented){c.setAttribute(e,"open");return}g._applyClose()}}N(e,t,d,"ln-popover",{attributes:s}),N(n,t+"Trigger",p,"ln-popover-trigger")})()})();
1
+ (function(){"use strict";function D(){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 k(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){o=t[s];break}if(!k(o))return}e.apply(console,t)}}function O(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function R(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o);const s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:o});return e.dispatchEvent(s),s}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function U(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}const I={};function Q(e,t){I[e]=t}function G(e){return I[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=Q,window.lnCore.getDataMapper=G);function z(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){O(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function J(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];$[n]=t}function X(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=J,window.lnCore.getLocaleFallback=X,window.lnCore.ensureLocaleObserver=z);const E={};function Y(e,t){E[e]||(E[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=E[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function F(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let r=0;r<n.length;r++){const u=n[r],l=u.getAttribute("data-ln-field");t[l]!=null&&(u.textContent=t[l])}const o=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<o.length;r++){const u=o[r],l=u.getAttribute("data-ln-attr").split(",");for(let d=0;d<l.length;d++){const h=l[d].trim().split(":");if(h.length!==2)continue;const f=h[0].trim(),c=h[1].trim();t[c]!=null&&u.setAttribute(f,t[c])}}const s=e.querySelectorAll("[data-ln-show]");for(let r=0;r<s.length;r++){const u=s[r],l=u.getAttribute("data-ln-show");l in t&&u.classList.toggle("hidden",!t[l])}const i=e.querySelectorAll("[data-ln-class]");for(let r=0;r<i.length;r++){const u=i[r],l=u.getAttribute("data-ln-class").split(",");for(let d=0;d<l.length;d++){const h=l[d].trim().split(":");if(h.length!==2)continue;const f=h[0].trim(),c=h[1].trim();c in t&&u.classList.toggle(f,!!t[c])}}return e}function Z(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 o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)F(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 B(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,u){return t[u]!==void 0?t[u]:""}))}const o=function(i,r){return t[r]!==void 0?t[r]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let i=0;i<s.length;i++){const r=s[i],u=r.attributes;for(let l=0;l<u.length;l++){const d=u[l];d.value.indexOf("{{")!==-1&&r.setAttribute(d.name,d.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function ee(e,t,n,o,s,i){const r={};for(let l=0;l<e.children.length;l++){const d=e.children[l],h=d.getAttribute("data-ln-render-key");h&&(r[h]=d)}const u=document.createDocumentFragment();for(let l=0;l<t.length;l++){const d=t[l],h=String(o(d));let f=r[h];if(f)s(f,d,l);else{const c=Y(n,i);if(!c||(B(c,d),f=c.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",h),s(f,d,l)}u.appendChild(f)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=B,window.lnCore.fill=F,window.lnCore.lnFill=Z,window.lnCore.renderList=ee);function M(e,t,n,o,s){if(!e||t===null)return!0;const i=o||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const u=l=>{s?console.warn(l,s):console.warn(l)};if(r==="boolean"){const l=t.trim().toLowerCase();return l!==""&&l!=="true"&&l!=="false"&&l!=="1"&&l!=="0"?(u(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const l=e.values||[];return l.includes(t)?!0:(u(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${l.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return u(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const l=parseInt(t,10);return e.min!==void 0&&l<e.min?(u(`[${i}] Value ${l} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&l>e.max?(u(`[${i}] Value ${l} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(u(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(l){return u(`[${i}] Invalid JSON for attribute "${n}": ${l.message}. Fallback: ${e.fallback}.`),!1}return!0}function te(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function ne(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}function S(e,t,n,o){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&r.push(e);for(const u of r)if(!u[n]){window.lnCore._persistSink&&u.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(u,t);try{u[n]=new o(u)}catch(l){console.error("["+n+"] init failed",u,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 ie(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 W(){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 re(e){const t=W(),n=e.observed||[];for(let o=0;o<n.length;o++){const s=n[o];t.byAttr.has(s)||t.byAttr.set(s,[]),t.byAttr.get(s).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const s=t.byDeclaredAttr.get(o);s.some(i=>i.componentTag===e.componentTag)||s.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ne(e);if(o===null)t.reactiveWildcard.push(e);else for(const s of o)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function N(e,t,n,o){for(let s=0;s<e.length;s++){const i=e[s];if(!t[i.attribute])continue;const r=i.effects&&i.effects[n];r?r(t,n,o):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,o)}}function se(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=W(),s=o.byAttr.get(n);if(D()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&k(t)){const i=o.byDeclaredAttr.get(n),r=t.getAttribute(n);for(let u=0;u<i.length;u++)M(i[u].spec,r,n,i[u].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||s)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=o.byReactive.get(n);i&&N(i,t,n,e.oldValue),o.reactiveWildcard.length&&N(o.reactiveWildcard,t,n,e.oldValue)}if(s)for(let i=0;i<s.length;i++){const r=s[i];if(r.handler){r.handler(t,n,e.oldValue);continue}r.onAttributeChange&&t[r.attribute]?r.onAttributeChange(t,n):(S(t,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(t))}}function le(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{se(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).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 ue(e){const t=j();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const s=o.query,i=e.target.nodeType===1?e.target.matches(s)?e.target:e.target.closest(s):e.target.parentElement?e.target.parentElement.closest(s):null;i&&o.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let s=0;s<t.length;s++){const i=t[s];S(o,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let s=0;s<t.length;s++){const i=t[s],r=i.query,u=Array.from(o.querySelectorAll(r));o.matches&&o.matches(r)&&u.push(o);for(let l=0;l<u.length;l++){const d=u[l];if(!document.contains(d)){const h=d[i.attribute];if(h&&typeof h.destroy=="function")try{h.destroy()}catch(f){console.error("["+i.attribute+"] destroy failed",d,f)}delete d[i.attribute]}}}}}}function ce(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{ue(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function H(e,t,n,o,s={}){const i=s.extraAttributes||[],r=s.onAttributeChange||null,u=s.onSubtreeChange||null,l=s.onInit||null,d=s.onAttrChange||null,h=s.effects||null,f=s.attributes||null,c=f?te(f):h,p=f?new Set(Object.keys(f)):null,g=s.persist||null;function w(m){const C=m||document.body;if(S(C,e,t,n),f&&D())for(const _ in f){const me=f[_],x=Array.from(C.querySelectorAll("["+_+"]"));C.matches&&C.matches("["+_+"]")&&x.push(C);for(let T=0;T<x.length;T++){const q=x[T];k(q)&&M(me,q.getAttribute(_),_,o,q)}}l&&l(C)}const a=[];if(e.indexOf("[")!==-1){const m=/\[([\w-]+)/g;let C;for(;(C=m.exec(e))!==null;)a.push(C[1])}else a.push(e);re({selector:e,attribute:t,componentTag:o,attributes:f,ComponentFn:n,onInit:l,observed:a.concat(i),onAttributeChange:r,onAttrChange:d,effects:c,declared:p,persist:g}),le();const v=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";j().push({selector:e,attribute:t,ComponentFn:n,onInit:l,onSubtreeChange:u,query:v}),ce(),window[t]=w;function b(){oe()>0?ie(function(){w(document.body)}):w(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",b):b(),w}function P(e){return(e||"").replace(/^#/,"")}function L(e){const t=e===void 0?location.hash:e,n={},o=P(t);if(!o)return n;const s=o.split("&");for(let i=0;i<s.length;i++){const r=s[i];if(!r)continue;const u=r.indexOf(":"),l=u>-1?r.slice(0,u):r,d=u>-1?r.slice(u+1):"";if(l)try{n[l]=decodeURIComponent(d)}catch{n[l]=d}}return n}function de(e){if(!e)return null;const t=L();return e in t?t[e]:null}function fe(e,t){if(!e)return;const n=L();t==null?delete n[e]:n[e]=String(t);const s=Object.keys(n).map(function(i){const r=n[i];return r===""?i:i+":"+encodeURIComponent(r)}).join("&");P(location.hash)!==s&&(location.hash=s)}function ae(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function pe(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 o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function he(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ge(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function be(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function we(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),s=o?o.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=L,window.lnCore.hashGet=de,window.lnCore.hashSet=fe,window.lnCore.hashLinkClick=ae,window.lnCore.resolveHashNamespace=pe,window.lnCore.hashSortEncode=he,window.lnCore.hashSortDecode=ge,window.lnCore.hashFilterEncode=be,window.lnCore.hashFilterDecode=we);function V(e,t,n,o){const s=o,i=window.innerWidth,r=window.innerHeight,u=t.width,l=t.height,d=(n||"bottom").split("-"),h=d[0],f=d[1]==="start"||d[1]==="end"?d[1]:"center",c={top:["top","bottom","right","left"],bottom:["bottom","top","right","left"],left:["left","right","top","bottom"],right:["right","left","top","bottom"]},p=c[h]||c.bottom;function g(b){return b==="top"||b==="bottom"?f==="start"?e.left:f==="end"?e.right-u:e.left+(e.width-u)/2:f==="start"?e.top:f==="end"?e.bottom-l:e.top+(e.height-l)/2}function w(b){let m,C,_=!0;return b==="top"?(m=e.top-s-l,C=g(b),m<0&&(_=!1)):b==="bottom"?(m=e.bottom+s,C=g(b),m+l>r&&(_=!1)):b==="left"?(m=g(b),C=e.left-s-u,C<0&&(_=!1)):(m=g(b),C=e.right+s,C+u>i&&(_=!1)),{top:m,left:C,side:b,fits:_}}let a=null;for(let b=0;b<p.length;b++){const m=w(p[b]);if(m.fits){a=m;break}}a||(a=w(p[0]));let y=a.top,v=a.left;return u>=i?v=0:(v<0&&(v=0),v+u>i&&(v=i-u)),l>=r?y=0:(y<0&&(y=0),y+l>r&&(y=r-l)),{top:y,left:v,placement:a.side}}function K(e){if(!e)return{width:0,height:0};const t=e.style,n=t.visibility,o=t.display,s=t.position;t.visibility="hidden",t.display="block",t.position="fixed";const i=e.offsetWidth,r=e.offsetHeight;return t.visibility=n,t.display=o,t.position=s,{width:i,height:r}}(function(){const e="data-ln-popover",t="lnPopover",n="data-ln-popover-for",o="data-ln-popover-position";if(window[t]!==void 0)return;const s={"data-ln-popover":{type:"enum",values:["open","close"],fallback:"close",effect:f,description:"Control state of the popover"},"data-ln-popover-for":{type:"string",description:"Target element ID that this trigger controls"},"data-ln-popover-position":{type:"enum",values:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],fallback:"bottom",description:"Preferred positioning anchor"},"data-ln-popover-placement":{type:"enum",values:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],description:"Active calculated placement applied at runtime"}},i=[];let r=null;function u(){r||(r=function(c){if(c.key!=="Escape"||i.length===0)return;i[i.length-1].close()},document.addEventListener("keydown",r))}function l(){i.length>0||r&&(document.removeEventListener("keydown",r),r=null)}function d(c){this.dom=c,this.isOpen=c.getAttribute(e)==="open",this.trigger=null,this._previousFocus=null,this._boundDocClick=null,this._docClickTimeout=null,this._boundReposition=null;const p=this;return this._onRequestOpen=function(g){const w=g.detail&&g.detail.trigger?g.detail.trigger:null;p.open(w)},this._onRequestClose=function(){p.close()},this._onRequestToggle=function(g){const w=g.detail&&g.detail.trigger?g.detail.trigger:null;p.toggle(w)},this._onNativeToggle=function(g){g.newState==="closed"&&p.isOpen&&(p._applyClose(),p.dom.setAttribute(e,"closed"))},c.addEventListener("ln-popover:request-open",this._onRequestOpen),c.addEventListener("ln-popover:request-close",this._onRequestClose),c.addEventListener("ln-popover:request-toggle",this._onRequestToggle),c.addEventListener("toggle",this._onNativeToggle),c.hasAttribute("tabindex")||c.setAttribute("tabindex","-1"),c.hasAttribute("role")||c.setAttribute("role","dialog"),c.hasAttribute("popover")||c.setAttribute("popover","manual"),this.isOpen&&this._applyOpen(null),this}d.prototype.open=function(c){this.isOpen||(this.trigger=c||null,this.dom.setAttribute(e,"open"))},d.prototype.close=function(){this.isOpen&&this.dom.setAttribute(e,"closed")},d.prototype.toggle=function(c){this.isOpen?this.close():this.open(c)},d.prototype._applyOpen=function(c){this.isOpen=!0,c&&(this.trigger=c),this._previousFocus=document.activeElement,typeof this.dom.showPopover=="function"&&this.dom.showPopover();const p=K(this.dom);if(this.trigger){const y=this.trigger.getBoundingClientRect(),v=this.dom.getAttribute(o)||"bottom",b=V(y,p,v,8);this.dom.style.top=b.top+"px",this.dom.style.left=b.left+"px",this.dom.setAttribute("data-ln-popover-placement",b.placement),this.trigger.setAttribute("aria-expanded","true")}const g=this.dom.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),w=Array.prototype.find.call(g,U);w?w.focus():this.dom.focus();const a=this;this._boundDocClick=function(y){a.dom.contains(y.target)||a.trigger&&a.trigger.contains(y.target)||a.close()},a._docClickTimeout=setTimeout(function(){a._docClickTimeout=null,document.addEventListener("click",a._boundDocClick)},0),this._boundReposition=function(){if(!a.trigger)return;const y=a.trigger.getBoundingClientRect(),v=K(a.dom),b=a.dom.getAttribute(o)||"bottom",m=V(y,v,b,8);a.dom.style.top=m.top+"px",a.dom.style.left=m.left+"px",a.dom.setAttribute("data-ln-popover-placement",m.placement)},window.addEventListener("scroll",this._boundReposition,{passive:!0,capture:!0}),window.addEventListener("resize",this._boundReposition),i.push(this),u(),O(this.dom,"ln-popover:open",{popoverId:this.dom.id,target:this.dom,trigger:this.trigger})},d.prototype._applyClose=function(){this.isOpen=!1,this._docClickTimeout&&(clearTimeout(this._docClickTimeout),this._docClickTimeout=null),this._boundDocClick&&(document.removeEventListener("click",this._boundDocClick),this._boundDocClick=null),this._boundReposition&&(window.removeEventListener("scroll",this._boundReposition,{capture:!0}),window.removeEventListener("resize",this._boundReposition),this._boundReposition=null),this.dom.style.top="",this.dom.style.left="",this.dom.removeAttribute("data-ln-popover-placement"),this.trigger&&this.trigger.setAttribute("aria-expanded","false"),typeof this.dom.hidePopover=="function"&&this.dom.matches(":popover-open")&&this.dom.hidePopover();const c=i.indexOf(this);c!==-1&&i.splice(c,1),l(),this._previousFocus&&this.trigger&&this._previousFocus===this.trigger?this.trigger.focus():this.trigger&&document.activeElement===document.body&&this.trigger.focus(),this._previousFocus=null,O(this.dom,"ln-popover:close",{popoverId:this.dom.id,target:this.dom,trigger:this.trigger}),this.trigger=null},d.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-popover:request-open",this._onRequestOpen),this.dom.removeEventListener("ln-popover:request-close",this._onRequestClose),this.dom.removeEventListener("ln-popover:request-toggle",this._onRequestToggle),this.dom.removeEventListener("toggle",this._onNativeToggle),this.isOpen&&this._applyClose(),delete this.dom[t])};function h(c){this.dom=c;const p=c.getAttribute(n);return c.setAttribute("aria-haspopup","dialog"),c.setAttribute("aria-expanded","false"),c.setAttribute("aria-controls",p),this._onClick=function(g){if(g.ctrlKey||g.metaKey||g.button===1)return;g.preventDefault();const w=document.getElementById(p);if(!w)return;w[t]&&(w[t].trigger=c);const a=w.getAttribute(e);w.setAttribute(e,a==="open"?"closed":"open")},c.addEventListener("click",this._onClick),this}h.prototype.destroy=function(){this.dom.removeEventListener("click",this._onClick),delete this.dom[t+"Trigger"]};function f(c){const p=c[t];if(!p)return;const w=c.getAttribute(e)==="open";if(w!==p.isOpen)if(w){if(R(c,"ln-popover:before-open",{popoverId:c.id,target:c,trigger:p.trigger}).defaultPrevented){c.setAttribute(e,"closed");return}p._applyOpen(p.trigger)}else{if(R(c,"ln-popover:before-close",{popoverId:c.id,target:c,trigger:p.trigger}).defaultPrevented){c.setAttribute(e,"open");return}p._applyClose()}}H(e,t,d,"ln-popover",{attributes:s}),H(n,t+"Trigger",h,"ln-popover-trigger")})()})();
@@ -63,9 +63,17 @@ import { dispatch, dispatchCancelable, computePlacement, measureHidden, isVisibl
63
63
  self.toggle(trigger);
64
64
  };
65
65
 
66
+ this._onNativeToggle = function (e) {
67
+ if (e.newState === 'closed' && self.isOpen) {
68
+ self._applyClose();
69
+ self.dom.setAttribute(DOM_SELECTOR, 'closed');
70
+ }
71
+ };
72
+
66
73
  dom.addEventListener('ln-popover:request-open', this._onRequestOpen);
67
74
  dom.addEventListener('ln-popover:request-close', this._onRequestClose);
68
75
  dom.addEventListener('ln-popover:request-toggle', this._onRequestToggle);
76
+ dom.addEventListener('toggle', this._onNativeToggle);
69
77
 
70
78
  // Make the popover container itself programmatically focusable
71
79
  // as a fallback when it has no focusable children.
@@ -242,6 +250,7 @@ import { dispatch, dispatchCancelable, computePlacement, measureHidden, isVisibl
242
250
  this.dom.removeEventListener('ln-popover:request-open', this._onRequestOpen);
243
251
  this.dom.removeEventListener('ln-popover:request-close', this._onRequestClose);
244
252
  this.dom.removeEventListener('ln-popover:request-toggle', this._onRequestToggle);
253
+ this.dom.removeEventListener('toggle', this._onNativeToggle);
245
254
  if (this.isOpen) this._applyClose();
246
255
  delete this.dom[DOM_ATTRIBUTE];
247
256
  };