@livenetworks/ashlar 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-ajax/ln-ajax.js +1 -1
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-core/lifecycle.js +9 -0
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-editor/src/ln-editor.js +45 -12
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-icon/ln-icon.js +1 -1
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-link/ln-link.js +1 -1
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function U(){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 o=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){o=t[s];break}if(!L(o))return}e.apply(console,t)}}function v(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function F(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o);const s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:o});return e.dispatchEvent(s),s}function E(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){E(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 n=!!(t&&t.typed),o=t&&t.exclude,s={},d=e.elements,l={};if(n)for(let u=0;u<d.length;u++){const r=d[u];r.name&&r.type==="checkbox"&&!r.disabled&&(l[r.name]=(l[r.name]||0)+1)}for(let u=0;u<d.length;u++){const r=d[u];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(o&&r.matches&&r.matches(o)))if(r.type==="checkbox")n&&l[r.name]===1?s[r.name]=r.checked:(s[r.name]||(s[r.name]=[]),r.checked&&s[r.name].push(r.value));else if(r.type==="radio")r.checked&&(s[r.name]=r.value);else if(r.type==="select-multiple"){s[r.name]=[];for(let i=0;i<r.options.length;i++)r.options[i].selected&&s[r.name].push(r.options[i].value)}else if(n&&r.type==="hidden")s[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const i=Number(r.value);s[r.name]=r.value===""||isNaN(i)?null:i}else s[r.name]=r.value}return s}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 ae(e,t){const n=e.elements,o=[],s={};for(let d=0;d<n.length;d++){const l=n[d];l.name&&l.type==="checkbox"&&(s[l.name]=(s[l.name]||0)+1)}for(let d=0;d<n.length;d++){const l=n[d];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const u=l.getAttribute("data-ln-fill-as")||l.name;if(!u||!(u in t))continue;const r=t[u];if(l.type==="checkbox"){if(Array.isArray(r))l.checked=r.indexOf(l.value)!==-1;else if(s[l.name]>1){const i=String(r).split(",").map(function(a){return a.trim()});l.checked=i.indexOf(l.value)!==-1}else l.checked=se(r);o.push(l)}else if(l.type==="radio")l.checked=l.value===String(r),o.push(l);else if(l.type==="select-multiple"){if(Array.isArray(r))for(let i=0;i<l.options.length;i++)l.options[i].selected=r.indexOf(l.options[i].value)!==-1;o.push(l)}else l.value=r,l.tagName==="SELECT"&&r!=null&&l.setAttribute("data-ln-value",r),o.push(l)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ae,window.lnCore.serializeForm=le,window.lnCore.resolveFormMethod=ie);const B={};function de(e,t){B[e]=t}function ue(e){return B[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=de,window.lnCore.getDataMapper=ue);function ce(e){const t=e?e.closest("[lang]"):null,n=(t?t.getAttribute("lang")||t.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return n?n.trim():"en-US"}function fe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,E(function(){new MutationObserver(function(){v(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function pe(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];$[n]=t}function he(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=pe,window.lnCore.getLocaleFallback=he,window.lnCore.ensureLocaleObserver=fe);const D={};function H(e,t){D[e]||(D[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=D[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function me(e,t,n){if(e){const o=e.querySelector('[data-ln-template="'+t+'"]');if(o)return o.content.cloneNode(!0)}return H(t,n)}function x(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const u=n[l],r=u.getAttribute("data-ln-field");t[r]!=null&&(u.textContent=t[r])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const u=o[l],r=u.getAttribute("data-ln-attr").split(",");for(let i=0;i<r.length;i++){const a=r[i].trim().split(":");if(a.length!==2)continue;const c=a[0].trim(),f=a[1].trim();t[f]!=null&&u.setAttribute(c,t[f])}}const s=e.querySelectorAll("[data-ln-show]");for(let l=0;l<s.length;l++){const u=s[l],r=u.getAttribute("data-ln-show");r in t&&u.classList.toggle("hidden",!t[r])}const d=e.querySelectorAll("[data-ln-class]");for(let l=0;l<d.length;l++){const u=d[l],r=u.getAttribute("data-ln-class").split(",");for(let i=0;i<r.length;i++){const a=r[i].trim().split(":");if(a.length!==2)continue;const c=a[0].trim(),f=a[1].trim();f in t&&u.classList.toggle(c,!!t[f])}}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 n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)x(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function j(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const d=n.currentNode;d.textContent.indexOf("{{")!==-1&&(d.textContent=d.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,u){return t[u]!==void 0?t[u]:""}))}const o=function(d,l){return t[l]!==void 0?t[l]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let d=0;d<s.length;d++){const l=s[d],u=l.attributes;for(let r=0;r<u.length;r++){const i=u[r];i.value.indexOf("{{")!==-1&&l.setAttribute(i.name,i.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function we(e,t,n,o,s,d){const l={};for(let r=0;r<e.children.length;r++){const i=e.children[r],a=i.getAttribute("data-ln-render-key");a&&(l[a]=i)}const u=document.createDocumentFragment();for(let r=0;r<t.length;r++){const i=t[r],a=String(o(i));let c=l[a];if(c)s(c,i,r);else{const f=H(n,d);if(!f||(j(f,i),c=f.firstElementChild,!c))continue;c.setAttribute("data-ln-render-key",a),s(c,i,r)}u.appendChild(c)}e.textContent="",e.appendChild(u)}function be(e,t){const n={},o=e.querySelectorAll("["+t+"]");for(let s=0;s<o.length;s++)n[o[s].getAttribute(t)]=o[s].textContent,o[s].remove();return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=j,window.lnCore.fill=x,window.lnCore.lnFill=ge,window.lnCore.renderList=we);function _(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function k(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function W(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const s=o.trim().toLowerCase();return!(s==="false"||s==="0")}function P(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const q=new Map;function V(e,t){const n=(e?e.join("|"):"")+"::"+t;if(q.has(n))return q.get(n);const o=new Set(e||[]),s=function(d,l){const u=d.getAttribute(l);return u!==null&&o.has(u)?u:t};return q.set(n,s),s}function X(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function K(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function J(e,t,n,o,s){if(!e||t===null)return!0;const d=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const u=r=>{s?console.warn(r,s):console.warn(r)};if(l==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(u(`[${d}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const r=e.values||[];return r.includes(t)?!0:(u(`[${d}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return u(`[${d}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(u(`[${d}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(u(`[${d}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(u(`[${d}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(r){return u(`[${d}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function Q(e,t,n){for(const o in n){const[s,d,l]=n[o];Object.defineProperty(e,o,{get:function(){return s(t,d,l)},enumerable:!0,configurable:!0})}return e}function G(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let s=o.read;if(!s&&o.type)switch(o.type){case"enum":s=V(o.values,o.fallback);break;case"integer":s=k;break;case"float":s=X;break;case"boolean":s=W;break;case"list":s=P;break;case"json":s=K;break;case"string":default:s=_;break}s||(s=_),t[o.prop]=[s,n,o.fallback]}return t}function ye(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function Ce(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=Q,window.lnCore.attrSpec=G,window.lnCore.attrStr=_,window.lnCore.attrInt=k,window.lnCore.attrBool=W,window.lnCore.attrList=P,window.lnCore.attrEnum=V,window.lnCore.attrFloat=X,window.lnCore.attrJson=K);function S(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(n){console.error("["+t.attribute+"] init failed",e,n)}}}function Z(e,t,n,o){if(e.nodeType!==1)return;const d=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:n,ComponentFn:o};if(e.matches&&e.matches(d)&&S(e,l),e.querySelectorAll){const u=e.querySelectorAll(d);for(let r=0;r<u.length;r++)S(u[r],l)}}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 Y(){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=Y(),n=e.observed||[];for(let o=0;o<n.length;o++){const s=n[o];t.byAttr.has(s)||t.byAttr.set(s,[]),t.byAttr.get(s).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const s=t.byDeclaredAttr.get(o);s.some(d=>d.componentTag===e.componentTag)||s.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=Ce(e);if(o===null)t.reactiveWildcard.push(e);else for(const s of o)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function ee(e,t,n,o){for(let s=0;s<e.length;s++){const d=e[s];if(!t[d.attribute])continue;const l=d.effects&&d.effects[n];l?l(t,n,o):d.onAttrChange&&(!d.declared||d.declared.has(n))&&d.onAttrChange(t,n,o)}}function _e(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,o=Y(),s=o.byAttr.get(t),d=U()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(t);if(!n&&!s&&!d)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(d&&L(l)){const u=o.byDeclaredAttr.get(t),r=l.getAttribute(t);for(let i=0;i<u.length;i++)J(u[i].spec,r,t,u[i].componentTag,l)}if(window.lnCore._debugSink&&(n||s)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),n){const u=o.byReactive.get(t);u&&ee(u,l,t,e.oldValue),o.reactiveWildcard.length&&ee(o.reactiveWildcard,l,t,e.oldValue)}if(s)for(let u=0;u<s.length;u++){const r=s[u];if(r.handler){r.handler(l,t,e.oldValue);continue}r.onAttributeChange&&l[r.attribute]?r.onAttributeChange(l,t):(Z(l,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(l))}}}function Se(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,E(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{_e(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function z(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function R(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(o){console.error("["+t.attribute+"] destroy failed",e,o)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Ie(e){const t=z();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange&&o.query){const s=o.query,d=e.target.nodeType===1?e.target.matches&&e.target.matches(s)?e.target:e.target.closest?e.target.closest(s):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(s):null;d&&o.onSubtreeChange(d,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1){const s=!!(o.firstElementChild||o.children&&o.children.length);for(let d=0;d<t.length;d++){const l=t[d];if(l.selector&&l.attribute&&l.ComponentFn){if(!s)o.matches&&o.matches(l.query)&&S(o,l);else if(o.matches&&o.matches(l.query)&&S(o,l),o.querySelectorAll){const u=o.querySelectorAll(l.query);for(let r=0;r<u.length;r++)S(u[r],l)}}l.onInit&&l.onInit(o)}}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1){const s=!!(o.firstElementChild||o.children&&o.children.length);for(let d=0;d<t.length;d++){const l=t[d],u=l.query;if(u){if(!s)o.matches&&o.matches(u)&&R(o,l);else if(o.matches&&o.matches(u)&&R(o,l),o.querySelectorAll){const r=o.querySelectorAll(u);for(let i=0;i<r.length;i++)R(r[i],l)}}}}}}}function te(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,E(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{Ie(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ee(e){z().push(e),te()}function ne(e,t,n,o,s={}){const d=s.extraAttributes||[],l=s.onAttributeChange||null,u=s.onSubtreeChange||null,r=s.onInit||null,i=s.onAttrChange||null,a=s.effects||null,c=s.attributes||null,f=c?ye(c):a,p=c?new Set(Object.keys(c)):null,w=s.persist||null;function b(y){const C=y||document.body;if(Z(C,e,t,n),c&&U())for(const I in c){const Be=c[I],T=Array.from(C.querySelectorAll("["+I+"]"));C.matches&&C.matches("["+I+"]")&&T.push(C);for(let N=0;N<T.length;N++){const M=T[N];L(M)&&J(Be,M.getAttribute(I),I,o,M)}}r&&r(C)}const m=[];if(e.indexOf("[")!==-1){const y=/\[([\w-]+)/g;let C;for(;(C=y.exec(e))!==null;)m.push(C[1])}else m.push(e);xe({selector:e,attribute:t,componentTag:o,attributes:c,ComponentFn:n,onInit:r,observed:m.concat(d),onAttributeChange:l,onAttrChange:i,effects:f,declared:p,persist:w}),Se();const A=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,g=s.subtreeQuery||(A?e:"["+e+"]");z().push({selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:u,query:g}),te(),window[t]=b,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ne,window.lnCore.observeLifecycle=Ee);function h(){ve()>0?Ae(function(){b(document.body)}):b(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",h):h(),b}function oe(e){return(e||"").replace(/^#/,"")}function O(e){const t=e===void 0?location.hash:e,n={},o=oe(t);if(!o)return n;const s=o.split("&");for(let d=0;d<s.length;d++){const l=s[d];if(!l)continue;const u=l.indexOf(":"),r=u>-1?l.slice(0,u):l,i=u>-1?l.slice(u+1):"";if(r)try{n[r]=decodeURIComponent(i)}catch{n[r]=i}}return n}function ke(e){if(!e)return null;const t=O();return e in t?t[e]:null}function Le(e,t){if(!e)return;const n=O();t==null?delete n[e]:n[e]=String(t);const s=Object.keys(n).map(function(d){const l=n[d];return l===""?d:d+":"+encodeURIComponent(l)}).join("&");oe(location.hash)!==s&&(location.hash=s)}function Fe(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 n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function qe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ze(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 Oe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),s=o?o.split(",").map(function(d){try{return decodeURIComponent(d)}catch{return d}}).filter(Boolean):[];return{key:n,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=O,window.lnCore.hashGet=ke,window.lnCore.hashSet=Le,window.lnCore.hashLinkClick=Fe,window.lnCore.resolveHashNamespace=De,window.lnCore.hashSortEncode=qe,window.lnCore.hashSortDecode=ze,window.lnCore.hashFilterEncode=Re,window.lnCore.hashFilterDecode=Oe);function Te(){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=Te);function Ne(e){if(!e)return null;const t=String(e).split(",").map(n=>n.trim().toLowerCase()).filter(Boolean).map(n=>n.startsWith(".")?n.slice(1):n);return t.length?t:null}function re(e){return!e||typeof e!="string"||!e.includes(".")?"":e.split(".").pop().toLowerCase()}function Me(e,t){if(!t||t.length===0)return!0;if(!e)return!1;const n=re(e.name),o=String(e.type||"").toLowerCase();return t.some(s=>{if(s.includes("/")){if(s.endsWith("/*")){const d=s.slice(0,-1);return o.startsWith(d)}return o===s}return n===s})}function Ue(e,t="en",n={}){if(typeof e!="number"||isNaN(e)||e===0)return"0 "+(n["unit-b"]||"B");const o=1024,s=[n["unit-b"]||"B",n["unit-kb"]||"KB",n["unit-mb"]||"MB",n["unit-gb"]||"GB"],d=Math.floor(Math.log(e)/Math.log(o)),l=Math.min(d,s.length-1),u=e/Math.pow(o,l);return new Intl.NumberFormat(t,{maximumFractionDigits:1,minimumFractionDigits:0}).format(u)+" "+s[l]}(function(){const e="data-ln-upload",t="lnUpload",n="file",o="file_ids[]";if(window[t]!==void 0)return;const s={"data-ln-upload":{prop:"uploadUrl",read:_,type:"string",fallback:"",description:"Endpoint URL for file uploads"},"data-ln-upload-accept":{type:"string",description:"Comma-separated list of allowed file extensions or MIME types"},"data-ln-upload-delete":{prop:"deleteUrlPattern",read:_,type:"string",fallback:"",description:"Endpoint URL pattern for deleting uploaded files"},"data-ln-upload-max-size":{prop:"maxSize",read:k,type:"integer",fallback:0,min:0,description:"Maximum allowed file size in bytes (0 for unlimited)"},"data-ln-upload-max-files":{prop:"maxFiles",read:k,type:"integer",fallback:0,min:0,description:"Maximum number of files allowed in upload queue (0 for unlimited)"},"data-ln-upload-file-field":{prop:"fileFieldName",read:_,type:"string",fallback:n,description:"Form data field name used for file payloads"},"data-ln-upload-ids-field":{prop:"idsFieldName",read:_,type:"string",fallback:o,description:"Form field name for submitting uploaded file IDs"},"data-ln-upload-dict":{type:"string",description:"Dictionary key prefix mapping for translatable upload messages"},"data-ln-upload-zone":{type:"marker",description:"Designates container as dropzone for drag-and-drop file uploads"},"data-ln-upload-list":{type:"marker",description:"Container element holding rendered upload items"},"data-ln-upload-item":{type:"marker",description:"Container element for an individual file upload item"},"data-ln-upload-action":{type:"enum",values:["remove","retry"],description:"Action button within upload item"},"data-ln-upload-state":{type:"enum",values:["ready","dragover","pending","uploading","success","error"],description:"Runtime status of dropzone or individual upload item"},"data-ln-upload-id":{type:"string",description:"Server-assigned file identifier for completed upload"},"data-ln-upload-local-id":{type:"string",description:"Client-generated unique ID for tracking file item in DOM"},"data-ln-upload-size":{type:"integer",min:0,description:"File size in bytes"},"data-ln-upload-ext":{type:"string",description:"Normalized file extension"}},d=G(s);function l(i,a,c){return Ue(i,a,c)}function u(){const i=document.querySelector('meta[name="csrf-token"]');return i?i.getAttribute("content"):""}function r(i){this.dom=i,Q(this,i,d),this.dict=be(i,"data-ln-upload-dict"),this.locale=ce(i),this.zone=i.querySelector("[data-ln-upload-zone]")||i,this.list=i.querySelector("[data-ln-upload-list]"),this.input=i.querySelector('input[type="file"]'),this.input||console.warn('[ln-upload] Missing <input type="file"> in container:',i);const a=i.getAttribute("data-ln-upload-accept")||(this.input?this.input.getAttribute("accept"):"");return this.allowedExts=Ne(a),this.uploadedFiles=new Map,this.fileIdCounter=0,this._dragDepth=0,this._hydrate(),this._bindEvents(),this}r.prototype._hydrate=function(){const i=this;if(!this.list)return;const a=this.list.querySelectorAll("[data-ln-upload-item]");for(let f=0;f<a.length;f++){const p=a[f],w=p.getAttribute("data-ln-upload-id"),b="file-"+ ++i.fileIdCounter;p.setAttribute("data-ln-upload-local-id",b);const m=p.querySelector('[data-ln-field="name"]'),A=p.querySelector('[data-ln-field="sizeText"]'),g=p.getAttribute("data-ln-upload-size"),h=g?parseInt(g,10):null;i.uploadedFiles.set(b,{serverId:w||null,name:m?m.textContent.trim():"",size:h!==null&&!isNaN(h)?h:A?A.textContent.trim():""})}const c=this.dom.querySelectorAll('input[type="hidden"]');for(let f=0;f<c.length;f++){const p=c[f];if(p.name===i.idsFieldName&&p.value&&!Array.from(i.uploadedFiles.values()).some(function(b){return String(b.serverId)===String(p.value)})){const b="file-"+ ++i.fileIdCounter;i.uploadedFiles.set(b,{serverId:p.value,name:"",size:""})}}this._syncHiddenInputs()},r.prototype._syncHiddenInputs=function(){const i=this,a=this.dom.querySelectorAll('input[type="hidden"]');for(let c=0;c<a.length;c++)a[c].name===i.idsFieldName&&a[c].remove();for(const[,c]of this.uploadedFiles)if(c.serverId){const f=document.createElement("input");f.type="hidden",f.name=i.idsFieldName,f.value=c.serverId,i.dom.appendChild(f)}},r.prototype._bindEvents=function(){const i=this;this._onZoneClick=function(a){i.zone===i.dom&&a.target.closest("[data-ln-upload-list], [data-ln-upload-action], input, button, a")||i.input&&a.target!==i.input&&i.input.click()},this._onInputChange=function(){i.input&&i.input.files&&(i.upload(i.input.files),i.input.value="")},this._onDragEnter=function(a){a.preventDefault(),a.stopPropagation(),i._dragDepth++,i.zone.setAttribute("data-ln-upload-state","dragover")},this._onDragOver=function(a){a.preventDefault(),a.stopPropagation(),i.zone.setAttribute("data-ln-upload-state","dragover")},this._onDragLeave=function(a){a.preventDefault(),a.stopPropagation(),i._dragDepth--,i._dragDepth<=0&&(i._dragDepth=0,i.zone.removeAttribute("data-ln-upload-state"))},this._onDrop=function(a){a.preventDefault(),a.stopPropagation(),i._dragDepth=0,i.zone.removeAttribute("data-ln-upload-state"),a.dataTransfer&&a.dataTransfer.files&&i.upload(a.dataTransfer.files)},this._onListClick=function(a){const c=a.target.closest('[data-ln-upload-action="remove"]');if(!c||!i.list||!i.list.contains(c)||c.disabled)return;const f=c.closest("[data-ln-upload-item]");if(f){const p=f.getAttribute("data-ln-upload-local-id");p&&i.remove(p)}},this._onRequestUpload=function(a){a.detail&&a.detail.files&&i.upload(a.detail.files)},this._onRequestRemove=function(a){if(a.detail){const c=a.detail.localId!==void 0?a.detail.localId:a.detail.serverId;c!==void 0&&i.remove(c)}},this._onRequestClear=function(){i.clear()},this.zone.addEventListener("click",this._onZoneClick),this.input&&this.input.addEventListener("change",this._onInputChange),this.zone.addEventListener("dragenter",this._onDragEnter),this.zone.addEventListener("dragover",this._onDragOver),this.zone.addEventListener("dragleave",this._onDragLeave),this.zone.addEventListener("drop",this._onDrop),this.list&&this.list.addEventListener("click",this._onListClick),this.dom.addEventListener("ln-upload:request-upload",this._onRequestUpload),this.dom.addEventListener("ln-upload:request-remove",this._onRequestRemove),this.dom.addEventListener("ln-upload:request-clear",this._onRequestClear)},r.prototype.upload=function(i){const a=this,c=Array.from(i);for(let f=0;f<c.length;f++){const p=c[f];if(a.maxFiles>0&&a.uploadedFiles.size>=a.maxFiles){v(a.dom,"ln-upload:invalid",{file:p,reason:"max-files"});continue}if(!Me(p,a.allowedExts)){v(a.dom,"ln-upload:invalid",{file:p,reason:"accept"});continue}if(a.maxSize>0&&p.size>a.maxSize){v(a.dom,"ln-upload:invalid",{file:p,reason:"max-size"});continue}F(a.dom,"ln-upload:before-upload",{file:p}).defaultPrevented||a._uploadSingleFile(p)}},r.prototype._uploadSingleFile=function(i){const a=this,c="file-"+ ++a.fileIdCounter,f=re(i.name);let p=null;if(this.list){const g=me(this.dom,"ln-upload-item","ln-upload");if(g&&(p=g.firstElementChild,p)){p.setAttribute("data-ln-upload-item",""),p.setAttribute("data-ln-upload-local-id",c),p.setAttribute("data-ln-upload-ext",f),p.setAttribute("data-ln-upload-state","uploading"),x(p,{name:i.name,sizeText:"0%",removeLabel:a.dict.remove||"Remove",uploading:!0,error:!1,deleting:!1});const h=p.querySelector('[data-ln-upload-action="remove"]');h&&(h.disabled=!0);const y=p.querySelector("[data-ln-progress]");y&&y.setAttribute("data-ln-progress","0"),a.list.appendChild(p)}}const w=new FormData;w.append(a.fileFieldName,i);const b=this.dom.querySelectorAll("input, select, textarea");for(let g=0;g<b.length;g++){const h=b[g];!h.name||h.name===a.idsFieldName||h.type==="file"||(h.type==="checkbox"||h.type==="radio")&&!h.checked||w.append(h.name,h.value)}const m=new XMLHttpRequest;a.uploadedFiles.set(c,{serverId:null,name:i.name,size:i.size,xhr:m}),m.upload.addEventListener("progress",function(g){if(g.lengthComputable){const h=Math.round(g.loaded/g.total*100);if(p){const y=p.querySelector("[data-ln-progress]");y&&y.setAttribute("data-ln-progress",String(h)),x(p,{sizeText:h+"%"})}v(a.dom,"ln-upload:progress",{localId:c,file:i,percent:h,loaded:g.loaded,total:g.total})}}),m.addEventListener("load",function(){const g=a.uploadedFiles.get(c);if(g&&delete g.xhr,m.status>=200&&m.status<300){let h;try{h=JSON.parse(m.responseText)}catch(C){A(a.dict.error||"Error",m.status,C);return}const y=h.id||h.serverId;if(p){p.removeAttribute("data-ln-upload-state"),y&&p.setAttribute("data-ln-upload-id",String(y)),x(p,{sizeText:l(h.size||i.size,a.locale,a.dict),uploading:!1});const C=p.querySelector('[data-ln-upload-action="remove"]');C&&(C.disabled=!1)}g&&(g.serverId=y,g.size=h.size||i.size,g.name=h.name||i.name),a._syncHiddenInputs(),v(a.dom,"ln-upload:uploaded",{localId:c,serverId:y,name:h.name||i.name,size:h.size||i.size,response:h})}else{let h="";try{h=JSON.parse(m.responseText).message||""}catch{}A(h,m.status,null)}}),m.addEventListener("error",function(){const g=a.uploadedFiles.get(c);g&&delete g.xhr,A("",0,null)});function A(g,h,y){if(p){p.setAttribute("data-ln-upload-state","error"),x(p,{sizeText:a.dict.error||"Error",uploading:!1,error:!0});const C=p.querySelector('[data-ln-upload-action="remove"]');C&&(C.disabled=!1)}v(a.dom,"ln-upload:error",{file:i,message:g,status:h,error:y})}a.uploadUrl?(m.open("POST",a.uploadUrl),m.setRequestHeader("X-CSRF-TOKEN",u()),m.setRequestHeader("X-Requested-With","XMLHttpRequest"),m.setRequestHeader("Accept","application/json"),m.send(w)):console.warn("[ln-upload] No upload URL configured (missing data-ln-upload)")},r.prototype.remove=function(i){const a=this;let c=null,f=null;if(a.uploadedFiles.has(i))c=i,f=a.uploadedFiles.get(i);else for(const[m,A]of a.uploadedFiles)if(String(A.serverId)===String(i)){c=m,f=A;break}if(!c||!f||F(a.dom,"ln-upload:before-remove",{localId:c,serverId:f.serverId}).defaultPrevented)return;const w=a.list?a.list.querySelector('[data-ln-upload-local-id="'+c+'"]'):null;if(f.xhr&&typeof f.xhr.abort=="function"&&f.xhr.abort(),!f.serverId){w&&w.remove(),a.uploadedFiles.delete(c),a._syncHiddenInputs(),v(a.dom,"ln-upload:removed",{localId:c,serverId:null});return}let b=null;if(a.deleteUrlPattern?b=a.deleteUrlPattern.replace("{id}",encodeURIComponent(f.serverId)):a.uploadUrl&&a.uploadUrl.includes("{id}")&&(b=a.uploadUrl.replace("{id}",encodeURIComponent(f.serverId))),!b){w&&w.remove(),a.uploadedFiles.delete(c),a._syncHiddenInputs(),v(a.dom,"ln-upload:removed",{localId:c,serverId:f.serverId});return}w&&(w.setAttribute("data-ln-upload-state","deleting"),x(w,{deleting:!0})),fetch(b,{method:"DELETE",headers:{"X-CSRF-TOKEN":u(),"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}}).then(function(m){m.ok?(w&&w.remove(),a.uploadedFiles.delete(c),a._syncHiddenInputs(),v(a.dom,"ln-upload:removed",{localId:c,serverId:f.serverId})):(w&&(w.removeAttribute("data-ln-upload-state"),x(w,{deleting:!1})),v(a.dom,"ln-upload:error",{file:f,message:"",status:m.status}))}).catch(function(m){w&&(w.removeAttribute("data-ln-upload-state"),x(w,{deleting:!1})),v(a.dom,"ln-upload:error",{file:f,message:"",status:0,error:m})})},r.prototype.clear=function(){const i=this;if(!F(i.dom,"ln-upload:before-clear",{}).defaultPrevented){for(const[,c]of this.uploadedFiles)if(c.xhr&&typeof c.xhr.abort=="function"&&c.xhr.abort(),c.serverId){let f=null;i.deleteUrlPattern?f=i.deleteUrlPattern.replace("{id}",encodeURIComponent(c.serverId)):i.uploadUrl&&i.uploadUrl.includes("{id}")&&(f=i.uploadUrl.replace("{id}",encodeURIComponent(c.serverId))),f&&fetch(f,{method:"DELETE",headers:{"X-CSRF-TOKEN":u(),"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}}).catch(function(){})}i.uploadedFiles.clear(),i.list&&(i.list.innerHTML=""),i._syncHiddenInputs(),v(i.dom,"ln-upload:cleared",{})}},r.prototype.getFileIds=function(){return Array.from(this.uploadedFiles.values()).map(function(i){return i.serverId}).filter(Boolean)},r.prototype.getFiles=function(){return Array.from(this.uploadedFiles.values()).map(function(i){return{serverId:i.serverId,name:i.name,size:i.size}})},r.prototype.destroy=function(){if(this.dom[t]){for(const[,i]of this.uploadedFiles)i.xhr&&typeof i.xhr.abort=="function"&&i.xhr.abort();this.zone.removeEventListener("click",this._onZoneClick),this.input&&this.input.removeEventListener("change",this._onInputChange),this.zone.removeEventListener("dragenter",this._onDragEnter),this.zone.removeEventListener("dragover",this._onDragOver),this.zone.removeEventListener("dragleave",this._onDragLeave),this.zone.removeEventListener("drop",this._onDrop),this.list&&this.list.removeEventListener("click",this._onListClick),this.dom.removeEventListener("ln-upload:request-upload",this._onRequestUpload),this.dom.removeEventListener("ln-upload:request-remove",this._onRequestRemove),this.dom.removeEventListener("ln-upload:request-clear",this._onRequestClear),this.uploadedFiles.clear(),this.dict={},delete this.dom[t]}},ne(e,t,r,"ln-upload",{attributes:s})})()})();
|
|
1
|
+
(function(){"use strict";function U(){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 o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){i=t[o];break}if(!L(i))return}e.apply(console,t)}}function v(e,t,n){const i=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function F(e,t,n){const i=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i);const o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:i});return e.dispatchEvent(o),o}function E(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){E(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 n=!!(t&&t.typed),i=t&&t.exclude,o={},u=e.elements,s={};if(n)for(let d=0;d<u.length;d++){const l=u[d];l.name&&l.type==="checkbox"&&!l.disabled&&(s[l.name]=(s[l.name]||0)+1)}for(let d=0;d<u.length;d++){const l=u[d];if(!(!l.name||l.disabled||l.type==="file"||l.type==="submit"||l.type==="button")&&!(i&&l.matches&&l.matches(i)))if(l.type==="checkbox")n&&s[l.name]===1?o[l.name]=l.checked:(o[l.name]||(o[l.name]=[]),l.checked&&o[l.name].push(l.value));else if(l.type==="radio")l.checked&&(o[l.name]=l.value);else if(l.type==="select-multiple"){o[l.name]=[];for(let r=0;r<l.options.length;r++)l.options[r].selected&&o[l.name].push(l.options[r].value)}else if(n&&l.type==="hidden")o[l.name]=l.value;else if(n&&(l.type==="number"||l.type==="range")){const r=Number(l.value);o[l.name]=l.value===""||isNaN(r)?null:r}else o[l.name]=l.value}return o}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 ae(e,t){const n=e.elements,i=[],o={};for(let u=0;u<n.length;u++){const s=n[u];s.name&&s.type==="checkbox"&&(o[s.name]=(o[s.name]||0)+1)}for(let u=0;u<n.length;u++){const s=n[u];if(s.type==="file"||s.type==="submit"||s.type==="button")continue;const d=s.getAttribute("data-ln-fill-as")||s.name;if(!d||!(d in t))continue;const l=t[d];if(s.type==="checkbox"){if(Array.isArray(l))s.checked=l.indexOf(s.value)!==-1;else if(o[s.name]>1){const r=String(l).split(",").map(function(a){return a.trim()});s.checked=r.indexOf(s.value)!==-1}else s.checked=se(l);i.push(s)}else if(s.type==="radio")s.checked=s.value===String(l),i.push(s);else if(s.type==="select-multiple"){if(Array.isArray(l))for(let r=0;r<s.options.length;r++)s.options[r].selected=l.indexOf(s.options[r].value)!==-1;i.push(s)}else s.value=l,s.tagName==="SELECT"&&l!=null&&s.setAttribute("data-ln-value",l),i.push(s)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ae,window.lnCore.serializeForm=le,window.lnCore.resolveFormMethod=ie);const B={};function de(e,t){B[e]=t}function ue(e){return B[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=de,window.lnCore.getDataMapper=ue);function ce(e){const t=e?e.closest("[lang]"):null,n=(t?t.getAttribute("lang")||t.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return n?n.trim():"en-US"}function fe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,E(function(){new MutationObserver(function(){v(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function pe(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];$[n]=t}function he(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=pe,window.lnCore.getLocaleFallback=he,window.lnCore.ensureLocaleObserver=fe);const D={};function H(e,t){D[e]||(D[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=D[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function me(e,t,n){if(e){const i=e.querySelector('[data-ln-template="'+t+'"]');if(i)return i.content.cloneNode(!0)}return H(t,n)}function x(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let s=0;s<n.length;s++){const d=n[s],l=d.getAttribute("data-ln-field");t[l]!=null&&(d.textContent=t[l])}const i=e.querySelectorAll("[data-ln-attr]");for(let s=0;s<i.length;s++){const d=i[s],l=d.getAttribute("data-ln-attr").split(",");for(let r=0;r<l.length;r++){const a=l[r].trim().split(":");if(a.length!==2)continue;const c=a[0].trim(),f=a[1].trim();t[f]!=null&&d.setAttribute(c,t[f])}}const o=e.querySelectorAll("[data-ln-show]");for(let s=0;s<o.length;s++){const d=o[s],l=d.getAttribute("data-ln-show");l in t&&d.classList.toggle("hidden",!t[l])}const u=e.querySelectorAll("[data-ln-class]");for(let s=0;s<u.length;s++){const d=u[s],l=d.getAttribute("data-ln-class").split(",");for(let r=0;r<l.length;r++){const a=l[r].trim().split(":");if(a.length!==2)continue;const c=a[0].trim(),f=a[1].trim();f in t&&d.classList.toggle(c,!!t[f])}}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 n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<n.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[i],t??null),n[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)x(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function j(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const u=n.currentNode;u.textContent.indexOf("{{")!==-1&&(u.textContent=u.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(s,d){return t[d]!==void 0?t[d]:""}))}const i=function(u,s){return t[s]!==void 0?t[s]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let u=0;u<o.length;u++){const s=o[u],d=s.attributes;for(let l=0;l<d.length;l++){const r=d[l];r.value.indexOf("{{")!==-1&&s.setAttribute(r.name,r.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function we(e,t,n,i,o,u){const s={};for(let l=0;l<e.children.length;l++){const r=e.children[l],a=r.getAttribute("data-ln-render-key");a&&(s[a]=r)}const d=document.createDocumentFragment();for(let l=0;l<t.length;l++){const r=t[l],a=String(i(r));let c=s[a];if(c)o(c,r,l);else{const f=H(n,u);if(!f||(j(f,r),c=f.firstElementChild,!c))continue;c.setAttribute("data-ln-render-key",a),o(c,r,l)}d.appendChild(c)}e.textContent="",e.appendChild(d)}function be(e,t){const n={},i=e.querySelectorAll("["+t+"]");for(let o=0;o<i.length;o++)n[i[o].getAttribute(t)]=i[o].textContent,i[o].remove();return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=j,window.lnCore.fill=x,window.lnCore.lnFill=ge,window.lnCore.renderList=we);function _(e,t,n){const i=e.getAttribute(t);return i===null?n:i}function k(e,t,n){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?n:i}function W(e,t,n=!1){const i=e.getAttribute(t);if(i===null)return!!n;const o=i.trim().toLowerCase();return!(o==="false"||o==="0")}function P(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const q=new Map;function V(e,t){const n=(e?e.join("|"):"")+"::"+t;if(q.has(n))return q.get(n);const i=new Set(e||[]),o=function(u,s){const d=u.getAttribute(s);return d!==null&&i.has(d)?d:t};return q.set(n,o),o}function X(e,t,n){const i=parseFloat(e.getAttribute(t));return isNaN(i)?n:i}function K(e,t,n){const i=e.getAttribute(t);if(!i)return n;try{return JSON.parse(i)}catch{return n}}function J(e,t,n,i,o){if(!e||t===null)return!0;const u=i||"ln-component",s=e.type;if(s==="trigger"||s==="marker"||s==="string"||s==="list"||!s||t===""&&e.fallback!==void 0)return!0;const d=l=>{o?console.warn(l,o):console.warn(l)};if(s==="boolean"){const l=t.trim().toLowerCase();return l!==""&&l!=="true"&&l!=="false"&&l!=="1"&&l!=="0"?(d(`[${u}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(s==="enum"){const l=e.values||[];return l.includes(t)?!0:(d(`[${u}] Invalid value "${t}" for attribute "${n}". Allowed: ${l.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(s==="integer"){if(!/^-?\d+$/.test(t))return d(`[${u}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const l=parseInt(t,10);return e.min!==void 0&&l<e.min?(d(`[${u}] Value ${l} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&l>e.max?(d(`[${u}] Value ${l} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(s==="float")return isNaN(Number(t))?(d(`[${u}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(s==="json")try{return JSON.parse(t),!0}catch(l){return d(`[${u}] Invalid JSON for attribute "${n}": ${l.message}. Fallback: ${e.fallback}.`),!1}return!0}function Q(e,t,n){for(const i in n){const[o,u,s]=n[i];Object.defineProperty(e,i,{get:function(){return o(t,u,s)},enumerable:!0,configurable:!0})}return e}function G(e){const t={};for(const n in e){const i=e[n];if(!i||!i.prop)continue;let o=i.read;if(!o&&i.type)switch(i.type){case"enum":o=V(i.values,i.fallback);break;case"integer":o=k;break;case"float":o=X;break;case"boolean":o=W;break;case"list":o=P;break;case"json":o=K;break;case"string":default:o=_;break}o||(o=_),t[i.prop]=[o,n,i.fallback]}return t}function ye(e){const t={};for(const n in e){const i=e[n];i&&i.effect&&(t[n]=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 n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=Q,window.lnCore.attrSpec=G,window.lnCore.attrStr=_,window.lnCore.attrInt=k,window.lnCore.attrBool=W,window.lnCore.attrList=P,window.lnCore.attrEnum=V,window.lnCore.attrFloat=X,window.lnCore.attrJson=K);function S(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(n){console.error("["+t.attribute+"] init failed",e,n)}}}function Z(e,t,n,i){if(e.nodeType!==1)return;const u=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",s={selector:t,attribute:n,ComponentFn:i};if(e.matches&&e.matches(u)&&S(e,s),e.querySelectorAll){const d=e.querySelectorAll(u);for(let l=0;l<d.length;l++)S(d[l],s)}}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 Y(){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=Y(),n=e.observed||[];for(let i=0;i<n.length;i++){const o=n[i];t.byAttr.has(o)||t.byAttr.set(o,[]),t.byAttr.get(o).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const o=t.byDeclaredAttr.get(i);o.some(u=>u.componentTag===e.componentTag)||o.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 o of i)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function ee(e,t,n,i){for(let o=0;o<e.length;o++){const u=e[o];if(!t[u.attribute])continue;const s=u.effects&&u.effects[n];s?s(t,n,i):u.onAttrChange&&(!u.declared||u.declared.has(n))&&u.onAttrChange(t,n,i)}}function _e(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,i=Y(),o=i.byAttr.get(t),u=U()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!n&&!o&&!u)return;const s=e.target;if(e.oldValue!==s.getAttribute(t)){if(u&&L(s)){const d=i.byDeclaredAttr.get(t),l=s.getAttribute(t);for(let r=0;r<d.length;r++)J(d[r].spec,l,t,d[r].componentTag,s)}if(window.lnCore._debugSink&&(n||o)&&window.lnCore._debugSink("attr",t,s,{oldValue:e.oldValue,newValue:s.getAttribute(t)}),n){const d=i.byReactive.get(t);d&&ee(d,s,t,e.oldValue),i.reactiveWildcard.length&&ee(i.reactiveWildcard,s,t,e.oldValue)}if(o)for(let d=0;d<o.length;d++){const l=o[d];if(l.handler){l.handler(s,t,e.oldValue);continue}l.onAttributeChange&&s[l.attribute]?l.onAttributeChange(s,t):(Z(s,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(s))}}}function Se(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,E(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{_e(t[n])}catch(i){console.error("[ln-core] mutation handler failed",t[n].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function z(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function R(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Ie(e){const t=z();if(!t.length)return;const n=e.target;if(n){const i=n.nodeType===1?n:n.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 o=t[i];if(o.onSubtreeChange&&o.query){const u=o.query,s=e.target.nodeType===1?e.target.matches&&e.target.matches(u)?e.target:e.target.closest?e.target.closest(u):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(u):null;s&&o.onSubtreeChange(s,e)}}for(let i=0;i<e.addedNodes.length;i++){const o=e.addedNodes[i];if(o.nodeType===1){const u=!!(o.firstElementChild||o.children&&o.children.length);for(let s=0;s<t.length;s++){const d=t[s];if(d.selector&&d.attribute&&d.ComponentFn){if(!u)o.matches&&o.matches(d.query)&&S(o,d);else if(o.matches&&o.matches(d.query)&&S(o,d),o.querySelectorAll){const l=o.querySelectorAll(d.query);for(let r=0;r<l.length;r++)S(l[r],d)}}d.onInit&&d.onInit(o)}}}for(let i=0;i<e.removedNodes.length;i++){const o=e.removedNodes[i];if(o.nodeType===1){const u=!!(o.firstElementChild||o.children&&o.children.length);for(let s=0;s<t.length;s++){const d=t[s],l=d.query;if(l){if(!u)o.matches&&o.matches(l)&&R(o,d);else if(o.matches&&o.matches(l)&&R(o,d),o.querySelectorAll){const r=o.querySelectorAll(l);for(let a=0;a<r.length;a++)R(r[a],d)}}}}}}function te(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,E(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const i=t[n];if(i.type==="childList")try{Ie(i)}catch(o){console.error("[ln-core] lifecycle handler failed",i.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ee(e){z().push(e),te()}function ne(e,t,n,i,o={}){const u=o.extraAttributes||[],s=o.onAttributeChange||null,d=o.onSubtreeChange||null,l=o.onInit||null,r=o.onAttrChange||null,a=o.effects||null,c=o.attributes||null,f=c?ye(c):a,p=c?new Set(Object.keys(c)):null,w=o.persist||null;function b(y){const C=y||document.body;if(Z(C,e,t,n),c&&U())for(const I in c){const Be=c[I],T=Array.from(C.querySelectorAll("["+I+"]"));C.matches&&C.matches("["+I+"]")&&T.push(C);for(let N=0;N<T.length;N++){const M=T[N];L(M)&&J(Be,M.getAttribute(I),I,i,M)}}l&&l(C)}const m=[];if(e.indexOf("[")!==-1){const y=/\[([\w-]+)/g;let C;for(;(C=y.exec(e))!==null;)m.push(C[1])}else m.push(e);xe({selector:e,attribute:t,componentTag:i,attributes:c,ComponentFn:n,onInit:l,observed:m.concat(u),onAttributeChange:s,onAttrChange:r,effects:f,declared:p,persist:w}),Se();const A=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,g=o.subtreeQuery||(A?e:"["+e+"]");z().push({selector:e,attribute:t,ComponentFn:n,onInit:l,onSubtreeChange:d,query:g}),te(),window[t]=b,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ne,window.lnCore.observeLifecycle=Ee);function h(){ve()>0?Ae(function(){b(document.body)}):b(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",h):h(),b}function oe(e){return(e||"").replace(/^#/,"")}function O(e){const t=e===void 0?location.hash:e,n={},i=oe(t);if(!i)return n;const o=i.split("&");for(let u=0;u<o.length;u++){const s=o[u];if(!s)continue;const d=s.indexOf(":"),l=d>-1?s.slice(0,d):s,r=d>-1?s.slice(d+1):"";if(l)try{n[l]=decodeURIComponent(r)}catch{n[l]=r}}return n}function ke(e){if(!e)return null;const t=O();return e in t?t[e]:null}function Le(e,t){if(!e)return;const n=O();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(u){const s=n[u];return s===""?u:u+":"+encodeURIComponent(s)}).join("&");oe(location.hash)!==o&&(location.hash=o)}function Fe(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 n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.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 ze(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 Oe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),i=e.slice(t+1),o=i?i.split(",").map(function(u){try{return decodeURIComponent(u)}catch{return u}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=O,window.lnCore.hashGet=ke,window.lnCore.hashSet=Le,window.lnCore.hashLinkClick=Fe,window.lnCore.resolveHashNamespace=De,window.lnCore.hashSortEncode=qe,window.lnCore.hashSortDecode=ze,window.lnCore.hashFilterEncode=Re,window.lnCore.hashFilterDecode=Oe);function Te(){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=Te);function Ne(e){if(!e)return null;const t=String(e).split(",").map(n=>n.trim().toLowerCase()).filter(Boolean).map(n=>n.startsWith(".")?n.slice(1):n);return t.length?t:null}function re(e){return!e||typeof e!="string"||!e.includes(".")?"":e.split(".").pop().toLowerCase()}function Me(e,t){if(!t||t.length===0)return!0;if(!e)return!1;const n=re(e.name),i=String(e.type||"").toLowerCase();return t.some(o=>{if(o.includes("/")){if(o.endsWith("/*")){const u=o.slice(0,-1);return i.startsWith(u)}return i===o}return n===o})}function Ue(e,t="en",n={}){if(typeof e!="number"||isNaN(e)||e===0)return"0 "+(n["unit-b"]||"B");const i=1024,o=[n["unit-b"]||"B",n["unit-kb"]||"KB",n["unit-mb"]||"MB",n["unit-gb"]||"GB"],u=Math.floor(Math.log(e)/Math.log(i)),s=Math.min(u,o.length-1),d=e/Math.pow(i,s);return new Intl.NumberFormat(t,{maximumFractionDigits:1,minimumFractionDigits:0}).format(d)+" "+o[s]}(function(){const e="data-ln-upload",t="lnUpload",n="file",i="file_ids[]";if(window[t]!==void 0)return;const o={"data-ln-upload":{prop:"uploadUrl",read:_,type:"string",fallback:"",description:"Endpoint URL for file uploads"},"data-ln-upload-accept":{type:"string",description:"Comma-separated list of allowed file extensions or MIME types"},"data-ln-upload-delete":{prop:"deleteUrlPattern",read:_,type:"string",fallback:"",description:"Endpoint URL pattern for deleting uploaded files"},"data-ln-upload-max-size":{prop:"maxSize",read:k,type:"integer",fallback:0,min:0,description:"Maximum allowed file size in bytes (0 for unlimited)"},"data-ln-upload-max-files":{prop:"maxFiles",read:k,type:"integer",fallback:0,min:0,description:"Maximum number of files allowed in upload queue (0 for unlimited)"},"data-ln-upload-file-field":{prop:"fileFieldName",read:_,type:"string",fallback:n,description:"Form data field name used for file payloads"},"data-ln-upload-ids-field":{prop:"idsFieldName",read:_,type:"string",fallback:i,description:"Form field name for submitting uploaded file IDs"},"data-ln-upload-dict":{type:"string",description:"Dictionary key prefix mapping for translatable upload messages"},"data-ln-upload-zone":{type:"marker",description:"Designates container as dropzone for drag-and-drop file uploads"},"data-ln-upload-list":{type:"marker",description:"Container element holding rendered upload items"},"data-ln-upload-item":{type:"marker",description:"Container element for an individual file upload item"},"data-ln-upload-action":{type:"enum",values:["remove","retry"],description:"Action button within upload item"},"data-ln-upload-state":{type:"enum",values:["ready","dragover","pending","uploading","success","error"],description:"Runtime status of dropzone or individual upload item"},"data-ln-upload-id":{type:"string",description:"Server-assigned file identifier for completed upload"},"data-ln-upload-local-id":{type:"string",description:"Client-generated unique ID for tracking file item in DOM"},"data-ln-upload-size":{type:"integer",min:0,description:"File size in bytes"},"data-ln-upload-ext":{type:"string",description:"Normalized file extension"}},u=G(o);function s(r,a,c){return Ue(r,a,c)}function d(){const r=document.querySelector('meta[name="csrf-token"]');return r?r.getAttribute("content"):""}function l(r){this.dom=r,Q(this,r,u),this.dict=be(r,"data-ln-upload-dict"),this.locale=ce(r),this.zone=r.querySelector("[data-ln-upload-zone]")||r,this.list=r.querySelector("[data-ln-upload-list]"),this.input=r.querySelector('input[type="file"]'),this.input||console.warn('[ln-upload] Missing <input type="file"> in container:',r);const a=r.getAttribute("data-ln-upload-accept")||(this.input?this.input.getAttribute("accept"):"");return this.allowedExts=Ne(a),this.uploadedFiles=new Map,this.fileIdCounter=0,this._dragDepth=0,this._hydrate(),this._bindEvents(),this}l.prototype._hydrate=function(){const r=this;if(!this.list)return;const a=this.list.querySelectorAll("[data-ln-upload-item]");for(let f=0;f<a.length;f++){const p=a[f],w=p.getAttribute("data-ln-upload-id"),b="file-"+ ++r.fileIdCounter;p.setAttribute("data-ln-upload-local-id",b);const m=p.querySelector('[data-ln-field="name"]'),A=p.querySelector('[data-ln-field="sizeText"]'),g=p.getAttribute("data-ln-upload-size"),h=g?parseInt(g,10):null;r.uploadedFiles.set(b,{serverId:w||null,name:m?m.textContent.trim():"",size:h!==null&&!isNaN(h)?h:A?A.textContent.trim():""})}const c=this.dom.querySelectorAll('input[type="hidden"]');for(let f=0;f<c.length;f++){const p=c[f];if(p.name===r.idsFieldName&&p.value&&!Array.from(r.uploadedFiles.values()).some(function(b){return String(b.serverId)===String(p.value)})){const b="file-"+ ++r.fileIdCounter;r.uploadedFiles.set(b,{serverId:p.value,name:"",size:""})}}this._syncHiddenInputs()},l.prototype._syncHiddenInputs=function(){const r=this,a=this.dom.querySelectorAll('input[type="hidden"]');for(let c=0;c<a.length;c++)a[c].name===r.idsFieldName&&a[c].remove();for(const[,c]of this.uploadedFiles)if(c.serverId){const f=document.createElement("input");f.type="hidden",f.name=r.idsFieldName,f.value=c.serverId,r.dom.appendChild(f)}},l.prototype._bindEvents=function(){const r=this;this._onZoneClick=function(a){r.zone===r.dom&&a.target.closest("[data-ln-upload-list], [data-ln-upload-action], input, button, a")||r.input&&a.target!==r.input&&r.input.click()},this._onInputChange=function(){r.input&&r.input.files&&(r.upload(r.input.files),r.input.value="")},this._onDragEnter=function(a){a.preventDefault(),a.stopPropagation(),r._dragDepth++,r.zone.setAttribute("data-ln-upload-state","dragover")},this._onDragOver=function(a){a.preventDefault(),a.stopPropagation(),r.zone.setAttribute("data-ln-upload-state","dragover")},this._onDragLeave=function(a){a.preventDefault(),a.stopPropagation(),r._dragDepth--,r._dragDepth<=0&&(r._dragDepth=0,r.zone.removeAttribute("data-ln-upload-state"))},this._onDrop=function(a){a.preventDefault(),a.stopPropagation(),r._dragDepth=0,r.zone.removeAttribute("data-ln-upload-state"),a.dataTransfer&&a.dataTransfer.files&&r.upload(a.dataTransfer.files)},this._onListClick=function(a){const c=a.target.closest('[data-ln-upload-action="remove"]');if(!c||!r.list||!r.list.contains(c)||c.disabled)return;const f=c.closest("[data-ln-upload-item]");if(f){const p=f.getAttribute("data-ln-upload-local-id");p&&r.remove(p)}},this._onRequestUpload=function(a){a.detail&&a.detail.files&&r.upload(a.detail.files)},this._onRequestRemove=function(a){if(a.detail){const c=a.detail.localId!==void 0?a.detail.localId:a.detail.serverId;c!==void 0&&r.remove(c)}},this._onRequestClear=function(){r.clear()},this.zone.addEventListener("click",this._onZoneClick),this.input&&this.input.addEventListener("change",this._onInputChange),this.zone.addEventListener("dragenter",this._onDragEnter),this.zone.addEventListener("dragover",this._onDragOver),this.zone.addEventListener("dragleave",this._onDragLeave),this.zone.addEventListener("drop",this._onDrop),this.list&&this.list.addEventListener("click",this._onListClick),this.dom.addEventListener("ln-upload:request-upload",this._onRequestUpload),this.dom.addEventListener("ln-upload:request-remove",this._onRequestRemove),this.dom.addEventListener("ln-upload:request-clear",this._onRequestClear)},l.prototype.upload=function(r){const a=this,c=Array.from(r);for(let f=0;f<c.length;f++){const p=c[f];if(a.maxFiles>0&&a.uploadedFiles.size>=a.maxFiles){v(a.dom,"ln-upload:invalid",{file:p,reason:"max-files"});continue}if(!Me(p,a.allowedExts)){v(a.dom,"ln-upload:invalid",{file:p,reason:"accept"});continue}if(a.maxSize>0&&p.size>a.maxSize){v(a.dom,"ln-upload:invalid",{file:p,reason:"max-size"});continue}F(a.dom,"ln-upload:before-upload",{file:p}).defaultPrevented||a._uploadSingleFile(p)}},l.prototype._uploadSingleFile=function(r){const a=this,c="file-"+ ++a.fileIdCounter,f=re(r.name);let p=null;if(this.list){const g=me(this.dom,"ln-upload-item","ln-upload");if(g&&(p=g.firstElementChild,p)){p.setAttribute("data-ln-upload-item",""),p.setAttribute("data-ln-upload-local-id",c),p.setAttribute("data-ln-upload-ext",f),p.setAttribute("data-ln-upload-state","uploading"),x(p,{name:r.name,sizeText:"0%",removeLabel:a.dict.remove||"Remove",uploading:!0,error:!1,deleting:!1});const h=p.querySelector('[data-ln-upload-action="remove"]');h&&(h.disabled=!0);const y=p.querySelector("[data-ln-progress]");y&&y.setAttribute("data-ln-progress","0"),a.list.appendChild(p)}}const w=new FormData;w.append(a.fileFieldName,r);const b=this.dom.querySelectorAll("input, select, textarea");for(let g=0;g<b.length;g++){const h=b[g];!h.name||h.name===a.idsFieldName||h.type==="file"||(h.type==="checkbox"||h.type==="radio")&&!h.checked||w.append(h.name,h.value)}const m=new XMLHttpRequest;a.uploadedFiles.set(c,{serverId:null,name:r.name,size:r.size,xhr:m}),m.upload.addEventListener("progress",function(g){if(g.lengthComputable){const h=Math.round(g.loaded/g.total*100);if(p){const y=p.querySelector("[data-ln-progress]");y&&y.setAttribute("data-ln-progress",String(h)),x(p,{sizeText:h+"%"})}v(a.dom,"ln-upload:progress",{localId:c,file:r,percent:h,loaded:g.loaded,total:g.total})}}),m.addEventListener("load",function(){const g=a.uploadedFiles.get(c);if(g&&delete g.xhr,m.status>=200&&m.status<300){let h;try{h=JSON.parse(m.responseText)}catch(C){A(a.dict.error||"Error",m.status,C);return}const y=h.id||h.serverId;if(p){p.removeAttribute("data-ln-upload-state"),y&&p.setAttribute("data-ln-upload-id",String(y)),x(p,{sizeText:s(h.size||r.size,a.locale,a.dict),uploading:!1});const C=p.querySelector('[data-ln-upload-action="remove"]');C&&(C.disabled=!1)}g&&(g.serverId=y,g.size=h.size||r.size,g.name=h.name||r.name),a._syncHiddenInputs(),v(a.dom,"ln-upload:uploaded",{localId:c,serverId:y,name:h.name||r.name,size:h.size||r.size,response:h})}else{let h="";try{h=JSON.parse(m.responseText).message||""}catch{}A(h,m.status,null)}}),m.addEventListener("error",function(){const g=a.uploadedFiles.get(c);g&&delete g.xhr,A("",0,null)});function A(g,h,y){if(p){p.setAttribute("data-ln-upload-state","error"),x(p,{sizeText:a.dict.error||"Error",uploading:!1,error:!0});const C=p.querySelector('[data-ln-upload-action="remove"]');C&&(C.disabled=!1)}v(a.dom,"ln-upload:error",{file:r,message:g,status:h,error:y})}a.uploadUrl?(m.open("POST",a.uploadUrl),m.setRequestHeader("X-CSRF-TOKEN",d()),m.setRequestHeader("X-Requested-With","XMLHttpRequest"),m.setRequestHeader("Accept","application/json"),m.send(w)):console.warn("[ln-upload] No upload URL configured (missing data-ln-upload)")},l.prototype.remove=function(r){const a=this;let c=null,f=null;if(a.uploadedFiles.has(r))c=r,f=a.uploadedFiles.get(r);else for(const[m,A]of a.uploadedFiles)if(String(A.serverId)===String(r)){c=m,f=A;break}if(!c||!f||F(a.dom,"ln-upload:before-remove",{localId:c,serverId:f.serverId}).defaultPrevented)return;const w=a.list?a.list.querySelector('[data-ln-upload-local-id="'+c+'"]'):null;if(f.xhr&&typeof f.xhr.abort=="function"&&f.xhr.abort(),!f.serverId){w&&w.remove(),a.uploadedFiles.delete(c),a._syncHiddenInputs(),v(a.dom,"ln-upload:removed",{localId:c,serverId:null});return}let b=null;if(a.deleteUrlPattern?b=a.deleteUrlPattern.replace("{id}",encodeURIComponent(f.serverId)):a.uploadUrl&&a.uploadUrl.includes("{id}")&&(b=a.uploadUrl.replace("{id}",encodeURIComponent(f.serverId))),!b){w&&w.remove(),a.uploadedFiles.delete(c),a._syncHiddenInputs(),v(a.dom,"ln-upload:removed",{localId:c,serverId:f.serverId});return}w&&(w.setAttribute("data-ln-upload-state","deleting"),x(w,{deleting:!0})),fetch(b,{method:"DELETE",headers:{"X-CSRF-TOKEN":d(),"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}}).then(function(m){m.ok?(w&&w.remove(),a.uploadedFiles.delete(c),a._syncHiddenInputs(),v(a.dom,"ln-upload:removed",{localId:c,serverId:f.serverId})):(w&&(w.removeAttribute("data-ln-upload-state"),x(w,{deleting:!1})),v(a.dom,"ln-upload:error",{file:f,message:"",status:m.status}))}).catch(function(m){w&&(w.removeAttribute("data-ln-upload-state"),x(w,{deleting:!1})),v(a.dom,"ln-upload:error",{file:f,message:"",status:0,error:m})})},l.prototype.clear=function(){const r=this;if(!F(r.dom,"ln-upload:before-clear",{}).defaultPrevented){for(const[,c]of this.uploadedFiles)if(c.xhr&&typeof c.xhr.abort=="function"&&c.xhr.abort(),c.serverId){let f=null;r.deleteUrlPattern?f=r.deleteUrlPattern.replace("{id}",encodeURIComponent(c.serverId)):r.uploadUrl&&r.uploadUrl.includes("{id}")&&(f=r.uploadUrl.replace("{id}",encodeURIComponent(c.serverId))),f&&fetch(f,{method:"DELETE",headers:{"X-CSRF-TOKEN":d(),"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}}).catch(function(){})}r.uploadedFiles.clear(),r.list&&(r.list.innerHTML=""),r._syncHiddenInputs(),v(r.dom,"ln-upload:cleared",{})}},l.prototype.getFileIds=function(){return Array.from(this.uploadedFiles.values()).map(function(r){return r.serverId}).filter(Boolean)},l.prototype.getFiles=function(){return Array.from(this.uploadedFiles.values()).map(function(r){return{serverId:r.serverId,name:r.name,size:r.size}})},l.prototype.destroy=function(){if(this.dom[t]){for(const[,r]of this.uploadedFiles)r.xhr&&typeof r.xhr.abort=="function"&&r.xhr.abort();this.zone.removeEventListener("click",this._onZoneClick),this.input&&this.input.removeEventListener("change",this._onInputChange),this.zone.removeEventListener("dragenter",this._onDragEnter),this.zone.removeEventListener("dragover",this._onDragOver),this.zone.removeEventListener("dragleave",this._onDragLeave),this.zone.removeEventListener("drop",this._onDrop),this.list&&this.list.removeEventListener("click",this._onListClick),this.dom.removeEventListener("ln-upload:request-upload",this._onRequestUpload),this.dom.removeEventListener("ln-upload:request-remove",this._onRequestRemove),this.dom.removeEventListener("ln-upload:request-clear",this._onRequestClear),this.uploadedFiles.clear(),this.dict={},delete this.dom[t]}},ne(e,t,l,"ln-upload",{attributes:o})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function N(){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 A(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let r=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){r=t[l];break}if(!A(r))return}e.apply(console,t)}}function S(e,t,o){const r=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function v(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){v(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ne(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function re(e,t){const o=!!(t&&t.typed),r=t&&t.exclude,l={},s=e.elements,i={};if(o)for(let a=0;a<s.length;a++){const n=s[a];n.name&&n.type==="checkbox"&&!n.disabled&&(i[n.name]=(i[n.name]||0)+1)}for(let a=0;a<s.length;a++){const n=s[a];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(r&&n.matches&&n.matches(r)))if(n.type==="checkbox")o&&i[n.name]===1?l[n.name]=n.checked:(l[n.name]||(l[n.name]=[]),n.checked&&l[n.name].push(n.value));else if(n.type==="radio")n.checked&&(l[n.name]=n.value);else if(n.type==="select-multiple"){l[n.name]=[];for(let c=0;c<n.options.length;c++)n.options[c].selected&&l[n.name].push(n.options[c].value)}else if(o&&n.type==="hidden")l[n.name]=n.value;else if(o&&(n.type==="number"||n.type==="range")){const c=Number(n.value);l[n.name]=n.value===""||isNaN(c)?null:c}else l[n.name]=n.value}return l}function oe(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ie(e,t){const o=e.elements,r=[],l={};for(let s=0;s<o.length;s++){const i=o[s];i.name&&i.type==="checkbox"&&(l[i.name]=(l[i.name]||0)+1)}for(let s=0;s<o.length;s++){const i=o[s];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const a=i.getAttribute("data-ln-fill-as")||i.name;if(!a||!(a in t))continue;const n=t[a];if(i.type==="checkbox"){if(Array.isArray(n))i.checked=n.indexOf(i.value)!==-1;else if(l[i.name]>1){const c=String(n).split(",").map(function(d){return d.trim()});i.checked=c.indexOf(i.value)!==-1}else i.checked=oe(n);r.push(i)}else if(i.type==="radio")i.checked=i.value===String(n),r.push(i);else if(i.type==="select-multiple"){if(Array.isArray(n))for(let c=0;c<i.options.length;c++)i.options[c].selected=n.indexOf(i.options[c].value)!==-1;r.push(i)}else i.value=n,i.tagName==="SELECT"&&n!=null&&i.setAttribute("data-ln-value",n),r.push(i)}return r}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ie,window.lnCore.serializeForm=re,window.lnCore.resolveFormMethod=ne);const T={};function le(e,t){T[e]=t}function se(e){return T[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=le,window.lnCore.getDataMapper=se);function ae(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,v(function(){new MutationObserver(function(){S(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const M={};function ce(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];M[o]=t}function de(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return M[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ce,window.lnCore.getLocaleFallback=de,window.lnCore.ensureLocaleObserver=ae);const x={};function ue(e,t){x[e]||(x[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=x[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function $(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let i=0;i<o.length;i++){const a=o[i],n=a.getAttribute("data-ln-field");t[n]!=null&&(a.textContent=t[n])}const r=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<r.length;i++){const a=r[i],n=a.getAttribute("data-ln-attr").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),w=d[1].trim();t[w]!=null&&a.setAttribute(u,t[w])}}const l=e.querySelectorAll("[data-ln-show]");for(let i=0;i<l.length;i++){const a=l[i],n=a.getAttribute("data-ln-show");n in t&&a.classList.toggle("hidden",!t[n])}const s=e.querySelectorAll("[data-ln-class]");for(let i=0;i<s.length;i++){const a=s[i],n=a.getAttribute("data-ln-class").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),w=d[1].trim();w in t&&a.classList.toggle(u,!!t[w])}}return e}function fe(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 r=0;r<o.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[r],t??null),o[r].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)$(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 B(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const s=o.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,a){return t[a]!==void 0?t[a]:""}))}const r=function(s,i){return t[i]!==void 0?t[i]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const i=l[s],a=i.attributes;for(let n=0;n<a.length;n++){const c=a[n];c.value.indexOf("{{")!==-1&&i.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function he(e,t,o,r,l,s){const i={};for(let n=0;n<e.children.length;n++){const c=e.children[n],d=c.getAttribute("data-ln-render-key");d&&(i[d]=c)}const a=document.createDocumentFragment();for(let n=0;n<t.length;n++){const c=t[n],d=String(r(c));let u=i[d];if(u)l(u,c,n);else{const w=ue(o,s);if(!w||(B(w,c),u=w.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),l(u,c,n)}a.appendChild(u)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=B,window.lnCore.fill=$,window.lnCore.lnFill=fe,window.lnCore.renderList=he);function k(e,t,o){const r=e.getAttribute(t);return r===null?o:r}function V(e,t,o){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?o:r}function j(e,t,o=!1){const r=e.getAttribute(t);if(r===null)return!!o;const l=r.trim().toLowerCase();return!(l==="false"||l==="0")}function W(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const E=new Map;function U(e,t){const o=(e?e.join("|"):"")+"::"+t;if(E.has(o))return E.get(o);const r=new Set(e||[]),l=function(s,i){const a=s.getAttribute(i);return a!==null&&r.has(a)?a:t};return E.set(o,l),l}function H(e,t,o){const r=parseFloat(e.getAttribute(t));return isNaN(r)?o:r}function K(e,t,o){const r=e.getAttribute(t);if(!r)return o;try{return JSON.parse(r)}catch{return o}}function P(e,t,o,r,l){if(!e||t===null)return!0;const s=r||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const a=n=>{l?console.warn(n,l):console.warn(n)};if(i==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(a(`[${s}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const n=e.values||[];return n.includes(t)?!0:(a(`[${s}] Invalid value "${t}" for attribute "${o}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(a(`[${s}] Value ${n} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(a(`[${s}] Value ${n} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(n){return a(`[${s}] Invalid JSON for attribute "${o}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function we(e,t,o){for(const r in o){const[l,s,i]=o[r];Object.defineProperty(e,r,{get:function(){return l(t,s,i)},enumerable:!0,configurable:!0})}return e}function pe(e){const t={};for(const o in e){const r=e[o];if(!r||!r.prop)continue;let l=r.read;if(!l&&r.type)switch(r.type){case"enum":l=U(r.values,r.fallback);break;case"integer":l=V;break;case"float":l=H;break;case"boolean":l=j;break;case"list":l=W;break;case"json":l=K;break;case"string":default:l=k;break}l||(l=k),t[r.prop]=[l,o,r.fallback]}return t}function be(e){const t={};for(const o in e){const r=e[o];r&&r.effect&&(t[o]=r.effect)}return Object.keys(t).length?t:null}function me(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=we,window.lnCore.attrSpec=pe,window.lnCore.attrStr=k,window.lnCore.attrInt=V,window.lnCore.attrBool=j,window.lnCore.attrList=W,window.lnCore.attrEnum=U,window.lnCore.attrFloat=H,window.lnCore.attrJson=K);function C(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 Q(e,t,o,r){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:o,ComponentFn:r};if(e.matches&&e.matches(s)&&C(e,i),e.querySelectorAll){const a=e.querySelectorAll(s);for(let n=0;n<a.length;n++)C(a[n],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ge(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ce(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 G(){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 ye(e){const t=G(),o=e.observed||[];for(let r=0;r<o.length;r++){const l=o[r];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const l=t.byDeclaredAttr.get(r);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=me(e);if(r===null)t.reactiveWildcard.push(e);else for(const l of r)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function J(e,t,o,r){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const i=s.effects&&s.effects[o];i?i(t,o,r):s.onAttrChange&&(!s.declared||s.declared.has(o))&&s.onAttrChange(t,o,r)}}function ve(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,r=G(),l=r.byAttr.get(t),s=N()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!o&&!l&&!s)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(s&&A(i)){const a=r.byDeclaredAttr.get(t),n=i.getAttribute(t);for(let c=0;c<a.length;c++)P(a[c].spec,n,t,a[c].componentTag,i)}if(window.lnCore._debugSink&&(o||l)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),o){const a=r.byReactive.get(t);a&&J(a,i,t,e.oldValue),r.reactiveWildcard.length&&J(r.reactiveWildcard,i,t,e.oldValue)}if(l)for(let a=0;a<l.length;a++){const n=l[a];if(n.handler){n.handler(i,t,e.oldValue);continue}n.onAttributeChange&&i[n.attribute]?n.onAttributeChange(i,t):(Q(i,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(i))}}}function _e(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,v(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{ve(t[o])}catch(r){console.error("[ln-core] mutation handler failed",t[o].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function L(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function O(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Ae(e){const t=L();if(t.length){if(e.target)for(let o=0;o<t.length;o++){const r=t[o];if(r.onSubtreeChange&&r.query){const l=r.query,s=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;s&&r.onSubtreeChange(s,e)}}for(let o=0;o<e.addedNodes.length;o++){const r=e.addedNodes[o];if(r.nodeType===1){const l=!!(r.firstElementChild||r.children&&r.children.length);for(let s=0;s<t.length;s++){const i=t[s];if(i.selector&&i.attribute&&i.ComponentFn){if(!l)r.matches&&r.matches(i.query)&&C(r,i);else if(r.matches&&r.matches(i.query)&&C(r,i),r.querySelectorAll){const a=r.querySelectorAll(i.query);for(let n=0;n<a.length;n++)C(a[n],i)}}i.onInit&&i.onInit(r)}}}for(let o=0;o<e.removedNodes.length;o++){const r=e.removedNodes[o];if(r.nodeType===1){const l=!!(r.firstElementChild||r.children&&r.children.length);for(let s=0;s<t.length;s++){const i=t[s],a=i.query;if(a){if(!l)r.matches&&r.matches(a)&&O(r,i);else if(r.matches&&r.matches(a)&&O(r,i),r.querySelectorAll){const n=r.querySelectorAll(a);for(let c=0;c<n.length;c++)O(n[c],i)}}}}}}}function z(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,v(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const r=t[o];if(r.type==="childList")try{Ae(r)}catch(l){console.error("[ln-core] lifecycle handler failed",r.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Se(e){L().push(e),z()}function X(e,t,o,r,l={}){const s=l.extraAttributes||[],i=l.onAttributeChange||null,a=l.onSubtreeChange||null,n=l.onInit||null,c=l.onAttrChange||null,d=l.effects||null,u=l.attributes||null,w=u?be(u):d,m=u?new Set(Object.keys(u)):null,p=l.persist||null;function f(D){const g=D||document.body;if(Q(g,e,t,o),u&&N())for(const y in u){const Te=u[y],I=Array.from(g.querySelectorAll("["+y+"]"));g.matches&&g.matches("["+y+"]")&&I.push(g);for(let R=0;R<I.length;R++){const F=I[R];A(F)&&P(Te,F.getAttribute(y),y,r,F)}}n&&n(g)}const h=[];if(e.indexOf("[")!==-1){const D=/\[([\w-]+)/g;let g;for(;(g=D.exec(e))!==null;)h.push(g[1])}else h.push(e);ye({selector:e,attribute:t,componentTag:r,attributes:u,ComponentFn:o,onInit:n,observed:h.concat(s),onAttributeChange:i,onAttrChange:c,effects:w,declared:m,persist:p}),_e();const b=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,_=l.subtreeQuery||(b?e:"["+e+"]");L().push({selector:e,attribute:t,ComponentFn:o,onInit:n,onSubtreeChange:a,query:_}),z(),window[t]=f,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=X,window.lnCore.observeLifecycle=Se);function te(){ge()>0?Ce(function(){f(document.body)}):f(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",te):te(),f}function Y(e){return(e||"").replace(/^#/,"")}function q(e){const t=e===void 0?location.hash:e,o={},r=Y(t);if(!r)return o;const l=r.split("&");for(let s=0;s<l.length;s++){const i=l[s];if(!i)continue;const a=i.indexOf(":"),n=a>-1?i.slice(0,a):i,c=a>-1?i.slice(a+1):"";if(n)try{o[n]=decodeURIComponent(c)}catch{o[n]=c}}return o}function xe(e){if(!e)return null;const t=q();return e in t?t[e]:null}function ke(e,t){if(!e)return;const o=q();t==null?delete o[e]:o[e]=String(t);const l=Object.keys(o).map(function(s){const i=o[s];return i===""?s:s+":"+encodeURIComponent(i)}).join("&");Y(location.hash)!==l&&(location.hash=l)}function Ee(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Le(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 r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function Oe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function qe(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 De(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),r=e.slice(t+1),l=r?r.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:o,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=q,window.lnCore.hashGet=xe,window.lnCore.hashSet=ke,window.lnCore.hashLinkClick=Ee,window.lnCore.resolveHashNamespace=Le,window.lnCore.hashSortEncode=Oe,window.lnCore.hashSortDecode=qe,window.lnCore.hashFilterEncode=De,window.lnCore.hashFilterDecode=Ie);function Re(){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=Re);const Z={required:"valueMissing",typeMismatch:"typeMismatch",tooShort:"tooShort",tooLong:"tooLong",patternMismatch:"patternMismatch",rangeUnderflow:"rangeUnderflow",rangeOverflow:"rangeOverflow"};function ee(e,t=0){return e?!!(e.valid&&t===0):t===0}function Fe(e){return e.type==="checkbox"||e.type==="radio"?!!e.checked:!!(e.value&&e.value.trim()!=="")}function Ne(e,t){const o=[];if(e){const r=Object.keys(Z);for(let l=0;l<r.length;l++){const s=r[l],i=Z[s];e[i]&&o.push(s)}}if(t){const r=Array.from(t);for(let l=0;l<r.length;l++)r[l]&&o.indexOf(r[l])===-1&&o.push(r[l])}return o}(function(){const e="data-ln-validate",t="lnValidate",o="data-ln-validate-errors",r="data-ln-validate-error",l="ln-validate-valid",s="ln-validate-invalid";if(window[t]!==void 0)return;const i={"data-ln-validate":{type:"marker",description:"Activates validation on form input or field"},"data-ln-validate-errors":{type:"marker",description:"Container element holding validation error message elements"},"data-ln-validate-error":{type:"string",description:"Identifies error message template for a specific validation rule"}};function a(n){this.dom=n,this._touched=!1,this._customErrors=new Set;const c=this,d=n.tagName,u=n.type,w=d==="SELECT"||u==="checkbox"||u==="radio";this._onInput=function(){c._touched=!0,c.validate()},this._onChange=function(){c._touched=!0,c.validate()},this._onSetCustom=function(p){const f=p.detail&&p.detail.error;if(!f)return;c._customErrors.add(f),c._touched=!0;const h=n.closest(".form-element");if(h){const b=h.querySelector("["+r+'="'+f+'"]');b&&b.classList.remove("hidden")}n.classList.remove(l),n.classList.add(s),n.setAttribute("aria-invalid","true")},this._onClearCustom=function(p){const f=p.detail&&p.detail.error,h=n.closest(".form-element");if(f){if(c._customErrors.delete(f),h){const b=h.querySelector("["+r+'="'+f+'"]');b&&b.classList.add("hidden")}}else c._customErrors.forEach(function(b){if(h){const _=h.querySelector("["+r+'="'+b+'"]');_&&_.classList.add("hidden")}}),c._customErrors.clear();c._touched&&c.validate()},w||n.addEventListener("input",this._onInput),n.addEventListener("change",this._onChange),n.addEventListener("ln-validate:set-custom",this._onSetCustom),n.addEventListener("ln-validate:clear-custom",this._onClearCustom);const m=n.form;return m&&(m.hasAttribute("novalidate")||m.setAttribute("novalidate",""),this._onFormReset=function(){c.reset()},this._onValidateRequest=function(p){c._touched=!0,!c.validate()&&p.detail&&p.detail.invalidFields&&p.detail.invalidFields.push(c.dom)},m.addEventListener("reset",this._onFormReset),m.addEventListener("ln-validate:request-validate",this._onValidateRequest),m._lnValidateGateBound||(m._lnValidateGateBound=!0,m.addEventListener("submit",function(p){const f={invalidFields:[]};S(m,"ln-validate:request-validate",f),f.invalidFields.length>0&&(p.preventDefault(),f.invalidFields.sort((h,b)=>h.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_PRECEDING?-1:1),f.invalidFields[0].focus())}))),Fe(n)&&(this._touched=!0,this.validate()),this}a.prototype.validate=function(){const n=this.dom,c=n.validity,d=ee(c,this._customErrors.size),u=Ne(c,this._customErrors),w=n.closest(".form-element");if(w){const p=w.querySelector("["+o+"]");if(p){const f=p.querySelectorAll("["+r+"]");for(let h=0;h<f.length;h++){const b=f[h].getAttribute(r);f[h].classList.toggle("hidden",!u.includes(b))}}}return n.classList.toggle(l,d),n.classList.toggle(s,!d),n.setAttribute("aria-invalid",d?"false":"true"),S(n,d?"ln-validate:valid":"ln-validate:invalid",{target:n,field:n.name,errors:u}),d},a.prototype.reset=function(){this._touched=!1,this._customErrors.clear(),this.dom.classList.remove(l,s),this.dom.removeAttribute("aria-invalid");const n=this.dom.closest(".form-element");if(n){const c=n.querySelectorAll("["+r+"]");for(let d=0;d<c.length;d++)c[d].classList.add("hidden")}},Object.defineProperty(a.prototype,"isValid",{get:function(){return ee(this.dom.validity,this._customErrors.size)}}),a.prototype.destroy=function(){if(!this.dom[t])return;this.dom.removeEventListener("input",this._onInput),this.dom.removeEventListener("change",this._onChange),this.dom.removeEventListener("ln-validate:set-custom",this._onSetCustom),this.dom.removeEventListener("ln-validate:clear-custom",this._onClearCustom);const n=this.dom.form;n&&(this._onFormReset&&n.removeEventListener("reset",this._onFormReset),this._onValidateRequest&&n.removeEventListener("ln-validate:request-validate",this._onValidateRequest)),this.dom.classList.remove(l,s),this.dom.removeAttribute("aria-invalid"),delete this.dom[t]},X(e,t,a,"ln-validate",{attributes:i})})()})();
|
|
1
|
+
(function(){"use strict";function T(){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 A(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let r=1;r<t.length;r++)if(t[r]&&t[r].nodeType===1){o=t[r];break}if(!A(o))return}e.apply(console,t)}}function S(e,t,i){const o=i||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function v(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){v(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ne(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function re(e,t){const i=!!(t&&t.typed),o=t&&t.exclude,r={},a=e.elements,l={};if(i)for(let s=0;s<a.length;s++){const n=a[s];n.name&&n.type==="checkbox"&&!n.disabled&&(l[n.name]=(l[n.name]||0)+1)}for(let s=0;s<a.length;s++){const n=a[s];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(o&&n.matches&&n.matches(o)))if(n.type==="checkbox")i&&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 c=0;c<n.options.length;c++)n.options[c].selected&&r[n.name].push(n.options[c].value)}else if(i&&n.type==="hidden")r[n.name]=n.value;else if(i&&(n.type==="number"||n.type==="range")){const c=Number(n.value);r[n.name]=n.value===""||isNaN(c)?null:c}else r[n.name]=n.value}return r}function oe(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ie(e,t){const i=e.elements,o=[],r={};for(let a=0;a<i.length;a++){const l=i[a];l.name&&l.type==="checkbox"&&(r[l.name]=(r[l.name]||0)+1)}for(let a=0;a<i.length;a++){const l=i[a];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const s=l.getAttribute("data-ln-fill-as")||l.name;if(!s||!(s in t))continue;const n=t[s];if(l.type==="checkbox"){if(Array.isArray(n))l.checked=n.indexOf(l.value)!==-1;else if(r[l.name]>1){const c=String(n).split(",").map(function(d){return d.trim()});l.checked=c.indexOf(l.value)!==-1}else l.checked=oe(n);o.push(l)}else if(l.type==="radio")l.checked=l.value===String(n),o.push(l);else if(l.type==="select-multiple"){if(Array.isArray(n))for(let c=0;c<l.options.length;c++)l.options[c].selected=n.indexOf(l.options[c].value)!==-1;o.push(l)}else l.value=n,l.tagName==="SELECT"&&n!=null&&l.setAttribute("data-ln-value",n),o.push(l)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ie,window.lnCore.serializeForm=re,window.lnCore.resolveFormMethod=ne);const N={};function le(e,t){N[e]=t}function se(e){return N[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=le,window.lnCore.getDataMapper=se);function ae(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,v(function(){new MutationObserver(function(){S(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const M={};function ce(e,t){if(!e||typeof t!="object")return;const i=e.toLowerCase().split("-")[0];M[i]=t}function de(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return M[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ce,window.lnCore.getLocaleFallback=de,window.lnCore.ensureLocaleObserver=ae);const x={};function ue(e,t){x[e]||(x[e]=document.querySelector('[data-ln-template="'+e+'"]'));const i=x[e];return i?i.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function $(e,t){if(!e||!t)return e;const i=e.querySelectorAll("[data-ln-field]");for(let l=0;l<i.length;l++){const s=i[l],n=s.getAttribute("data-ln-field");t[n]!=null&&(s.textContent=t[n])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const s=o[l],n=s.getAttribute("data-ln-attr").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),w=d[1].trim();t[w]!=null&&s.setAttribute(u,t[w])}}const r=e.querySelectorAll("[data-ln-show]");for(let l=0;l<r.length;l++){const s=r[l],n=s.getAttribute("data-ln-show");n in t&&s.classList.toggle("hidden",!t[n])}const a=e.querySelectorAll("[data-ln-class]");for(let l=0;l<a.length;l++){const s=a[l],n=s.getAttribute("data-ln-class").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),w=d[1].trim();w in t&&s.classList.toggle(u,!!t[w])}}return e}function fe(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 i=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<i.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",i[o],t??null),i[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)$(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let i=0;i<t.length;i++)t[i].textContent=""}})));function B(e,t){if(!e||!t)return e;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;i.nextNode();){const a=i.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,s){return t[s]!==void 0?t[s]:""}))}const o=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],s=l.attributes;for(let n=0;n<s.length;n++){const c=s[n];c.value.indexOf("{{")!==-1&&l.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function he(e,t,i,o,r,a){const l={};for(let n=0;n<e.children.length;n++){const c=e.children[n],d=c.getAttribute("data-ln-render-key");d&&(l[d]=c)}const s=document.createDocumentFragment();for(let n=0;n<t.length;n++){const c=t[n],d=String(o(c));let u=l[d];if(u)r(u,c,n);else{const w=ue(i,a);if(!w||(B(w,c),u=w.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),r(u,c,n)}s.appendChild(u)}e.textContent="",e.appendChild(s)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=B,window.lnCore.fill=$,window.lnCore.lnFill=fe,window.lnCore.renderList=he);function E(e,t,i){const o=e.getAttribute(t);return o===null?i:o}function V(e,t,i){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?i:o}function j(e,t,i=!1){const o=e.getAttribute(t);if(o===null)return!!i;const r=o.trim().toLowerCase();return!(r==="false"||r==="0")}function W(e,t){return(e.getAttribute(t)||"").split(",").map(i=>i.trim()).filter(Boolean)}const k=new Map;function U(e,t){const i=(e?e.join("|"):"")+"::"+t;if(k.has(i))return k.get(i);const o=new Set(e||[]),r=function(a,l){const s=a.getAttribute(l);return s!==null&&o.has(s)?s:t};return k.set(i,r),r}function H(e,t,i){const o=parseFloat(e.getAttribute(t));return isNaN(o)?i:o}function K(e,t,i){const o=e.getAttribute(t);if(!o)return i;try{return JSON.parse(o)}catch{return i}}function P(e,t,i,o,r){if(!e||t===null)return!0;const a=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const s=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"?(s(`[${a}] Invalid value "${t}" for boolean attribute "${i}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const n=e.values||[];return n.includes(t)?!0:(s(`[${a}] Invalid value "${t}" for attribute "${i}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return s(`[${a}] Invalid integer "${t}" for attribute "${i}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(s(`[${a}] Value ${n} for attribute "${i}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(s(`[${a}] Value ${n} for attribute "${i}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(s(`[${a}] Invalid float "${t}" for attribute "${i}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(n){return s(`[${a}] Invalid JSON for attribute "${i}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function we(e,t,i){for(const o in i){const[r,a,l]=i[o];Object.defineProperty(e,o,{get:function(){return r(t,a,l)},enumerable:!0,configurable:!0})}return e}function pe(e){const t={};for(const i in e){const o=e[i];if(!o||!o.prop)continue;let r=o.read;if(!r&&o.type)switch(o.type){case"enum":r=U(o.values,o.fallback);break;case"integer":r=V;break;case"float":r=H;break;case"boolean":r=j;break;case"list":r=W;break;case"json":r=K;break;case"string":default:r=E;break}r||(r=E),t[o.prop]=[r,i,o.fallback]}return t}function be(e){const t={};for(const i in e){const o=e[i];o&&o.effect&&(t[i]=o.effect)}return Object.keys(t).length?t:null}function me(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const i in e.effects)t.add(i);if(e.onAttrChange&&e.declared)for(const i of e.declared)t.add(i);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=we,window.lnCore.attrSpec=pe,window.lnCore.attrStr=E,window.lnCore.attrInt=V,window.lnCore.attrBool=j,window.lnCore.attrList=W,window.lnCore.attrEnum=U,window.lnCore.attrFloat=H,window.lnCore.attrJson=K);function C(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(i){console.error("["+t.attribute+"] init failed",e,i)}}}function Q(e,t,i,o){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:i,ComponentFn:o};if(e.matches&&e.matches(a)&&C(e,l),e.querySelectorAll){const s=e.querySelectorAll(a);for(let n=0;n<s.length;n++)C(s[n],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ge(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ce(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 G(){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 ye(e){const t=G(),i=e.observed||[];for(let o=0;o<i.length;o++){const r=i[o];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 o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const r=t.byDeclaredAttr.get(o);r.some(a=>a.componentTag===e.componentTag)||r.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=me(e);if(o===null)t.reactiveWildcard.push(e);else for(const r of o)t.byReactive.has(r)||t.byReactive.set(r,[]),t.byReactive.get(r).push(e)}e.persist&&t.persist.push(e)}function J(e,t,i,o){for(let r=0;r<e.length;r++){const a=e[r];if(!t[a.attribute])continue;const l=a.effects&&a.effects[i];l?l(t,i,o):a.onAttrChange&&(!a.declared||a.declared.has(i))&&a.onAttrChange(t,i,o)}}function ve(e){const t=e.attributeName,i=t.indexOf("data-ln-")===0,o=G(),r=o.byAttr.get(t),a=T()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(t);if(!i&&!r&&!a)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(a&&A(l)){const s=o.byDeclaredAttr.get(t),n=l.getAttribute(t);for(let c=0;c<s.length;c++)P(s[c].spec,n,t,s[c].componentTag,l)}if(window.lnCore._debugSink&&(i||r)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),i){const s=o.byReactive.get(t);s&&J(s,l,t,e.oldValue),o.reactiveWildcard.length&&J(o.reactiveWildcard,l,t,e.oldValue)}if(r)for(let s=0;s<r.length;s++){const n=r[s];if(n.handler){n.handler(l,t,e.oldValue);continue}n.onAttributeChange&&l[n.attribute]?n.onAttributeChange(l,t):(Q(l,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(l))}}}function _e(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,v(function(){new MutationObserver(function(t){for(let i=0;i<t.length;i++)try{ve(t[i])}catch(o){console.error("[ln-core] mutation handler failed",t[i].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function L(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function O(e,t){if(!document.contains(e))if(t.attribute){const i=e[t.attribute];if(i&&typeof i.destroy=="function")try{i.destroy()}catch(o){console.error("["+t.attribute+"] destroy failed",e,o)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Ae(e){const t=L();if(!t.length)return;const i=e.target;if(i){const o=i.nodeType===1?i:i.parentElement;if(o&&(o.isContentEditable||o.closest&&o.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let o=0;o<t.length;o++){const r=t[o];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 o=0;o<e.addedNodes.length;o++){const r=e.addedNodes[o];if(r.nodeType===1){const a=!!(r.firstElementChild||r.children&&r.children.length);for(let l=0;l<t.length;l++){const s=t[l];if(s.selector&&s.attribute&&s.ComponentFn){if(!a)r.matches&&r.matches(s.query)&&C(r,s);else if(r.matches&&r.matches(s.query)&&C(r,s),r.querySelectorAll){const n=r.querySelectorAll(s.query);for(let c=0;c<n.length;c++)C(n[c],s)}}s.onInit&&s.onInit(r)}}}for(let o=0;o<e.removedNodes.length;o++){const r=e.removedNodes[o];if(r.nodeType===1){const a=!!(r.firstElementChild||r.children&&r.children.length);for(let l=0;l<t.length;l++){const s=t[l],n=s.query;if(n){if(!a)r.matches&&r.matches(n)&&O(r,s);else if(r.matches&&r.matches(n)&&O(r,s),r.querySelectorAll){const c=r.querySelectorAll(n);for(let d=0;d<c.length;d++)O(c[d],s)}}}}}}function z(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,v(function(){new MutationObserver(function(t){for(let i=0;i<t.length;i++){const o=t[i];if(o.type==="childList")try{Ae(o)}catch(r){console.error("[ln-core] lifecycle handler failed",o.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Se(e){L().push(e),z()}function X(e,t,i,o,r={}){const a=r.extraAttributes||[],l=r.onAttributeChange||null,s=r.onSubtreeChange||null,n=r.onInit||null,c=r.onAttrChange||null,d=r.effects||null,u=r.attributes||null,w=u?be(u):d,m=u?new Set(Object.keys(u)):null,p=r.persist||null;function f(D){const g=D||document.body;if(Q(g,e,t,i),u&&T())for(const y in u){const Ne=u[y],I=Array.from(g.querySelectorAll("["+y+"]"));g.matches&&g.matches("["+y+"]")&&I.push(g);for(let R=0;R<I.length;R++){const F=I[R];A(F)&&P(Ne,F.getAttribute(y),y,o,F)}}n&&n(g)}const h=[];if(e.indexOf("[")!==-1){const D=/\[([\w-]+)/g;let g;for(;(g=D.exec(e))!==null;)h.push(g[1])}else h.push(e);ye({selector:e,attribute:t,componentTag:o,attributes:u,ComponentFn:i,onInit:n,observed:h.concat(a),onAttributeChange:l,onAttrChange:c,effects:w,declared:m,persist:p}),_e();const b=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,_=r.subtreeQuery||(b?e:"["+e+"]");L().push({selector:e,attribute:t,ComponentFn:i,onInit:n,onSubtreeChange:s,query:_}),z(),window[t]=f,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=X,window.lnCore.observeLifecycle=Se);function te(){ge()>0?Ce(function(){f(document.body)}):f(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",te):te(),f}function Y(e){return(e||"").replace(/^#/,"")}function q(e){const t=e===void 0?location.hash:e,i={},o=Y(t);if(!o)return i;const r=o.split("&");for(let a=0;a<r.length;a++){const l=r[a];if(!l)continue;const s=l.indexOf(":"),n=s>-1?l.slice(0,s):l,c=s>-1?l.slice(s+1):"";if(n)try{i[n]=decodeURIComponent(c)}catch{i[n]=c}}return i}function xe(e){if(!e)return null;const t=q();return e in t?t[e]:null}function Ee(e,t){if(!e)return;const i=q();t==null?delete i[e]:i[e]=String(t);const r=Object.keys(i).map(function(a){const l=i[a];return l===""?a:a+":"+encodeURIComponent(l)}).join("&");Y(location.hash)!==r&&(location.hash=r)}function ke(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Le(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const i=e.getAttribute("data-ln-hash");if(i&&i.trim()!=="")return i.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function Oe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function qe(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 De(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 i=e.slice(0,t),o=e.slice(t+1),r=o?o.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:i,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=q,window.lnCore.hashGet=xe,window.lnCore.hashSet=Ee,window.lnCore.hashLinkClick=ke,window.lnCore.resolveHashNamespace=Le,window.lnCore.hashSortEncode=Oe,window.lnCore.hashSortDecode=qe,window.lnCore.hashFilterEncode=De,window.lnCore.hashFilterDecode=Ie);function Re(){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=Re);const Z={required:"valueMissing",typeMismatch:"typeMismatch",tooShort:"tooShort",tooLong:"tooLong",patternMismatch:"patternMismatch",rangeUnderflow:"rangeUnderflow",rangeOverflow:"rangeOverflow"};function ee(e,t=0){return e?!!(e.valid&&t===0):t===0}function Fe(e){return e.type==="checkbox"||e.type==="radio"?!!e.checked:!!(e.value&&e.value.trim()!=="")}function Te(e,t){const i=[];if(e){const o=Object.keys(Z);for(let r=0;r<o.length;r++){const a=o[r],l=Z[a];e[l]&&i.push(a)}}if(t){const o=Array.from(t);for(let r=0;r<o.length;r++)o[r]&&i.indexOf(o[r])===-1&&i.push(o[r])}return i}(function(){const e="data-ln-validate",t="lnValidate",i="data-ln-validate-errors",o="data-ln-validate-error",r="ln-validate-valid",a="ln-validate-invalid";if(window[t]!==void 0)return;const l={"data-ln-validate":{type:"marker",description:"Activates validation on form input or field"},"data-ln-validate-errors":{type:"marker",description:"Container element holding validation error message elements"},"data-ln-validate-error":{type:"string",description:"Identifies error message template for a specific validation rule"}};function s(n){this.dom=n,this._touched=!1,this._customErrors=new Set;const c=this,d=n.tagName,u=n.type,w=d==="SELECT"||u==="checkbox"||u==="radio";this._onInput=function(){c._touched=!0,c.validate()},this._onChange=function(){c._touched=!0,c.validate()},this._onSetCustom=function(p){const f=p.detail&&p.detail.error;if(!f)return;c._customErrors.add(f),c._touched=!0;const h=n.closest(".form-element");if(h){const b=h.querySelector("["+o+'="'+f+'"]');b&&b.classList.remove("hidden")}n.classList.remove(r),n.classList.add(a),n.setAttribute("aria-invalid","true")},this._onClearCustom=function(p){const f=p.detail&&p.detail.error,h=n.closest(".form-element");if(f){if(c._customErrors.delete(f),h){const b=h.querySelector("["+o+'="'+f+'"]');b&&b.classList.add("hidden")}}else c._customErrors.forEach(function(b){if(h){const _=h.querySelector("["+o+'="'+b+'"]');_&&_.classList.add("hidden")}}),c._customErrors.clear();c._touched&&c.validate()},w||n.addEventListener("input",this._onInput),n.addEventListener("change",this._onChange),n.addEventListener("ln-validate:set-custom",this._onSetCustom),n.addEventListener("ln-validate:clear-custom",this._onClearCustom);const m=n.form;return m&&(m.hasAttribute("novalidate")||m.setAttribute("novalidate",""),this._onFormReset=function(){c.reset()},this._onValidateRequest=function(p){c._touched=!0,!c.validate()&&p.detail&&p.detail.invalidFields&&p.detail.invalidFields.push(c.dom)},m.addEventListener("reset",this._onFormReset),m.addEventListener("ln-validate:request-validate",this._onValidateRequest),m._lnValidateGateBound||(m._lnValidateGateBound=!0,m.addEventListener("submit",function(p){const f={invalidFields:[]};S(m,"ln-validate:request-validate",f),f.invalidFields.length>0&&(p.preventDefault(),f.invalidFields.sort((h,b)=>h.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_PRECEDING?-1:1),f.invalidFields[0].focus())}))),Fe(n)&&(this._touched=!0,this.validate()),this}s.prototype.validate=function(){const n=this.dom,c=n.validity,d=ee(c,this._customErrors.size),u=Te(c,this._customErrors),w=n.closest(".form-element");if(w){const p=w.querySelector("["+i+"]");if(p){const f=p.querySelectorAll("["+o+"]");for(let h=0;h<f.length;h++){const b=f[h].getAttribute(o);f[h].classList.toggle("hidden",!u.includes(b))}}}return n.classList.toggle(r,d),n.classList.toggle(a,!d),n.setAttribute("aria-invalid",d?"false":"true"),S(n,d?"ln-validate:valid":"ln-validate:invalid",{target:n,field:n.name,errors:u}),d},s.prototype.reset=function(){this._touched=!1,this._customErrors.clear(),this.dom.classList.remove(r,a),this.dom.removeAttribute("aria-invalid");const n=this.dom.closest(".form-element");if(n){const c=n.querySelectorAll("["+o+"]");for(let d=0;d<c.length;d++)c[d].classList.add("hidden")}},Object.defineProperty(s.prototype,"isValid",{get:function(){return ee(this.dom.validity,this._customErrors.size)}}),s.prototype.destroy=function(){if(!this.dom[t])return;this.dom.removeEventListener("input",this._onInput),this.dom.removeEventListener("change",this._onChange),this.dom.removeEventListener("ln-validate:set-custom",this._onSetCustom),this.dom.removeEventListener("ln-validate:clear-custom",this._onClearCustom);const n=this.dom.form;n&&(this._onFormReset&&n.removeEventListener("reset",this._onFormReset),this._onValidateRequest&&n.removeEventListener("ln-validate:request-validate",this._onValidateRequest)),this.dom.classList.remove(r,a),this.dom.removeAttribute("aria-invalid"),delete this.dom[t]},X(e,t,s,"ln-validate",{attributes:l})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function M(){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 S(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 n=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){n=t[s];break}if(!S(n))return}e.apply(console,t)}}function m(e,t,o){const n=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,n),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ne(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function oe(e,t){const o=!!(t&&t.typed),n=t&&t.exclude,s={},l=e.elements,i={};if(o)for(let c=0;c<l.length;c++){const r=l[c];r.name&&r.type==="checkbox"&&!r.disabled&&(i[r.name]=(i[r.name]||0)+1)}for(let c=0;c<l.length;c++){const r=l[c];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(n&&r.matches&&r.matches(n)))if(r.type==="checkbox")o&&i[r.name]===1?s[r.name]=r.checked:(s[r.name]||(s[r.name]=[]),r.checked&&s[r.name].push(r.value));else if(r.type==="radio")r.checked&&(s[r.name]=r.value);else if(r.type==="select-multiple"){s[r.name]=[];for(let u=0;u<r.options.length;u++)r.options[u].selected&&s[r.name].push(r.options[u].value)}else if(o&&r.type==="hidden")s[r.name]=r.value;else if(o&&(r.type==="number"||r.type==="range")){const u=Number(r.value);s[r.name]=r.value===""||isNaN(u)?null:u}else s[r.name]=r.value}return s}function re(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ie(e,t){const o=e.elements,n=[],s={};for(let l=0;l<o.length;l++){const i=o[l];i.name&&i.type==="checkbox"&&(s[i.name]=(s[i.name]||0)+1)}for(let l=0;l<o.length;l++){const i=o[l];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const c=i.getAttribute("data-ln-fill-as")||i.name;if(!c||!(c in t))continue;const r=t[c];if(i.type==="checkbox"){if(Array.isArray(r))i.checked=r.indexOf(i.value)!==-1;else if(s[i.name]>1){const u=String(r).split(",").map(function(b){return b.trim()});i.checked=u.indexOf(i.value)!==-1}else i.checked=re(r);n.push(i)}else if(i.type==="radio")i.checked=i.value===String(r),n.push(i);else if(i.type==="select-multiple"){if(Array.isArray(r))for(let u=0;u<i.options.length;u++)i.options[u].selected=r.indexOf(i.options[u].value)!==-1;n.push(i)}else i.value=r,i.tagName==="SELECT"&&r!=null&&i.setAttribute("data-ln-value",r),n.push(i)}return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ie,window.lnCore.serializeForm=oe,window.lnCore.resolveFormMethod=ne);const F={};function se(e,t){F[e]=t}function le(e){return F[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=se,window.lnCore.getDataMapper=le);function ce(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){m(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function ae(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];$[o]=t}function de(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ae,window.lnCore.getLocaleFallback=de,window.lnCore.ensureLocaleObserver=ce);const q={};function ue(e,t){q[e]||(q[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=q[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function B(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let i=0;i<o.length;i++){const c=o[i],r=c.getAttribute("data-ln-field");t[r]!=null&&(c.textContent=t[r])}const n=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<n.length;i++){const c=n[i],r=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<r.length;u++){const b=r[u].trim().split(":");if(b.length!==2)continue;const f=b[0].trim(),a=b[1].trim();t[a]!=null&&c.setAttribute(f,t[a])}}const s=e.querySelectorAll("[data-ln-show]");for(let i=0;i<s.length;i++){const c=s[i],r=c.getAttribute("data-ln-show");r in t&&c.classList.toggle("hidden",!t[r])}const l=e.querySelectorAll("[data-ln-class]");for(let i=0;i<l.length;i++){const c=l[i],r=c.getAttribute("data-ln-class").split(",");for(let u=0;u<r.length;u++){const b=r[u].trim().split(":");if(b.length!==2)continue;const f=b[0].trim(),a=b[1].trim();a in t&&c.classList.toggle(f,!!t[a])}}return e}function fe(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 n=0;n<o.length;n++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[n],t??null),o[n].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)B(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let 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 l=o.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,c){return t[c]!==void 0?t[c]:""}))}const n=function(l,i){return t[i]!==void 0?t[i]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let l=0;l<s.length;l++){const i=s[l],c=i.attributes;for(let r=0;r<c.length;r++){const u=c[r];u.value.indexOf("{{")!==-1&&i.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,n))}}return e}function he(e,t,o,n,s,l){const i={};for(let r=0;r<e.children.length;r++){const u=e.children[r],b=u.getAttribute("data-ln-render-key");b&&(i[b]=u)}const c=document.createDocumentFragment();for(let r=0;r<t.length;r++){const u=t[r],b=String(n(u));let f=i[b];if(f)s(f,u,r);else{const a=ue(o,l);if(!a||(j(a,u),f=a.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",b),s(f,u,r)}c.appendChild(f)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=j,window.lnCore.fill=B,window.lnCore.lnFill=fe,window.lnCore.renderList=he);function v(e,t,o){const n=e.getAttribute(t);return n===null?o:n}function W(e,t,o){const n=parseInt(e.getAttribute(t),10);return isNaN(n)?o:n}function U(e,t,o=!1){const n=e.getAttribute(t);if(n===null)return!!o;const s=n.trim().toLowerCase();return!(s==="false"||s==="0")}function K(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const O=new Map;function V(e,t){const o=(e?e.join("|"):"")+"::"+t;if(O.has(o))return O.get(o);const n=new Set(e||[]),s=function(l,i){const c=l.getAttribute(i);return c!==null&&n.has(c)?c:t};return O.set(o,s),s}function H(e,t,o){const n=parseFloat(e.getAttribute(t));return isNaN(n)?o:n}function J(e,t,o){const n=e.getAttribute(t);if(!n)return o;try{return JSON.parse(n)}catch{return o}}function Q(e,t,o,n,s){if(!e||t===null)return!0;const l=n||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const c=r=>{s?console.warn(r,s):console.warn(r)};if(i==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(c(`[${l}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const r=e.values||[];return r.includes(t)?!0:(c(`[${l}] Invalid value "${t}" for attribute "${o}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return c(`[${l}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(c(`[${l}] Value ${r} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(c(`[${l}] Value ${r} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(c(`[${l}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(r){return c(`[${l}] Invalid JSON for attribute "${o}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function P(e,t,o){for(const n in o){const[s,l,i]=o[n];Object.defineProperty(e,n,{get:function(){return s(t,l,i)},enumerable:!0,configurable:!0})}return e}function G(e){const t={};for(const o in e){const n=e[o];if(!n||!n.prop)continue;let s=n.read;if(!s&&n.type)switch(n.type){case"enum":s=V(n.values,n.fallback);break;case"integer":s=W;break;case"float":s=H;break;case"boolean":s=U;break;case"list":s=K;break;case"json":s=J;break;case"string":default:s=v;break}s||(s=v),t[n.prop]=[s,o,n.fallback]}return t}function we(e){const t={};for(const o in e){const n=e[o];n&&n.effect&&(t[o]=n.effect)}return Object.keys(t).length?t:null}function pe(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=P,window.lnCore.attrSpec=G,window.lnCore.attrStr=v,window.lnCore.attrInt=W,window.lnCore.attrBool=U,window.lnCore.attrList=K,window.lnCore.attrEnum=V,window.lnCore.attrFloat=H,window.lnCore.attrJson=J);function _(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,n){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:o,ComponentFn:n};if(e.matches&&e.matches(l)&&_(e,i),e.querySelectorAll){const c=e.querySelectorAll(l);for(let r=0;r<c.length;r++)_(c[r],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function be(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function me(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 X(){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 ge(e){const t=X(),o=e.observed||[];for(let n=0;n<o.length;n++){const s=o[n];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 n in e.attributes){t.byDeclaredAttr.has(n)||t.byDeclaredAttr.set(n,[]);const s=t.byDeclaredAttr.get(n);s.some(l=>l.componentTag===e.componentTag)||s.push({spec:e.attributes[n],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const n=pe(e);if(n===null)t.reactiveWildcard.push(e);else for(const s of n)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function Y(e,t,o,n){for(let s=0;s<e.length;s++){const l=e[s];if(!t[l.attribute])continue;const i=l.effects&&l.effects[o];i?i(t,o,n):l.onAttrChange&&(!l.declared||l.declared.has(o))&&l.onAttrChange(t,o,n)}}function ye(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,n=X(),s=n.byAttr.get(t),l=M()&&n.byDeclaredAttr&&n.byDeclaredAttr.has(t);if(!o&&!s&&!l)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(l&&S(i)){const c=n.byDeclaredAttr.get(t),r=i.getAttribute(t);for(let u=0;u<c.length;u++)Q(c[u].spec,r,t,c[u].componentTag,i)}if(window.lnCore._debugSink&&(o||s)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),o){const c=n.byReactive.get(t);c&&Y(c,i,t,e.oldValue),n.reactiveWildcard.length&&Y(n.reactiveWildcard,i,t,e.oldValue)}if(s)for(let c=0;c<s.length;c++){const r=s[c];if(r.handler){r.handler(i,t,e.oldValue);continue}r.onAttributeChange&&i[r.attribute]?r.onAttributeChange(i,t):(z(i,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(i))}}}function Ce(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{ye(t[o])}catch(n){console.error("[ln-core] mutation handler failed",t[o].target,n)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function E(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function L(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(n){console.error("["+t.attribute+"] destroy failed",e,n)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function _e(e){const t=E();if(t.length){if(e.target)for(let o=0;o<t.length;o++){const n=t[o];if(n.onSubtreeChange&&n.query){const s=n.query,l=e.target.nodeType===1?e.target.matches&&e.target.matches(s)?e.target:e.target.closest?e.target.closest(s):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(s):null;l&&n.onSubtreeChange(l,e)}}for(let o=0;o<e.addedNodes.length;o++){const n=e.addedNodes[o];if(n.nodeType===1){const s=!!(n.firstElementChild||n.children&&n.children.length);for(let l=0;l<t.length;l++){const i=t[l];if(i.selector&&i.attribute&&i.ComponentFn){if(!s)n.matches&&n.matches(i.query)&&_(n,i);else if(n.matches&&n.matches(i.query)&&_(n,i),n.querySelectorAll){const c=n.querySelectorAll(i.query);for(let r=0;r<c.length;r++)_(c[r],i)}}i.onInit&&i.onInit(n)}}}for(let o=0;o<e.removedNodes.length;o++){const n=e.removedNodes[o];if(n.nodeType===1){const s=!!(n.firstElementChild||n.children&&n.children.length);for(let l=0;l<t.length;l++){const i=t[l],c=i.query;if(c){if(!s)n.matches&&n.matches(c)&&L(n,i);else if(n.matches&&n.matches(c)&&L(n,i),n.querySelectorAll){const r=n.querySelectorAll(c);for(let u=0;u<r.length;u++)L(r[u],i)}}}}}}}function Z(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const n=t[o];if(n.type==="childList")try{_e(n)}catch(s){console.error("[ln-core] lifecycle handler failed",n.target,s)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function ke(e){E().push(e),Z()}function ee(e,t,o,n,s={}){const l=s.extraAttributes||[],i=s.onAttributeChange||null,c=s.onSubtreeChange||null,r=s.onInit||null,u=s.onAttrChange||null,b=s.effects||null,f=s.attributes||null,a=f?we(f):b,d=f?new Set(Object.keys(f)):null,h=s.persist||null;function w(D){const g=D||document.body;if(z(g,e,t,o),f&&M())for(const k in f){const De=f[k],R=Array.from(g.querySelectorAll("["+k+"]"));g.matches&&g.matches("["+k+"]")&&R.push(g);for(let T=0;T<R.length;T++){const N=R[T];S(N)&&Q(De,N.getAttribute(k),k,n,N)}}r&&r(g)}const p=[];if(e.indexOf("[")!==-1){const D=/\[([\w-]+)/g;let g;for(;(g=D.exec(e))!==null;)p.push(g[1])}else p.push(e);ge({selector:e,attribute:t,componentTag:n,attributes:f,ComponentFn:o,onInit:r,observed:p.concat(l),onAttributeChange:i,onAttrChange:u,effects:a,declared:d,persist:h}),Ce();const y=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,x=s.subtreeQuery||(y?e:"["+e+"]");E().push({selector:e,attribute:t,ComponentFn:o,onInit:r,onSubtreeChange:c,query:x}),Z(),window[t]=w,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ee,window.lnCore.observeLifecycle=ke);function C(){be()>0?me(function(){w(document.body)}):w(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",C):C(),w}function te(e){return(e||"").replace(/^#/,"")}function I(e){const t=e===void 0?location.hash:e,o={},n=te(t);if(!n)return o;const s=n.split("&");for(let l=0;l<s.length;l++){const i=s[l];if(!i)continue;const c=i.indexOf(":"),r=c>-1?i.slice(0,c):i,u=c>-1?i.slice(c+1):"";if(r)try{o[r]=decodeURIComponent(u)}catch{o[r]=u}}return o}function Ae(e){if(!e)return null;const t=I();return e in t?t[e]:null}function ve(e,t){if(!e)return;const o=I();t==null?delete o[e]:o[e]=String(t);const s=Object.keys(o).map(function(l){const i=o[l];return i===""?l:l+":"+encodeURIComponent(i)}).join("&");te(location.hash)!==s&&(location.hash=s)}function xe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Se(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 n=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return n?t?n+"-"+t:n:t||null}function qe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Oe(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 Ee(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Le(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),n=e.slice(t+1),s=n?n.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:o,values:s}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=I,window.lnCore.hashGet=Ae,window.lnCore.hashSet=ve,window.lnCore.hashLinkClick=xe,window.lnCore.resolveHashNamespace=Se,window.lnCore.hashSortEncode=qe,window.lnCore.hashSortDecode=Oe,window.lnCore.hashFilterEncode=Ee,window.lnCore.hashFilterDecode=Le);function Ie(){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=Ie),(function(){const e="data-ln-websocket-connector",t="lnWebsocketConnector",o="lnConnector";if(window[t]!==void 0)return;const n=1e3,s=3e4;function l(a){const d=a[t];d&&(d.command==="connect"?d._open():d._disconnect())}function i(a){const d=a[t];!d||d.command!=="connect"||(d._drop("url-changed"),d._open())}const c={"data-ln-websocket-connector":{prop:"command",type:"enum",values:["connect","disconnect"],fallback:"connect",effect:l,description:"Connection command set from outside: connect or disconnect"},"data-ln-websocket-connector-url":{prop:"url",read:v,type:"string",fallback:"",effect:i,description:"WebSocket endpoint URL (ws:// or wss://)"}},r=G(c),u={"ln-websocket-connector:request-sync":"sync","ln-websocket-connector:request-query":"query","ln-websocket-connector:request-create":"create","ln-websocket-connector:request-update":"update","ln-websocket-connector:request-delete":"delete","ln-websocket-connector:request-bulk-delete":"bulk-delete"};function b(a,d){return a==="sync"?{since:d.since}:a==="query"?{query:d.query||{}}:a==="create"?{data:d.data,idempotencyKey:d.idempotencyKey}:a==="update"?{id:d.id,data:d.data,expected_version:d.expected_version,idempotencyKey:d.idempotencyKey}:a==="delete"?{id:d.id,idempotencyKey:d.idempotencyKey}:{ids:d.ids,idempotencyKey:d.idempotencyKey}}function f(a){this.dom=a,P(this,a,r),a[t]=this,a[o]=this,this.namespace="ln-websocket-connector",this._socket=null,this._status="disconnected",this._attempt=0,this._timer=null,this._seq=0,this._pending=new Map,this._held=[];const d=this;this._onRequest=function(h){d._request(u[h.type],h.detail||{})};for(const h in u)a.addEventListener(h,this._onRequest);return this.command==="connect"&&this._open(),this}f.prototype._open=function(){if(this._socket||this._timer)return;const a=this,d=this.url;this._attempt++,this._status="connecting",m(this.dom,"ln-websocket-connector:connecting",{url:d,attempt:this._attempt});let h;try{h=new WebSocket(d)}catch(w){this._status="disconnected",this._attempt=0,this._failAll(this._held,w.message),this._held=[],m(this.dom,"ln-websocket-connector:disconnected",{url:d,code:0,reason:w.message,willReconnect:!1});return}this._socket=h,h.onopen=function(){a._status="connected",a._attempt=0,m(a.dom,"ln-websocket-connector:connected",{url:d});const w=a._held;a._held=[];for(let p=0;p<w.length;p++)a._send(w[p])},h.onmessage=function(w){a._receive(w.data)},h.onclose=function(w){a._socket=null,a._status="disconnected",a._failPending("connection closed");const p=a.command==="connect";m(a.dom,"ln-websocket-connector:disconnected",{url:d,code:w.code,reason:w.reason,willReconnect:p}),p&&a._scheduleReconnect()}},f.prototype._scheduleReconnect=function(){const a=this,d=Math.min(n*Math.pow(2,Math.max(0,this._attempt-1)),s);this._timer=setTimeout(function(){a._timer=null,a._open()},d)},f.prototype._drop=function(a){const d=!!(this._socket||this._timer);clearTimeout(this._timer),this._timer=null,this._attempt=0,this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(1e3,a),this._socket=null),d&&(this._status="disconnected",this._failPending("connection closed"),m(this.dom,"ln-websocket-connector:disconnected",{url:this.url,code:1e3,reason:a,willReconnect:!1}))},f.prototype._disconnect=function(){this._drop("disconnect"),this._failAll(this._held,"disconnected"),this._held=[]},f.prototype._request=function(a,d){const h={ref:String(++this._seq),type:a,detail:d};this._status==="connected"?this._send(h):this.command==="connect"?this._held.push(h):this._fail(h,0,"disconnected",null)},f.prototype._send=function(a){this._pending.set(a.ref,a),this._socket.send(JSON.stringify(Object.assign({ref:a.ref,type:a.type},b(a.type,a.detail))))},f.prototype._receive=function(a){let d;try{d=JSON.parse(a)}catch{console.warn("[ln-websocket-connector] Ignored a frame that is not JSON:",a);return}if(d.ref!==void 0){const h=this._pending.get(String(d.ref));if(!h)return;this._pending.delete(h.ref),d.ok?this._resolve(h,d.content,d.message||null):this._fail(h,d.status||0,d.error,d.data);return}d.type==="changes"&&m(this.dom,"ln-websocket-connector:fetched",{data:{data:d.data||[],deleted:d.deleted||[],synced_at:d.synced_at},since:null,meta:null})},f.prototype._resolve=function(a,d,h){const w=a.detail,p=w.meta||null,y=this.dom;if(a.type==="sync")m(y,"ln-websocket-connector:fetched",{data:d,since:w.since,meta:p});else if(a.type==="query"){const x=w.query||{},C=d||{};m(y,"ln-websocket-connector:fetched",{data:C.data||[],total:C.total,filtered:C.filtered,offset:x.offset,queryGen:x.queryGen,meta:p})}else a.type==="create"?m(y,"ln-websocket-connector:created",{record:d,tempId:w.tempId,message:h,meta:p}):a.type==="update"?m(y,"ln-websocket-connector:updated",{record:d,id:w.id,message:h,meta:p}):a.type==="delete"?m(y,"ln-websocket-connector:deleted",{response:d,id:w.id,message:h,meta:p}):m(y,"ln-websocket-connector:bulk-deleted",{response:d,ids:w.ids,message:h,meta:p})},f.prototype._fail=function(a,d,h,w){const p=a.detail;m(this.dom,"ln-websocket-connector:error",{action:a.type,error:h,status:d,data:w||null,conflictData:d===409&&w||null,since:p.since,id:p.id,ids:p.ids,tempId:p.tempId,meta:p.meta||null})},f.prototype._failAll=function(a,d){for(let h=0;h<a.length;h++)this._fail(a[h],0,d,null)},f.prototype._failPending=function(a){const d=Array.from(this._pending.values());this._pending.clear(),this._failAll(d,a)},f.prototype.destroy=function(){if(this.dom[t]){for(const a in u)this.dom.removeEventListener(a,this._onRequest);clearTimeout(this._timer),this._timer=null,this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(1e3,"destroy"),this._socket=null),this._pending.clear(),this._held=[],delete this.dom[t],delete this.dom[o]}},ee(e,t,f,"ln-websocket-connector",{attributes:c})})()})();
|
|
1
|
+
(function(){"use strict";function M(){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 S(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 o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){i=t[o];break}if(!S(i))return}e.apply(console,t)}}function m(e,t,r){const i=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ne(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function oe(e,t){const r=!!(t&&t.typed),i=t&&t.exclude,o={},c=e.elements,s={};if(r)for(let l=0;l<c.length;l++){const n=c[l];n.name&&n.type==="checkbox"&&!n.disabled&&(s[n.name]=(s[n.name]||0)+1)}for(let l=0;l<c.length;l++){const n=c[l];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(i&&n.matches&&n.matches(i)))if(n.type==="checkbox")r&&s[n.name]===1?o[n.name]=n.checked:(o[n.name]||(o[n.name]=[]),n.checked&&o[n.name].push(n.value));else if(n.type==="radio")n.checked&&(o[n.name]=n.value);else if(n.type==="select-multiple"){o[n.name]=[];for(let u=0;u<n.options.length;u++)n.options[u].selected&&o[n.name].push(n.options[u].value)}else if(r&&n.type==="hidden")o[n.name]=n.value;else if(r&&(n.type==="number"||n.type==="range")){const u=Number(n.value);o[n.name]=n.value===""||isNaN(u)?null:u}else o[n.name]=n.value}return o}function re(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ie(e,t){const r=e.elements,i=[],o={};for(let c=0;c<r.length;c++){const s=r[c];s.name&&s.type==="checkbox"&&(o[s.name]=(o[s.name]||0)+1)}for(let c=0;c<r.length;c++){const s=r[c];if(s.type==="file"||s.type==="submit"||s.type==="button")continue;const l=s.getAttribute("data-ln-fill-as")||s.name;if(!l||!(l in t))continue;const n=t[l];if(s.type==="checkbox"){if(Array.isArray(n))s.checked=n.indexOf(s.value)!==-1;else if(o[s.name]>1){const u=String(n).split(",").map(function(p){return p.trim()});s.checked=u.indexOf(s.value)!==-1}else s.checked=re(n);i.push(s)}else if(s.type==="radio")s.checked=s.value===String(n),i.push(s);else if(s.type==="select-multiple"){if(Array.isArray(n))for(let u=0;u<s.options.length;u++)s.options[u].selected=n.indexOf(s.options[u].value)!==-1;i.push(s)}else s.value=n,s.tagName==="SELECT"&&n!=null&&s.setAttribute("data-ln-value",n),i.push(s)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ie,window.lnCore.serializeForm=oe,window.lnCore.resolveFormMethod=ne);const F={};function se(e,t){F[e]=t}function le(e){return F[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=se,window.lnCore.getDataMapper=le);function ce(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){m(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function ae(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];$[r]=t}function de(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ae,window.lnCore.getLocaleFallback=de,window.lnCore.ensureLocaleObserver=ce);const q={};function ue(e,t){q[e]||(q[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=q[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function B(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let s=0;s<r.length;s++){const l=r[s],n=l.getAttribute("data-ln-field");t[n]!=null&&(l.textContent=t[n])}const i=e.querySelectorAll("[data-ln-attr]");for(let s=0;s<i.length;s++){const l=i[s],n=l.getAttribute("data-ln-attr").split(",");for(let u=0;u<n.length;u++){const p=n[u].trim().split(":");if(p.length!==2)continue;const f=p[0].trim(),a=p[1].trim();t[a]!=null&&l.setAttribute(f,t[a])}}const o=e.querySelectorAll("[data-ln-show]");for(let s=0;s<o.length;s++){const l=o[s],n=l.getAttribute("data-ln-show");n in t&&l.classList.toggle("hidden",!t[n])}const c=e.querySelectorAll("[data-ln-class]");for(let s=0;s<c.length;s++){const l=c[s],n=l.getAttribute("data-ln-class").split(",");for(let u=0;u<n.length;u++){const p=n[u].trim().split(":");if(p.length!==2)continue;const f=p[0].trim(),a=p[1].trim();a in t&&l.classList.toggle(f,!!t[a])}}return e}function fe(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<r.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[i],t??null),r[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)B(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function j(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const c=r.currentNode;c.textContent.indexOf("{{")!==-1&&(c.textContent=c.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(s,l){return t[l]!==void 0?t[l]:""}))}const i=function(c,s){return t[s]!==void 0?t[s]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let c=0;c<o.length;c++){const s=o[c],l=s.attributes;for(let n=0;n<l.length;n++){const u=l[n];u.value.indexOf("{{")!==-1&&s.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function he(e,t,r,i,o,c){const s={};for(let n=0;n<e.children.length;n++){const u=e.children[n],p=u.getAttribute("data-ln-render-key");p&&(s[p]=u)}const l=document.createDocumentFragment();for(let n=0;n<t.length;n++){const u=t[n],p=String(i(u));let f=s[p];if(f)o(f,u,n);else{const a=ue(r,c);if(!a||(j(a,u),f=a.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",p),o(f,u,n)}l.appendChild(f)}e.textContent="",e.appendChild(l)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=j,window.lnCore.fill=B,window.lnCore.lnFill=fe,window.lnCore.renderList=he);function v(e,t,r){const i=e.getAttribute(t);return i===null?r:i}function W(e,t,r){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?r:i}function U(e,t,r=!1){const i=e.getAttribute(t);if(i===null)return!!r;const o=i.trim().toLowerCase();return!(o==="false"||o==="0")}function K(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const O=new Map;function V(e,t){const r=(e?e.join("|"):"")+"::"+t;if(O.has(r))return O.get(r);const i=new Set(e||[]),o=function(c,s){const l=c.getAttribute(s);return l!==null&&i.has(l)?l:t};return O.set(r,o),o}function H(e,t,r){const i=parseFloat(e.getAttribute(t));return isNaN(i)?r:i}function J(e,t,r){const i=e.getAttribute(t);if(!i)return r;try{return JSON.parse(i)}catch{return r}}function Q(e,t,r,i,o){if(!e||t===null)return!0;const c=i||"ln-component",s=e.type;if(s==="trigger"||s==="marker"||s==="string"||s==="list"||!s||t===""&&e.fallback!==void 0)return!0;const l=n=>{o?console.warn(n,o):console.warn(n)};if(s==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(l(`[${c}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(s==="enum"){const n=e.values||[];return n.includes(t)?!0:(l(`[${c}] Invalid value "${t}" for attribute "${r}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(s==="integer"){if(!/^-?\d+$/.test(t))return l(`[${c}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(l(`[${c}] Value ${n} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(l(`[${c}] Value ${n} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(s==="float")return isNaN(Number(t))?(l(`[${c}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(s==="json")try{return JSON.parse(t),!0}catch(n){return l(`[${c}] Invalid JSON for attribute "${r}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function P(e,t,r){for(const i in r){const[o,c,s]=r[i];Object.defineProperty(e,i,{get:function(){return o(t,c,s)},enumerable:!0,configurable:!0})}return e}function G(e){const t={};for(const r in e){const i=e[r];if(!i||!i.prop)continue;let o=i.read;if(!o&&i.type)switch(i.type){case"enum":o=V(i.values,i.fallback);break;case"integer":o=W;break;case"float":o=H;break;case"boolean":o=U;break;case"list":o=K;break;case"json":o=J;break;case"string":default:o=v;break}o||(o=v),t[i.prop]=[o,r,i.fallback]}return t}function we(e){const t={};for(const r in e){const i=e[r];i&&i.effect&&(t[r]=i.effect)}return Object.keys(t).length?t:null}function pe(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=P,window.lnCore.attrSpec=G,window.lnCore.attrStr=v,window.lnCore.attrInt=W,window.lnCore.attrBool=U,window.lnCore.attrList=K,window.lnCore.attrEnum=V,window.lnCore.attrFloat=H,window.lnCore.attrJson=J);function _(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(r){console.error("["+t.attribute+"] init failed",e,r)}}}function z(e,t,r,i){if(e.nodeType!==1)return;const c=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",s={selector:t,attribute:r,ComponentFn:i};if(e.matches&&e.matches(c)&&_(e,s),e.querySelectorAll){const l=e.querySelectorAll(c);for(let n=0;n<l.length;n++)_(l[n],s)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function be(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function me(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 X(){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 ge(e){const t=X(),r=e.observed||[];for(let i=0;i<r.length;i++){const o=r[i];t.byAttr.has(o)||t.byAttr.set(o,[]),t.byAttr.get(o).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const o=t.byDeclaredAttr.get(i);o.some(c=>c.componentTag===e.componentTag)||o.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=pe(e);if(i===null)t.reactiveWildcard.push(e);else for(const o of i)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function Y(e,t,r,i){for(let o=0;o<e.length;o++){const c=e[o];if(!t[c.attribute])continue;const s=c.effects&&c.effects[r];s?s(t,r,i):c.onAttrChange&&(!c.declared||c.declared.has(r))&&c.onAttrChange(t,r,i)}}function ye(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,i=X(),o=i.byAttr.get(t),c=M()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!r&&!o&&!c)return;const s=e.target;if(e.oldValue!==s.getAttribute(t)){if(c&&S(s)){const l=i.byDeclaredAttr.get(t),n=s.getAttribute(t);for(let u=0;u<l.length;u++)Q(l[u].spec,n,t,l[u].componentTag,s)}if(window.lnCore._debugSink&&(r||o)&&window.lnCore._debugSink("attr",t,s,{oldValue:e.oldValue,newValue:s.getAttribute(t)}),r){const l=i.byReactive.get(t);l&&Y(l,s,t,e.oldValue),i.reactiveWildcard.length&&Y(i.reactiveWildcard,s,t,e.oldValue)}if(o)for(let l=0;l<o.length;l++){const n=o[l];if(n.handler){n.handler(s,t,e.oldValue);continue}n.onAttributeChange&&s[n.attribute]?n.onAttributeChange(s,t):(z(s,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(s))}}}function Ce(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{ye(t[r])}catch(i){console.error("[ln-core] mutation handler failed",t[r].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function E(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function L(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function _e(e){const t=E();if(!t.length)return;const r=e.target;if(r){const i=r.nodeType===1?r:r.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 o=t[i];if(o.onSubtreeChange&&o.query){const c=o.query,s=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;s&&o.onSubtreeChange(s,e)}}for(let i=0;i<e.addedNodes.length;i++){const o=e.addedNodes[i];if(o.nodeType===1){const c=!!(o.firstElementChild||o.children&&o.children.length);for(let s=0;s<t.length;s++){const l=t[s];if(l.selector&&l.attribute&&l.ComponentFn){if(!c)o.matches&&o.matches(l.query)&&_(o,l);else if(o.matches&&o.matches(l.query)&&_(o,l),o.querySelectorAll){const n=o.querySelectorAll(l.query);for(let u=0;u<n.length;u++)_(n[u],l)}}l.onInit&&l.onInit(o)}}}for(let i=0;i<e.removedNodes.length;i++){const o=e.removedNodes[i];if(o.nodeType===1){const c=!!(o.firstElementChild||o.children&&o.children.length);for(let s=0;s<t.length;s++){const l=t[s],n=l.query;if(n){if(!c)o.matches&&o.matches(n)&&L(o,l);else if(o.matches&&o.matches(n)&&L(o,l),o.querySelectorAll){const u=o.querySelectorAll(n);for(let p=0;p<u.length;p++)L(u[p],l)}}}}}}function Z(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.type==="childList")try{_e(i)}catch(o){console.error("[ln-core] lifecycle handler failed",i.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function ke(e){E().push(e),Z()}function ee(e,t,r,i,o={}){const c=o.extraAttributes||[],s=o.onAttributeChange||null,l=o.onSubtreeChange||null,n=o.onInit||null,u=o.onAttrChange||null,p=o.effects||null,f=o.attributes||null,a=f?we(f):p,d=f?new Set(Object.keys(f)):null,h=o.persist||null;function w(D){const g=D||document.body;if(z(g,e,t,r),f&&M())for(const k in f){const De=f[k],T=Array.from(g.querySelectorAll("["+k+"]"));g.matches&&g.matches("["+k+"]")&&T.push(g);for(let R=0;R<T.length;R++){const N=T[R];S(N)&&Q(De,N.getAttribute(k),k,i,N)}}n&&n(g)}const b=[];if(e.indexOf("[")!==-1){const D=/\[([\w-]+)/g;let g;for(;(g=D.exec(e))!==null;)b.push(g[1])}else b.push(e);ge({selector:e,attribute:t,componentTag:i,attributes:f,ComponentFn:r,onInit:n,observed:b.concat(c),onAttributeChange:s,onAttrChange:u,effects:a,declared:d,persist:h}),Ce();const y=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,x=o.subtreeQuery||(y?e:"["+e+"]");E().push({selector:e,attribute:t,ComponentFn:r,onInit:n,onSubtreeChange:l,query:x}),Z(),window[t]=w,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ee,window.lnCore.observeLifecycle=ke);function C(){be()>0?me(function(){w(document.body)}):w(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",C):C(),w}function te(e){return(e||"").replace(/^#/,"")}function I(e){const t=e===void 0?location.hash:e,r={},i=te(t);if(!i)return r;const o=i.split("&");for(let c=0;c<o.length;c++){const s=o[c];if(!s)continue;const l=s.indexOf(":"),n=l>-1?s.slice(0,l):s,u=l>-1?s.slice(l+1):"";if(n)try{r[n]=decodeURIComponent(u)}catch{r[n]=u}}return r}function Ae(e){if(!e)return null;const t=I();return e in t?t[e]:null}function ve(e,t){if(!e)return;const r=I();t==null?delete r[e]:r[e]=String(t);const o=Object.keys(r).map(function(c){const s=r[c];return s===""?c:c+":"+encodeURIComponent(s)}).join("&");te(location.hash)!==o&&(location.hash=o)}function xe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Se(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function qe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Oe(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 Ee(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Le(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),i=e.slice(t+1),o=i?i.split(",").map(function(c){try{return decodeURIComponent(c)}catch{return c}}).filter(Boolean):[];return{key:r,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=I,window.lnCore.hashGet=Ae,window.lnCore.hashSet=ve,window.lnCore.hashLinkClick=xe,window.lnCore.resolveHashNamespace=Se,window.lnCore.hashSortEncode=qe,window.lnCore.hashSortDecode=Oe,window.lnCore.hashFilterEncode=Ee,window.lnCore.hashFilterDecode=Le);function Ie(){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=Ie),(function(){const e="data-ln-websocket-connector",t="lnWebsocketConnector",r="lnConnector";if(window[t]!==void 0)return;const i=1e3,o=3e4;function c(a){const d=a[t];d&&(d.command==="connect"?d._open():d._disconnect())}function s(a){const d=a[t];!d||d.command!=="connect"||(d._drop("url-changed"),d._open())}const l={"data-ln-websocket-connector":{prop:"command",type:"enum",values:["connect","disconnect"],fallback:"connect",effect:c,description:"Connection command set from outside: connect or disconnect"},"data-ln-websocket-connector-url":{prop:"url",read:v,type:"string",fallback:"",effect:s,description:"WebSocket endpoint URL (ws:// or wss://)"}},n=G(l),u={"ln-websocket-connector:request-sync":"sync","ln-websocket-connector:request-query":"query","ln-websocket-connector:request-create":"create","ln-websocket-connector:request-update":"update","ln-websocket-connector:request-delete":"delete","ln-websocket-connector:request-bulk-delete":"bulk-delete"};function p(a,d){return a==="sync"?{since:d.since}:a==="query"?{query:d.query||{}}:a==="create"?{data:d.data,idempotencyKey:d.idempotencyKey}:a==="update"?{id:d.id,data:d.data,expected_version:d.expected_version,idempotencyKey:d.idempotencyKey}:a==="delete"?{id:d.id,idempotencyKey:d.idempotencyKey}:{ids:d.ids,idempotencyKey:d.idempotencyKey}}function f(a){this.dom=a,P(this,a,n),a[t]=this,a[r]=this,this.namespace="ln-websocket-connector",this._socket=null,this._status="disconnected",this._attempt=0,this._timer=null,this._seq=0,this._pending=new Map,this._held=[];const d=this;this._onRequest=function(h){d._request(u[h.type],h.detail||{})};for(const h in u)a.addEventListener(h,this._onRequest);return this.command==="connect"&&this._open(),this}f.prototype._open=function(){if(this._socket||this._timer)return;const a=this,d=this.url;this._attempt++,this._status="connecting",m(this.dom,"ln-websocket-connector:connecting",{url:d,attempt:this._attempt});let h;try{h=new WebSocket(d)}catch(w){this._status="disconnected",this._attempt=0,this._failAll(this._held,w.message),this._held=[],m(this.dom,"ln-websocket-connector:disconnected",{url:d,code:0,reason:w.message,willReconnect:!1});return}this._socket=h,h.onopen=function(){a._status="connected",a._attempt=0,m(a.dom,"ln-websocket-connector:connected",{url:d});const w=a._held;a._held=[];for(let b=0;b<w.length;b++)a._send(w[b])},h.onmessage=function(w){a._receive(w.data)},h.onclose=function(w){a._socket=null,a._status="disconnected",a._failPending("connection closed");const b=a.command==="connect";m(a.dom,"ln-websocket-connector:disconnected",{url:d,code:w.code,reason:w.reason,willReconnect:b}),b&&a._scheduleReconnect()}},f.prototype._scheduleReconnect=function(){const a=this,d=Math.min(i*Math.pow(2,Math.max(0,this._attempt-1)),o);this._timer=setTimeout(function(){a._timer=null,a._open()},d)},f.prototype._drop=function(a){const d=!!(this._socket||this._timer);clearTimeout(this._timer),this._timer=null,this._attempt=0,this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(1e3,a),this._socket=null),d&&(this._status="disconnected",this._failPending("connection closed"),m(this.dom,"ln-websocket-connector:disconnected",{url:this.url,code:1e3,reason:a,willReconnect:!1}))},f.prototype._disconnect=function(){this._drop("disconnect"),this._failAll(this._held,"disconnected"),this._held=[]},f.prototype._request=function(a,d){const h={ref:String(++this._seq),type:a,detail:d};this._status==="connected"?this._send(h):this.command==="connect"?this._held.push(h):this._fail(h,0,"disconnected",null)},f.prototype._send=function(a){this._pending.set(a.ref,a),this._socket.send(JSON.stringify(Object.assign({ref:a.ref,type:a.type},p(a.type,a.detail))))},f.prototype._receive=function(a){let d;try{d=JSON.parse(a)}catch{console.warn("[ln-websocket-connector] Ignored a frame that is not JSON:",a);return}if(d.ref!==void 0){const h=this._pending.get(String(d.ref));if(!h)return;this._pending.delete(h.ref),d.ok?this._resolve(h,d.content,d.message||null):this._fail(h,d.status||0,d.error,d.data);return}d.type==="changes"&&m(this.dom,"ln-websocket-connector:fetched",{data:{data:d.data||[],deleted:d.deleted||[],synced_at:d.synced_at},since:null,meta:null})},f.prototype._resolve=function(a,d,h){const w=a.detail,b=w.meta||null,y=this.dom;if(a.type==="sync")m(y,"ln-websocket-connector:fetched",{data:d,since:w.since,meta:b});else if(a.type==="query"){const x=w.query||{},C=d||{};m(y,"ln-websocket-connector:fetched",{data:C.data||[],total:C.total,filtered:C.filtered,offset:x.offset,queryGen:x.queryGen,meta:b})}else a.type==="create"?m(y,"ln-websocket-connector:created",{record:d,tempId:w.tempId,message:h,meta:b}):a.type==="update"?m(y,"ln-websocket-connector:updated",{record:d,id:w.id,message:h,meta:b}):a.type==="delete"?m(y,"ln-websocket-connector:deleted",{response:d,id:w.id,message:h,meta:b}):m(y,"ln-websocket-connector:bulk-deleted",{response:d,ids:w.ids,message:h,meta:b})},f.prototype._fail=function(a,d,h,w){const b=a.detail;m(this.dom,"ln-websocket-connector:error",{action:a.type,error:h,status:d,data:w||null,conflictData:d===409&&w||null,since:b.since,id:b.id,ids:b.ids,tempId:b.tempId,meta:b.meta||null})},f.prototype._failAll=function(a,d){for(let h=0;h<a.length;h++)this._fail(a[h],0,d,null)},f.prototype._failPending=function(a){const d=Array.from(this._pending.values());this._pending.clear(),this._failAll(d,a)},f.prototype.destroy=function(){if(this.dom[t]){for(const a in u)this.dom.removeEventListener(a,this._onRequest);clearTimeout(this._timer),this._timer=null,this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(1e3,"destroy"),this._socket=null),this._pending.clear(),this._held=[],delete this.dom[t],delete this.dom[r]}},ee(e,t,f,"ln-websocket-connector",{attributes:l})})()})();
|
package/package.json
CHANGED