@livenetworks/ashlar 2.1.1 → 2.1.3

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 (71) hide show
  1. package/components/ln-accordion/ln-accordion.js +1 -1
  2. package/components/ln-ajax/ln-ajax.js +1 -1
  3. package/components/ln-api-connector/ln-api-connector.js +1 -1
  4. package/components/ln-api-queue/ln-api-queue.js +1 -1
  5. package/components/ln-autoresize/ln-autoresize.js +1 -1
  6. package/components/ln-autoresize/src/ln-autoresize.js +3 -1
  7. package/components/ln-autosave/ln-autosave.js +1 -1
  8. package/components/ln-chart/ln-chart.js +1 -1
  9. package/components/ln-circular-progress/ln-circular-progress.js +1 -1
  10. package/components/ln-confirm/ln-confirm.js +1 -1
  11. package/components/ln-core/lifecycle.js +24 -12
  12. package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
  13. package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
  14. package/components/ln-data-store/ln-data-store.js +1 -1
  15. package/components/ln-date/ln-date.js +1 -1
  16. package/components/ln-date/src/ln-date.js +22 -12
  17. package/components/ln-debug/ln-debug.js +1 -1
  18. package/components/ln-dropdown/ln-dropdown.js +1 -1
  19. package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
  20. package/components/ln-dropdown/src/ln-dropdown.js +18 -5
  21. package/components/ln-editor/ln-editor.js +1 -1
  22. package/components/ln-external-links/ln-external-links.js +1 -1
  23. package/components/ln-filter/ln-filter.js +1 -1
  24. package/components/ln-filter/ln-filter.schema.json +1 -1
  25. package/components/ln-filter/src/ln-filter.js +11 -10
  26. package/components/ln-form/ln-form.js +1 -1
  27. package/components/ln-form/src/ln-form.js +11 -0
  28. package/components/ln-icon/ln-icon.js +1 -1
  29. package/components/ln-include/ln-include.js +1 -1
  30. package/components/ln-key/ln-key.js +1 -1
  31. package/components/ln-link/ln-link.js +1 -1
  32. package/components/ln-list/ln-list.js +1 -1
  33. package/components/ln-list/src/ln-list.js +14 -5
  34. package/components/ln-modal/ln-modal.js +1 -1
  35. package/components/ln-nav/ln-nav.js +1 -1
  36. package/components/ln-number/ln-number.js +1 -1
  37. package/components/ln-number/src/ln-number.js +21 -10
  38. package/components/ln-obfuscator/ln-obfuscator.js +1 -1
  39. package/components/ln-options/ln-options.js +1 -1
  40. package/components/ln-picklist/ln-picklist.js +1 -1
  41. package/components/ln-popover/ln-popover.js +1 -1
  42. package/components/ln-popover/ln-popover.schema.json +82 -82
  43. package/components/ln-popover/src/ln-popover.js +22 -5
  44. package/components/ln-progress/ln-progress.js +1 -1
  45. package/components/ln-router/ln-router.js +1 -1
  46. package/components/ln-scroll/ln-scroll.js +1 -1
  47. package/components/ln-search/ln-search.js +1 -1
  48. package/components/ln-search/ln-search.schema.json +103 -103
  49. package/components/ln-search/src/ln-search.js +9 -5
  50. package/components/ln-slug/ln-slug.js +1 -1
  51. package/components/ln-sort/ln-sort.js +1 -1
  52. package/components/ln-sortable/ln-sortable.js +1 -1
  53. package/components/ln-sortable/src/ln-sortable.js +52 -7
  54. package/components/ln-stat/ln-stat.js +1 -1
  55. package/components/ln-table/ln-table.js +1 -1
  56. package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
  57. package/components/ln-tabs/ln-tabs.js +1 -1
  58. package/components/ln-tabs/src/ln-tabs.js +12 -8
  59. package/components/ln-time/ln-time.js +1 -1
  60. package/components/ln-time/src/ln-time.js +17 -7
  61. package/components/ln-toast/ln-toast.js +1 -1
  62. package/components/ln-toggle/ln-toggle.js +1 -1
  63. package/components/ln-tooltip/ln-tooltip.js +1 -1
  64. package/components/ln-translations/ln-translations.js +1 -1
  65. package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
  66. package/components/ln-upload/ln-upload.js +1 -1
  67. package/components/ln-validate/ln-validate.js +1 -1
  68. package/components/ln-validate/src/ln-validate.js +21 -7
  69. package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
  70. package/package.json +1 -1
  71. package/web-types.json +1 -1
@@ -1 +1 @@
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 L(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let r=1;r<t.length;r++)if(t[r]&&t[r].nodeType===1){i=t[r];break}if(!L(i))return}e.apply(console,t)}}function _(e,t,o){const i=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function D(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){D(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ie(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function le(e,t){const o=!!(t&&t.typed),i=t&&t.exclude,r={},a=e.elements,l={};if(o)for(let c=0;c<a.length;c++){const n=a[c];n.name&&n.type==="checkbox"&&!n.disabled&&(l[n.name]=(l[n.name]||0)+1)}for(let c=0;c<a.length;c++){const n=a[c];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(i&&n.matches&&n.matches(i)))if(n.type==="checkbox")o&&l[n.name]===1?r[n.name]=n.checked:(r[n.name]||(r[n.name]=[]),n.checked&&r[n.name].push(n.value));else if(n.type==="radio")n.checked&&(r[n.name]=n.value);else if(n.type==="select-multiple"){r[n.name]=[];for(let h=0;h<n.options.length;h++)n.options[h].selected&&r[n.name].push(n.options[h].value)}else if(o&&n.type==="hidden")r[n.name]=n.value;else if(o&&(n.type==="number"||n.type==="range")){const h=Number(n.value);r[n.name]=n.value===""||isNaN(h)?null:h}else r[n.name]=n.value}return r}function se(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ce(e,t){const o=e.elements,i=[],r={};for(let a=0;a<o.length;a++){const l=o[a];l.name&&l.type==="checkbox"&&(r[l.name]=(r[l.name]||0)+1)}for(let a=0;a<o.length;a++){const l=o[a];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const c=l.getAttribute("data-ln-fill-as")||l.name;if(!c||!(c in t))continue;const n=t[c];if(l.type==="checkbox"){if(Array.isArray(n))l.checked=n.indexOf(l.value)!==-1;else if(r[l.name]>1){const h=String(n).split(",").map(function(m){return m.trim()});l.checked=h.indexOf(l.value)!==-1}else l.checked=se(n);i.push(l)}else if(l.type==="radio")l.checked=l.value===String(n),i.push(l);else if(l.type==="select-multiple"){if(Array.isArray(n))for(let h=0;h<l.options.length;h++)l.options[h].selected=n.indexOf(l.options[h].value)!==-1;i.push(l)}else l.value=n,l.tagName==="SELECT"&&n!=null&&l.setAttribute("data-ln-value",n),i.push(l)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ce,window.lnCore.serializeForm=le,window.lnCore.resolveFormMethod=ie);function x(...e){return e.filter(t=>t!=null&&t!=="").map((t,o)=>o===0?t.replace(/\/+$/,""):t.replace(/^\/+/,"").replace(/\/+$/,"")).filter(Boolean).join("/")}function O(e,t){return Object.assign({"Content-Type":"application/json",Accept:"application/json"},e,t?{Authorization:t}:null)}function ae(e,t="ln-core"){try{return e?JSON.parse(e):{}}catch(o){return console.error(`[${t}] Invalid headers JSON:`,o),{}}}const M={};function de(e,t){M[e]=t}function ue(e){return M[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=de,window.lnCore.getDataMapper=ue);function fe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,D(function(){new MutationObserver(function(){_(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const P={};function he(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];P[o]=t}function we(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return P[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=he,window.lnCore.getLocaleFallback=we,window.lnCore.ensureLocaleObserver=fe);const j={};function be(e,t){j[e]||(j[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=j[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function H(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let l=0;l<o.length;l++){const c=o[l],n=c.getAttribute("data-ln-field");t[n]!=null&&(c.textContent=t[n])}const i=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<i.length;l++){const c=i[l],n=c.getAttribute("data-ln-attr").split(",");for(let h=0;h<n.length;h++){const m=n[h].trim().split(":");if(m.length!==2)continue;const C=m[0].trim(),y=m[1].trim();t[y]!=null&&c.setAttribute(C,t[y])}}const r=e.querySelectorAll("[data-ln-show]");for(let l=0;l<r.length;l++){const c=r[l],n=c.getAttribute("data-ln-show");n in t&&c.classList.toggle("hidden",!t[n])}const a=e.querySelectorAll("[data-ln-class]");for(let l=0;l<a.length;l++){const c=a[l],n=c.getAttribute("data-ln-class").split(",");for(let h=0;h<n.length;h++){const m=n[h].trim().split(":");if(m.length!==2)continue;const C=m[0].trim(),y=m[1].trim();y in t&&c.classList.toggle(C,!!t[y])}}return e}function pe(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<o.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[i],t??null),o[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)H(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function U(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const a=o.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,c){return t[c]!==void 0?t[c]:""}))}const i=function(a,l){return t[l]!==void 0?t[l]:""},r=Array.from(e.querySelectorAll("*"));e.nodeType===1&&r.push(e);for(let a=0;a<r.length;a++){const l=r[a],c=l.attributes;for(let n=0;n<c.length;n++){const h=c[n];h.value.indexOf("{{")!==-1&&l.setAttribute(h.name,h.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function me(e,t,o,i,r,a){const l={};for(let n=0;n<e.children.length;n++){const h=e.children[n],m=h.getAttribute("data-ln-render-key");m&&(l[m]=h)}const c=document.createDocumentFragment();for(let n=0;n<t.length;n++){const h=t[n],m=String(i(h));let C=l[m];if(C)r(C,h,n);else{const y=be(o,a);if(!y||(U(y,h),C=y.firstElementChild,!C))continue;C.setAttribute("data-ln-render-key",m),r(C,h,n)}c.appendChild(C)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=U,window.lnCore.fill=H,window.lnCore.lnFill=pe,window.lnCore.renderList=me);function E(e,t,o){const i=e.getAttribute(t);return i===null?o:i}function W(e,t,o){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?o:i}function J(e,t,o=!1){const i=e.getAttribute(t);if(i===null)return!!o;const r=i.trim().toLowerCase();return!(r==="false"||r==="0")}function V(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const q=new Map;function K(e,t){const o=(e?e.join("|"):"")+"::"+t;if(q.has(o))return q.get(o);const i=new Set(e||[]),r=function(a,l){const c=a.getAttribute(l);return c!==null&&i.has(c)?c:t};return q.set(o,r),r}function G(e,t,o){const i=parseFloat(e.getAttribute(t));return isNaN(i)?o:i}function z(e,t,o){const i=e.getAttribute(t);if(!i)return o;try{return JSON.parse(i)}catch{return o}}function Q(e,t,o,i,r){if(!e||t===null)return!0;const a=i||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=n=>{r?console.warn(n,r):console.warn(n)};if(l==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(c(`[${a}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const n=e.values||[];return n.includes(t)?!0:(c(`[${a}] Invalid value "${t}" for attribute "${o}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${a}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(c(`[${a}] Value ${n} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(c(`[${a}] Value ${n} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${a}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(n){return c(`[${a}] Invalid JSON for attribute "${o}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function X(e,t,o){for(const i in o){const[r,a,l]=o[i];Object.defineProperty(e,i,{get:function(){return r(t,a,l)},enumerable:!0,configurable:!0})}return e}function Y(e){const t={};for(const o in e){const i=e[o];if(!i||!i.prop)continue;let r=i.read;if(!r&&i.type)switch(i.type){case"enum":r=K(i.values,i.fallback);break;case"integer":r=W;break;case"float":r=G;break;case"boolean":r=J;break;case"list":r=V;break;case"json":r=z;break;case"string":default:r=E;break}r||(r=E),t[i.prop]=[r,o,i.fallback]}return t}function ge(e){const t={};for(const o in e){const i=e[o];i&&i.effect&&(t[o]=i.effect)}return Object.keys(t).length?t:null}function Ce(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=X,window.lnCore.attrSpec=Y,window.lnCore.attrStr=E,window.lnCore.attrInt=W,window.lnCore.attrBool=J,window.lnCore.attrList=V,window.lnCore.attrEnum=K,window.lnCore.attrFloat=G,window.lnCore.attrJson=z);function T(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function Z(e,t,o,i){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:o,ComponentFn:i};if(e.matches&&e.matches(a)&&T(e,l),e.querySelectorAll){const c=e.querySelectorAll(a);for(let n=0;n<c.length;n++)T(c[n],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ye(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ve(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 ee(){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 _e(e){const t=ee(),o=e.observed||[];for(let i=0;i<o.length;i++){const r=o[i];t.byAttr.has(r)||t.byAttr.set(r,[]),t.byAttr.get(r).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const r=t.byDeclaredAttr.get(i);r.some(a=>a.componentTag===e.componentTag)||r.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=Ce(e);if(i===null)t.reactiveWildcard.push(e);else for(const r of i)t.byReactive.has(r)||t.byReactive.set(r,[]),t.byReactive.get(r).push(e)}e.persist&&t.persist.push(e)}function te(e,t,o,i){for(let r=0;r<e.length;r++){const a=e[r];if(!t[a.attribute])continue;const l=a.effects&&a.effects[o];l?l(t,o,i):a.onAttrChange&&(!a.declared||a.declared.has(o))&&a.onAttrChange(t,o,i)}}function Ae(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,i=ee(),r=i.byAttr.get(t),a=R()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!o&&!r&&!a)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(a&&L(l)){const c=i.byDeclaredAttr.get(t),n=l.getAttribute(t);for(let h=0;h<c.length;h++)Q(c[h].spec,n,t,c[h].componentTag,l)}if(window.lnCore._debugSink&&(o||r)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),o){const c=i.byReactive.get(t);c&&te(c,l,t,e.oldValue),i.reactiveWildcard.length&&te(i.reactiveWildcard,l,t,e.oldValue)}if(r)for(let c=0;c<r.length;c++){const n=r[c];if(n.handler){n.handler(l,t,e.oldValue);continue}n.onAttributeChange&&l[n.attribute]?n.onAttributeChange(l,t):(Z(l,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(l))}}}function ke(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,D(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{Ae(t[o])}catch(i){console.error("[ln-core] mutation handler failed",t[o].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function I(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function $(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function xe(e){const t=I();if(!t.length)return;const o=e.target;if(o){const i=o.nodeType===1?o:o.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let i=0;i<t.length;i++){const r=t[i];if(r.onSubtreeChange&&r.query){const a=r.query,l=e.target.nodeType===1?e.target.matches&&e.target.matches(a)?e.target:e.target.closest?e.target.closest(a):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(a):null;l&&r.onSubtreeChange(l,e)}}for(let i=0;i<e.addedNodes.length;i++){const r=e.addedNodes[i];if(r.nodeType===1){const a=!!(r.firstElementChild||r.children&&r.children.length);for(let l=0;l<t.length;l++){const c=t[l];if(c.selector&&c.attribute&&c.ComponentFn){if(!a)r.matches&&r.matches(c.query)&&T(r,c);else if(r.matches&&r.matches(c.query)&&T(r,c),r.querySelectorAll){const n=r.querySelectorAll(c.query);for(let h=0;h<n.length;h++)T(n[h],c)}}c.onInit&&c.onInit(r)}}}for(let i=0;i<e.removedNodes.length;i++){const r=e.removedNodes[i];if(r.nodeType===1){const a=!!(r.firstElementChild||r.children&&r.children.length);for(let l=0;l<t.length;l++){const c=t[l],n=c.query;if(n){if(!a)r.matches&&r.matches(n)&&$(r,c);else if(r.matches&&r.matches(n)&&$(r,c),r.querySelectorAll){const h=r.querySelectorAll(n);for(let m=0;m<h.length;m++)$(h[m],c)}}}}}}function ne(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,D(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const i=t[o];if(i.type==="childList")try{xe(i)}catch(r){console.error("[ln-core] lifecycle handler failed",i.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Se(e){I().push(e),ne()}function oe(e,t,o,i,r={}){const a=r.extraAttributes||[],l=r.onAttributeChange||null,c=r.onSubtreeChange||null,n=r.onInit||null,h=r.onAttrChange||null,m=r.effects||null,C=r.attributes||null,y=C?ge(C):m,B=C?new Set(Object.keys(C)):null,s=r.persist||null;function u(b){const w=b||document.body;if(Z(w,e,t,o),C&&R())for(const v in C){const F=C[v],A=Array.from(w.querySelectorAll("["+v+"]"));w.matches&&w.matches("["+v+"]")&&A.push(w);for(let S=0;S<A.length;S++){const k=A[S];L(k)&&Q(F,k.getAttribute(v),v,i,k)}}n&&n(w)}const d=[];if(e.indexOf("[")!==-1){const b=/\[([\w-]+)/g;let w;for(;(w=b.exec(e))!==null;)d.push(w[1])}else d.push(e);_e({selector:e,attribute:t,componentTag:i,attributes:C,ComponentFn:o,onInit:n,observed:d.concat(a),onAttributeChange:l,onAttrChange:h,effects:y,declared:B,persist:s}),ke();const f=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,p=r.subtreeQuery||(f?e:"["+e+"]");I().push({selector:e,attribute:t,ComponentFn:o,onInit:n,onSubtreeChange:c,query:p}),ne(),window[t]=u,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=oe,window.lnCore.observeLifecycle=Se);function g(){ye()>0?ve(function(){u(document.body)}):u(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):g(),u}function re(e){return(e||"").replace(/^#/,"")}function N(e){const t=e===void 0?location.hash:e,o={},i=re(t);if(!i)return o;const r=i.split("&");for(let a=0;a<r.length;a++){const l=r[a];if(!l)continue;const c=l.indexOf(":"),n=c>-1?l.slice(0,c):l,h=c>-1?l.slice(c+1):"";if(n)try{o[n]=decodeURIComponent(h)}catch{o[n]=h}}return o}function Ee(e){if(!e)return null;const t=N();return e in t?t[e]:null}function Oe(e,t){if(!e)return;const o=N();t==null?delete o[e]:o[e]=String(t);const r=Object.keys(o).map(function(a){const l=o[a];return l===""?a:a+":"+encodeURIComponent(l)}).join("&");re(location.hash)!==r&&(location.hash=r)}function Te(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function De(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function Le(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function je(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 qe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ie(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),i=e.slice(t+1),r=i?i.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:o,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=N,window.lnCore.hashGet=Ee,window.lnCore.hashSet=Oe,window.lnCore.hashLinkClick=Te,window.lnCore.resolveHashNamespace=De,window.lnCore.hashSortEncode=Le,window.lnCore.hashSortDecode=je,window.lnCore.hashFilterEncode=qe,window.lnCore.hashFilterDecode=Ie);function $e(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=$e),(function(){const e="data-ln-couchdb-connector",t="lnCouchDbConnector",o="lnConnector";if(window[t]!==void 0)return;function i(s){const u=s[t];u&&u.refreshConfig()}const r={"data-ln-couchdb-connector":{type:"marker",description:"Mounts CouchDB/PouchDB connector bridging database and ln-ashlar data coordinators"},"data-ln-couchdb-url":{prop:"url",read:E,type:"string",fallback:"",effect:i,description:"CouchDB server base endpoint URL"},"data-ln-couchdb-db":{prop:"db",read:E,type:"string",fallback:"",effect:i,description:"Target CouchDB database name"},"data-ln-couchdb-auth":{prop:"auth",read:E,type:"string",fallback:"",effect:i,description:"Authentication credentials for CouchDB requests"},"data-ln-couchdb-headers":{effect:i,type:"json",fallback:null,description:"Custom HTTP headers in JSON or semicolon-separated format"}},a=Y(r);function l(s){const u=s&&s.content!==void 0?s.content:s,d=s&&s.message?s.message:null;return{content:u,message:d}}function c(s){return this.dom=s,X(this,s,a),s[t]=this,s[o]=this,this.namespace="ln-couchdb-connector",this.refreshConfig(),this._deltaController=null,this._handlers=null,B(this),this}c.prototype.refreshConfig=function(){const s=this.dom;this.credentials="same-origin";const u=s.getAttribute("data-ln-couchdb-headers")||"";this.headers=ae(u,"ln-couchdb-connector"),this.auth&&console.warn("[ln-couchdb-connector] Security Warning: Sensitive authorization credentials detected in data-ln-couchdb-auth attribute. Storing basic authentication credentials in HTML DOM attributes is highly discouraged and vulnerable to XSS credential extraction. Please use HttpOnly session cookies or a Backend Proxy Gateway instead."),u.toLowerCase().includes("authorization")&&console.warn("[ln-couchdb-connector] Security Warning: Sensitive authorization credentials detected in data-ln-couchdb-headers attribute. Please use HttpOnly session cookies or a Backend Proxy Gateway instead."),_(s,"ln-couchdb-connector:config-changed",{url:this.url,db:this.db,auth:this.auth?"[REDACTED]":"",headers:this.headers})};function n(s,u,d){const f=Object.assign({},O(s.headers,s.auth),d||{});return u&&(f["Idempotency-Key"]=u),f}c.prototype.fetchDelta=function(s){const u=this;this._deltaController&&this._deltaController.abort(),this._deltaController=new AbortController;const d=this._deltaController.signal,f=["include_docs=true","feed=normal"];s&&f.push("since="+encodeURIComponent(s));const p=x(u.url,u.db,"_changes")+"?"+f.join("&");return window.fetch(p,{method:"GET",headers:O(u.headers,u.auth),credentials:u.credentials,signal:d}).then(g=>{if(!g.ok)throw new Error("HTTP "+g.status+": "+g.statusText);return g.json()}).then(g=>{const b=g.results||[];return{data:b.filter(w=>!w.deleted&&w.doc).map(w=>Object.assign({},w.doc,{id:w.doc._id})),deleted:b.filter(w=>w.deleted).map(w=>w.id),synced_at:g.last_seq||s||""}}).finally(()=>{u._deltaController&&u._deltaController.signal===d&&(u._deltaController=null)})};function h(s,u,d){const f=Object.assign({_id:u.id},u);return f._id||delete f._id,window.fetch(x(s.url,s.db),{method:"POST",headers:n(s,d),credentials:s.credentials,body:JSON.stringify(f)}).then(p=>{if(!p.ok)throw new Error("HTTP "+p.status+": "+p.statusText);return p.json()}).then(p=>{const g=l(p),b=g.content;return{record:Object.assign({},f,{id:b.id,_id:b.id,_rev:b.rev}),message:g.message}})}c.prototype.create=function(s,u){return h(this,s,u).then(d=>d.record)};function m(s,u,d,f){const p=Object.assign({id:String(u),_id:String(u)},d),g=p._rev||p.rev;return(g?Promise.resolve(g):window.fetch(x(s.url,s.db,null,u),{method:"GET",headers:O(s.headers,s.auth),credentials:s.credentials}).then(w=>{if(!w.ok)throw new Error("Could not retrieve document for revision mapping");return w.json().then(v=>v._rev)})).then(w=>{const v=Object.assign({},p,{_rev:w});delete v.rev;const F=n(s,f,{"If-Match":w});return window.fetch(x(s.url,s.db,null,u),{method:"PUT",headers:F,credentials:s.credentials,body:JSON.stringify(v)}).then(A=>{if(A.ok)return A.json().then(S=>{const k=l(S);return{record:Object.assign({},v,{_rev:k.content.rev}),message:k.message}});if(A.status===409)return A.json().then(S=>{const k=new Error("Conflict");throw k.status=409,k.data=S,k});throw new Error("HTTP "+A.status+": "+A.statusText)})})}c.prototype.update=function(s,u,d){return m(this,s,u,d).then(f=>f.record)};function C(s,u,d,f){return(d?Promise.resolve(d):window.fetch(x(s.url,s.db,null,u),{method:"GET",headers:O(s.headers,s.auth),credentials:s.credentials}).then(g=>{if(!g.ok)throw new Error("Could not retrieve document for revision delete");return g.json().then(b=>b._rev)})).then(g=>{const b=x(s.url,s.db,null,u)+"?rev="+encodeURIComponent(g);return window.fetch(b,{method:"DELETE",headers:n(s,f),credentials:s.credentials}).then(w=>{if(!w.ok)throw new Error("HTTP "+w.status+": "+w.statusText);return w.json()}).then(w=>{const v=l(w);return{response:v.content,message:v.message}})})}c.prototype.delete=function(s,u,d){return C(this,s,u,d).then(f=>f.response)};function y(s,u,d){return!u||u.length===0?Promise.resolve({response:{ok:!0,deletedCount:0},message:null}):window.fetch(x(s.url,s.db,"_all_docs"),{method:"POST",headers:O(s.headers,s.auth),credentials:s.credentials,body:JSON.stringify({keys:u})}).then(f=>{if(!f.ok)throw new Error("HTTP "+f.status+": "+f.statusText);return f.json()}).then(f=>{const g=(f.rows||[]).filter(b=>!b.error&&b.value&&b.value.rev).map(b=>({_id:b.id,_rev:b.value.rev,_deleted:!0}));return g.length===0?{response:{ok:!0,deletedCount:0},message:null}:window.fetch(x(s.url,s.db,"_bulk_docs"),{method:"POST",headers:n(s,d),credentials:s.credentials,body:JSON.stringify({docs:g})}).then(b=>{if(!b.ok)throw new Error("HTTP "+b.status+": "+b.statusText);return b.json()}).then(b=>{const w=l(b);return{response:{ok:!0,results:w.content,deletedCount:g.length},message:w.message}})})}c.prototype.bulkDelete=function(s,u){return y(this,s,u).then(d=>d.response)};function B(s){s._handlers={sync:function(u){const d=u.detail||{};s.fetchDelta(d.since).then(function(f){_(s.dom,"ln-couchdb-connector:fetched",{data:f,since:d.since,meta:d.meta||null})}).catch(function(f){f&&f.name==="AbortError"||_(s.dom,"ln-couchdb-connector:error",{action:"sync",error:f.message,status:f.status||0,since:d.since,meta:d.meta||null})})},create:function(u){const d=u.detail||{};h(s,d.data,d.idempotencyKey).then(function(f){_(s.dom,"ln-couchdb-connector:created",{record:f.record,tempId:d.tempId,message:f.message,meta:d.meta||null})}).catch(function(f){_(s.dom,"ln-couchdb-connector:error",{action:"create",error:f.message,status:f.status||0,tempId:d.tempId,meta:d.meta||null})})},update:function(u){const d=u.detail||{},f=Object.assign({},d.data);d.expected_version!==void 0&&(f._rev=d.expected_version),m(s,d.id,f,d.idempotencyKey).then(function(p){_(s.dom,"ln-couchdb-connector:updated",{record:p.record,id:d.id,message:p.message,meta:d.meta||null})}).catch(function(p){_(s.dom,"ln-couchdb-connector:error",{action:"update",error:p.message,status:p.status||0,id:d.id,data:p.status===409?p.data:null,conflictData:p.status===409?p.data:null,meta:d.meta||null})})},delete:function(u){const d=u.detail||{};C(s,d.id,d.rev,d.idempotencyKey).then(function(f){_(s.dom,"ln-couchdb-connector:deleted",{response:f.response,id:d.id,message:f.message,meta:d.meta||null})}).catch(function(f){_(s.dom,"ln-couchdb-connector:error",{action:"delete",error:f.message,status:f.status||0,id:d.id,meta:d.meta||null})})},bulkDelete:function(u){const d=u.detail||{};y(s,d.ids,d.idempotencyKey).then(function(f){_(s.dom,"ln-couchdb-connector:bulk-deleted",{response:f.response,ids:d.ids,message:f.message,meta:d.meta||null})}).catch(function(f){_(s.dom,"ln-couchdb-connector:error",{action:"bulk-delete",error:f.message,status:f.status||0,ids:d.ids,meta:d.meta||null})})}},s.dom.addEventListener("ln-couchdb-connector:request-sync",s._handlers.sync),s.dom.addEventListener("ln-couchdb-connector:request-create",s._handlers.create),s.dom.addEventListener("ln-couchdb-connector:request-update",s._handlers.update),s.dom.addEventListener("ln-couchdb-connector:request-delete",s._handlers.delete),s.dom.addEventListener("ln-couchdb-connector:request-bulk-delete",s._handlers.bulkDelete)}c.prototype.destroy=function(){if(!this.dom[t])return;const s=this;s._deltaController&&(s._deltaController.abort(),s._deltaController=null),s._handlers&&(s.dom.removeEventListener("ln-couchdb-connector:request-sync",s._handlers.sync),s.dom.removeEventListener("ln-couchdb-connector:request-create",s._handlers.create),s.dom.removeEventListener("ln-couchdb-connector:request-update",s._handlers.update),s.dom.removeEventListener("ln-couchdb-connector:request-delete",s._handlers.delete),s.dom.removeEventListener("ln-couchdb-connector:request-bulk-delete",s._handlers.bulkDelete),s._handlers=null),delete this.dom[t],delete this.dom[o]},oe(e,t,c,"ln-couchdb-connector",{attributes:r})})()})();
1
+ (function(){"use strict";function P(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function q(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){i=t[s];break}if(!q(i))return}e.apply(console,t)}}function v(e,t,o){const i=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function L(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){L(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function le(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ce(e,t){const o=!!(t&&t.typed),i=t&&t.exclude,s={},c=e.elements,r={};if(o)for(let a=0;a<c.length;a++){const n=c[a];n.name&&n.type==="checkbox"&&!n.disabled&&(r[n.name]=(r[n.name]||0)+1)}for(let a=0;a<c.length;a++){const n=c[a];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(i&&n.matches&&n.matches(i)))if(n.type==="checkbox")o&&r[n.name]===1?s[n.name]=n.checked:(s[n.name]||(s[n.name]=[]),n.checked&&s[n.name].push(n.value));else if(n.type==="radio")n.checked&&(s[n.name]=n.value);else if(n.type==="select-multiple"){s[n.name]=[];for(let f=0;f<n.options.length;f++)n.options[f].selected&&s[n.name].push(n.options[f].value)}else if(o&&n.type==="hidden")s[n.name]=n.value;else if(o&&(n.type==="number"||n.type==="range")){const f=Number(n.value);s[n.name]=n.value===""||isNaN(f)?null:f}else s[n.name]=n.value}return s}function ae(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function de(e,t){const o=e.elements,i=[],s={};for(let c=0;c<o.length;c++){const r=o[c];r.name&&r.type==="checkbox"&&(s[r.name]=(s[r.name]||0)+1)}for(let c=0;c<o.length;c++){const r=o[c];if(r.type==="file"||r.type==="submit"||r.type==="button")continue;const a=r.getAttribute("data-ln-fill-as")||r.name;if(!a||!(a in t))continue;const n=t[a];if(r.type==="checkbox"){if(Array.isArray(n))r.checked=n.indexOf(r.value)!==-1;else if(s[r.name]>1){const f=String(n).split(",").map(function(b){return b.trim()});r.checked=f.indexOf(r.value)!==-1}else r.checked=ae(n);i.push(r)}else if(r.type==="radio")r.checked=r.value===String(n),i.push(r);else if(r.type==="select-multiple"){if(Array.isArray(n))for(let f=0;f<r.options.length;f++)r.options[f].selected=n.indexOf(r.options[f].value)!==-1;i.push(r)}else r.value=n,r.tagName==="SELECT"&&n!=null&&r.setAttribute("data-ln-value",n),i.push(r)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=de,window.lnCore.serializeForm=ce,window.lnCore.resolveFormMethod=le);function k(...e){return e.filter(t=>t!=null&&t!=="").map((t,o)=>o===0?t.replace(/\/+$/,""):t.replace(/^\/+/,"").replace(/\/+$/,"")).filter(Boolean).join("/")}function T(e,t){return Object.assign({"Content-Type":"application/json",Accept:"application/json"},e,t?{Authorization:t}:null)}function ue(e,t="ln-core"){try{return e?JSON.parse(e):{}}catch(o){return console.error(`[${t}] Invalid headers JSON:`,o),{}}}const H={};function fe(e,t){H[e]=t}function he(e){return H[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=fe,window.lnCore.getDataMapper=he);function we(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,L(function(){new MutationObserver(function(){v(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const U={};function be(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];U[o]=t}function pe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return U[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=be,window.lnCore.getLocaleFallback=pe,window.lnCore.ensureLocaleObserver=we);const I={};function me(e,t){I[e]||(I[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=I[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function W(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let r=0;r<o.length;r++){const a=o[r],n=a.getAttribute("data-ln-field");t[n]!=null&&(a.textContent=t[n])}const i=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<i.length;r++){const a=i[r],n=a.getAttribute("data-ln-attr").split(",");for(let f=0;f<n.length;f++){const b=n[f].trim().split(":");if(b.length!==2)continue;const m=b[0].trim(),_=b[1].trim();t[_]!=null&&a.setAttribute(m,t[_])}}const s=e.querySelectorAll("[data-ln-show]");for(let r=0;r<s.length;r++){const a=s[r],n=a.getAttribute("data-ln-show");n in t&&a.classList.toggle("hidden",!t[n])}const c=e.querySelectorAll("[data-ln-class]");for(let r=0;r<c.length;r++){const a=c[r],n=a.getAttribute("data-ln-class").split(",");for(let f=0;f<n.length;f++){const b=n[f].trim().split(":");if(b.length!==2)continue;const m=b[0].trim(),_=b[1].trim();_ in t&&a.classList.toggle(m,!!t[_])}}return e}function ge(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<o.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[i],t??null),o[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)W(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function J(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const c=o.currentNode;c.textContent.indexOf("{{")!==-1&&(c.textContent=c.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,a){return t[a]!==void 0?t[a]:""}))}const i=function(c,r){return t[r]!==void 0?t[r]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let c=0;c<s.length;c++){const r=s[c],a=r.attributes;for(let n=0;n<a.length;n++){const f=a[n];f.value.indexOf("{{")!==-1&&r.setAttribute(f.name,f.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function Ce(e,t,o,i,s,c){const r={};for(let n=0;n<e.children.length;n++){const f=e.children[n],b=f.getAttribute("data-ln-render-key");b&&(r[b]=f)}const a=document.createDocumentFragment();for(let n=0;n<t.length;n++){const f=t[n],b=String(i(f));let m=r[b];if(m)s(m,f,n);else{const _=me(o,c);if(!_||(J(_,f),m=_.firstElementChild,!m))continue;m.setAttribute("data-ln-render-key",b),s(m,f,n)}a.appendChild(m)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=J,window.lnCore.fill=W,window.lnCore.lnFill=ge,window.lnCore.renderList=Ce);function O(e,t,o){const i=e.getAttribute(t);return i===null?o:i}function V(e,t,o){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?o:i}function K(e,t,o=!1){const i=e.getAttribute(t);if(i===null)return!!o;const s=i.trim().toLowerCase();return!(s==="false"||s==="0")}function G(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const R=new Map;function z(e,t){const o=(e?e.join("|"):"")+"::"+t;if(R.has(o))return R.get(o);const i=new Set(e||[]),s=function(c,r){const a=c.getAttribute(r);return a!==null&&i.has(a)?a:t};return R.set(o,s),s}function Q(e,t,o){const i=parseFloat(e.getAttribute(t));return isNaN(i)?o:i}function X(e,t,o){const i=e.getAttribute(t);if(!i)return o;try{return JSON.parse(i)}catch{return o}}function Y(e,t,o,i,s){if(!e||t===null)return!0;const c=i||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const a=n=>{s?console.warn(n,s):console.warn(n)};if(r==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(a(`[${c}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const n=e.values||[];return n.includes(t)?!0:(a(`[${c}] Invalid value "${t}" for attribute "${o}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return a(`[${c}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(a(`[${c}] Value ${n} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(a(`[${c}] Value ${n} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(a(`[${c}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(n){return a(`[${c}] Invalid JSON for attribute "${o}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function Z(e,t,o){for(const i in o){const[s,c,r]=o[i];Object.defineProperty(e,i,{get:function(){return s(t,c,r)},enumerable:!0,configurable:!0})}return e}function ee(e){const t={};for(const o in e){const i=e[o];if(!i||!i.prop)continue;let s=i.read;if(!s&&i.type)switch(i.type){case"enum":s=z(i.values,i.fallback);break;case"integer":s=V;break;case"float":s=Q;break;case"boolean":s=K;break;case"list":s=G;break;case"json":s=X;break;case"string":default:s=O;break}s||(s=O),t[i.prop]=[s,o,i.fallback]}return t}function ye(e){const t={};for(const o in e){const i=e[o];i&&i.effect&&(t[o]=i.effect)}return Object.keys(t).length?t:null}function _e(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=Z,window.lnCore.attrSpec=ee,window.lnCore.attrStr=O,window.lnCore.attrInt=V,window.lnCore.attrBool=K,window.lnCore.attrList=G,window.lnCore.attrEnum=z,window.lnCore.attrFloat=Q,window.lnCore.attrJson=X);function D(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function te(e,t,o,i){if(e.nodeType!==1)return;const c=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r={selector:t,attribute:o,ComponentFn:i};if(e.matches&&e.matches(c)&&D(e,r),e.querySelectorAll){const a=e.querySelectorAll(c);for(let n=0;n<a.length;n++)D(a[n],r)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ve(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ae(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 ne(){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 ke(e){const t=ne(),o=e.observed||[];for(let i=0;i<o.length;i++){const s=o[i];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 i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const s=t.byDeclaredAttr.get(i);s.some(c=>c.componentTag===e.componentTag)||s.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=_e(e);if(i===null)t.reactiveWildcard.push(e);else for(const s of i)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function oe(e,t,o,i){for(let s=0;s<e.length;s++){const c=e[s];if(!t[c.attribute])continue;const r=c.effects&&c.effects[o];r?r(t,o,i):c.onAttrChange&&(!c.declared||c.declared.has(o))&&c.onAttrChange(t,o,i)}}function xe(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,i=ne(),s=i.byAttr.get(t),c=P()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!o&&!s&&!c)return;const r=e.target;if(e.oldValue!==r.getAttribute(t)){if(c&&q(r)){const a=i.byDeclaredAttr.get(t),n=r.getAttribute(t);for(let f=0;f<a.length;f++)Y(a[f].spec,n,t,a[f].componentTag,r)}if(window.lnCore._debugSink&&(o||s)&&window.lnCore._debugSink("attr",t,r,{oldValue:e.oldValue,newValue:r.getAttribute(t)}),o){const a=i.byReactive.get(t);a&&oe(a,r,t,e.oldValue),i.reactiveWildcard.length&&oe(i.reactiveWildcard,r,t,e.oldValue)}if(s)for(let a=0;a<s.length;a++){const n=s[a];if(n.handler){n.handler(r,t,e.oldValue);continue}n.onAttributeChange&&r[n.attribute]?n.onAttributeChange(r,t):(te(r,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(r))}}}function Se(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,L(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{xe(t[o])}catch(i){console.error("[ln-core] mutation handler failed",t[o].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function $(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function N(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function B(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Ee(e){const t=$();if(!t.length)return;const o=e.target;if(o){const s=o.nodeType===1?o:o.parentElement;if(s&&(s.isContentEditable||s.closest&&s.closest('[contenteditable]:not([contenteditable="false"])')))return}const i=N();if(e.target&&i.length)for(let s=0;s<i.length;s++){const c=i[s],r=c.query,a=e.target.nodeType===1?e.target.matches&&e.target.matches(r)?e.target:e.target.closest?e.target.closest(r):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(r):null;a&&c.onSubtreeChange(a,e)}for(let s=0;s<e.addedNodes.length;s++){const c=e.addedNodes[s];if(c.nodeType===1){const r=!!(c.firstElementChild||c.children&&c.children.length);for(let a=0;a<t.length;a++){const n=t[a];if(n.selector&&n.attribute&&n.ComponentFn){if(!r)c.matches&&c.matches(n.query)&&D(c,n);else if(c.matches&&c.matches(n.query)&&D(c,n),c.querySelectorAll){const f=c.querySelectorAll(n.query);for(let b=0;b<f.length;b++)D(f[b],n)}}n.onInit&&n.onInit(c)}}}for(let s=0;s<e.removedNodes.length;s++){const c=e.removedNodes[s];if(c.nodeType===1){const r=!!(c.firstElementChild||c.children&&c.children.length);for(let a=0;a<t.length;a++){const n=t[a],f=n.query;if(f){if(!r)c.matches&&c.matches(f)&&B(c,n);else if(c.matches&&c.matches(f)&&B(c,n),c.querySelectorAll){const b=c.querySelectorAll(f);for(let m=0;m<b.length;m++)B(b[m],n)}}}}}}function re(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,L(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const i=t[o];if(i.type==="childList")try{Ee(i)}catch(s){console.error("[ln-core] lifecycle handler failed",i.target,s)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Oe(e){$().push(e),e.onSubtreeChange&&e.query&&N().push(e),re()}function ie(e,t,o,i,s={}){const c=s.extraAttributes||[],r=s.onAttributeChange||null,a=s.onSubtreeChange||null,n=s.onInit||null,f=s.onAttrChange||null,b=s.effects||null,m=s.attributes||null,_=m?ye(m):b,M=m?new Set(Object.keys(m)):null,l=s.persist||null;function u(w){const y=w||document.body;if(te(y,e,t,o),m&&P())for(const S in m){const x=m[S],E=Array.from(y.querySelectorAll("["+S+"]"));y.matches&&y.matches("["+S+"]")&&E.push(y);for(let A=0;A<E.length;A++){const j=E[A];q(j)&&Y(x,j.getAttribute(S),S,i,j)}}n&&n(y)}const d=[];if(e.indexOf("[")!==-1){const w=/\[([\w-]+)/g;let y;for(;(y=w.exec(e))!==null;)d.push(y[1])}else d.push(e);ke({selector:e,attribute:t,componentTag:i,attributes:m,ComponentFn:o,onInit:n,observed:d.concat(c),onAttributeChange:r,onAttrChange:f,effects:_,declared:M,persist:l}),Se();const h=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,g=s.subtreeQuery||(h?e:"["+e+"]"),C={selector:e,attribute:t,ComponentFn:o,onInit:n,onSubtreeChange:a,query:g};$().push(C),a&&g&&N().push(C),re(),window[t]=u,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ie,window.lnCore.observeLifecycle=Oe);function p(){ve()>0?Ae(function(){u(document.body)}):u(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",p):p(),u}function se(e){return(e||"").replace(/^#/,"")}function F(e){const t=e===void 0?location.hash:e,o={},i=se(t);if(!i)return o;const s=i.split("&");for(let c=0;c<s.length;c++){const r=s[c];if(!r)continue;const a=r.indexOf(":"),n=a>-1?r.slice(0,a):r,f=a>-1?r.slice(a+1):"";if(n)try{o[n]=decodeURIComponent(f)}catch{o[n]=f}}return o}function Te(e){if(!e)return null;const t=F();return e in t?t[e]:null}function De(e,t){if(!e)return;const o=F();t==null?delete o[e]:o[e]=String(t);const s=Object.keys(o).map(function(c){const r=o[c];return r===""?c:c+":"+encodeURIComponent(r)}).join("&");se(location.hash)!==s&&(location.hash=s)}function Le(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function je(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function qe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ie(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 Re(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function $e(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),i=e.slice(t+1),s=i?i.split(",").map(function(c){try{return decodeURIComponent(c)}catch{return c}}).filter(Boolean):[];return{key:o,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=F,window.lnCore.hashGet=Te,window.lnCore.hashSet=De,window.lnCore.hashLinkClick=Le,window.lnCore.resolveHashNamespace=je,window.lnCore.hashSortEncode=qe,window.lnCore.hashSortDecode=Ie,window.lnCore.hashFilterEncode=Re,window.lnCore.hashFilterDecode=$e);function Ne(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Ne),(function(){const e="data-ln-couchdb-connector",t="lnCouchDbConnector",o="lnConnector";if(window[t]!==void 0)return;function i(l){const u=l[t];u&&u.refreshConfig()}const s={"data-ln-couchdb-connector":{type:"marker",description:"Mounts CouchDB/PouchDB connector bridging database and ln-ashlar data coordinators"},"data-ln-couchdb-url":{prop:"url",read:O,type:"string",fallback:"",effect:i,description:"CouchDB server base endpoint URL"},"data-ln-couchdb-db":{prop:"db",read:O,type:"string",fallback:"",effect:i,description:"Target CouchDB database name"},"data-ln-couchdb-auth":{prop:"auth",read:O,type:"string",fallback:"",effect:i,description:"Authentication credentials for CouchDB requests"},"data-ln-couchdb-headers":{effect:i,type:"json",fallback:null,description:"Custom HTTP headers in JSON or semicolon-separated format"}},c=ee(s);function r(l){const u=l&&l.content!==void 0?l.content:l,d=l&&l.message?l.message:null;return{content:u,message:d}}function a(l){return this.dom=l,Z(this,l,c),l[t]=this,l[o]=this,this.namespace="ln-couchdb-connector",this.refreshConfig(),this._deltaController=null,this._handlers=null,M(this),this}a.prototype.refreshConfig=function(){const l=this.dom;this.credentials="same-origin";const u=l.getAttribute("data-ln-couchdb-headers")||"";this.headers=ue(u,"ln-couchdb-connector"),this.auth&&console.warn("[ln-couchdb-connector] Security Warning: Sensitive authorization credentials detected in data-ln-couchdb-auth attribute. Storing basic authentication credentials in HTML DOM attributes is highly discouraged and vulnerable to XSS credential extraction. Please use HttpOnly session cookies or a Backend Proxy Gateway instead."),u.toLowerCase().includes("authorization")&&console.warn("[ln-couchdb-connector] Security Warning: Sensitive authorization credentials detected in data-ln-couchdb-headers attribute. Please use HttpOnly session cookies or a Backend Proxy Gateway instead."),v(l,"ln-couchdb-connector:config-changed",{url:this.url,db:this.db,auth:this.auth?"[REDACTED]":"",headers:this.headers})};function n(l,u,d){const h=Object.assign({},T(l.headers,l.auth),d||{});return u&&(h["Idempotency-Key"]=u),h}a.prototype.fetchDelta=function(l){const u=this;this._deltaController&&this._deltaController.abort(),this._deltaController=new AbortController;const d=this._deltaController.signal,h=["include_docs=true","feed=normal"];l&&h.push("since="+encodeURIComponent(l));const g=k(u.url,u.db,"_changes")+"?"+h.join("&");return window.fetch(g,{method:"GET",headers:T(u.headers,u.auth),credentials:u.credentials,signal:d}).then(C=>{if(!C.ok)throw new Error("HTTP "+C.status+": "+C.statusText);return C.json()}).then(C=>{const p=C.results||[];return{data:p.filter(w=>!w.deleted&&w.doc).map(w=>Object.assign({},w.doc,{id:w.doc._id})),deleted:p.filter(w=>w.deleted).map(w=>w.id),synced_at:C.last_seq||l||""}}).finally(()=>{u._deltaController&&u._deltaController.signal===d&&(u._deltaController=null)})};function f(l,u,d){const h=Object.assign({_id:u.id},u);return h._id||delete h._id,window.fetch(k(l.url,l.db),{method:"POST",headers:n(l,d),credentials:l.credentials,body:JSON.stringify(h)}).then(g=>{if(!g.ok)throw new Error("HTTP "+g.status+": "+g.statusText);return g.json()}).then(g=>{const C=r(g),p=C.content;return{record:Object.assign({},h,{id:p.id,_id:p.id,_rev:p.rev}),message:C.message}})}a.prototype.create=function(l,u){return f(this,l,u).then(d=>d.record)};function b(l,u,d,h){const g=Object.assign({id:String(u),_id:String(u)},d),C=g._rev||g.rev;return(C?Promise.resolve(C):window.fetch(k(l.url,l.db,null,u),{method:"GET",headers:T(l.headers,l.auth),credentials:l.credentials}).then(w=>{if(!w.ok)throw new Error("Could not retrieve document for revision mapping");return w.json().then(y=>y._rev)})).then(w=>{const y=Object.assign({},g,{_rev:w});delete y.rev;const S=n(l,h,{"If-Match":w});return window.fetch(k(l.url,l.db,null,u),{method:"PUT",headers:S,credentials:l.credentials,body:JSON.stringify(y)}).then(x=>{if(x.ok)return x.json().then(E=>{const A=r(E);return{record:Object.assign({},y,{_rev:A.content.rev}),message:A.message}});if(x.status===409)return x.json().then(E=>{const A=new Error("Conflict");throw A.status=409,A.data=E,A});throw new Error("HTTP "+x.status+": "+x.statusText)})})}a.prototype.update=function(l,u,d){return b(this,l,u,d).then(h=>h.record)};function m(l,u,d,h){return(d?Promise.resolve(d):window.fetch(k(l.url,l.db,null,u),{method:"GET",headers:T(l.headers,l.auth),credentials:l.credentials}).then(C=>{if(!C.ok)throw new Error("Could not retrieve document for revision delete");return C.json().then(p=>p._rev)})).then(C=>{const p=k(l.url,l.db,null,u)+"?rev="+encodeURIComponent(C);return window.fetch(p,{method:"DELETE",headers:n(l,h),credentials:l.credentials}).then(w=>{if(!w.ok)throw new Error("HTTP "+w.status+": "+w.statusText);return w.json()}).then(w=>{const y=r(w);return{response:y.content,message:y.message}})})}a.prototype.delete=function(l,u,d){return m(this,l,u,d).then(h=>h.response)};function _(l,u,d){return!u||u.length===0?Promise.resolve({response:{ok:!0,deletedCount:0},message:null}):window.fetch(k(l.url,l.db,"_all_docs"),{method:"POST",headers:T(l.headers,l.auth),credentials:l.credentials,body:JSON.stringify({keys:u})}).then(h=>{if(!h.ok)throw new Error("HTTP "+h.status+": "+h.statusText);return h.json()}).then(h=>{const C=(h.rows||[]).filter(p=>!p.error&&p.value&&p.value.rev).map(p=>({_id:p.id,_rev:p.value.rev,_deleted:!0}));return C.length===0?{response:{ok:!0,deletedCount:0},message:null}:window.fetch(k(l.url,l.db,"_bulk_docs"),{method:"POST",headers:n(l,d),credentials:l.credentials,body:JSON.stringify({docs:C})}).then(p=>{if(!p.ok)throw new Error("HTTP "+p.status+": "+p.statusText);return p.json()}).then(p=>{const w=r(p);return{response:{ok:!0,results:w.content,deletedCount:C.length},message:w.message}})})}a.prototype.bulkDelete=function(l,u){return _(this,l,u).then(d=>d.response)};function M(l){l._handlers={sync:function(u){const d=u.detail||{};l.fetchDelta(d.since).then(function(h){v(l.dom,"ln-couchdb-connector:fetched",{data:h,since:d.since,meta:d.meta||null})}).catch(function(h){h&&h.name==="AbortError"||v(l.dom,"ln-couchdb-connector:error",{action:"sync",error:h.message,status:h.status||0,since:d.since,meta:d.meta||null})})},create:function(u){const d=u.detail||{};f(l,d.data,d.idempotencyKey).then(function(h){v(l.dom,"ln-couchdb-connector:created",{record:h.record,tempId:d.tempId,message:h.message,meta:d.meta||null})}).catch(function(h){v(l.dom,"ln-couchdb-connector:error",{action:"create",error:h.message,status:h.status||0,tempId:d.tempId,meta:d.meta||null})})},update:function(u){const d=u.detail||{},h=Object.assign({},d.data);d.expected_version!==void 0&&(h._rev=d.expected_version),b(l,d.id,h,d.idempotencyKey).then(function(g){v(l.dom,"ln-couchdb-connector:updated",{record:g.record,id:d.id,message:g.message,meta:d.meta||null})}).catch(function(g){v(l.dom,"ln-couchdb-connector:error",{action:"update",error:g.message,status:g.status||0,id:d.id,data:g.status===409?g.data:null,conflictData:g.status===409?g.data:null,meta:d.meta||null})})},delete:function(u){const d=u.detail||{};m(l,d.id,d.rev,d.idempotencyKey).then(function(h){v(l.dom,"ln-couchdb-connector:deleted",{response:h.response,id:d.id,message:h.message,meta:d.meta||null})}).catch(function(h){v(l.dom,"ln-couchdb-connector:error",{action:"delete",error:h.message,status:h.status||0,id:d.id,meta:d.meta||null})})},bulkDelete:function(u){const d=u.detail||{};_(l,d.ids,d.idempotencyKey).then(function(h){v(l.dom,"ln-couchdb-connector:bulk-deleted",{response:h.response,ids:d.ids,message:h.message,meta:d.meta||null})}).catch(function(h){v(l.dom,"ln-couchdb-connector:error",{action:"bulk-delete",error:h.message,status:h.status||0,ids:d.ids,meta:d.meta||null})})}},l.dom.addEventListener("ln-couchdb-connector:request-sync",l._handlers.sync),l.dom.addEventListener("ln-couchdb-connector:request-create",l._handlers.create),l.dom.addEventListener("ln-couchdb-connector:request-update",l._handlers.update),l.dom.addEventListener("ln-couchdb-connector:request-delete",l._handlers.delete),l.dom.addEventListener("ln-couchdb-connector:request-bulk-delete",l._handlers.bulkDelete)}a.prototype.destroy=function(){if(!this.dom[t])return;const l=this;l._deltaController&&(l._deltaController.abort(),l._deltaController=null),l._handlers&&(l.dom.removeEventListener("ln-couchdb-connector:request-sync",l._handlers.sync),l.dom.removeEventListener("ln-couchdb-connector:request-create",l._handlers.create),l.dom.removeEventListener("ln-couchdb-connector:request-update",l._handlers.update),l.dom.removeEventListener("ln-couchdb-connector:request-delete",l._handlers.delete),l.dom.removeEventListener("ln-couchdb-connector:request-bulk-delete",l._handlers.bulkDelete),l._handlers=null),delete this.dom[t],delete this.dom[o]},ie(e,t,a,"ln-couchdb-connector",{attributes:s})})()})();
@@ -1 +1 @@
1
- (function(){"use strict";function G(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function T(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let a=1;a<t.length;a++)if(t[a]&&t[a].nodeType===1){i=t[a];break}if(!T(i))return}e.apply(console,t)}}function g(e,t,o){const i=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function D(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){D(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function K(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function Q(e,t){const o=!!(t&&t.typed),i=t&&t.exclude,a={},p=e.elements,c={};if(o)for(let f=0;f<p.length;f++){const l=p[f];l.name&&l.type==="checkbox"&&!l.disabled&&(c[l.name]=(c[l.name]||0)+1)}for(let f=0;f<p.length;f++){const l=p[f];if(!(!l.name||l.disabled||l.type==="file"||l.type==="submit"||l.type==="button")&&!(i&&l.matches&&l.matches(i)))if(l.type==="checkbox")o&&c[l.name]===1?a[l.name]=l.checked:(a[l.name]||(a[l.name]=[]),l.checked&&a[l.name].push(l.value));else if(l.type==="radio")l.checked&&(a[l.name]=l.value);else if(l.type==="select-multiple"){a[l.name]=[];for(let m=0;m<l.options.length;m++)l.options[m].selected&&a[l.name].push(l.options[m].value)}else if(o&&l.type==="hidden")a[l.name]=l.value;else if(o&&(l.type==="number"||l.type==="range")){const m=Number(l.value);a[l.name]=l.value===""||isNaN(m)?null:m}else a[l.name]=l.value}return a}function pe(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function he(e,t){const o=e.elements,i=[],a={};for(let p=0;p<o.length;p++){const c=o[p];c.name&&c.type==="checkbox"&&(a[c.name]=(a[c.name]||0)+1)}for(let p=0;p<o.length;p++){const c=o[p];if(c.type==="file"||c.type==="submit"||c.type==="button")continue;const f=c.getAttribute("data-ln-fill-as")||c.name;if(!f||!(f in t))continue;const l=t[f];if(c.type==="checkbox"){if(Array.isArray(l))c.checked=l.indexOf(c.value)!==-1;else if(a[c.name]>1){const m=String(l).split(",").map(function(q){return q.trim()});c.checked=m.indexOf(c.value)!==-1}else c.checked=pe(l);i.push(c)}else if(c.type==="radio")c.checked=c.value===String(l),i.push(c);else if(c.type==="select-multiple"){if(Array.isArray(l))for(let m=0;m<c.options.length;m++)c.options[m].selected=l.indexOf(c.options[m].value)!==-1;i.push(c)}else c.value=l,c.tagName==="SELECT"&&l!=null&&c.setAttribute("data-ln-value",l),i.push(c)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=he,window.lnCore.serializeForm=Q,window.lnCore.resolveFormMethod=K);const P={};function we(e,t){P[e]=t}function me(e){return P[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=we,window.lnCore.getDataMapper=me);function be(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,D(function(){new MutationObserver(function(){g(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const V={};function ye(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];V[o]=t}function ge(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return V[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ye,window.lnCore.getLocaleFallback=ge,window.lnCore.ensureLocaleObserver=be);const L={};function Ce(e,t){L[e]||(L[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=L[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function z(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let c=0;c<o.length;c++){const f=o[c],l=f.getAttribute("data-ln-field");t[l]!=null&&(f.textContent=t[l])}const i=e.querySelectorAll("[data-ln-attr]");for(let c=0;c<i.length;c++){const f=i[c],l=f.getAttribute("data-ln-attr").split(",");for(let m=0;m<l.length;m++){const q=l[m].trim().split(":");if(q.length!==2)continue;const _=q[0].trim(),C=q[1].trim();t[C]!=null&&f.setAttribute(_,t[C])}}const a=e.querySelectorAll("[data-ln-show]");for(let c=0;c<a.length;c++){const f=a[c],l=f.getAttribute("data-ln-show");l in t&&f.classList.toggle("hidden",!t[l])}const p=e.querySelectorAll("[data-ln-class]");for(let c=0;c<p.length;c++){const f=p[c],l=f.getAttribute("data-ln-class").split(",");for(let m=0;m<l.length;m++){const q=l[m].trim().split(":");if(q.length!==2)continue;const _=q[0].trim(),C=q[1].trim();C in t&&f.classList.toggle(_,!!t[C])}}return e}function _e(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<o.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[i],t??null),o[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)z(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function H(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const p=o.currentNode;p.textContent.indexOf("{{")!==-1&&(p.textContent=p.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(c,f){return t[f]!==void 0?t[f]:""}))}const i=function(p,c){return t[c]!==void 0?t[c]:""},a=Array.from(e.querySelectorAll("*"));e.nodeType===1&&a.push(e);for(let p=0;p<a.length;p++){const c=a[p],f=c.attributes;for(let l=0;l<f.length;l++){const m=f[l];m.value.indexOf("{{")!==-1&&c.setAttribute(m.name,m.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function Ae(e,t,o,i,a,p){const c={};for(let l=0;l<e.children.length;l++){const m=e.children[l],q=m.getAttribute("data-ln-render-key");q&&(c[q]=m)}const f=document.createDocumentFragment();for(let l=0;l<t.length;l++){const m=t[l],q=String(i(m));let _=c[q];if(_)a(_,m,l);else{const C=Ce(o,p);if(!C||(H(C,m),_=C.firstElementChild,!_))continue;_.setAttribute("data-ln-render-key",q),a(_,m,l)}f.appendChild(_)}e.textContent="",e.appendChild(f)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=H,window.lnCore.fill=z,window.lnCore.lnFill=_e,window.lnCore.renderList=Ae);function F(e,t,o){const i=e.getAttribute(t);return i===null?o:i}function J(e,t,o){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?o:i}function X(e,t,o=!1){const i=e.getAttribute(t);if(i===null)return!!o;const a=i.trim().toLowerCase();return!(a==="false"||a==="0")}function Y(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const j=new Map;function Z(e,t){const o=(e?e.join("|"):"")+"::"+t;if(j.has(o))return j.get(o);const i=new Set(e||[]),a=function(p,c){const f=p.getAttribute(c);return f!==null&&i.has(f)?f:t};return j.set(o,a),a}function ee(e,t,o){const i=parseFloat(e.getAttribute(t));return isNaN(i)?o:i}function te(e,t,o){const i=e.getAttribute(t);if(!i)return o;try{return JSON.parse(i)}catch{return o}}function ne(e,t,o,i,a){if(!e||t===null)return!0;const p=i||"ln-component",c=e.type;if(c==="trigger"||c==="marker"||c==="string"||c==="list"||!c||t===""&&e.fallback!==void 0)return!0;const f=l=>{a?console.warn(l,a):console.warn(l)};if(c==="boolean"){const l=t.trim().toLowerCase();return l!==""&&l!=="true"&&l!=="false"&&l!=="1"&&l!=="0"?(f(`[${p}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(c==="enum"){const l=e.values||[];return l.includes(t)?!0:(f(`[${p}] Invalid value "${t}" for attribute "${o}". Allowed: ${l.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return f(`[${p}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const l=parseInt(t,10);return e.min!==void 0&&l<e.min?(f(`[${p}] Value ${l} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&l>e.max?(f(`[${p}] Value ${l} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(f(`[${p}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(l){return f(`[${p}] Invalid JSON for attribute "${o}": ${l.message}. Fallback: ${e.fallback}.`),!1}return!0}function re(e,t,o){for(const i in o){const[a,p,c]=o[i];Object.defineProperty(e,i,{get:function(){return a(t,p,c)},enumerable:!0,configurable:!0})}return e}function oe(e){const t={};for(const o in e){const i=e[o];if(!i||!i.prop)continue;let a=i.read;if(!a&&i.type)switch(i.type){case"enum":a=Z(i.values,i.fallback);break;case"integer":a=J;break;case"float":a=ee;break;case"boolean":a=X;break;case"list":a=Y;break;case"json":a=te;break;case"string":default:a=F;break}a||(a=F),t[i.prop]=[a,o,i.fallback]}return t}function ve(e){const t={};for(const o in e){const i=e[o];i&&i.effect&&(t[o]=i.effect)}return Object.keys(t).length?t:null}function qe(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=re,window.lnCore.attrSpec=oe,window.lnCore.attrStr=F,window.lnCore.attrInt=J,window.lnCore.attrBool=X,window.lnCore.attrList=Y,window.lnCore.attrEnum=Z,window.lnCore.attrFloat=ee,window.lnCore.attrJson=te);function I(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function ie(e,t,o,i){if(e.nodeType!==1)return;const p=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c={selector:t,attribute:o,ComponentFn:i};if(e.matches&&e.matches(p)&&I(e,c),e.querySelectorAll){const f=e.querySelectorAll(p);for(let l=0;l<f.length;l++)I(f[l],c)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ee(){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 ae(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function xe(e){const t=ae(),o=e.observed||[];for(let i=0;i<o.length;i++){const a=o[i];t.byAttr.has(a)||t.byAttr.set(a,[]),t.byAttr.get(a).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const a=t.byDeclaredAttr.get(i);a.some(p=>p.componentTag===e.componentTag)||a.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=qe(e);if(i===null)t.reactiveWildcard.push(e);else for(const a of i)t.byReactive.has(a)||t.byReactive.set(a,[]),t.byReactive.get(a).push(e)}e.persist&&t.persist.push(e)}function le(e,t,o,i){for(let a=0;a<e.length;a++){const p=e[a];if(!t[p.attribute])continue;const c=p.effects&&p.effects[o];c?c(t,o,i):p.onAttrChange&&(!p.declared||p.declared.has(o))&&p.onAttrChange(t,o,i)}}function ke(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,i=ae(),a=i.byAttr.get(t),p=G()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!o&&!a&&!p)return;const c=e.target;if(e.oldValue!==c.getAttribute(t)){if(p&&T(c)){const f=i.byDeclaredAttr.get(t),l=c.getAttribute(t);for(let m=0;m<f.length;m++)ne(f[m].spec,l,t,f[m].componentTag,c)}if(window.lnCore._debugSink&&(o||a)&&window.lnCore._debugSink("attr",t,c,{oldValue:e.oldValue,newValue:c.getAttribute(t)}),o){const f=i.byReactive.get(t);f&&le(f,c,t,e.oldValue),i.reactiveWildcard.length&&le(i.reactiveWildcard,c,t,e.oldValue)}if(a)for(let f=0;f<a.length;f++){const l=a[f];if(l.handler){l.handler(c,t,e.oldValue);continue}l.onAttributeChange&&c[l.attribute]?l.onAttributeChange(c,t):(ie(c,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(c))}}}function Ie(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,D(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{ke(t[o])}catch(i){console.error("[ln-core] mutation handler failed",t[o].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function $(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function M(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Oe(e){const t=$();if(!t.length)return;const o=e.target;if(o){const i=o.nodeType===1?o:o.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let i=0;i<t.length;i++){const a=t[i];if(a.onSubtreeChange&&a.query){const p=a.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(p)?e.target:e.target.closest?e.target.closest(p):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(p):null;c&&a.onSubtreeChange(c,e)}}for(let i=0;i<e.addedNodes.length;i++){const a=e.addedNodes[i];if(a.nodeType===1){const p=!!(a.firstElementChild||a.children&&a.children.length);for(let c=0;c<t.length;c++){const f=t[c];if(f.selector&&f.attribute&&f.ComponentFn){if(!p)a.matches&&a.matches(f.query)&&I(a,f);else if(a.matches&&a.matches(f.query)&&I(a,f),a.querySelectorAll){const l=a.querySelectorAll(f.query);for(let m=0;m<l.length;m++)I(l[m],f)}}f.onInit&&f.onInit(a)}}}for(let i=0;i<e.removedNodes.length;i++){const a=e.removedNodes[i];if(a.nodeType===1){const p=!!(a.firstElementChild||a.children&&a.children.length);for(let c=0;c<t.length;c++){const f=t[c],l=f.query;if(l){if(!p)a.matches&&a.matches(l)&&M(a,f);else if(a.matches&&a.matches(l)&&M(a,f),a.querySelectorAll){const m=a.querySelectorAll(l);for(let q=0;q<m.length;q++)M(m[q],f)}}}}}}function se(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,D(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const i=t[o];if(i.type==="childList")try{Oe(i)}catch(a){console.error("[ln-core] lifecycle handler failed",i.target,a)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function De(e){$().push(e),se()}function ce(e,t,o,i,a={}){const p=a.extraAttributes||[],c=a.onAttributeChange||null,f=a.onSubtreeChange||null,l=a.onInit||null,m=a.onAttrChange||null,q=a.effects||null,_=a.attributes||null,C=_?ve(_):q,W=_?new Set(Object.keys(_)):null,N=a.persist||null;function n(y){const A=y||document.body;if(ie(A,e,t,o),_&&G())for(const E in _){const d=_[E],h=Array.from(A.querySelectorAll("["+E+"]"));A.matches&&A.matches("["+E+"]")&&h.push(A);for(let b=0;b<h.length;b++){const v=h[b];T(v)&&ne(d,v.getAttribute(E),E,i,v)}}l&&l(A)}const r=[];if(e.indexOf("[")!==-1){const y=/\[([\w-]+)/g;let A;for(;(A=y.exec(e))!==null;)r.push(A[1])}else r.push(e);xe({selector:e,attribute:t,componentTag:i,attributes:_,ComponentFn:o,onInit:l,observed:r.concat(p),onAttributeChange:c,onAttrChange:m,effects:C,declared:W,persist:N}),Ie();const s=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,u=a.subtreeQuery||(s?e:"["+e+"]");$().push({selector:e,attribute:t,ComponentFn:o,onInit:l,onSubtreeChange:f,query:u}),se(),window[t]=n,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ce,window.lnCore.observeLifecycle=De);function w(){Ee()>0?Se(function(){n(document.body)}):n(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",w):w(),n}function Re(e,t){let o=!1;return function(){o||(o=!0,queueMicrotask(function(){o=!1,e()}))}}function de(e){return(e||"").replace(/^#/,"")}function B(e){const t=e===void 0?location.hash:e,o={},i=de(t);if(!i)return o;const a=i.split("&");for(let p=0;p<a.length;p++){const c=a[p];if(!c)continue;const f=c.indexOf(":"),l=f>-1?c.slice(0,f):c,m=f>-1?c.slice(f+1):"";if(l)try{o[l]=decodeURIComponent(m)}catch{o[l]=m}}return o}function Te(e){if(!e)return null;const t=B();return e in t?t[e]:null}function Le(e,t){if(!e)return;const o=B();t==null?delete o[e]:o[e]=String(t);const a=Object.keys(o).map(function(p){const c=o[p];return c===""?p:p+":"+encodeURIComponent(c)}).join("&");de(location.hash)!==a&&(location.hash=a)}function Fe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function je(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function $e(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Me(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 o=e.slice(0,t),i=e.slice(t+1),a=i?i.split(",").map(function(p){try{return decodeURIComponent(p)}catch{return p}}).filter(Boolean):[];return{key:o,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=B,window.lnCore.hashGet=Te,window.lnCore.hashSet=Le,window.lnCore.hashLinkClick=Fe,window.lnCore.resolveHashNamespace=je,window.lnCore.hashSortEncode=$e,window.lnCore.hashSortDecode=Me,window.lnCore.hashFilterEncode=Be,window.lnCore.hashFilterDecode=We);function k(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=k);function Ne(e){return e=e||{},{sort:e.sort,filters:e.filters,search:e.search,offset:e.offset,limit:e.limit,queryGen:e.queryGen}}function Ue(e,t){const o=!e||!!e.initializationError,i=!!(e&&e.noLocalQuery&&!e.windowed);return t&&(o||!e.canServe||i)?"remote":e&&!e.initializationError?"store":"none"}function ue(e,t){const o=Object.assign({},e);return t&&(o.filters=t.filters,o.search=t.search,o.sort=t.sort),o}class Ge{constructor(){this._pending=new Map}wait(t){return new Promise((o,i)=>{this._pending.set(t,{resolve:o,reject:i})})}resolve(t){return this._settle(t,!1)}reject(t){return this._settle(t,!0)}close(t){const o=t||new Error("Mutation receipt registry closed");for(const i of this._pending.values())i.reject(o);this._pending.clear()}_settle(t,o){const i=t&&t.requestId;if(!i)return!1;const a=this._pending.get(i);return a?(this._pending.delete(i),o?a.reject(t.error||new Error("Store mutation failed")):a.resolve(t),!0):!1}}(function(){const e="data-ln-data-coordinator",t="lnDataCoordinator",o="data-ln-data-coordinator-scope";if(window[t]!==void 0)return;const i="data-ln-data-coordinator-search",a="data-ln-data-coordinator-filters",p="data-ln-data-coordinator-sort-field",c="data-ln-data-coordinator-sort-direction",l=oe({"data-ln-data-coordinator":{prop:"_name",type:"string",description:"Coordinator name or identifier for data routing"},"data-ln-data-coordinator-scope":{type:"string",description:"Scope name addressing the bound data store and connector"},"data-ln-data-coordinator-connector":{type:"string",description:"Selector, identifier, or namespace of the bound connector"},"data-ln-data-coordinator-mapper":{type:"string",description:"Name of the registered data mapper transform"},"data-ln-data-coordinator-search":{prop:"_searchAttr",type:"string",description:"Active search query term"},"data-ln-data-coordinator-filters":{prop:"_filtersAttr",type:"string",description:"Active encoded filter parameters"},"data-ln-data-coordinator-sort-field":{prop:"_sortFieldAttr",type:"string",description:"Sort field name"},"data-ln-data-coordinator-sort-direction":{prop:"_sortDirAttr",type:"enum",values:["asc","desc"],fallback:"asc",description:"Sort direction"},"data-ln-data-coordinator-stale":{type:"marker",description:"Flag indicating data needs re-synchronization"},"data-ln-data-coordinator-no-autosync":{type:"boolean",description:"Disables automatic synchronization upon state changes"}}),m=[["[data-ln-table-source]","data-ln-table-source","table"],["[data-ln-list-source]","data-ln-list-source","list"],["[data-ln-chart-source]","data-ln-chart-source","chart"],["[data-ln-options]","data-ln-options","options"],["[data-ln-stat]","data-ln-stat","stat"]];function q(n){const r=n.getAttribute("data-ln-data-coordinator-connector");if(r)return n.querySelector(r)||document.querySelector(r)||document.getElementById(r);const s=n.querySelector("[data-ln-connector], [data-ln-api-connector], [data-ln-couchdb-connector], [data-ln-websocket-connector]");if(s)return s;for(const u of n.querySelectorAll("*")){if(u.lnConnector)return u;for(const w of u.attributes)if(w.name.startsWith("data-ln-")&&w.name.endsWith("-connector"))return u}return null}function _(n){var s;if(!n)return"ln-connector";if((s=n.lnConnector)!=null&&s.namespace)return n.lnConnector.namespace;const r=n.getAttribute("data-ln-connector");if(r&&r!=="true")return r.startsWith("ln-")?r:"ln-"+r+(r.endsWith("-connector")?"":"-connector");for(const u of n.attributes)if(u.name.startsWith("data-ln-")&&u.name.endsWith("-connector"))return u.name.replace(/^data-/,"");return"ln-connector"}function C(n){const r=this;return this.dom=n,re(this,n,l),this._name||console.warn("[ln-data-coordinator] missing id — the coordinator cannot be addressed",n),n[t]=this,this._destroyed=!1,this.mapper=null,this._unsubs=[],this._boundQueries=new WeakMap,this._boundDelivered=new WeakMap,this._mutationReceipts=new Ge,this._queueQueryRefresh=Re(()=>{r._destroyed||r._refreshAll(null,!0)}),this.refreshMapper(),W(this),this._checkInitialSync(),this}C.prototype._noAutosync=function(n){var r;return this.dom.hasAttribute("data-ln-data-coordinator-no-autosync")||!!((r=n.storeEl)!=null&&r.hasAttribute("data-ln-data-store-no-autosync"))},C.prototype._isStale=function(n){var s,u;const r=this.dom.getAttribute("data-ln-data-coordinator-stale")||((s=n.storeEl)==null?void 0:s.getAttribute("data-ln-data-store-stale"));return r==="never"||r==="-1"?!1:!((u=n.store)!=null&&u.lastSyncedAt)||Date.now()/1e3-n.store.lastSyncedAt>(parseInt(r,10)||300)},C.prototype._checkInitialSync=function(){const n=this,r=this.findChildren();r.store&&Promise.resolve(r.store.ready).then(()=>{if(n._destroyed)return;const s=n.findChildren();s.store&&s.connector&&!n._noAutosync(s)&&!s.store.isSyncing&&(!s.store.hasCache||n._isStale(s))&&s.store.forceSync()}).catch(s=>n._reportError("store-initialize",s,null))},C.prototype.refreshMapper=function(){var s,u;const n=this.dom.getAttribute("data-ln-data-coordinator-mapper")||this.dom.id,r=n&&((u=(s=window.lnCore)==null?void 0:s.getDataMapper)==null?void 0:u.call(s,n))||null;this.mapper={ingress:(r==null?void 0:r.ingress)||(w=>w),egress:(r==null?void 0:r.egress)||(w=>w)}},C.prototype.findChildren=function(){const n=this.dom.querySelector("[data-ln-data-store]"),r=q(this.dom),s=this.dom.querySelector("[data-ln-api-queue]");return{storeEl:n,connectorEl:r,queueEl:s,store:(n==null?void 0:n.lnDataStore)||null,connector:(r==null?void 0:r.lnConnector)||(r==null?void 0:r.lnApiConnector)||(r==null?void 0:r.lnCouchDbConnector)||(r==null?void 0:r.lnWebsocketConnector)||null,queue:(s==null?void 0:s.lnApiQueue)||null}},C.prototype._fanOutRemote=function(n,r,s,u){this.refreshMapper(),n.queue?g(n.queueEl,"ln-api-queue:request-enqueue",s):n.connector&&g(n.connectorEl,_(n.connectorEl)+":request-"+r,u)},C.prototype._fanOutCreate=function(n,r,s){const u="_temp_"+k(),w=this.mapper.egress(r);n.storeEl&&g(n.storeEl,"ln-data-store:request-create",{tempId:u,data:w}),this._fanOutRemote(n,"create",{chainKey:u,op:"create",targetId:null,payload:w,expectedVersion:null,meta:{tempId:u,action:s}},{data:w,url:s,meta:{entryId:k(),queued:!1,op:"create",tempId:u}})},C.prototype._fanOutUpdate=function(n,r,s,u,w){const y=this.mapper.egress(s);n.storeEl&&g(n.storeEl,"ln-data-store:request-update",{id:r,data:y}),this._fanOutRemote(n,"update",{chainKey:r,op:"update",targetId:r,payload:y,expectedVersion:u,meta:{id:r,action:w}},{id:r,data:y,expected_version:u,url:w,meta:{entryId:k(),queued:!1,op:"update",id:r}})},C.prototype._fanOutDelete=function(n,r){n.storeEl&&g(n.storeEl,"ln-data-store:request-delete",{id:r}),this._fanOutRemote(n,"delete",{chainKey:r,op:"delete",targetId:r,payload:null,expectedVersion:null,meta:{id:r}},{id:r,meta:{entryId:k(),queued:!1,op:"delete",id:r}})},C.prototype._fanOutBulkDelete=function(n,r){const s=r.join(",");n.storeEl&&g(n.storeEl,"ln-data-store:request-bulk-delete",{ids:r}),this._fanOutRemote(n,"bulk-delete",{chainKey:s,op:"bulk-delete",targetId:null,payload:{ids:r},expectedVersion:null,meta:{bulkKey:s,ids:r}},{ids:r,meta:{entryId:k(),queued:!1,op:"bulk-delete",bulkKey:s}})},C.prototype._requestStoreMutation=function(n,r,s){if(!n.storeEl)return Promise.reject(new Error("Store element not found"));const u=k(),w=this._mutationReceipts.wait(u);return g(n.storeEl,"ln-data-store:request-"+r,Object.assign({},s,{requestId:u})),w},C.prototype._reportError=function(n,r,s){this._destroyed||g(this.dom,"ln-data-coordinator:error",{operation:n,error:r,meta:s||null})},C.prototype._owns=function(n){var s;const r=this._name||((s=this.findChildren().storeEl)==null?void 0:s.id);return!!n&&n===r},C.prototype._currentQuery=function(){const n=this.dom.getAttribute(p),r=this.dom.getAttribute(c),s=new URLSearchParams(this.dom.getAttribute(a)||""),u={};for(const w of new Set(s.keys()))u[w]=s.getAll(w);return{search:this.dom.getAttribute(i)||"",filters:u,sort:n&&r?{field:n,direction:r}:null}},C.prototype._refreshAll=function(n,r){for(const[s,u,w]of m)for(const y of this.dom.ownerDocument.querySelectorAll(s))if(this._owns(y.getAttribute(u))){if((w==="table"||w==="list")&&y.hasAttribute(w==="table"?"data-ln-table-window":"data-ln-list-window")){g(y,"ln-"+w+(r?":request-invalidate":":request-revalidate"),{});continue}this._serveElement(y,w,null,n)}},C.prototype._serveElement=function(n,r,s,u){const w=this.findChildren(),y=w.store;if(!y)return;s&&this._boundQueries.set(n,s);const A=this._boundQueries.get(n)||{sort:null,filters:{},search:""},E=ue(A,this._currentQuery()),d=this;return Promise.resolve(y.ready).then(()=>{if(d._destroyed)return;const h=Ue(y,w.connector);if(r==="table"||r==="list"||r==="chart")return h==="remote"?(g(n,"ln-"+r+":set-loading",{loading:!0}),g(w.connectorEl,_(w.connectorEl)+":request-query",{query:E,meta:{targetEl:n,kind:r,offset:E.offset,limit:E.limit,queryGen:A.queryGen}})):h!=="store"?g(n,"ln-"+r+":set-loading",{loading:!1}):y.getAll(E).then(b=>{d._destroyed||!d._boundDelivered||(g(n,"ln-"+r+":set-loading",{loading:!1}),g(n,"ln-"+r+":set-data",{data:b.data,total:(u==null?void 0:u.total)??b.total,filtered:(u==null?void 0:u.filtered)??b.filtered,offset:b.offset??(u==null?void 0:u.offset)??A.offset,queryGen:A.queryGen!==void 0?A.queryGen:(u==null?void 0:u.queryGen)??b.queryGen,provisional:b.provisional===!0}),d._boundDelivered.set(n,!0))});if(r==="options"){if(h==="remote")return g(w.connectorEl,_(w.connectorEl)+":request-query",{query:{},meta:{targetEl:n,kind:r}});if(h==="store")return y.getAll({}).then(b=>!d._destroyed&&g(n,"ln-options:set-data",{data:b.data}))}if(r==="stat"){let b=s==null?void 0:s.filters;if(!b){const S=n.getAttribute("data-ln-stat-filter");if(S!=null&&S.includes(":")){const x=S.split(":");b={[x[0].trim()]:[x.slice(1).join(":").trim()]}}}const v=w.connector&&y&&(y.windowed&&b&&Object.keys(b).length||y.noLocalQuery)?"remote":h;if(v==="remote")return g(w.connectorEl,_(w.connectorEl)+":request-query",{query:{filters:b},meta:{targetEl:n,kind:r}});if(v==="store")return y.count(b).then(S=>!d._destroyed&&g(n,"ln-stat:set-count",{count:S}))}}).catch(h=>{d._destroyed||((r==="table"||r==="list"||r==="chart")&&g(n,"ln-"+r+":set-loading",{loading:!1}),d._reportError(r+"-query",h,{targetEl:n,kind:r}))})};function W(n){const r=n._unsubs=[],s=(d,h,b)=>{d.addEventListener(h,b),r.push(()=>d.removeEventListener(h,b))};s(n.dom,"ln-data-store:request-remote-sync",d=>{n.refreshMapper();const h=n.findChildren();h.store&&h.connector&&g(h.connectorEl,_(h.connectorEl)+":request-sync",{since:d.detail.since,meta:{op:"sync"}})}),s(n.dom,"ln-data-store:request-page",d=>{const h=n.findChildren(),b=d.detail||{};if(!h.connectorEl)return;const v=ue(b.query||{},n._currentQuery());g(h.connectorEl,_(h.connectorEl)+":request-query",{query:Object.assign({},v,{offset:b.offset,limit:b.limit,queryGen:b.queryGen})})}),s(n.dom,"ln-data-coordinator:request-create",d=>n._fanOutCreate(n.findChildren(),d.detail.data||{},d.detail.action)),s(n.dom,"ln-data-coordinator:request-update",d=>n._fanOutUpdate(n.findChildren(),d.detail.id,d.detail.data||{},d.detail.expected_version,d.detail.action)),s(n.dom,"ln-data-coordinator:request-delete",d=>n._fanOutDelete(n.findChildren(),d.detail.id)),s(n.dom,"ln-data-coordinator:request-bulk-delete",d=>n._fanOutBulkDelete(n.findChildren(),d.detail.ids||[])),s(n.dom,"ln-api-queue:send",d=>n._onQueueSend(d.detail||{})),s(n.dom,"ln-api-queue:failed",d=>{var h;return n._reportError("queue-failed",((h=d==null?void 0:d.detail)==null?void 0:h.error)||new Error("Queue failed"),(d==null?void 0:d.detail)||null)}),s(n.dom,"ln-data-store:initialized",d=>{var b;const h=n.findChildren();h.store&&!h.store.initializationError&&h.connector&&!n._noAutosync(h)&&!h.store.isSyncing&&(!((b=d.detail)!=null&&b.hasCache)||n._isStale(h))&&h.store.forceSync()});const u=()=>{const d=n.findChildren();d.store&&!d.store.initializationError&&d.connector&&!n._noAutosync(d)&&d.store.isInitialized&&!d.store.isSyncing&&d.store.forceSync()};s(n.dom,"ln-websocket-connector:connected",u),s(document,"submit",d=>n._onFormSubmit(d));const w=(d,h,b)=>{var v;n._owns(d.target.getAttribute(b))&&n._serveElement(d.target,h,h==="stat"?{filters:((v=d.detail)==null?void 0:v.filters)||null}:h==="options"?null:Ne(d.detail||{}),null)};s(document,"ln-table:request-data",d=>w(d,"table","data-ln-table-source")),s(document,"ln-list:request-data",d=>w(d,"list","data-ln-list-source")),s(document,"ln-chart:request-data",d=>w(d,"chart","data-ln-chart-source")),s(document,"ln-options:request-data",d=>w(d,"options","data-ln-options")),s(document,"ln-stat:request-count",d=>w(d,"stat","data-ln-stat"));const y=d=>{n._mutationReceipts.resolve(d.detail),n._refreshAll(null,!1)};s(n.dom,"ln-data-store:ready",y),s(n.dom,"ln-data-store:created",y),s(n.dom,"ln-data-store:updated",y),s(n.dom,"ln-data-store:deleted",y),s(n.dom,"ln-data-store:mutation-error",d=>n._mutationReceipts.reject(d.detail)),s(n.dom,"ln-data-store:synced",d=>{var h;(h=d.detail)!=null&&h.changed&&n._refreshAll(d.detail.meta,!1)}),s(n.dom,"ln-data-store:query-changed",()=>n._refreshAll(null,!0)),s(n.dom,"ln-search:change",d=>{var b;d.preventDefault();const h=((b=d.detail)==null?void 0:b.term)!=null?d.detail.term:"";h!==(n.dom.getAttribute(i)||"")&&n.dom.setAttribute(i,h)}),s(n.dom,"ln-filter:change",d=>{var fe;d.preventDefault();const h=(fe=d.detail)==null?void 0:fe.key;if(!h)return;const b=(d.detail.values||[]).slice(),v=n._currentQuery().filters,S=v[h];if(S?S.length===b.length&&S.every((R,U)=>R===b[U]):!b.length)return;b.length?v[h]=b:delete v[h];const x=new URLSearchParams;Object.keys(v).forEach(R=>v[R].forEach(U=>x.append(R,U)));const O=x.toString();O?n.dom.setAttribute(a,O):n.dom.removeAttribute(a)}),s(n.dom,"ln-sort:change",d=>{var x,O;d.preventDefault();const h=(x=d.detail)==null?void 0:x.field,b=(O=d.detail)==null?void 0:O.direction,v=h&&b&&b!=="none"?{field:h,direction:b}:null,S=n._currentQuery().sort;!S&&!v||S&&v&&S.field===v.field&&S.direction===v.direction||(v?(n.dom.setAttribute(p,v.field),n.dom.setAttribute(c,v.direction)):(n.dom.removeAttribute(p),n.dom.removeAttribute(c)))});const A=new Set(["ln-api-connector","ln-couchdb-connector","ln-websocket-connector","ln-connector"]),E=n.findChildren().connectorEl;if(E){const d=_(E);A.add(d),s(n.dom,d+":connected",u)}A.forEach(d=>{s(n.dom,d+":fetched",h=>n._reconcileServerFetch(h.detail)),s(n.dom,d+":created",h=>n._reconcileServerMutation("create",h.detail)),s(n.dom,d+":updated",h=>n._reconcileServerMutation("update",h.detail)),s(n.dom,d+":deleted",h=>n._reconcileServerMutation("ack",h.detail)),s(n.dom,d+":bulk-deleted",h=>n._reconcileServerMutation("ack",h.detail)),s(n.dom,d+":error",h=>n._reconcileServerMutation("error",h.detail))})}C.prototype._onQueueSend=function(n){this.refreshMapper();const r=this.findChildren();if(!r.store||!r.connector||!r.queue)return;const s=n.meta||{},u=_(r.connectorEl),w=n.idempotencyKey||n.entryId,y={create:()=>g(r.connectorEl,u+":request-create",{data:n.payload,url:s.action||null,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"create",tempId:s.tempId}}),update:()=>g(r.connectorEl,u+":request-update",{id:n.targetId,data:n.payload,expected_version:n.expectedVersion,url:s.action||null,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"update",id:n.targetId}}),delete:()=>g(r.connectorEl,u+":request-delete",{id:n.targetId,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"delete",id:n.targetId}}),"bulk-delete":()=>{var A;return g(r.connectorEl,u+":request-bulk-delete",{ids:((A=n.payload)==null?void 0:A.ids)||[],idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"bulk-delete",bulkKey:s.bulkKey}})}};y[n.op]&&y[n.op]()},C.prototype._onFormSubmit=function(n){const r=n.target;if(n.defaultPrevented)return;const s=r.hasAttribute(o)?r.getAttribute(o):null;if(s===null||(s?!this._owns(s):r.closest("["+e+"]")!==this.dom))return;const u=K(r);if(u!=="POST"&&u!=="PUT"&&u!=="PATCH")return;n.preventDefault();const w=Q(r);delete w._method,delete w._token;const y=w.id,A=w.expected_version,E=r.getAttribute("action")||"",d=this.findChildren();delete w.id,delete w.expected_version,u==="POST"?this._fanOutCreate(d,w,E):this._fanOutUpdate(d,y,w,A,E)},C.prototype._reconcileServerFetch=function(n){if(!n)return;const r=n.meta||{},s=this.findChildren(),u=n.data;this.refreshMapper();const w=Array.isArray(u)?u:(u==null?void 0:u.data)||[],y=Array.isArray(u==null?void 0:u.deleted)?u.deleted:[],A=Array.isArray(u)?Math.floor(Date.now()/1e3):(u==null?void 0:u.synced_at)??(u==null?void 0:u.since)??Math.floor(Date.now()/1e3),E=w.map(d=>this.mapper.ingress(d));if(!(!s.store||s.store.initializationError)){if(!r.kind)return s.store.applySync(E,y,A,{total:n.total,filtered:n.filtered,offset:n.offset,queryGen:n.queryGen,targetEl:r.targetEl});s.store.applyQuery(E,{total:n.total}).then(d=>{const h=r.kind;h==="table"||h==="list"||h==="chart"?(g(r.targetEl,"ln-"+h+":set-loading",{loading:!1}),g(r.targetEl,"ln-"+h+":set-data",{data:d,total:n.total??d.length,filtered:n.filtered??d.length,offset:n.offset,queryGen:r.queryGen}),this._boundDelivered.set(r.targetEl,!0)):h==="options"?s.store.getAll({}).then(b=>g(r.targetEl,"ln-options:set-data",{data:b.data})):h==="stat"&&g(r.targetEl,"ln-stat:set-count",{count:n.filtered??n.total??E.length})})}},C.prototype._reconcileServerMutation=function(n,r){var w;if(!r)return;const s=this.findChildren(),u=r.meta||{};if(n==="create"){if(!r.record)return this._reportError("create-empty-response",new Error("Create response missing record payload"),u);const y=this.mapper.ingress(r.record);(s.storeEl?this._requestStoreMutation(s,"update",{id:u.tempId,data:y}):Promise.resolve()).then(()=>{u.queued&&s.queue&&g(s.queueEl,"ln-api-queue:resolve-create",{entryId:u.entryId,oldKey:u.tempId,newId:y.id})}).catch(A=>this._reportError("create-reconcile",A,u))}else if(n==="update"){const y=r.record?this.mapper.ingress(r.record):null;(s.storeEl&&y?this._requestStoreMutation(s,"update",{id:u.id,data:y}):Promise.resolve()).then(()=>{u.queued&&s.queue&&g(s.queueEl,"ln-api-queue:ack",{entryId:u.entryId})}).catch(A=>this._reportError("update-reconcile",A,u))}else if(n==="ack")u.queued&&s.queue&&g(s.queueEl,"ln-api-queue:ack",{entryId:u.entryId});else if(n==="error"){const y=r.status||((w=r.error)==null?void 0:w.status)||0;u.queued&&s.queue&&g(s.queueEl,"ln-api-queue:nack",{entryId:u.entryId,reason:y===401||y===419?"auth":y===0||y>=500?"retry":"drop"}),s.storeEl&&g(s.storeEl,"ln-data-store:request-sync-failed",{error:r.error||r,status:y}),this._reportError("connector-error",r.error||r,u)}},C.prototype.destroy=function(){var n;if(this.dom[t]){for(this._destroyed=!0;(n=this._unsubs)!=null&&n.length;)this._unsubs.pop()();this._unsubs=this._boundQueries=this._boundDelivered=this._queueQueryRefresh=null,this._mutationReceipts.close(new Error("Data coordinator destroyed")),this._mutationReceipts=null,delete this.dom[t]}};function N(n,r){const s=n[t];s&&(r==="data-ln-data-coordinator-mapper"?s.refreshMapper():(r===i||r===a||r===p||r===c)&&s._queueQueryRefresh())}ce(e,t,C,"ln-data-coordinator",{extraAttributes:["data-ln-data-coordinator-mapper",i,a,p,c],onAttributeChange:N}),window[t].init=window[t]})()})();
1
+ (function(){"use strict";function K(){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 T(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 a=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){a=t[s];break}if(!T(a))return}e.apply(console,t)}}function g(e,t,o){const a=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,a),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:a}))}function D(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){D(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Q(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function P(e,t){const o=!!(t&&t.typed),a=t&&t.exclude,s={},u=e.elements,c={};if(o)for(let p=0;p<u.length;p++){const i=u[p];i.name&&i.type==="checkbox"&&!i.disabled&&(c[i.name]=(c[i.name]||0)+1)}for(let p=0;p<u.length;p++){const i=u[p];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(a&&i.matches&&i.matches(a)))if(i.type==="checkbox")o&&c[i.name]===1?s[i.name]=i.checked:(s[i.name]||(s[i.name]=[]),i.checked&&s[i.name].push(i.value));else if(i.type==="radio")i.checked&&(s[i.name]=i.value);else if(i.type==="select-multiple"){s[i.name]=[];for(let m=0;m<i.options.length;m++)i.options[m].selected&&s[i.name].push(i.options[m].value)}else if(o&&i.type==="hidden")s[i.name]=i.value;else if(o&&(i.type==="number"||i.type==="range")){const m=Number(i.value);s[i.name]=i.value===""||isNaN(m)?null:m}else s[i.name]=i.value}return s}function he(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function we(e,t){const o=e.elements,a=[],s={};for(let u=0;u<o.length;u++){const c=o[u];c.name&&c.type==="checkbox"&&(s[c.name]=(s[c.name]||0)+1)}for(let u=0;u<o.length;u++){const c=o[u];if(c.type==="file"||c.type==="submit"||c.type==="button")continue;const p=c.getAttribute("data-ln-fill-as")||c.name;if(!p||!(p in t))continue;const i=t[p];if(c.type==="checkbox"){if(Array.isArray(i))c.checked=i.indexOf(c.value)!==-1;else if(s[c.name]>1){const m=String(i).split(",").map(function(A){return A.trim()});c.checked=m.indexOf(c.value)!==-1}else c.checked=he(i);a.push(c)}else if(c.type==="radio")c.checked=c.value===String(i),a.push(c);else if(c.type==="select-multiple"){if(Array.isArray(i))for(let m=0;m<c.options.length;m++)c.options[m].selected=i.indexOf(c.options[m].value)!==-1;a.push(c)}else c.value=i,c.tagName==="SELECT"&&i!=null&&c.setAttribute("data-ln-value",i),a.push(c)}return a}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=we,window.lnCore.serializeForm=P,window.lnCore.resolveFormMethod=Q);const V={};function me(e,t){V[e]=t}function be(e){return V[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=me,window.lnCore.getDataMapper=be);function ye(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,D(function(){new MutationObserver(function(){g(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const z={};function ge(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];z[o]=t}function Ce(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return z[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ge,window.lnCore.getLocaleFallback=Ce,window.lnCore.ensureLocaleObserver=ye);const L={};function _e(e,t){L[e]||(L[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=L[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function H(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let c=0;c<o.length;c++){const p=o[c],i=p.getAttribute("data-ln-field");t[i]!=null&&(p.textContent=t[i])}const a=e.querySelectorAll("[data-ln-attr]");for(let c=0;c<a.length;c++){const p=a[c],i=p.getAttribute("data-ln-attr").split(",");for(let m=0;m<i.length;m++){const A=i[m].trim().split(":");if(A.length!==2)continue;const _=A[0].trim(),C=A[1].trim();t[C]!=null&&p.setAttribute(_,t[C])}}const s=e.querySelectorAll("[data-ln-show]");for(let c=0;c<s.length;c++){const p=s[c],i=p.getAttribute("data-ln-show");i in t&&p.classList.toggle("hidden",!t[i])}const u=e.querySelectorAll("[data-ln-class]");for(let c=0;c<u.length;c++){const p=u[c],i=p.getAttribute("data-ln-class").split(",");for(let m=0;m<i.length;m++){const A=i[m].trim().split(":");if(A.length!==2)continue;const _=A[0].trim(),C=A[1].trim();C in t&&p.classList.toggle(_,!!t[C])}}return e}function Ae(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let a=0;a<o.length;a++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[a],t??null),o[a].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)H(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function J(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const u=o.currentNode;u.textContent.indexOf("{{")!==-1&&(u.textContent=u.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(c,p){return t[p]!==void 0?t[p]:""}))}const a=function(u,c){return t[c]!==void 0?t[c]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let u=0;u<s.length;u++){const c=s[u],p=c.attributes;for(let i=0;i<p.length;i++){const m=p[i];m.value.indexOf("{{")!==-1&&c.setAttribute(m.name,m.value.replace(/\{\{\s*(\w+)\s*\}\}/g,a))}}return e}function ve(e,t,o,a,s,u){const c={};for(let i=0;i<e.children.length;i++){const m=e.children[i],A=m.getAttribute("data-ln-render-key");A&&(c[A]=m)}const p=document.createDocumentFragment();for(let i=0;i<t.length;i++){const m=t[i],A=String(a(m));let _=c[A];if(_)s(_,m,i);else{const C=_e(o,u);if(!C||(J(C,m),_=C.firstElementChild,!_))continue;_.setAttribute("data-ln-render-key",A),s(_,m,i)}p.appendChild(_)}e.textContent="",e.appendChild(p)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=J,window.lnCore.fill=H,window.lnCore.lnFill=Ae,window.lnCore.renderList=ve);function F(e,t,o){const a=e.getAttribute(t);return a===null?o:a}function X(e,t,o){const a=parseInt(e.getAttribute(t),10);return isNaN(a)?o:a}function Y(e,t,o=!1){const a=e.getAttribute(t);if(a===null)return!!o;const s=a.trim().toLowerCase();return!(s==="false"||s==="0")}function Z(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const j=new Map;function ee(e,t){const o=(e?e.join("|"):"")+"::"+t;if(j.has(o))return j.get(o);const a=new Set(e||[]),s=function(u,c){const p=u.getAttribute(c);return p!==null&&a.has(p)?p:t};return j.set(o,s),s}function te(e,t,o){const a=parseFloat(e.getAttribute(t));return isNaN(a)?o:a}function ne(e,t,o){const a=e.getAttribute(t);if(!a)return o;try{return JSON.parse(a)}catch{return o}}function re(e,t,o,a,s){if(!e||t===null)return!0;const u=a||"ln-component",c=e.type;if(c==="trigger"||c==="marker"||c==="string"||c==="list"||!c||t===""&&e.fallback!==void 0)return!0;const p=i=>{s?console.warn(i,s):console.warn(i)};if(c==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(p(`[${u}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(c==="enum"){const i=e.values||[];return i.includes(t)?!0:(p(`[${u}] Invalid value "${t}" for attribute "${o}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return p(`[${u}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(p(`[${u}] Value ${i} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(p(`[${u}] Value ${i} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(p(`[${u}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(i){return p(`[${u}] Invalid JSON for attribute "${o}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function oe(e,t,o){for(const a in o){const[s,u,c]=o[a];Object.defineProperty(e,a,{get:function(){return s(t,u,c)},enumerable:!0,configurable:!0})}return e}function ie(e){const t={};for(const o in e){const a=e[o];if(!a||!a.prop)continue;let s=a.read;if(!s&&a.type)switch(a.type){case"enum":s=ee(a.values,a.fallback);break;case"integer":s=X;break;case"float":s=te;break;case"boolean":s=Y;break;case"list":s=Z;break;case"json":s=ne;break;case"string":default:s=F;break}s||(s=F),t[a.prop]=[s,o,a.fallback]}return t}function Ee(e){const t={};for(const o in e){const a=e[o];a&&a.effect&&(t[o]=a.effect)}return Object.keys(t).length?t:null}function qe(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=oe,window.lnCore.attrSpec=ie,window.lnCore.attrStr=F,window.lnCore.attrInt=X,window.lnCore.attrBool=Y,window.lnCore.attrList=Z,window.lnCore.attrEnum=ee,window.lnCore.attrFloat=te,window.lnCore.attrJson=ne);function I(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function ae(e,t,o,a){if(e.nodeType!==1)return;const u=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c={selector:t,attribute:o,ComponentFn:a};if(e.matches&&e.matches(u)&&I(e,c),e.querySelectorAll){const p=e.querySelectorAll(u);for(let i=0;i<p.length;i++)I(p[i],c)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Se(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function xe(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function le(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ke(e){const t=le(),o=e.observed||[];for(let a=0;a<o.length;a++){const s=o[a];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 a in e.attributes){t.byDeclaredAttr.has(a)||t.byDeclaredAttr.set(a,[]);const s=t.byDeclaredAttr.get(a);s.some(u=>u.componentTag===e.componentTag)||s.push({spec:e.attributes[a],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const a=qe(e);if(a===null)t.reactiveWildcard.push(e);else for(const s of a)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function se(e,t,o,a){for(let s=0;s<e.length;s++){const u=e[s];if(!t[u.attribute])continue;const c=u.effects&&u.effects[o];c?c(t,o,a):u.onAttrChange&&(!u.declared||u.declared.has(o))&&u.onAttrChange(t,o,a)}}function Ie(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,a=le(),s=a.byAttr.get(t),u=K()&&a.byDeclaredAttr&&a.byDeclaredAttr.has(t);if(!o&&!s&&!u)return;const c=e.target;if(e.oldValue!==c.getAttribute(t)){if(u&&T(c)){const p=a.byDeclaredAttr.get(t),i=c.getAttribute(t);for(let m=0;m<p.length;m++)re(p[m].spec,i,t,p[m].componentTag,c)}if(window.lnCore._debugSink&&(o||s)&&window.lnCore._debugSink("attr",t,c,{oldValue:e.oldValue,newValue:c.getAttribute(t)}),o){const p=a.byReactive.get(t);p&&se(p,c,t,e.oldValue),a.reactiveWildcard.length&&se(a.reactiveWildcard,c,t,e.oldValue)}if(s)for(let p=0;p<s.length;p++){const i=s[p];if(i.handler){i.handler(c,t,e.oldValue);continue}i.onAttributeChange&&c[i.attribute]?i.onAttributeChange(c,t):(ae(c,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(c))}}}function Oe(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,D(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{Ie(t[o])}catch(a){console.error("[ln-core] mutation handler failed",t[o].target,a)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function $(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function M(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function B(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(a){console.error("["+t.attribute+"] destroy failed",e,a)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function De(e){const t=$();if(!t.length)return;const o=e.target;if(o){const s=o.nodeType===1?o:o.parentElement;if(s&&(s.isContentEditable||s.closest&&s.closest('[contenteditable]:not([contenteditable="false"])')))return}const a=M();if(e.target&&a.length)for(let s=0;s<a.length;s++){const u=a[s],c=u.query,p=e.target.nodeType===1?e.target.matches&&e.target.matches(c)?e.target:e.target.closest?e.target.closest(c):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(c):null;p&&u.onSubtreeChange(p,e)}for(let s=0;s<e.addedNodes.length;s++){const u=e.addedNodes[s];if(u.nodeType===1){const c=!!(u.firstElementChild||u.children&&u.children.length);for(let p=0;p<t.length;p++){const i=t[p];if(i.selector&&i.attribute&&i.ComponentFn){if(!c)u.matches&&u.matches(i.query)&&I(u,i);else if(u.matches&&u.matches(i.query)&&I(u,i),u.querySelectorAll){const m=u.querySelectorAll(i.query);for(let A=0;A<m.length;A++)I(m[A],i)}}i.onInit&&i.onInit(u)}}}for(let s=0;s<e.removedNodes.length;s++){const u=e.removedNodes[s];if(u.nodeType===1){const c=!!(u.firstElementChild||u.children&&u.children.length);for(let p=0;p<t.length;p++){const i=t[p],m=i.query;if(m){if(!c)u.matches&&u.matches(m)&&B(u,i);else if(u.matches&&u.matches(m)&&B(u,i),u.querySelectorAll){const A=u.querySelectorAll(m);for(let _=0;_<A.length;_++)B(A[_],i)}}}}}}function ce(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,D(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const a=t[o];if(a.type==="childList")try{De(a)}catch(s){console.error("[ln-core] lifecycle handler failed",a.target,s)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Re(e){$().push(e),e.onSubtreeChange&&e.query&&M().push(e),ce()}function de(e,t,o,a,s={}){const u=s.extraAttributes||[],c=s.onAttributeChange||null,p=s.onSubtreeChange||null,i=s.onInit||null,m=s.onAttrChange||null,A=s.effects||null,_=s.attributes||null,C=_?Ee(_):A,N=_?new Set(Object.keys(_)):null,U=s.persist||null;function n(q){const E=q||document.body;if(ae(E,e,t,o),_&&K())for(const d in _){const h=_[d],b=Array.from(E.querySelectorAll("["+d+"]"));E.matches&&E.matches("["+d+"]")&&b.push(E);for(let v=0;v<b.length;v++){const S=b[v];T(S)&&re(h,S.getAttribute(d),d,a,S)}}i&&i(E)}const r=[];if(e.indexOf("[")!==-1){const q=/\[([\w-]+)/g;let E;for(;(E=q.exec(e))!==null;)r.push(E[1])}else r.push(e);ke({selector:e,attribute:t,componentTag:a,attributes:_,ComponentFn:o,onInit:i,observed:r.concat(u),onAttributeChange:c,onAttrChange:m,effects:C,declared:N,persist:U}),Oe();const l=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,f=s.subtreeQuery||(l?e:"["+e+"]"),w={selector:e,attribute:t,ComponentFn:o,onInit:i,onSubtreeChange:p,query:f};$().push(w),p&&f&&M().push(w),ce(),window[t]=n,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=de,window.lnCore.observeLifecycle=Re);function y(){Se()>0?xe(function(){n(document.body)}):n(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",y):y(),n}function Te(e,t){let o=!1;return function(){o||(o=!0,queueMicrotask(function(){o=!1,e()}))}}function ue(e){return(e||"").replace(/^#/,"")}function W(e){const t=e===void 0?location.hash:e,o={},a=ue(t);if(!a)return o;const s=a.split("&");for(let u=0;u<s.length;u++){const c=s[u];if(!c)continue;const p=c.indexOf(":"),i=p>-1?c.slice(0,p):c,m=p>-1?c.slice(p+1):"";if(i)try{o[i]=decodeURIComponent(m)}catch{o[i]=m}}return o}function Le(e){if(!e)return null;const t=W();return e in t?t[e]:null}function Fe(e,t){if(!e)return;const o=W();t==null?delete o[e]:o[e]=String(t);const s=Object.keys(o).map(function(u){const c=o[u];return c===""?u:u+":"+encodeURIComponent(c)}).join("&");ue(location.hash)!==s&&(location.hash=s)}function je(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function $e(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const a=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return a?t?a+"-"+t:a:t||null}function Me(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Be(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 We(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ne(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),a=e.slice(t+1),s=a?a.split(",").map(function(u){try{return decodeURIComponent(u)}catch{return u}}).filter(Boolean):[];return{key:o,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=W,window.lnCore.hashGet=Le,window.lnCore.hashSet=Fe,window.lnCore.hashLinkClick=je,window.lnCore.resolveHashNamespace=$e,window.lnCore.hashSortEncode=Me,window.lnCore.hashSortDecode=Be,window.lnCore.hashFilterEncode=We,window.lnCore.hashFilterDecode=Ne);function k(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=k);function Ue(e){return e=e||{},{sort:e.sort,filters:e.filters,search:e.search,offset:e.offset,limit:e.limit,queryGen:e.queryGen}}function Ge(e,t){const o=!e||!!e.initializationError,a=!!(e&&e.noLocalQuery&&!e.windowed);return t&&(o||!e.canServe||a)?"remote":e&&!e.initializationError?"store":"none"}function fe(e,t){const o=Object.assign({},e);return t&&(o.filters=t.filters,o.search=t.search,o.sort=t.sort),o}class Ke{constructor(){this._pending=new Map}wait(t){return new Promise((o,a)=>{this._pending.set(t,{resolve:o,reject:a})})}resolve(t){return this._settle(t,!1)}reject(t){return this._settle(t,!0)}close(t){const o=t||new Error("Mutation receipt registry closed");for(const a of this._pending.values())a.reject(o);this._pending.clear()}_settle(t,o){const a=t&&t.requestId;if(!a)return!1;const s=this._pending.get(a);return s?(this._pending.delete(a),o?s.reject(t.error||new Error("Store mutation failed")):s.resolve(t),!0):!1}}(function(){const e="data-ln-data-coordinator",t="lnDataCoordinator",o="data-ln-data-coordinator-scope";if(window[t]!==void 0)return;const a="data-ln-data-coordinator-search",s="data-ln-data-coordinator-filters",u="data-ln-data-coordinator-sort-field",c="data-ln-data-coordinator-sort-direction",i=ie({"data-ln-data-coordinator":{prop:"_name",type:"string",description:"Coordinator name or identifier for data routing"},"data-ln-data-coordinator-scope":{type:"string",description:"Scope name addressing the bound data store and connector"},"data-ln-data-coordinator-connector":{type:"string",description:"Selector, identifier, or namespace of the bound connector"},"data-ln-data-coordinator-mapper":{type:"string",description:"Name of the registered data mapper transform"},"data-ln-data-coordinator-search":{prop:"_searchAttr",type:"string",description:"Active search query term"},"data-ln-data-coordinator-filters":{prop:"_filtersAttr",type:"string",description:"Active encoded filter parameters"},"data-ln-data-coordinator-sort-field":{prop:"_sortFieldAttr",type:"string",description:"Sort field name"},"data-ln-data-coordinator-sort-direction":{prop:"_sortDirAttr",type:"enum",values:["asc","desc"],fallback:"asc",description:"Sort direction"},"data-ln-data-coordinator-stale":{type:"marker",description:"Flag indicating data needs re-synchronization"},"data-ln-data-coordinator-no-autosync":{type:"boolean",description:"Disables automatic synchronization upon state changes"}}),m=[["[data-ln-table-source]","data-ln-table-source","table"],["[data-ln-list-source]","data-ln-list-source","list"],["[data-ln-chart-source]","data-ln-chart-source","chart"],["[data-ln-options]","data-ln-options","options"],["[data-ln-stat]","data-ln-stat","stat"]];function A(n){const r=n.getAttribute("data-ln-data-coordinator-connector");if(r)return n.querySelector(r)||document.querySelector(r)||document.getElementById(r);const l=n.querySelector("[data-ln-connector], [data-ln-api-connector], [data-ln-couchdb-connector], [data-ln-websocket-connector]");if(l)return l;for(const f of n.querySelectorAll("*")){if(f.lnConnector)return f;for(const w of f.attributes)if(w.name.startsWith("data-ln-")&&w.name.endsWith("-connector"))return f}return null}function _(n){var l;if(!n)return"ln-connector";if((l=n.lnConnector)!=null&&l.namespace)return n.lnConnector.namespace;const r=n.getAttribute("data-ln-connector");if(r&&r!=="true")return r.startsWith("ln-")?r:"ln-"+r+(r.endsWith("-connector")?"":"-connector");for(const f of n.attributes)if(f.name.startsWith("data-ln-")&&f.name.endsWith("-connector"))return f.name.replace(/^data-/,"");return"ln-connector"}function C(n){const r=this;return this.dom=n,oe(this,n,i),this._name||console.warn("[ln-data-coordinator] missing id — the coordinator cannot be addressed",n),n[t]=this,this._destroyed=!1,this.mapper=null,this._unsubs=[],this._boundQueries=new WeakMap,this._boundDelivered=new WeakMap,this._mutationReceipts=new Ke,this._queueQueryRefresh=Te(()=>{r._destroyed||r._refreshAll(null,!0)}),this.refreshMapper(),N(this),this._checkInitialSync(),this}C.prototype._noAutosync=function(n){var r;return this.dom.hasAttribute("data-ln-data-coordinator-no-autosync")||!!((r=n.storeEl)!=null&&r.hasAttribute("data-ln-data-store-no-autosync"))},C.prototype._isStale=function(n){var l,f;const r=this.dom.getAttribute("data-ln-data-coordinator-stale")||((l=n.storeEl)==null?void 0:l.getAttribute("data-ln-data-store-stale"));return r==="never"||r==="-1"?!1:!((f=n.store)!=null&&f.lastSyncedAt)||Date.now()/1e3-n.store.lastSyncedAt>(parseInt(r,10)||300)},C.prototype._checkInitialSync=function(){const n=this,r=this.findChildren();r.store&&Promise.resolve(r.store.ready).then(()=>{if(n._destroyed)return;const l=n.findChildren();l.store&&l.connector&&!n._noAutosync(l)&&!l.store.isSyncing&&(!l.store.hasCache||n._isStale(l))&&l.store.forceSync()}).catch(l=>n._reportError("store-initialize",l,null))},C.prototype.refreshMapper=function(){var l,f;const n=this.dom.getAttribute("data-ln-data-coordinator-mapper")||this.dom.id,r=n&&((f=(l=window.lnCore)==null?void 0:l.getDataMapper)==null?void 0:f.call(l,n))||null;this.mapper={ingress:(r==null?void 0:r.ingress)||(w=>w),egress:(r==null?void 0:r.egress)||(w=>w)}},C.prototype.findChildren=function(){const n=this.dom.querySelector("[data-ln-data-store]"),r=A(this.dom),l=this.dom.querySelector("[data-ln-api-queue]");return{storeEl:n,connectorEl:r,queueEl:l,store:(n==null?void 0:n.lnDataStore)||null,connector:(r==null?void 0:r.lnConnector)||(r==null?void 0:r.lnApiConnector)||(r==null?void 0:r.lnCouchDbConnector)||(r==null?void 0:r.lnWebsocketConnector)||null,queue:(l==null?void 0:l.lnApiQueue)||null}},C.prototype._fanOutRemote=function(n,r,l,f){this.refreshMapper(),n.queue?g(n.queueEl,"ln-api-queue:request-enqueue",l):n.connector&&g(n.connectorEl,_(n.connectorEl)+":request-"+r,f)},C.prototype._fanOutCreate=function(n,r,l){const f="_temp_"+k(),w=this.mapper.egress(r);n.storeEl&&g(n.storeEl,"ln-data-store:request-create",{tempId:f,data:w}),this._fanOutRemote(n,"create",{chainKey:f,op:"create",targetId:null,payload:w,expectedVersion:null,meta:{tempId:f,action:l}},{data:w,url:l,meta:{entryId:k(),queued:!1,op:"create",tempId:f}})},C.prototype._fanOutUpdate=function(n,r,l,f,w){const y=this.mapper.egress(l);n.storeEl&&g(n.storeEl,"ln-data-store:request-update",{id:r,data:y}),this._fanOutRemote(n,"update",{chainKey:r,op:"update",targetId:r,payload:y,expectedVersion:f,meta:{id:r,action:w}},{id:r,data:y,expected_version:f,url:w,meta:{entryId:k(),queued:!1,op:"update",id:r}})},C.prototype._fanOutDelete=function(n,r){n.storeEl&&g(n.storeEl,"ln-data-store:request-delete",{id:r}),this._fanOutRemote(n,"delete",{chainKey:r,op:"delete",targetId:r,payload:null,expectedVersion:null,meta:{id:r}},{id:r,meta:{entryId:k(),queued:!1,op:"delete",id:r}})},C.prototype._fanOutBulkDelete=function(n,r){const l=r.join(",");n.storeEl&&g(n.storeEl,"ln-data-store:request-bulk-delete",{ids:r}),this._fanOutRemote(n,"bulk-delete",{chainKey:l,op:"bulk-delete",targetId:null,payload:{ids:r},expectedVersion:null,meta:{bulkKey:l,ids:r}},{ids:r,meta:{entryId:k(),queued:!1,op:"bulk-delete",bulkKey:l}})},C.prototype._requestStoreMutation=function(n,r,l){if(!n.storeEl)return Promise.reject(new Error("Store element not found"));const f=k(),w=this._mutationReceipts.wait(f);return g(n.storeEl,"ln-data-store:request-"+r,Object.assign({},l,{requestId:f})),w},C.prototype._reportError=function(n,r,l){this._destroyed||g(this.dom,"ln-data-coordinator:error",{operation:n,error:r,meta:l||null})},C.prototype._owns=function(n){var l;const r=this._name||((l=this.findChildren().storeEl)==null?void 0:l.id);return!!n&&n===r},C.prototype._currentQuery=function(){const n=this.dom.getAttribute(u),r=this.dom.getAttribute(c),l=new URLSearchParams(this.dom.getAttribute(s)||""),f={};for(const w of new Set(l.keys()))f[w]=l.getAll(w);return{search:this.dom.getAttribute(a)||"",filters:f,sort:n&&r?{field:n,direction:r}:null}},C.prototype._refreshAll=function(n,r){for(const[l,f,w]of m)for(const y of this.dom.ownerDocument.querySelectorAll(l))if(this._owns(y.getAttribute(f))){if((w==="table"||w==="list")&&y.hasAttribute(w==="table"?"data-ln-table-window":"data-ln-list-window")){g(y,"ln-"+w+(r?":request-invalidate":":request-revalidate"),{});continue}this._serveElement(y,w,null,n)}},C.prototype._serveElement=function(n,r,l,f){const w=this.findChildren(),y=w.store;if(!y)return;l&&this._boundQueries.set(n,l);const q=this._boundQueries.get(n)||{sort:null,filters:{},search:""},E=fe(q,this._currentQuery()),d=this;return Promise.resolve(y.ready).then(()=>{if(d._destroyed)return;const h=Ge(y,w.connector);if(r==="table"||r==="list"||r==="chart")return h==="remote"?(g(n,"ln-"+r+":set-loading",{loading:!0}),g(w.connectorEl,_(w.connectorEl)+":request-query",{query:E,meta:{targetEl:n,kind:r,offset:E.offset,limit:E.limit,queryGen:q.queryGen}})):h!=="store"?g(n,"ln-"+r+":set-loading",{loading:!1}):y.getAll(E).then(b=>{d._destroyed||!d._boundDelivered||(g(n,"ln-"+r+":set-loading",{loading:!1}),g(n,"ln-"+r+":set-data",{data:b.data,total:(f==null?void 0:f.total)??b.total,filtered:(f==null?void 0:f.filtered)??b.filtered,offset:b.offset??(f==null?void 0:f.offset)??q.offset,queryGen:q.queryGen!==void 0?q.queryGen:(f==null?void 0:f.queryGen)??b.queryGen,provisional:b.provisional===!0}),d._boundDelivered.set(n,!0))});if(r==="options"){if(h==="remote")return g(w.connectorEl,_(w.connectorEl)+":request-query",{query:{},meta:{targetEl:n,kind:r}});if(h==="store")return y.getAll({}).then(b=>!d._destroyed&&g(n,"ln-options:set-data",{data:b.data}))}if(r==="stat"){let b=l==null?void 0:l.filters;if(!b){const S=n.getAttribute("data-ln-stat-filter");if(S!=null&&S.includes(":")){const x=S.split(":");b={[x[0].trim()]:[x.slice(1).join(":").trim()]}}}const v=w.connector&&y&&(y.windowed&&b&&Object.keys(b).length||y.noLocalQuery)?"remote":h;if(v==="remote")return g(w.connectorEl,_(w.connectorEl)+":request-query",{query:{filters:b},meta:{targetEl:n,kind:r}});if(v==="store")return y.count(b).then(S=>!d._destroyed&&g(n,"ln-stat:set-count",{count:S}))}}).catch(h=>{d._destroyed||((r==="table"||r==="list"||r==="chart")&&g(n,"ln-"+r+":set-loading",{loading:!1}),d._reportError(r+"-query",h,{targetEl:n,kind:r}))})};function N(n){const r=n._unsubs=[],l=(d,h,b)=>{d.addEventListener(h,b),r.push(()=>d.removeEventListener(h,b))};l(n.dom,"ln-data-store:request-remote-sync",d=>{n.refreshMapper();const h=n.findChildren();h.store&&h.connector&&g(h.connectorEl,_(h.connectorEl)+":request-sync",{since:d.detail.since,meta:{op:"sync"}})}),l(n.dom,"ln-data-store:request-page",d=>{const h=n.findChildren(),b=d.detail||{};if(!h.connectorEl)return;const v=fe(b.query||{},n._currentQuery());g(h.connectorEl,_(h.connectorEl)+":request-query",{query:Object.assign({},v,{offset:b.offset,limit:b.limit,queryGen:b.queryGen})})}),l(n.dom,"ln-data-coordinator:request-create",d=>n._fanOutCreate(n.findChildren(),d.detail.data||{},d.detail.action)),l(n.dom,"ln-data-coordinator:request-update",d=>n._fanOutUpdate(n.findChildren(),d.detail.id,d.detail.data||{},d.detail.expected_version,d.detail.action)),l(n.dom,"ln-data-coordinator:request-delete",d=>n._fanOutDelete(n.findChildren(),d.detail.id)),l(n.dom,"ln-data-coordinator:request-bulk-delete",d=>n._fanOutBulkDelete(n.findChildren(),d.detail.ids||[])),l(n.dom,"ln-api-queue:send",d=>n._onQueueSend(d.detail||{})),l(n.dom,"ln-api-queue:failed",d=>{var h;return n._reportError("queue-failed",((h=d==null?void 0:d.detail)==null?void 0:h.error)||new Error("Queue failed"),(d==null?void 0:d.detail)||null)}),l(n.dom,"ln-data-store:initialized",d=>{var b;const h=n.findChildren();h.store&&!h.store.initializationError&&h.connector&&!n._noAutosync(h)&&!h.store.isSyncing&&(!((b=d.detail)!=null&&b.hasCache)||n._isStale(h))&&h.store.forceSync()});const f=()=>{const d=n.findChildren();d.store&&!d.store.initializationError&&d.connector&&!n._noAutosync(d)&&d.store.isInitialized&&!d.store.isSyncing&&d.store.forceSync()};l(n.dom,"ln-websocket-connector:connected",f),l(document,"submit",d=>n._onFormSubmit(d));const w=(d,h,b)=>{var v;n._owns(d.target.getAttribute(b))&&n._serveElement(d.target,h,h==="stat"?{filters:((v=d.detail)==null?void 0:v.filters)||null}:h==="options"?null:Ue(d.detail||{}),null)};l(document,"ln-table:request-data",d=>w(d,"table","data-ln-table-source")),l(document,"ln-list:request-data",d=>w(d,"list","data-ln-list-source")),l(document,"ln-chart:request-data",d=>w(d,"chart","data-ln-chart-source")),l(document,"ln-options:request-data",d=>w(d,"options","data-ln-options")),l(document,"ln-stat:request-count",d=>w(d,"stat","data-ln-stat"));const y=d=>{n._mutationReceipts.resolve(d.detail),n._refreshAll(null,!1)};l(n.dom,"ln-data-store:ready",y),l(n.dom,"ln-data-store:created",y),l(n.dom,"ln-data-store:updated",y),l(n.dom,"ln-data-store:deleted",y),l(n.dom,"ln-data-store:mutation-error",d=>n._mutationReceipts.reject(d.detail)),l(n.dom,"ln-data-store:synced",d=>{var h;(h=d.detail)!=null&&h.changed&&n._refreshAll(d.detail.meta,!1)}),l(n.dom,"ln-data-store:query-changed",()=>n._refreshAll(null,!0)),l(n.dom,"ln-search:change",d=>{var b;d.preventDefault();const h=((b=d.detail)==null?void 0:b.term)!=null?d.detail.term:"";h!==(n.dom.getAttribute(a)||"")&&n.dom.setAttribute(a,h)}),l(n.dom,"ln-filter:change",d=>{var pe;d.preventDefault();const h=(pe=d.detail)==null?void 0:pe.key;if(!h)return;const b=(d.detail.values||[]).slice(),v=n._currentQuery().filters,S=v[h];if(S?S.length===b.length&&S.every((R,G)=>R===b[G]):!b.length)return;b.length?v[h]=b:delete v[h];const x=new URLSearchParams;Object.keys(v).forEach(R=>v[R].forEach(G=>x.append(R,G)));const O=x.toString();O?n.dom.setAttribute(s,O):n.dom.removeAttribute(s)}),l(n.dom,"ln-sort:change",d=>{var x,O;d.preventDefault();const h=(x=d.detail)==null?void 0:x.field,b=(O=d.detail)==null?void 0:O.direction,v=h&&b&&b!=="none"?{field:h,direction:b}:null,S=n._currentQuery().sort;!S&&!v||S&&v&&S.field===v.field&&S.direction===v.direction||(v?(n.dom.setAttribute(u,v.field),n.dom.setAttribute(c,v.direction)):(n.dom.removeAttribute(u),n.dom.removeAttribute(c)))});const q=new Set(["ln-api-connector","ln-couchdb-connector","ln-websocket-connector","ln-connector"]),E=n.findChildren().connectorEl;if(E){const d=_(E);q.add(d),l(n.dom,d+":connected",f)}q.forEach(d=>{l(n.dom,d+":fetched",h=>n._reconcileServerFetch(h.detail)),l(n.dom,d+":created",h=>n._reconcileServerMutation("create",h.detail)),l(n.dom,d+":updated",h=>n._reconcileServerMutation("update",h.detail)),l(n.dom,d+":deleted",h=>n._reconcileServerMutation("ack",h.detail)),l(n.dom,d+":bulk-deleted",h=>n._reconcileServerMutation("ack",h.detail)),l(n.dom,d+":error",h=>n._reconcileServerMutation("error",h.detail))})}C.prototype._onQueueSend=function(n){this.refreshMapper();const r=this.findChildren();if(!r.store||!r.connector||!r.queue)return;const l=n.meta||{},f=_(r.connectorEl),w=n.idempotencyKey||n.entryId,y={create:()=>g(r.connectorEl,f+":request-create",{data:n.payload,url:l.action||null,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"create",tempId:l.tempId}}),update:()=>g(r.connectorEl,f+":request-update",{id:n.targetId,data:n.payload,expected_version:n.expectedVersion,url:l.action||null,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"update",id:n.targetId}}),delete:()=>g(r.connectorEl,f+":request-delete",{id:n.targetId,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"delete",id:n.targetId}}),"bulk-delete":()=>{var q;return g(r.connectorEl,f+":request-bulk-delete",{ids:((q=n.payload)==null?void 0:q.ids)||[],idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"bulk-delete",bulkKey:l.bulkKey}})}};y[n.op]&&y[n.op]()},C.prototype._onFormSubmit=function(n){const r=n.target;if(n.defaultPrevented)return;const l=r.hasAttribute(o)?r.getAttribute(o):null;if(l===null||(l?!this._owns(l):r.closest("["+e+"]")!==this.dom))return;const f=Q(r);if(f!=="POST"&&f!=="PUT"&&f!=="PATCH")return;n.preventDefault();const w=P(r);delete w._method,delete w._token;const y=w.id,q=w.expected_version,E=r.getAttribute("action")||"",d=this.findChildren();delete w.id,delete w.expected_version,f==="POST"?this._fanOutCreate(d,w,E):this._fanOutUpdate(d,y,w,q,E)},C.prototype._reconcileServerFetch=function(n){if(!n)return;const r=n.meta||{},l=this.findChildren(),f=n.data;this.refreshMapper();const w=Array.isArray(f)?f:(f==null?void 0:f.data)||[],y=Array.isArray(f==null?void 0:f.deleted)?f.deleted:[],q=Array.isArray(f)?Math.floor(Date.now()/1e3):(f==null?void 0:f.synced_at)??(f==null?void 0:f.since)??Math.floor(Date.now()/1e3),E=w.map(d=>this.mapper.ingress(d));if(!(!l.store||l.store.initializationError)){if(!r.kind)return l.store.applySync(E,y,q,{total:n.total,filtered:n.filtered,offset:n.offset,queryGen:n.queryGen,targetEl:r.targetEl});l.store.applyQuery(E,{total:n.total}).then(d=>{const h=r.kind;h==="table"||h==="list"||h==="chart"?(g(r.targetEl,"ln-"+h+":set-loading",{loading:!1}),g(r.targetEl,"ln-"+h+":set-data",{data:d,total:n.total??d.length,filtered:n.filtered??d.length,offset:n.offset,queryGen:r.queryGen}),this._boundDelivered.set(r.targetEl,!0)):h==="options"?l.store.getAll({}).then(b=>g(r.targetEl,"ln-options:set-data",{data:b.data})):h==="stat"&&g(r.targetEl,"ln-stat:set-count",{count:n.filtered??n.total??E.length})})}},C.prototype._reconcileServerMutation=function(n,r){var w;if(!r)return;const l=this.findChildren(),f=r.meta||{};if(n==="create"){if(!r.record)return this._reportError("create-empty-response",new Error("Create response missing record payload"),f);const y=this.mapper.ingress(r.record);(l.storeEl?this._requestStoreMutation(l,"update",{id:f.tempId,data:y}):Promise.resolve()).then(()=>{f.queued&&l.queue&&g(l.queueEl,"ln-api-queue:resolve-create",{entryId:f.entryId,oldKey:f.tempId,newId:y.id})}).catch(q=>this._reportError("create-reconcile",q,f))}else if(n==="update"){const y=r.record?this.mapper.ingress(r.record):null;(l.storeEl&&y?this._requestStoreMutation(l,"update",{id:f.id,data:y}):Promise.resolve()).then(()=>{f.queued&&l.queue&&g(l.queueEl,"ln-api-queue:ack",{entryId:f.entryId})}).catch(q=>this._reportError("update-reconcile",q,f))}else if(n==="ack")f.queued&&l.queue&&g(l.queueEl,"ln-api-queue:ack",{entryId:f.entryId});else if(n==="error"){const y=r.status||((w=r.error)==null?void 0:w.status)||0;f.queued&&l.queue&&g(l.queueEl,"ln-api-queue:nack",{entryId:f.entryId,reason:y===401||y===419?"auth":y===0||y>=500?"retry":"drop"}),l.storeEl&&g(l.storeEl,"ln-data-store:request-sync-failed",{error:r.error||r,status:y}),this._reportError("connector-error",r.error||r,f)}},C.prototype.destroy=function(){var n;if(this.dom[t]){for(this._destroyed=!0;(n=this._unsubs)!=null&&n.length;)this._unsubs.pop()();this._unsubs=this._boundQueries=this._boundDelivered=this._queueQueryRefresh=null,this._mutationReceipts.close(new Error("Data coordinator destroyed")),this._mutationReceipts=null,delete this.dom[t]}};function U(n,r){const l=n[t];l&&(r==="data-ln-data-coordinator-mapper"?l.refreshMapper():(r===a||r===s||r===u||r===c)&&l._queueQueryRefresh())}de(e,t,C,"ln-data-coordinator",{extraAttributes:["data-ln-data-coordinator-mapper",a,s,u,c],onAttributeChange:U}),window[t].init=window[t]})()})();