@livenetworks/ashlar 2.1.1 → 2.1.2
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-autoresize/src/ln-autoresize.js +3 -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 +24 -12
- 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-date/src/ln-date.js +22 -13
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
- package/components/ln-dropdown/src/ln-dropdown.js +18 -5
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-filter/ln-filter.schema.json +1 -1
- package/components/ln-filter/src/ln-filter.js +11 -10
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-form/src/ln-form.js +11 -0
- 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-list/src/ln-list.js +14 -5
- 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-number/src/ln-number.js +22 -12
- 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-popover/ln-popover.schema.json +82 -82
- package/components/ln-popover/src/ln-popover.js +22 -5
- 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-search/ln-search.schema.json +103 -103
- package/components/ln-search/src/ln-search.js +9 -5
- 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-sortable/src/ln-sortable.js +52 -7
- 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-tabs/src/ln-tabs.js +12 -8
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-time/src/ln-time.js +17 -7
- 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-validate/src/ln-validate.js +21 -7
- 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 I(){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 x(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 l=null;for(let r=1;r<t.length;r++)if(t[r]&&t[r].nodeType===1){l=t[r];break}if(!x(l))return}e.apply(console,t)}}function _(e,t,i){const l=i||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:l}))}function F(e,t,i){const l=i||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l);const r=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:l});return e.dispatchEvent(r),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 oe(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),l=t&&t.exclude,r={},s=e.elements,o={};if(i)for(let a=0;a<s.length;a++){const n=s[a];n.name&&n.type==="checkbox"&&!n.disabled&&(o[n.name]=(o[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")&&!(l&&n.matches&&n.matches(l)))if(n.type==="checkbox")i&&o[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 ie(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function le(e,t){const i=e.elements,l=[],r={};for(let s=0;s<i.length;s++){const o=i[s];o.name&&o.type==="checkbox"&&(r[o.name]=(r[o.name]||0)+1)}for(let s=0;s<i.length;s++){const o=i[s];if(o.type==="file"||o.type==="submit"||o.type==="button")continue;const a=o.getAttribute("data-ln-fill-as")||o.name;if(!a||!(a in t))continue;const n=t[a];if(o.type==="checkbox"){if(Array.isArray(n))o.checked=n.indexOf(o.value)!==-1;else if(r[o.name]>1){const c=String(n).split(",").map(function(u){return u.trim()});o.checked=c.indexOf(o.value)!==-1}else o.checked=ie(n);l.push(o)}else if(o.type==="radio")o.checked=o.value===String(n),l.push(o);else if(o.type==="select-multiple"){if(Array.isArray(n))for(let c=0;c<o.options.length;c++)o.options[c].selected=n.indexOf(o.options[c].value)!==-1;l.push(o)}else o.value=n,o.tagName==="SELECT"&&n!=null&&o.setAttribute("data-ln-value",n),l.push(o)}return l}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=le,window.lnCore.serializeForm=re,window.lnCore.resolveFormMethod=oe);const $={};function ae(e,t){$[e]=t}function se(e){return $[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ae,window.lnCore.getDataMapper=se);function ce(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,v(function(){new MutationObserver(function(){_(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const B={};function de(e,t){if(!e||typeof t!="object")return;const i=e.toLowerCase().split("-")[0];B[i]=t}function ue(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return B[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=de,window.lnCore.getLocaleFallback=ue,window.lnCore.ensureLocaleObserver=ce);const S={};function L(e,t){S[e]||(S[e]=document.querySelector('[data-ln-template="'+e+'"]'));const i=S[e];return i?i.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function M(e,t){if(!e||!t)return e;const i=e.querySelectorAll("[data-ln-field]");for(let o=0;o<i.length;o++){const a=i[o],n=a.getAttribute("data-ln-field");t[n]!=null&&(a.textContent=t[n])}const l=e.querySelectorAll("[data-ln-attr]");for(let o=0;o<l.length;o++){const a=l[o],n=a.getAttribute("data-ln-attr").split(",");for(let c=0;c<n.length;c++){const u=n[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&a.setAttribute(d,t[f])}}const r=e.querySelectorAll("[data-ln-show]");for(let o=0;o<r.length;o++){const a=r[o],n=a.getAttribute("data-ln-show");n in t&&a.classList.toggle("hidden",!t[n])}const s=e.querySelectorAll("[data-ln-class]");for(let o=0;o<s.length;o++){const a=s[o],n=a.getAttribute("data-ln-class").split(",");for(let c=0;c<n.length;c++){const u=n[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&a.classList.toggle(d,!!t[f])}}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 l=0;l<i.length;l++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",i[l],t??null),i[l].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)M(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let i=0;i<t.length;i++)t[i].textContent=""}})));function j(e,t){if(!e||!t)return e;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;i.nextNode();){const s=i.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,a){return t[a]!==void 0?t[a]:""}))}const l=function(s,o){return t[o]!==void 0?t[o]:""},r=Array.from(e.querySelectorAll("*"));e.nodeType===1&&r.push(e);for(let s=0;s<r.length;s++){const o=r[s],a=o.attributes;for(let n=0;n<a.length;n++){const c=a[n];c.value.indexOf("{{")!==-1&&o.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,l))}}return e}function ge(e,t,i,l,r,s){const o={};for(let n=0;n<e.children.length;n++){const c=e.children[n],u=c.getAttribute("data-ln-render-key");u&&(o[u]=c)}const a=document.createDocumentFragment();for(let n=0;n<t.length;n++){const c=t[n],u=String(l(c));let d=o[u];if(d)r(d,c,n);else{const f=L(i,s);if(!f||(j(f,c),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),r(d,c,n)}a.appendChild(d)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=j,window.lnCore.fill=M,window.lnCore.lnFill=fe,window.lnCore.renderList=ge);function w(e,t,i){const l=e.getAttribute(t);return l===null?i:l}function W(e,t,i){const l=parseInt(e.getAttribute(t),10);return isNaN(l)?i:l}function U(e,t,i=!1){const l=e.getAttribute(t);if(l===null)return!!i;const r=l.trim().toLowerCase();return!(r==="false"||r==="0")}function V(e,t){return(e.getAttribute(t)||"").split(",").map(i=>i.trim()).filter(Boolean)}const k=new Map;function P(e,t){const i=(e?e.join("|"):"")+"::"+t;if(k.has(i))return k.get(i);const l=new Set(e||[]),r=function(s,o){const a=s.getAttribute(o);return a!==null&&l.has(a)?a:t};return k.set(i,r),r}function H(e,t,i){const l=parseFloat(e.getAttribute(t));return isNaN(l)?i:l}function K(e,t,i){const l=e.getAttribute(t);if(!l)return i;try{return JSON.parse(l)}catch{return i}}function J(e,t,i,l,r){if(!e||t===null)return!0;const s=l||"ln-component",o=e.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||t===""&&e.fallback!==void 0)return!0;const a=n=>{r?console.warn(n,r):console.warn(n)};if(o==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(a(`[${s}] Invalid value "${t}" for boolean attribute "${i}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const n=e.values||[];return n.includes(t)?!0:(a(`[${s}] Invalid value "${t}" for attribute "${i}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${i}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(a(`[${s}] Value ${n} for attribute "${i}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(a(`[${s}] Value ${n} for attribute "${i}" is greater than max (${e.max}).`),!1):!0}if(o==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${i}". Fallback: ${e.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(t),!0}catch(n){return a(`[${s}] Invalid JSON for attribute "${i}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function Q(e,t,i){for(const l in i){const[r,s,o]=i[l];Object.defineProperty(e,l,{get:function(){return r(t,s,o)},enumerable:!0,configurable:!0})}return e}function z(e){const t={};for(const i in e){const l=e[i];if(!l||!l.prop)continue;let r=l.read;if(!r&&l.type)switch(l.type){case"enum":r=P(l.values,l.fallback);break;case"integer":r=W;break;case"float":r=H;break;case"boolean":r=U;break;case"list":r=V;break;case"json":r=K;break;case"string":default:r=w;break}r||(r=w),t[l.prop]=[r,i,l.fallback]}return t}function he(e){const t={};for(const i in e){const l=e[i];l&&l.effect&&(t[i]=l.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 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=Q,window.lnCore.attrSpec=z,window.lnCore.attrStr=w,window.lnCore.attrInt=W,window.lnCore.attrBool=U,window.lnCore.attrList=V,window.lnCore.attrEnum=P,window.lnCore.attrFloat=H,window.lnCore.attrJson=K);function y(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(i){console.error("["+t.attribute+"] init failed",e,i)}}}function G(e,t,i,l){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",o={selector:t,attribute:i,ComponentFn:l};if(e.matches&&e.matches(s)&&y(e,o),e.querySelectorAll){const a=e.querySelectorAll(s);for(let n=0;n<a.length;n++)y(a[n],o)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function we(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function be(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 me(e){const t=X(),i=e.observed||[];for(let l=0;l<i.length;l++){const r=i[l];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 l in e.attributes){t.byDeclaredAttr.has(l)||t.byDeclaredAttr.set(l,[]);const r=t.byDeclaredAttr.get(l);r.some(s=>s.componentTag===e.componentTag)||r.push({spec:e.attributes[l],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const l=pe(e);if(l===null)t.reactiveWildcard.push(e);else for(const r of l)t.byReactive.has(r)||t.byReactive.set(r,[]),t.byReactive.get(r).push(e)}e.persist&&t.persist.push(e)}function Y(e,t,i,l){for(let r=0;r<e.length;r++){const s=e[r];if(!t[s.attribute])continue;const o=s.effects&&s.effects[i];o?o(t,i,l):s.onAttrChange&&(!s.declared||s.declared.has(i))&&s.onAttrChange(t,i,l)}}function ye(e){const t=e.attributeName,i=t.indexOf("data-ln-")===0,l=X(),r=l.byAttr.get(t),s=I()&&l.byDeclaredAttr&&l.byDeclaredAttr.has(t);if(!i&&!r&&!s)return;const o=e.target;if(e.oldValue!==o.getAttribute(t)){if(s&&x(o)){const a=l.byDeclaredAttr.get(t),n=o.getAttribute(t);for(let c=0;c<a.length;c++)J(a[c].spec,n,t,a[c].componentTag,o)}if(window.lnCore._debugSink&&(i||r)&&window.lnCore._debugSink("attr",t,o,{oldValue:e.oldValue,newValue:o.getAttribute(t)}),i){const a=l.byReactive.get(t);a&&Y(a,o,t,e.oldValue),l.reactiveWildcard.length&&Y(l.reactiveWildcard,o,t,e.oldValue)}if(r)for(let a=0;a<r.length;a++){const n=r[a];if(n.handler){n.handler(o,t,e.oldValue);continue}n.onAttributeChange&&o[n.attribute]?n.onAttributeChange(o,t):(G(o,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(o))}}}function Ce(){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{ye(t[i])}catch(l){console.error("[ln-core] mutation handler failed",t[i].target,l)}}).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 q(e,t){if(!document.contains(e))if(t.attribute){const i=e[t.attribute];if(i&&typeof i.destroy=="function")try{i.destroy()}catch(l){console.error("["+t.attribute+"] destroy failed",e,l)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ve(e){const t=E();if(!t.length)return;const i=e.target;if(i){const l=i.nodeType===1?i:i.parentElement;if(l&&(l.isContentEditable||l.closest&&l.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let l=0;l<t.length;l++){const r=t[l];if(r.onSubtreeChange&&r.query){const s=r.query,o=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;o&&r.onSubtreeChange(o,e)}}for(let l=0;l<e.addedNodes.length;l++){const r=e.addedNodes[l];if(r.nodeType===1){const s=!!(r.firstElementChild||r.children&&r.children.length);for(let o=0;o<t.length;o++){const a=t[o];if(a.selector&&a.attribute&&a.ComponentFn){if(!s)r.matches&&r.matches(a.query)&&y(r,a);else if(r.matches&&r.matches(a.query)&&y(r,a),r.querySelectorAll){const n=r.querySelectorAll(a.query);for(let c=0;c<n.length;c++)y(n[c],a)}}a.onInit&&a.onInit(r)}}}for(let l=0;l<e.removedNodes.length;l++){const r=e.removedNodes[l];if(r.nodeType===1){const s=!!(r.firstElementChild||r.children&&r.children.length);for(let o=0;o<t.length;o++){const a=t[o],n=a.query;if(n){if(!s)r.matches&&r.matches(n)&&q(r,a);else if(r.matches&&r.matches(n)&&q(r,a),r.querySelectorAll){const c=r.querySelectorAll(n);for(let u=0;u<c.length;u++)q(c[u],a)}}}}}}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 l=t[i];if(l.type==="childList")try{ve(l)}catch(r){console.error("[ln-core] lifecycle handler failed",l.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ae(e){E().push(e),Z()}function ee(e,t,i,l,r={}){const s=r.extraAttributes||[],o=r.onAttributeChange||null,a=r.onSubtreeChange||null,n=r.onInit||null,c=r.onAttrChange||null,u=r.effects||null,d=r.attributes||null,f=d?he(d):u,h=d?new Set(Object.keys(d)):null,m=r.persist||null;function g(D){const p=D||document.body;if(G(p,e,t,i),d&&I())for(const C in d){const Re=d[C],N=Array.from(p.querySelectorAll("["+C+"]"));p.matches&&p.matches("["+C+"]")&&N.push(p);for(let R=0;R<N.length;R++){const T=N[R];x(T)&&J(Re,T.getAttribute(C),C,l,T)}}n&&n(p)}const b=[];if(e.indexOf("[")!==-1){const D=/\[([\w-]+)/g;let p;for(;(p=D.exec(e))!==null;)b.push(p[1])}else b.push(e);me({selector:e,attribute:t,componentTag:l,attributes:d,ComponentFn:i,onInit:n,observed:b.concat(s),onAttributeChange:o,onAttrChange:c,effects:f,declared:h,persist:m}),Ce();const A=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Ne=r.subtreeQuery||(A?e:"["+e+"]");E().push({selector:e,attribute:t,ComponentFn:i,onInit:n,onSubtreeChange:a,query:Ne}),Z(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ee,window.lnCore.observeLifecycle=Ae);function ne(){we()>0?be(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ne):ne(),g}function te(e){return(e||"").replace(/^#/,"")}function O(e){const t=e===void 0?location.hash:e,i={},l=te(t);if(!l)return i;const r=l.split("&");for(let s=0;s<r.length;s++){const o=r[s];if(!o)continue;const a=o.indexOf(":"),n=a>-1?o.slice(0,a):o,c=a>-1?o.slice(a+1):"";if(n)try{i[n]=decodeURIComponent(c)}catch{i[n]=c}}return i}function xe(e){if(!e)return null;const t=O();return e in t?t[e]:null}function _e(e,t){if(!e)return;const i=O();t==null?delete i[e]:i[e]=String(t);const r=Object.keys(i).map(function(s){const o=i[s];return o===""?s:s+":"+encodeURIComponent(o)}).join("&");te(location.hash)!==r&&(location.hash=r)}function Se(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 l=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return l?t?l+"-"+t:l:t||null}function ke(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ee(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function qe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Oe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const i=e.slice(0,t),l=e.slice(t+1),r=l?l.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:i,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=O,window.lnCore.hashGet=xe,window.lnCore.hashSet=_e,window.lnCore.hashLinkClick=Se,window.lnCore.resolveHashNamespace=Le,window.lnCore.hashSortEncode=ke,window.lnCore.hashSortDecode=Ee,window.lnCore.hashFilterEncode=qe,window.lnCore.hashFilterDecode=Oe);function De(){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=De),(function(){const e="data-ln-translations",t="lnTranslations";if(window[t]!==void 0)return;const i={"data-ln-translations":{type:"marker",description:"Mounts multi-language translation manager on form container"},"data-ln-translations-default":{prop:"defaultLang",read:w,type:"string",fallback:"",description:"Default primary language code (e.g. en)"},"data-ln-translations-placeholder":{prop:"placeholderLabel",read:w,type:"string",fallback:"{lang} translation",description:"Placeholder label pattern for cloned translation inputs"},"data-ln-translations-remove-label":{prop:"removeLabel",read:w,type:"string",fallback:"Remove {lang}",description:"Accessible label template for translation removal buttons"},"data-ln-translations-locales":{prop:"_localesRaw",read:w,type:"json",fallback:"",description:"JSON dictionary of supported locale codes and display labels"},"data-ln-translations-active":{type:"marker",description:"Container holding active language badge tags"},"data-ln-translations-add":{type:"string",description:"Trigger button action to add specified language translation fields"},"data-ln-translations-lang":{type:"string",description:"Language code associated with active language badge"},"data-ln-translations-prefix":{type:"string",description:"Prefix format pattern for cloned translated field names"},"data-ln-translatable":{type:"marker",description:"Marks form control as translatable into multiple languages"},"data-ln-translatable-lang":{type:"string",description:"Language code assigned to specific translatable input instance"}},l=z(i),r={en:"English",sq:"Shqip",sr:"Srpski"};function s(o){if(this.dom=o,Q(this,o,l),this.activeLanguages=new Set,this.badgesEl=o.querySelector("[data-ln-translations-active]"),this.menuEl=o.querySelector("[data-ln-dropdown] > [data-ln-toggle]"),this.locales=r,this._localesRaw)try{this.locales=JSON.parse(this._localesRaw)}catch{console.warn("[ln-translations] Invalid JSON in data-ln-translations-locales")}this._applyDefaultLang(),this._updateDropdown();const a=this;return this._onRequestAdd=function(n){n.detail&&n.detail.lang&&a.addLanguage(n.detail.lang)},this._onRequestRemove=function(n){n.detail&&n.detail.lang&&a.removeLanguage(n.detail.lang)},o.addEventListener("ln-translations:request-add",this._onRequestAdd),o.addEventListener("ln-translations:request-remove",this._onRequestRemove),this._detectExisting(),this}s.prototype._applyDefaultLang=function(){if(!this.defaultLang)return;const o=this.dom.querySelectorAll("[data-ln-translatable]");for(const a of o){const n=a.querySelectorAll("input:not([data-ln-translatable-lang]), textarea:not([data-ln-translatable-lang]), select:not([data-ln-translatable-lang])");for(const c of n)c.setAttribute("data-ln-translatable-lang",this.defaultLang)}},s.prototype._detectExisting=function(){const o=this.dom.querySelectorAll("[data-ln-translatable-lang]");for(const a of o){const n=a.getAttribute("data-ln-translatable-lang");n&&n!==this.defaultLang&&this.activeLanguages.add(n)}this.activeLanguages.size>0&&(this._updateBadges(),this._updateDropdown())},s.prototype._updateDropdown=function(){if(!this.menuEl)return;this.menuEl.textContent="";const o=this;let a=0;for(const c in this.locales){if(!this.locales.hasOwnProperty(c)||this.activeLanguages.has(c))continue;a++;const u=L("ln-translations-menu-item","ln-translations");if(!u)return;const d=u.querySelector("[data-ln-translations-lang]");d.setAttribute("data-ln-translations-lang",c),d.textContent=this.locales[c],d.addEventListener("click",function(f){f.ctrlKey||f.metaKey||f.button===1||(f.preventDefault(),f.stopPropagation(),o.menuEl.getAttribute("data-ln-toggle")==="open"&&o.menuEl.setAttribute("data-ln-toggle","close"),o.addLanguage(c))}),this.menuEl.appendChild(u)}const n=this.dom.querySelector("[data-ln-translations-add]");n&&(n.hidden=a===0)},s.prototype._updateBadges=function(){if(!this.badgesEl)return;this.badgesEl.textContent="";const o=this;this.activeLanguages.forEach(function(a){const n=L("ln-translations-badge","ln-translations");if(!n)return;const c=n.querySelector("[data-ln-translations-lang]");c.setAttribute("data-ln-translations-lang",a);const u=c.querySelector("span");u.textContent=o.locales[a]||a.toUpperCase();const d=c.querySelector("button"),f=o.locales[a]||a.toUpperCase();d.setAttribute("aria-label",o.removeLabel.replace("{lang}",f)),d.addEventListener("click",function(h){h.ctrlKey||h.metaKey||h.button===1||(h.preventDefault(),h.stopPropagation(),o.removeLanguage(a))}),o.badgesEl.appendChild(n)})},s.prototype.addLanguage=function(o,a){if(this.activeLanguages.has(o))return;const n=this.locales[o]||o;if(F(this.dom,"ln-translations:before-add",{target:this.dom,lang:o,langName:n}).defaultPrevented)return;this.activeLanguages.add(o),a=a||{};const u=this.dom.querySelectorAll("[data-ln-translatable]");for(const d of u){const f=d.getAttribute("data-ln-translatable"),h=d.getAttribute("data-ln-translations-prefix")||"",m=d.querySelector(this.defaultLang?'[data-ln-translatable-lang="'+this.defaultLang+'"]':"input:not([data-ln-translatable-lang]), textarea:not([data-ln-translatable-lang]), select:not([data-ln-translatable-lang])");if(!m)continue;const g=m.cloneNode(m.tagName==="SELECT");h?g.name=h+"[trans]["+o+"]["+f+"]":g.name="trans["+o+"]["+f+"]",g.value=a[f]!==void 0?a[f]:"",g.removeAttribute("id"),"placeholder"in g&&(g.placeholder=this.placeholderLabel.replace("{lang}",n)),g.setAttribute("data-ln-translatable-lang",o);const b=d.querySelectorAll('[data-ln-translatable-lang]:not([data-ln-translatable-lang="'+this.defaultLang+'"])'),A=b.length>0?b[b.length-1]:m;A.parentNode.insertBefore(g,A.nextSibling)}this._updateDropdown(),this._updateBadges(),_(this.dom,"ln-translations:added",{target:this.dom,lang:o,langName:n})},s.prototype.removeLanguage=function(o){if(!this.activeLanguages.has(o)||F(this.dom,"ln-translations:before-remove",{target:this.dom,lang:o}).defaultPrevented)return;const n=this.dom.querySelectorAll('[data-ln-translatable-lang="'+o+'"]');for(const c of n)c.parentNode.removeChild(c);this.activeLanguages.delete(o),this._updateDropdown(),this._updateBadges(),_(this.dom,"ln-translations:removed",{target:this.dom,lang:o})},s.prototype.getActiveLanguages=function(){return new Set(this.activeLanguages)},s.prototype.hasLanguage=function(o){return this.activeLanguages.has(o)},s.prototype.destroy=function(){if(!this.dom[t])return;const o=this.defaultLang,a=this.dom.querySelectorAll("[data-ln-translatable-lang]");for(const n of a)n.getAttribute("data-ln-translatable-lang")!==o&&n.parentNode.removeChild(n);this.dom.removeEventListener("ln-translations:request-add",this._onRequestAdd),this.dom.removeEventListener("ln-translations:request-remove",this._onRequestRemove),delete this.dom[t]},ee(e,t,s,"ln-translations",{attributes:i})})()})();
|
|
1
|
+
(function(){"use strict";function F(){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 _(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 l=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){l=t[i];break}if(!_(l))return}e.apply(console,t)}}function x(e,t,r){const l=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:l}))}function $(e,t,r){const l=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l);const i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:l});return e.dispatchEvent(i),i}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 le(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ae(e,t){const r=!!(t&&t.typed),l=t&&t.exclude,i={},a=e.elements,o={};if(r)for(let s=0;s<a.length;s++){const n=a[s];n.name&&n.type==="checkbox"&&!n.disabled&&(o[n.name]=(o[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")&&!(l&&n.matches&&n.matches(l)))if(n.type==="checkbox")r&&o[n.name]===1?i[n.name]=n.checked:(i[n.name]||(i[n.name]=[]),n.checked&&i[n.name].push(n.value));else if(n.type==="radio")n.checked&&(i[n.name]=n.value);else if(n.type==="select-multiple"){i[n.name]=[];for(let c=0;c<n.options.length;c++)n.options[c].selected&&i[n.name].push(n.options[c].value)}else if(r&&n.type==="hidden")i[n.name]=n.value;else if(r&&(n.type==="number"||n.type==="range")){const c=Number(n.value);i[n.name]=n.value===""||isNaN(c)?null:c}else i[n.name]=n.value}return i}function se(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ce(e,t){const r=e.elements,l=[],i={};for(let a=0;a<r.length;a++){const o=r[a];o.name&&o.type==="checkbox"&&(i[o.name]=(i[o.name]||0)+1)}for(let a=0;a<r.length;a++){const o=r[a];if(o.type==="file"||o.type==="submit"||o.type==="button")continue;const s=o.getAttribute("data-ln-fill-as")||o.name;if(!s||!(s in t))continue;const n=t[s];if(o.type==="checkbox"){if(Array.isArray(n))o.checked=n.indexOf(o.value)!==-1;else if(i[o.name]>1){const c=String(n).split(",").map(function(u){return u.trim()});o.checked=c.indexOf(o.value)!==-1}else o.checked=se(n);l.push(o)}else if(o.type==="radio")o.checked=o.value===String(n),l.push(o);else if(o.type==="select-multiple"){if(Array.isArray(n))for(let c=0;c<o.options.length;c++)o.options[c].selected=n.indexOf(o.options[c].value)!==-1;l.push(o)}else o.value=n,o.tagName==="SELECT"&&n!=null&&o.setAttribute("data-ln-value",n),l.push(o)}return l}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ce,window.lnCore.serializeForm=ae,window.lnCore.resolveFormMethod=le);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 fe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,v(function(){new MutationObserver(function(){x(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const M={};function ge(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];M[r]=t}function he(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=ge,window.lnCore.getLocaleFallback=he,window.lnCore.ensureLocaleObserver=fe);const S={};function L(e,t){S[e]||(S[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=S[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function j(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let o=0;o<r.length;o++){const s=r[o],n=s.getAttribute("data-ln-field");t[n]!=null&&(s.textContent=t[n])}const l=e.querySelectorAll("[data-ln-attr]");for(let o=0;o<l.length;o++){const s=l[o],n=s.getAttribute("data-ln-attr").split(",");for(let c=0;c<n.length;c++){const u=n[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&s.setAttribute(d,t[f])}}const i=e.querySelectorAll("[data-ln-show]");for(let o=0;o<i.length;o++){const s=i[o],n=s.getAttribute("data-ln-show");n in t&&s.classList.toggle("hidden",!t[n])}const a=e.querySelectorAll("[data-ln-class]");for(let o=0;o<a.length;o++){const s=a[o],n=s.getAttribute("data-ln-class").split(",");for(let c=0;c<n.length;c++){const u=n[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&s.classList.toggle(d,!!t[f])}}return e}function pe(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let l=0;l<r.length;l++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[l],t??null),r[l].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)j(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 W(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const a=r.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,s){return t[s]!==void 0?t[s]:""}))}const l=function(a,o){return t[o]!==void 0?t[o]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let a=0;a<i.length;a++){const o=i[a],s=o.attributes;for(let n=0;n<s.length;n++){const c=s[n];c.value.indexOf("{{")!==-1&&o.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,l))}}return e}function we(e,t,r,l,i,a){const o={};for(let n=0;n<e.children.length;n++){const c=e.children[n],u=c.getAttribute("data-ln-render-key");u&&(o[u]=c)}const s=document.createDocumentFragment();for(let n=0;n<t.length;n++){const c=t[n],u=String(l(c));let d=o[u];if(d)i(d,c,n);else{const f=L(r,a);if(!f||(W(f,c),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),i(d,c,n)}s.appendChild(d)}e.textContent="",e.appendChild(s)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=j,window.lnCore.lnFill=pe,window.lnCore.renderList=we);function w(e,t,r){const l=e.getAttribute(t);return l===null?r:l}function U(e,t,r){const l=parseInt(e.getAttribute(t),10);return isNaN(l)?r:l}function V(e,t,r=!1){const l=e.getAttribute(t);if(l===null)return!!r;const i=l.trim().toLowerCase();return!(i==="false"||i==="0")}function P(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const k=new Map;function H(e,t){const r=(e?e.join("|"):"")+"::"+t;if(k.has(r))return k.get(r);const l=new Set(e||[]),i=function(a,o){const s=a.getAttribute(o);return s!==null&&l.has(s)?s:t};return k.set(r,i),i}function K(e,t,r){const l=parseFloat(e.getAttribute(t));return isNaN(l)?r:l}function J(e,t,r){const l=e.getAttribute(t);if(!l)return r;try{return JSON.parse(l)}catch{return r}}function Q(e,t,r,l,i){if(!e||t===null)return!0;const a=l||"ln-component",o=e.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||t===""&&e.fallback!==void 0)return!0;const s=n=>{i?console.warn(n,i):console.warn(n)};if(o==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(s(`[${a}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const n=e.values||[];return n.includes(t)?!0:(s(`[${a}] Invalid value "${t}" for attribute "${r}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(t))return s(`[${a}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(s(`[${a}] Value ${n} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(s(`[${a}] Value ${n} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(o==="float")return isNaN(Number(t))?(s(`[${a}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(t),!0}catch(n){return s(`[${a}] Invalid JSON for attribute "${r}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function z(e,t,r){for(const l in r){const[i,a,o]=r[l];Object.defineProperty(e,l,{get:function(){return i(t,a,o)},enumerable:!0,configurable:!0})}return e}function G(e){const t={};for(const r in e){const l=e[r];if(!l||!l.prop)continue;let i=l.read;if(!i&&l.type)switch(l.type){case"enum":i=H(l.values,l.fallback);break;case"integer":i=U;break;case"float":i=K;break;case"boolean":i=V;break;case"list":i=P;break;case"json":i=J;break;case"string":default:i=w;break}i||(i=w),t[l.prop]=[i,r,l.fallback]}return t}function be(e){const t={};for(const r in e){const l=e[r];l&&l.effect&&(t[r]=l.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 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=z,window.lnCore.attrSpec=G,window.lnCore.attrStr=w,window.lnCore.attrInt=U,window.lnCore.attrBool=V,window.lnCore.attrList=P,window.lnCore.attrEnum=H,window.lnCore.attrFloat=K,window.lnCore.attrJson=J);function y(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(r){console.error("["+t.attribute+"] init failed",e,r)}}}function X(e,t,r,l){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",o={selector:t,attribute:r,ComponentFn:l};if(e.matches&&e.matches(a)&&y(e,o),e.querySelectorAll){const s=e.querySelectorAll(a);for(let n=0;n<s.length;n++)y(s[n],o)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ye(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function 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 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 ve(e){const t=Y(),r=e.observed||[];for(let l=0;l<r.length;l++){const i=r[l];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const l in e.attributes){t.byDeclaredAttr.has(l)||t.byDeclaredAttr.set(l,[]);const i=t.byDeclaredAttr.get(l);i.some(a=>a.componentTag===e.componentTag)||i.push({spec:e.attributes[l],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const l=me(e);if(l===null)t.reactiveWildcard.push(e);else for(const i of l)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function Z(e,t,r,l){for(let i=0;i<e.length;i++){const a=e[i];if(!t[a.attribute])continue;const o=a.effects&&a.effects[r];o?o(t,r,l):a.onAttrChange&&(!a.declared||a.declared.has(r))&&a.onAttrChange(t,r,l)}}function Ae(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,l=Y(),i=l.byAttr.get(t),a=F()&&l.byDeclaredAttr&&l.byDeclaredAttr.has(t);if(!r&&!i&&!a)return;const o=e.target;if(e.oldValue!==o.getAttribute(t)){if(a&&_(o)){const s=l.byDeclaredAttr.get(t),n=o.getAttribute(t);for(let c=0;c<s.length;c++)Q(s[c].spec,n,t,s[c].componentTag,o)}if(window.lnCore._debugSink&&(r||i)&&window.lnCore._debugSink("attr",t,o,{oldValue:e.oldValue,newValue:o.getAttribute(t)}),r){const s=l.byReactive.get(t);s&&Z(s,o,t,e.oldValue),l.reactiveWildcard.length&&Z(l.reactiveWildcard,o,t,e.oldValue)}if(i)for(let s=0;s<i.length;s++){const n=i[s];if(n.handler){n.handler(o,t,e.oldValue);continue}n.onAttributeChange&&o[n.attribute]?n.onAttributeChange(o,t):(X(o,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(o))}}}function _e(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,v(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{Ae(t[r])}catch(l){console.error("[ln-core] mutation handler failed",t[r].target,l)}}).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 q(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function O(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(l){console.error("["+t.attribute+"] destroy failed",e,l)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function xe(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}const l=q();if(e.target&&l.length)for(let i=0;i<l.length;i++){const a=l[i],o=a.query,s=e.target.nodeType===1?e.target.matches&&e.target.matches(o)?e.target:e.target.closest?e.target.closest(o):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(o):null;s&&a.onSubtreeChange(s,e)}for(let i=0;i<e.addedNodes.length;i++){const a=e.addedNodes[i];if(a.nodeType===1){const o=!!(a.firstElementChild||a.children&&a.children.length);for(let s=0;s<t.length;s++){const n=t[s];if(n.selector&&n.attribute&&n.ComponentFn){if(!o)a.matches&&a.matches(n.query)&&y(a,n);else if(a.matches&&a.matches(n.query)&&y(a,n),a.querySelectorAll){const c=a.querySelectorAll(n.query);for(let u=0;u<c.length;u++)y(c[u],n)}}n.onInit&&n.onInit(a)}}}for(let i=0;i<e.removedNodes.length;i++){const a=e.removedNodes[i];if(a.nodeType===1){const o=!!(a.firstElementChild||a.children&&a.children.length);for(let s=0;s<t.length;s++){const n=t[s],c=n.query;if(c){if(!o)a.matches&&a.matches(c)&&O(a,n);else if(a.matches&&a.matches(c)&&O(a,n),a.querySelectorAll){const u=a.querySelectorAll(c);for(let d=0;d<u.length;d++)O(u[d],n)}}}}}}function ee(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,v(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const l=t[r];if(l.type==="childList")try{xe(l)}catch(i){console.error("[ln-core] lifecycle handler failed",l.target,i)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Se(e){E().push(e),e.onSubtreeChange&&e.query&&q().push(e),ee()}function te(e,t,r,l,i={}){const a=i.extraAttributes||[],o=i.onAttributeChange||null,s=i.onSubtreeChange||null,n=i.onInit||null,c=i.onAttrChange||null,u=i.effects||null,d=i.attributes||null,f=d?be(d):u,h=d?new Set(Object.keys(d)):null,m=i.persist||null;function g(R){const p=R||document.body;if(X(p,e,t,r),d&&F())for(const C in d){const Ie=d[C],N=Array.from(p.querySelectorAll("["+C+"]"));p.matches&&p.matches("["+C+"]")&&N.push(p);for(let T=0;T<N.length;T++){const I=N[T];_(I)&&Q(Ie,I.getAttribute(C),C,l,I)}}n&&n(p)}const b=[];if(e.indexOf("[")!==-1){const R=/\[([\w-]+)/g;let p;for(;(p=R.exec(e))!==null;)b.push(p[1])}else b.push(e);ve({selector:e,attribute:t,componentTag:l,attributes:d,ComponentFn:r,onInit:n,observed:b.concat(a),onAttributeChange:o,onAttrChange:c,effects:f,declared:h,persist:m}),_e();const A=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,oe=i.subtreeQuery||(A?e:"["+e+"]"),re={selector:e,attribute:t,ComponentFn:r,onInit:n,onSubtreeChange:s,query:oe};E().push(re),s&&oe&&q().push(re),ee(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=te,window.lnCore.observeLifecycle=Se);function ie(){ye()>0?Ce(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ie):ie(),g}function ne(e){return(e||"").replace(/^#/,"")}function D(e){const t=e===void 0?location.hash:e,r={},l=ne(t);if(!l)return r;const i=l.split("&");for(let a=0;a<i.length;a++){const o=i[a];if(!o)continue;const s=o.indexOf(":"),n=s>-1?o.slice(0,s):o,c=s>-1?o.slice(s+1):"";if(n)try{r[n]=decodeURIComponent(c)}catch{r[n]=c}}return r}function Le(e){if(!e)return null;const t=D();return e in t?t[e]:null}function ke(e,t){if(!e)return;const r=D();t==null?delete r[e]:r[e]=String(t);const i=Object.keys(r).map(function(a){const o=r[a];return o===""?a:a+":"+encodeURIComponent(o)}).join("&");ne(location.hash)!==i&&(location.hash=i)}function Ee(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function qe(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 l=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return l?t?l+"-"+t:l:t||null}function Oe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function De(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 Ne(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),l=e.slice(t+1),i=l?l.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:r,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=D,window.lnCore.hashGet=Le,window.lnCore.hashSet=ke,window.lnCore.hashLinkClick=Ee,window.lnCore.resolveHashNamespace=qe,window.lnCore.hashSortEncode=Oe,window.lnCore.hashSortDecode=De,window.lnCore.hashFilterEncode=Re,window.lnCore.hashFilterDecode=Ne);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(){const e="data-ln-translations",t="lnTranslations";if(window[t]!==void 0)return;const r={"data-ln-translations":{type:"marker",description:"Mounts multi-language translation manager on form container"},"data-ln-translations-default":{prop:"defaultLang",read:w,type:"string",fallback:"",description:"Default primary language code (e.g. en)"},"data-ln-translations-placeholder":{prop:"placeholderLabel",read:w,type:"string",fallback:"{lang} translation",description:"Placeholder label pattern for cloned translation inputs"},"data-ln-translations-remove-label":{prop:"removeLabel",read:w,type:"string",fallback:"Remove {lang}",description:"Accessible label template for translation removal buttons"},"data-ln-translations-locales":{prop:"_localesRaw",read:w,type:"json",fallback:"",description:"JSON dictionary of supported locale codes and display labels"},"data-ln-translations-active":{type:"marker",description:"Container holding active language badge tags"},"data-ln-translations-add":{type:"string",description:"Trigger button action to add specified language translation fields"},"data-ln-translations-lang":{type:"string",description:"Language code associated with active language badge"},"data-ln-translations-prefix":{type:"string",description:"Prefix format pattern for cloned translated field names"},"data-ln-translatable":{type:"marker",description:"Marks form control as translatable into multiple languages"},"data-ln-translatable-lang":{type:"string",description:"Language code assigned to specific translatable input instance"}},l=G(r),i={en:"English",sq:"Shqip",sr:"Srpski"};function a(o){if(this.dom=o,z(this,o,l),this.activeLanguages=new Set,this.badgesEl=o.querySelector("[data-ln-translations-active]"),this.menuEl=o.querySelector("[data-ln-dropdown] > [data-ln-toggle]"),this.locales=i,this._localesRaw)try{this.locales=JSON.parse(this._localesRaw)}catch{console.warn("[ln-translations] Invalid JSON in data-ln-translations-locales")}this._applyDefaultLang(),this._updateDropdown();const s=this;return this._onRequestAdd=function(n){n.detail&&n.detail.lang&&s.addLanguage(n.detail.lang)},this._onRequestRemove=function(n){n.detail&&n.detail.lang&&s.removeLanguage(n.detail.lang)},o.addEventListener("ln-translations:request-add",this._onRequestAdd),o.addEventListener("ln-translations:request-remove",this._onRequestRemove),this._detectExisting(),this}a.prototype._applyDefaultLang=function(){if(!this.defaultLang)return;const o=this.dom.querySelectorAll("[data-ln-translatable]");for(const s of o){const n=s.querySelectorAll("input:not([data-ln-translatable-lang]), textarea:not([data-ln-translatable-lang]), select:not([data-ln-translatable-lang])");for(const c of n)c.setAttribute("data-ln-translatable-lang",this.defaultLang)}},a.prototype._detectExisting=function(){const o=this.dom.querySelectorAll("[data-ln-translatable-lang]");for(const s of o){const n=s.getAttribute("data-ln-translatable-lang");n&&n!==this.defaultLang&&this.activeLanguages.add(n)}this.activeLanguages.size>0&&(this._updateBadges(),this._updateDropdown())},a.prototype._updateDropdown=function(){if(!this.menuEl)return;this.menuEl.textContent="";const o=this;let s=0;for(const c in this.locales){if(!this.locales.hasOwnProperty(c)||this.activeLanguages.has(c))continue;s++;const u=L("ln-translations-menu-item","ln-translations");if(!u)return;const d=u.querySelector("[data-ln-translations-lang]");d.setAttribute("data-ln-translations-lang",c),d.textContent=this.locales[c],d.addEventListener("click",function(f){f.ctrlKey||f.metaKey||f.button===1||(f.preventDefault(),f.stopPropagation(),o.menuEl.getAttribute("data-ln-toggle")==="open"&&o.menuEl.setAttribute("data-ln-toggle","close"),o.addLanguage(c))}),this.menuEl.appendChild(u)}const n=this.dom.querySelector("[data-ln-translations-add]");n&&(n.hidden=s===0)},a.prototype._updateBadges=function(){if(!this.badgesEl)return;this.badgesEl.textContent="";const o=this;this.activeLanguages.forEach(function(s){const n=L("ln-translations-badge","ln-translations");if(!n)return;const c=n.querySelector("[data-ln-translations-lang]");c.setAttribute("data-ln-translations-lang",s);const u=c.querySelector("span");u.textContent=o.locales[s]||s.toUpperCase();const d=c.querySelector("button"),f=o.locales[s]||s.toUpperCase();d.setAttribute("aria-label",o.removeLabel.replace("{lang}",f)),d.addEventListener("click",function(h){h.ctrlKey||h.metaKey||h.button===1||(h.preventDefault(),h.stopPropagation(),o.removeLanguage(s))}),o.badgesEl.appendChild(n)})},a.prototype.addLanguage=function(o,s){if(this.activeLanguages.has(o))return;const n=this.locales[o]||o;if($(this.dom,"ln-translations:before-add",{target:this.dom,lang:o,langName:n}).defaultPrevented)return;this.activeLanguages.add(o),s=s||{};const u=this.dom.querySelectorAll("[data-ln-translatable]");for(const d of u){const f=d.getAttribute("data-ln-translatable"),h=d.getAttribute("data-ln-translations-prefix")||"",m=d.querySelector(this.defaultLang?'[data-ln-translatable-lang="'+this.defaultLang+'"]':"input:not([data-ln-translatable-lang]), textarea:not([data-ln-translatable-lang]), select:not([data-ln-translatable-lang])");if(!m)continue;const g=m.cloneNode(m.tagName==="SELECT");h?g.name=h+"[trans]["+o+"]["+f+"]":g.name="trans["+o+"]["+f+"]",g.value=s[f]!==void 0?s[f]:"",g.removeAttribute("id"),"placeholder"in g&&(g.placeholder=this.placeholderLabel.replace("{lang}",n)),g.setAttribute("data-ln-translatable-lang",o);const b=d.querySelectorAll('[data-ln-translatable-lang]:not([data-ln-translatable-lang="'+this.defaultLang+'"])'),A=b.length>0?b[b.length-1]:m;A.parentNode.insertBefore(g,A.nextSibling)}this._updateDropdown(),this._updateBadges(),x(this.dom,"ln-translations:added",{target:this.dom,lang:o,langName:n})},a.prototype.removeLanguage=function(o){if(!this.activeLanguages.has(o)||$(this.dom,"ln-translations:before-remove",{target:this.dom,lang:o}).defaultPrevented)return;const n=this.dom.querySelectorAll('[data-ln-translatable-lang="'+o+'"]');for(const c of n)c.parentNode.removeChild(c);this.activeLanguages.delete(o),this._updateDropdown(),this._updateBadges(),x(this.dom,"ln-translations:removed",{target:this.dom,lang:o})},a.prototype.getActiveLanguages=function(){return new Set(this.activeLanguages)},a.prototype.hasLanguage=function(o){return this.activeLanguages.has(o)},a.prototype.destroy=function(){if(!this.dom[t])return;const o=this.defaultLang,s=this.dom.querySelectorAll("[data-ln-translatable-lang]");for(const n of s)n.getAttribute("data-ln-translatable-lang")!==o&&n.parentNode.removeChild(n);this.dom.removeEventListener("ln-translations:request-add",this._onRequestAdd),this.dom.removeEventListener("ln-translations:request-remove",this._onRequestRemove),delete this.dom[t]},te(e,t,a,"ln-translations",{attributes:r})})()})();
|
|
@@ -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 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 i=null;for(let r=1;r<t.length;r++)if(t[r]&&t[r].nodeType===1){i=t[r];break}if(!A(i))return}e.apply(console,t)}}function h(e,t,l){const i=l||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function m(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){m(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Z(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ee(e,t){const l=!!(t&&t.typed),i=t&&t.exclude,r={},s=e.elements,o={};if(l)for(let c=0;c<s.length;c++){const n=s[c];n.name&&n.type==="checkbox"&&!n.disabled&&(o[n.name]=(o[n.name]||0)+1)}for(let c=0;c<s.length;c++){const n=s[c];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(i&&n.matches&&n.matches(i)))if(n.type==="checkbox")l&&o[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 a=0;a<n.options.length;a++)n.options[a].selected&&r[n.name].push(n.options[a].value)}else if(l&&n.type==="hidden")r[n.name]=n.value;else if(l&&(n.type==="number"||n.type==="range")){const a=Number(n.value);r[n.name]=n.value===""||isNaN(a)?null:a}else r[n.name]=n.value}return r}function te(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ne(e,t){const l=e.elements,i=[],r={};for(let s=0;s<l.length;s++){const o=l[s];o.name&&o.type==="checkbox"&&(r[o.name]=(r[o.name]||0)+1)}for(let s=0;s<l.length;s++){const o=l[s];if(o.type==="file"||o.type==="submit"||o.type==="button")continue;const c=o.getAttribute("data-ln-fill-as")||o.name;if(!c||!(c in t))continue;const n=t[c];if(o.type==="checkbox"){if(Array.isArray(n))o.checked=n.indexOf(o.value)!==-1;else if(r[o.name]>1){const a=String(n).split(",").map(function(d){return d.trim()});o.checked=a.indexOf(o.value)!==-1}else o.checked=te(n);i.push(o)}else if(o.type==="radio")o.checked=o.value===String(n),i.push(o);else if(o.type==="select-multiple"){if(Array.isArray(n))for(let a=0;a<o.options.length;a++)o.options[a].selected=n.indexOf(o.options[a].value)!==-1;i.push(o)}else o.value=n,o.tagName==="SELECT"&&n!=null&&o.setAttribute("data-ln-value",n),i.push(o)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ne,window.lnCore.serializeForm=ee,window.lnCore.resolveFormMethod=Z);const F={};function oe(e,t){F[e]=t}function re(e){return F[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=oe,window.lnCore.getDataMapper=re);function ie(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,m(function(){new MutationObserver(function(){h(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function le(e,t){if(!e||typeof t!="object")return;const l=e.toLowerCase().split("-")[0];$[l]=t}function se(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=le,window.lnCore.getLocaleFallback=se,window.lnCore.ensureLocaleObserver=ie);const v={};function ce(e,t){v[e]||(v[e]=document.querySelector('[data-ln-template="'+e+'"]'));const l=v[e];return l?l.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function T(e,t){if(!e||!t)return e;const l=e.querySelectorAll("[data-ln-field]");for(let o=0;o<l.length;o++){const c=l[o],n=c.getAttribute("data-ln-field");t[n]!=null&&(c.textContent=t[n])}const i=e.querySelectorAll("[data-ln-attr]");for(let o=0;o<i.length;o++){const c=i[o],n=c.getAttribute("data-ln-attr").split(",");for(let a=0;a<n.length;a++){const d=n[a].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();t[f]!=null&&c.setAttribute(u,t[f])}}const r=e.querySelectorAll("[data-ln-show]");for(let o=0;o<r.length;o++){const c=r[o],n=c.getAttribute("data-ln-show");n in t&&c.classList.toggle("hidden",!t[n])}const s=e.querySelectorAll("[data-ln-class]");for(let o=0;o<s.length;o++){const c=s[o],n=c.getAttribute("data-ln-class").split(",");for(let a=0;a<n.length;a++){const d=n[a].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();f in t&&c.classList.toggle(u,!!t[f])}}return e}function ae(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const l=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<l.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",l[i],t??null),l[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)T(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let l=0;l<t.length;l++)t[l].textContent=""}})));function N(e,t){if(!e||!t)return e;const l=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;l.nextNode();){const s=l.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,c){return t[c]!==void 0?t[c]:""}))}const i=function(s,o){return t[o]!==void 0?t[o]:""},r=Array.from(e.querySelectorAll("*"));e.nodeType===1&&r.push(e);for(let s=0;s<r.length;s++){const o=r[s],c=o.attributes;for(let n=0;n<c.length;n++){const a=c[n];a.value.indexOf("{{")!==-1&&o.setAttribute(a.name,a.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function de(e,t,l,i,r,s){const o={};for(let n=0;n<e.children.length;n++){const a=e.children[n],d=a.getAttribute("data-ln-render-key");d&&(o[d]=a)}const c=document.createDocumentFragment();for(let n=0;n<t.length;n++){const a=t[n],d=String(i(a));let u=o[d];if(u)r(u,a,n);else{const f=ce(l,s);if(!f||(N(f,a),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),r(u,a,n)}c.appendChild(u)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=N,window.lnCore.fill=T,window.lnCore.lnFill=ae,window.lnCore.renderList=de);function x(e,t,l){const i=e.getAttribute(t);return i===null?l:i}function B(e,t,l){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?l:i}function R(e,t,l=!1){const i=e.getAttribute(t);if(i===null)return!!l;const r=i.trim().toLowerCase();return!(r==="false"||r==="0")}function j(e,t){return(e.getAttribute(t)||"").split(",").map(l=>l.trim()).filter(Boolean)}const k=new Map;function W(e,t){const l=(e?e.join("|"):"")+"::"+t;if(k.has(l))return k.get(l);const i=new Set(e||[]),r=function(s,o){const c=s.getAttribute(o);return c!==null&&i.has(c)?c:t};return k.set(l,r),r}function U(e,t,l){const i=parseFloat(e.getAttribute(t));return isNaN(i)?l:i}function H(e,t,l){const i=e.getAttribute(t);if(!i)return l;try{return JSON.parse(i)}catch{return l}}function V(e,t,l,i,r){if(!e||t===null)return!0;const s=i||"ln-component",o=e.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||t===""&&e.fallback!==void 0)return!0;const c=n=>{r?console.warn(n,r):console.warn(n)};if(o==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${l}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const n=e.values||[];return n.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${l}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${l}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(c(`[${s}] Value ${n} for attribute "${l}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(c(`[${s}] Value ${n} for attribute "${l}" is greater than max (${e.max}).`),!1):!0}if(o==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${l}". Fallback: ${e.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(t),!0}catch(n){return c(`[${s}] Invalid JSON for attribute "${l}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function ue(e,t,l){for(const i in l){const[r,s,o]=l[i];Object.defineProperty(e,i,{get:function(){return r(t,s,o)},enumerable:!0,configurable:!0})}return e}function fe(e){const t={};for(const l in e){const i=e[l];if(!i||!i.prop)continue;let r=i.read;if(!r&&i.type)switch(i.type){case"enum":r=W(i.values,i.fallback);break;case"integer":r=B;break;case"float":r=U;break;case"boolean":r=R;break;case"list":r=j;break;case"json":r=H;break;case"string":default:r=x;break}r||(r=x),t[i.prop]=[r,l,i.fallback]}return t}function we(e){const t={};for(const l in e){const i=e[l];i&&i.effect&&(t[l]=i.effect)}return Object.keys(t).length?t:null}function he(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const l in e.effects)t.add(l);if(e.onAttrChange&&e.declared)for(const l of e.declared)t.add(l);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ue,window.lnCore.attrSpec=fe,window.lnCore.attrStr=x,window.lnCore.attrInt=B,window.lnCore.attrBool=R,window.lnCore.attrList=j,window.lnCore.attrEnum=W,window.lnCore.attrFloat=U,window.lnCore.attrJson=H);function b(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(l){console.error("["+t.attribute+"] init failed",e,l)}}}function K(e,t,l,i){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",o={selector:t,attribute:l,ComponentFn:i};if(e.matches&&e.matches(s)&&b(e,o),e.querySelectorAll){const c=e.querySelectorAll(s);for(let n=0;n<c.length;n++)b(c[n],o)}}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 pe(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 Q(){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=Q(),l=e.observed||[];for(let i=0;i<l.length;i++){const r=l[i];t.byAttr.has(r)||t.byAttr.set(r,[]),t.byAttr.get(r).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const r=t.byDeclaredAttr.get(i);r.some(s=>s.componentTag===e.componentTag)||r.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=he(e);if(i===null)t.reactiveWildcard.push(e);else for(const r of i)t.byReactive.has(r)||t.byReactive.set(r,[]),t.byReactive.get(r).push(e)}e.persist&&t.persist.push(e)}function J(e,t,l,i){for(let r=0;r<e.length;r++){const s=e[r];if(!t[s.attribute])continue;const o=s.effects&&s.effects[l];o?o(t,l,i):s.onAttrChange&&(!s.declared||s.declared.has(l))&&s.onAttrChange(t,l,i)}}function me(e){const t=e.attributeName,l=t.indexOf("data-ln-")===0,i=Q(),r=i.byAttr.get(t),s=M()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!l&&!r&&!s)return;const o=e.target;if(e.oldValue!==o.getAttribute(t)){if(s&&A(o)){const c=i.byDeclaredAttr.get(t),n=o.getAttribute(t);for(let a=0;a<c.length;a++)V(c[a].spec,n,t,c[a].componentTag,o)}if(window.lnCore._debugSink&&(l||r)&&window.lnCore._debugSink("attr",t,o,{oldValue:e.oldValue,newValue:o.getAttribute(t)}),l){const c=i.byReactive.get(t);c&&J(c,o,t,e.oldValue),i.reactiveWildcard.length&&J(i.reactiveWildcard,o,t,e.oldValue)}if(r)for(let c=0;c<r.length;c++){const n=r[c];if(n.handler){n.handler(o,t,e.oldValue);continue}n.onAttributeChange&&o[n.attribute]?n.onAttributeChange(o,t):(K(o,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(o))}}}function Ce(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,m(function(){new MutationObserver(function(t){for(let l=0;l<t.length;l++)try{me(t[l])}catch(i){console.error("[ln-core] mutation handler failed",t[l].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function _(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function S(e,t){if(!document.contains(e))if(t.attribute){const l=e[t.attribute];if(l&&typeof l.destroy=="function")try{l.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ye(e){const t=_();if(!t.length)return;const l=e.target;if(l){const i=l.nodeType===1?l:l.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let i=0;i<t.length;i++){const r=t[i];if(r.onSubtreeChange&&r.query){const s=r.query,o=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;o&&r.onSubtreeChange(o,e)}}for(let i=0;i<e.addedNodes.length;i++){const r=e.addedNodes[i];if(r.nodeType===1){const s=!!(r.firstElementChild||r.children&&r.children.length);for(let o=0;o<t.length;o++){const c=t[o];if(c.selector&&c.attribute&&c.ComponentFn){if(!s)r.matches&&r.matches(c.query)&&b(r,c);else if(r.matches&&r.matches(c.query)&&b(r,c),r.querySelectorAll){const n=r.querySelectorAll(c.query);for(let a=0;a<n.length;a++)b(n[a],c)}}c.onInit&&c.onInit(r)}}}for(let i=0;i<e.removedNodes.length;i++){const r=e.removedNodes[i];if(r.nodeType===1){const s=!!(r.firstElementChild||r.children&&r.children.length);for(let o=0;o<t.length;o++){const c=t[o],n=c.query;if(n){if(!s)r.matches&&r.matches(n)&&S(r,c);else if(r.matches&&r.matches(n)&&S(r,c),r.querySelectorAll){const a=r.querySelectorAll(n);for(let d=0;d<a.length;d++)S(a[d],c)}}}}}}function z(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,m(function(){new MutationObserver(function(t){for(let l=0;l<t.length;l++){const i=t[l];if(i.type==="childList")try{ye(i)}catch(r){console.error("[ln-core] lifecycle handler failed",i.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ae(e){_().push(e),z()}function G(e,t,l,i,r={}){const s=r.extraAttributes||[],o=r.onAttributeChange||null,c=r.onSubtreeChange||null,n=r.onInit||null,a=r.onAttrChange||null,d=r.effects||null,u=r.attributes||null,f=u?we(u):d,Oe=u?new Set(Object.keys(u)):null,Le=r.persist||null;function y(L){const w=L||document.body;if(K(w,e,t,l),u&&M())for(const g in u){const Ie=u[g],q=Array.from(w.querySelectorAll("["+g+"]"));w.matches&&w.matches("["+g+"]")&&q.push(w);for(let D=0;D<q.length;D++){const I=q[D];A(I)&&V(Ie,I.getAttribute(g),g,i,I)}}n&&n(w)}const O=[];if(e.indexOf("[")!==-1){const L=/\[([\w-]+)/g;let w;for(;(w=L.exec(e))!==null;)O.push(w[1])}else O.push(e);ge({selector:e,attribute:t,componentTag:i,attributes:u,ComponentFn:l,onInit:n,observed:O.concat(s),onAttributeChange:o,onAttrChange:a,effects:f,declared:Oe,persist:Le}),Ce();const qe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,De=r.subtreeQuery||(qe?e:"["+e+"]");_().push({selector:e,attribute:t,ComponentFn:l,onInit:n,onSubtreeChange:c,query:De}),z(),window[t]=y,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=G,window.lnCore.observeLifecycle=Ae);function Y(){be()>0?pe(function(){y(document.body)}):y(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Y):Y(),y}function P(e){return(e||"").replace(/^#/,"")}function p(e){const t=e===void 0?location.hash:e,l={},i=P(t);if(!i)return l;const r=i.split("&");for(let s=0;s<r.length;s++){const o=r[s];if(!o)continue;const c=o.indexOf(":"),n=c>-1?o.slice(0,c):o,a=c>-1?o.slice(c+1):"";if(n)try{l[n]=decodeURIComponent(a)}catch{l[n]=a}}return l}function E(e){if(!e)return null;const t=p();return e in t?t[e]:null}function C(e,t){if(!e)return;const l=p();t==null?delete l[e]:l[e]=String(t);const r=Object.keys(l).map(function(s){const o=l[s];return o===""?s:s+":"+encodeURIComponent(o)}).join("&");P(location.hash)!==r&&(location.hash=r)}function X(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ve(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const l=e.getAttribute("data-ln-hash");if(l&&l.trim()!=="")return l.trim();const 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 xe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ke(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 _e(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Se(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const l=e.slice(0,t),i=e.slice(t+1),r=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:l,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=p,window.lnCore.hashGet=E,window.lnCore.hashSet=C,window.lnCore.hashLinkClick=X,window.lnCore.resolveHashNamespace=ve,window.lnCore.hashSortEncode=xe,window.lnCore.hashSortDecode=ke,window.lnCore.hashFilterEncode=_e,window.lnCore.hashFilterDecode=Se);function Ee(){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=Ee),(function(){const e="data-ln-ui-coordinator",t="lnUiCoordinator";if(window[t]!==void 0)return;const l={"data-ln-ui-coordinator":{type:"marker",description:"Mounts UI coordinator mediating global hash-routing, modals, and toasts"}};document.addEventListener("click",function(s){if(s.ctrlKey||s.metaKey||s.button===1)return;const o=s.target.closest('a[href^="#"]');if(!o)return;const c=o.getAttribute("href"),n=p(c);for(const a in n){const d=document.getElementById(a);if(d&&d.lnModal){if(!X(s))return;C(a,n[a]),d.lnModal.isOpen||h(d,"ln-modal:request-open",{});return}}});function i(){const s=location.hash;if(!s)return;const o=p(s);for(const c in o){const n=document.getElementById(c);n&&n.lnModal&&!n.lnModal.isOpen&&h(n,"ln-modal:request-open",{})}}window.addEventListener("hashchange",i),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",i):i(),document.addEventListener("ln-modal:close",function(s){const o=s.target;o&&o.id&&E(o.id)!==null&&C(o.id,null)}),document.addEventListener("ln-ajax:success",function(s){const c=(s.detail||{}).data;if(c&&c.message){const a=c.message;h(window,"ln-toast:enqueue",{type:a.type||"success",title:a.title||"",message:typeof a=="string"?a:a.body||""})}const n=s.target.closest("[data-ln-modal]");n&&n.lnModal&&(n.id&&E(n.id)!==null&&C(n.id,null),h(n,"ln-modal:request-close",{}))}),document.addEventListener("ln-ajax:error",function(s){const c=(s.detail||{}).data;if(c&&c.message){const n=c.message;h(window,"ln-toast:enqueue",{type:n.type||"error",title:n.title||"",message:typeof n=="string"?n:n.body||""})}}),document.addEventListener("ln-upload:error",function(s){const o=s.detail||{};o.message&&h(window,"ln-toast:enqueue",{type:"error",title:"",message:o.message})});function r(s){return this.dom=s,this}r.prototype.destroy=function(){delete this.dom[t]},G(e,t,r,"ln-ui-coordinator",{attributes:l})})()})();
|
|
1
|
+
(function(){"use strict";function F(){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 i=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){i=t[l];break}if(!A(i))return}e.apply(console,t)}}function h(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 m(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){m(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,l={},s=e.elements,o={};if(r)for(let c=0;c<s.length;c++){const n=s[c];n.name&&n.type==="checkbox"&&!n.disabled&&(o[n.name]=(o[n.name]||0)+1)}for(let c=0;c<s.length;c++){const n=s[c];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(i&&n.matches&&n.matches(i)))if(n.type==="checkbox")r&&o[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 a=0;a<n.options.length;a++)n.options[a].selected&&l[n.name].push(n.options[a].value)}else if(r&&n.type==="hidden")l[n.name]=n.value;else if(r&&(n.type==="number"||n.type==="range")){const a=Number(n.value);l[n.name]=n.value===""||isNaN(a)?null:a}else l[n.name]=n.value}return l}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=[],l={};for(let s=0;s<r.length;s++){const o=r[s];o.name&&o.type==="checkbox"&&(l[o.name]=(l[o.name]||0)+1)}for(let s=0;s<r.length;s++){const o=r[s];if(o.type==="file"||o.type==="submit"||o.type==="button")continue;const c=o.getAttribute("data-ln-fill-as")||o.name;if(!c||!(c in t))continue;const n=t[c];if(o.type==="checkbox"){if(Array.isArray(n))o.checked=n.indexOf(o.value)!==-1;else if(l[o.name]>1){const a=String(n).split(",").map(function(u){return u.trim()});o.checked=a.indexOf(o.value)!==-1}else o.checked=re(n);i.push(o)}else if(o.type==="radio")o.checked=o.value===String(n),i.push(o);else if(o.type==="select-multiple"){if(Array.isArray(n))for(let a=0;a<o.options.length;a++)o.options[a].selected=n.indexOf(o.options[a].value)!==-1;i.push(o)}else o.value=n,o.tagName==="SELECT"&&n!=null&&o.setAttribute("data-ln-value",n),i.push(o)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ie,window.lnCore.serializeForm=oe,window.lnCore.resolveFormMethod=ne);const $={};function le(e,t){$[e]=t}function se(e){return $[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=le,window.lnCore.getDataMapper=se);function ce(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,m(function(){new MutationObserver(function(){h(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const T={};function ae(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];T[r]=t}function ue(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ae,window.lnCore.getLocaleFallback=ue,window.lnCore.ensureLocaleObserver=ce);const v={};function de(e,t){v[e]||(v[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=v[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function N(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let o=0;o<r.length;o++){const c=r[o],n=c.getAttribute("data-ln-field");t[n]!=null&&(c.textContent=t[n])}const i=e.querySelectorAll("[data-ln-attr]");for(let o=0;o<i.length;o++){const c=i[o],n=c.getAttribute("data-ln-attr").split(",");for(let a=0;a<n.length;a++){const u=n[a].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let o=0;o<l.length;o++){const c=l[o],n=c.getAttribute("data-ln-show");n in t&&c.classList.toggle("hidden",!t[n])}const s=e.querySelectorAll("[data-ln-class]");for(let o=0;o<s.length;o++){const c=s[o],n=c.getAttribute("data-ln-class").split(",");for(let a=0;a<n.length;a++){const u=n[a].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}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)N(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 R(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const s=r.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,c){return t[c]!==void 0?t[c]:""}))}const i=function(s,o){return t[o]!==void 0?t[o]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const o=l[s],c=o.attributes;for(let n=0;n<c.length;n++){const a=c[n];a.value.indexOf("{{")!==-1&&o.setAttribute(a.name,a.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function we(e,t,r,i,l,s){const o={};for(let n=0;n<e.children.length;n++){const a=e.children[n],u=a.getAttribute("data-ln-render-key");u&&(o[u]=a)}const c=document.createDocumentFragment();for(let n=0;n<t.length;n++){const a=t[n],u=String(i(a));let d=o[u];if(d)l(d,a,n);else{const f=de(r,s);if(!f||(R(f,a),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),l(d,a,n)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=R,window.lnCore.fill=N,window.lnCore.lnFill=fe,window.lnCore.renderList=we);function x(e,t,r){const i=e.getAttribute(t);return i===null?r:i}function B(e,t,r){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?r:i}function j(e,t,r=!1){const i=e.getAttribute(t);if(i===null)return!!r;const l=i.trim().toLowerCase();return!(l==="false"||l==="0")}function W(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const _=new Map;function U(e,t){const r=(e?e.join("|"):"")+"::"+t;if(_.has(r))return _.get(r);const i=new Set(e||[]),l=function(s,o){const c=s.getAttribute(o);return c!==null&&i.has(c)?c:t};return _.set(r,l),l}function H(e,t,r){const i=parseFloat(e.getAttribute(t));return isNaN(i)?r:i}function V(e,t,r){const i=e.getAttribute(t);if(!i)return r;try{return JSON.parse(i)}catch{return r}}function K(e,t,r,i,l){if(!e||t===null)return!0;const s=i||"ln-component",o=e.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||t===""&&e.fallback!==void 0)return!0;const c=n=>{l?console.warn(n,l):console.warn(n)};if(o==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const n=e.values||[];return n.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${r}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(c(`[${s}] Value ${n} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(c(`[${s}] Value ${n} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(o==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(t),!0}catch(n){return c(`[${s}] Invalid JSON for attribute "${r}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function he(e,t,r){for(const i in r){const[l,s,o]=r[i];Object.defineProperty(e,i,{get:function(){return l(t,s,o)},enumerable:!0,configurable:!0})}return e}function be(e){const t={};for(const r in e){const i=e[r];if(!i||!i.prop)continue;let l=i.read;if(!l&&i.type)switch(i.type){case"enum":l=U(i.values,i.fallback);break;case"integer":l=B;break;case"float":l=H;break;case"boolean":l=j;break;case"list":l=W;break;case"json":l=V;break;case"string":default:l=x;break}l||(l=x),t[i.prop]=[l,r,i.fallback]}return t}function pe(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 ge(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=he,window.lnCore.attrSpec=be,window.lnCore.attrStr=x,window.lnCore.attrInt=B,window.lnCore.attrBool=j,window.lnCore.attrList=W,window.lnCore.attrEnum=U,window.lnCore.attrFloat=H,window.lnCore.attrJson=V);function b(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 Q(e,t,r,i){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",o={selector:t,attribute:r,ComponentFn:i};if(e.matches&&e.matches(s)&&b(e,o),e.querySelectorAll){const c=e.querySelectorAll(s);for(let n=0;n<c.length;n++)b(c[n],o)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function me(){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 J(){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=J(),r=e.observed||[];for(let i=0;i<r.length;i++){const l=r[i];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 i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const l=t.byDeclaredAttr.get(i);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=ge(e);if(i===null)t.reactiveWildcard.push(e);else for(const l of i)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function z(e,t,r,i){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const o=s.effects&&s.effects[r];o?o(t,r,i):s.onAttrChange&&(!s.declared||s.declared.has(r))&&s.onAttrChange(t,r,i)}}function Ae(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,i=J(),l=i.byAttr.get(t),s=F()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!r&&!l&&!s)return;const o=e.target;if(e.oldValue!==o.getAttribute(t)){if(s&&A(o)){const c=i.byDeclaredAttr.get(t),n=o.getAttribute(t);for(let a=0;a<c.length;a++)K(c[a].spec,n,t,c[a].componentTag,o)}if(window.lnCore._debugSink&&(r||l)&&window.lnCore._debugSink("attr",t,o,{oldValue:e.oldValue,newValue:o.getAttribute(t)}),r){const c=i.byReactive.get(t);c&&z(c,o,t,e.oldValue),i.reactiveWildcard.length&&z(i.reactiveWildcard,o,t,e.oldValue)}if(l)for(let c=0;c<l.length;c++){const n=l[c];if(n.handler){n.handler(o,t,e.oldValue);continue}n.onAttributeChange&&o[n.attribute]?n.onAttributeChange(o,t):(Q(o,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(o))}}}function ve(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,m(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{Ae(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 k(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function S(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function E(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 xe(e){const t=k();if(!t.length)return;const r=e.target;if(r){const l=r.nodeType===1?r:r.parentElement;if(l&&(l.isContentEditable||l.closest&&l.closest('[contenteditable]:not([contenteditable="false"])')))return}const i=S();if(e.target&&i.length)for(let l=0;l<i.length;l++){const s=i[l],o=s.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(o)?e.target:e.target.closest?e.target.closest(o):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(o):null;c&&s.onSubtreeChange(c,e)}for(let l=0;l<e.addedNodes.length;l++){const s=e.addedNodes[l];if(s.nodeType===1){const o=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const n=t[c];if(n.selector&&n.attribute&&n.ComponentFn){if(!o)s.matches&&s.matches(n.query)&&b(s,n);else if(s.matches&&s.matches(n.query)&&b(s,n),s.querySelectorAll){const a=s.querySelectorAll(n.query);for(let u=0;u<a.length;u++)b(a[u],n)}}n.onInit&&n.onInit(s)}}}for(let l=0;l<e.removedNodes.length;l++){const s=e.removedNodes[l];if(s.nodeType===1){const o=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const n=t[c],a=n.query;if(a){if(!o)s.matches&&s.matches(a)&&E(s,n);else if(s.matches&&s.matches(a)&&E(s,n),s.querySelectorAll){const u=s.querySelectorAll(a);for(let d=0;d<u.length;d++)E(u[d],n)}}}}}}function G(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,m(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.type==="childList")try{xe(i)}catch(l){console.error("[ln-core] lifecycle handler failed",i.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function _e(e){k().push(e),e.onSubtreeChange&&e.query&&S().push(e),G()}function P(e,t,r,i,l={}){const s=l.extraAttributes||[],o=l.onAttributeChange||null,c=l.onSubtreeChange||null,n=l.onInit||null,a=l.onAttrChange||null,u=l.effects||null,d=l.attributes||null,f=d?pe(d):u,De=d?new Set(Object.keys(d)):null,Ie=l.persist||null;function y(q){const w=q||document.body;if(Q(w,e,t,r),d&&F())for(const g in d){const Fe=d[g],D=Array.from(w.querySelectorAll("["+g+"]"));w.matches&&w.matches("["+g+"]")&&D.push(w);for(let I=0;I<D.length;I++){const M=D[I];A(M)&&K(Fe,M.getAttribute(g),g,i,M)}}n&&n(w)}const L=[];if(e.indexOf("[")!==-1){const q=/\[([\w-]+)/g;let w;for(;(w=q.exec(e))!==null;)L.push(w[1])}else L.push(e);ye({selector:e,attribute:t,componentTag:i,attributes:d,ComponentFn:r,onInit:n,observed:L.concat(s),onAttributeChange:o,onAttrChange:a,effects:f,declared:De,persist:Ie}),ve();const Me=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Z=l.subtreeQuery||(Me?e:"["+e+"]"),ee={selector:e,attribute:t,ComponentFn:r,onInit:n,onSubtreeChange:c,query:Z};k().push(ee),c&&Z&&S().push(ee),G(),window[t]=y,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=P,window.lnCore.observeLifecycle=_e);function te(){me()>0?Ce(function(){y(document.body)}):y(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",te):te(),y}function X(e){return(e||"").replace(/^#/,"")}function p(e){const t=e===void 0?location.hash:e,r={},i=X(t);if(!i)return r;const l=i.split("&");for(let s=0;s<l.length;s++){const o=l[s];if(!o)continue;const c=o.indexOf(":"),n=c>-1?o.slice(0,c):o,a=c>-1?o.slice(c+1):"";if(n)try{r[n]=decodeURIComponent(a)}catch{r[n]=a}}return r}function O(e){if(!e)return null;const t=p();return e in t?t[e]:null}function C(e,t){if(!e)return;const r=p();t==null?delete r[e]:r[e]=String(t);const l=Object.keys(r).map(function(s){const o=r[s];return o===""?s:s+":"+encodeURIComponent(o)}).join("&");X(location.hash)!==l&&(location.hash=l)}function Y(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ke(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 Se(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ee(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 Oe(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),l=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:r,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=p,window.lnCore.hashGet=O,window.lnCore.hashSet=C,window.lnCore.hashLinkClick=Y,window.lnCore.resolveHashNamespace=ke,window.lnCore.hashSortEncode=Se,window.lnCore.hashSortDecode=Ee,window.lnCore.hashFilterEncode=Oe,window.lnCore.hashFilterDecode=Le);function qe(){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=qe),(function(){const e="data-ln-ui-coordinator",t="lnUiCoordinator";if(window[t]!==void 0)return;const r={"data-ln-ui-coordinator":{type:"marker",description:"Mounts UI coordinator mediating global hash-routing, modals, and toasts"}};document.addEventListener("click",function(s){if(s.ctrlKey||s.metaKey||s.button===1)return;const o=s.target.closest('a[href^="#"]');if(!o)return;const c=o.getAttribute("href"),n=p(c);for(const a in n){const u=document.getElementById(a);if(u&&u.lnModal){if(!Y(s))return;C(a,n[a]),u.lnModal.isOpen||h(u,"ln-modal:request-open",{});return}}});function i(){const s=location.hash;if(!s)return;const o=p(s);for(const c in o){const n=document.getElementById(c);n&&n.lnModal&&!n.lnModal.isOpen&&h(n,"ln-modal:request-open",{})}}window.addEventListener("hashchange",i),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",i):i(),document.addEventListener("ln-modal:close",function(s){const o=s.target;o&&o.id&&O(o.id)!==null&&C(o.id,null)}),document.addEventListener("ln-ajax:success",function(s){const c=(s.detail||{}).data;if(c&&c.message){const a=c.message;h(window,"ln-toast:enqueue",{type:a.type||"success",title:a.title||"",message:typeof a=="string"?a:a.body||""})}const n=s.target.closest("[data-ln-modal]");n&&n.lnModal&&(n.id&&O(n.id)!==null&&C(n.id,null),h(n,"ln-modal:request-close",{}))}),document.addEventListener("ln-ajax:error",function(s){const c=(s.detail||{}).data;if(c&&c.message){const n=c.message;h(window,"ln-toast:enqueue",{type:n.type||"error",title:n.title||"",message:typeof n=="string"?n:n.body||""})}}),document.addEventListener("ln-upload:error",function(s){const o=s.detail||{};o.message&&h(window,"ln-toast:enqueue",{type:"error",title:"",message:o.message})});function l(s){return this.dom=s,this}l.prototype.destroy=function(){delete this.dom[t]},P(e,t,l,"ln-ui-coordinator",{attributes:r})})()})();
|
|
@@ -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 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
|
+
(function(){"use strict";function $(){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 F(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 l=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){l=t[i];break}if(!F(l))return}e.apply(console,t)}}function C(e,t,o){const l=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:l}))}function D(e,t,o){const l=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l);const i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:l});return e.dispatchEvent(i),i}function k(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){k(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function se(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ae(e,t){const o=!!(t&&t.typed),l=t&&t.exclude,i={},d=e.elements,s={};if(o)for(let u=0;u<d.length;u++){const n=d[u];n.name&&n.type==="checkbox"&&!n.disabled&&(s[n.name]=(s[n.name]||0)+1)}for(let u=0;u<d.length;u++){const n=d[u];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(l&&n.matches&&n.matches(l)))if(n.type==="checkbox")o&&s[n.name]===1?i[n.name]=n.checked:(i[n.name]||(i[n.name]=[]),n.checked&&i[n.name].push(n.value));else if(n.type==="radio")n.checked&&(i[n.name]=n.value);else if(n.type==="select-multiple"){i[n.name]=[];for(let r=0;r<n.options.length;r++)n.options[r].selected&&i[n.name].push(n.options[r].value)}else if(o&&n.type==="hidden")i[n.name]=n.value;else if(o&&(n.type==="number"||n.type==="range")){const r=Number(n.value);i[n.name]=n.value===""||isNaN(r)?null:r}else i[n.name]=n.value}return i}function de(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ue(e,t){const o=e.elements,l=[],i={};for(let d=0;d<o.length;d++){const s=o[d];s.name&&s.type==="checkbox"&&(i[s.name]=(i[s.name]||0)+1)}for(let d=0;d<o.length;d++){const s=o[d];if(s.type==="file"||s.type==="submit"||s.type==="button")continue;const u=s.getAttribute("data-ln-fill-as")||s.name;if(!u||!(u in t))continue;const n=t[u];if(s.type==="checkbox"){if(Array.isArray(n))s.checked=n.indexOf(s.value)!==-1;else if(i[s.name]>1){const r=String(n).split(",").map(function(a){return a.trim()});s.checked=r.indexOf(s.value)!==-1}else s.checked=de(n);l.push(s)}else if(s.type==="radio")s.checked=s.value===String(n),l.push(s);else if(s.type==="select-multiple"){if(Array.isArray(n))for(let r=0;r<s.options.length;r++)s.options[r].selected=n.indexOf(s.options[r].value)!==-1;l.push(s)}else s.value=n,s.tagName==="SELECT"&&n!=null&&s.setAttribute("data-ln-value",n),l.push(s)}return l}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ue,window.lnCore.serializeForm=ae,window.lnCore.resolveFormMethod=se);const H={};function ce(e,t){H[e]=t}function fe(e){return H[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ce,window.lnCore.getDataMapper=fe);function pe(e){const t=e?e.closest("[lang]"):null,o=(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 o?o.trim():"en-US"}function he(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,k(function(){new MutationObserver(function(){C(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const j={};function me(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];j[o]=t}function ge(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return j[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=me,window.lnCore.getLocaleFallback=ge,window.lnCore.ensureLocaleObserver=he);const q={};function W(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 we(e,t,o){if(e){const l=e.querySelector('[data-ln-template="'+t+'"]');if(l)return l.content.cloneNode(!0)}return W(t,o)}function x(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let s=0;s<o.length;s++){const u=o[s],n=u.getAttribute("data-ln-field");t[n]!=null&&(u.textContent=t[n])}const l=e.querySelectorAll("[data-ln-attr]");for(let s=0;s<l.length;s++){const u=l[s],n=u.getAttribute("data-ln-attr").split(",");for(let r=0;r<n.length;r++){const a=n[r].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 i=e.querySelectorAll("[data-ln-show]");for(let s=0;s<i.length;s++){const u=i[s],n=u.getAttribute("data-ln-show");n in t&&u.classList.toggle("hidden",!t[n])}const d=e.querySelectorAll("[data-ln-class]");for(let s=0;s<d.length;s++){const u=d[s],n=u.getAttribute("data-ln-class").split(",");for(let r=0;r<n.length;r++){const a=n[r].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 be(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 l=0;l<o.length;l++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[l],t??null),o[l].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 o=0;o<t.length;o++)t[o].textContent=""}})));function P(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const d=o.currentNode;d.textContent.indexOf("{{")!==-1&&(d.textContent=d.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(s,u){return t[u]!==void 0?t[u]:""}))}const l=function(d,s){return t[s]!==void 0?t[s]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let d=0;d<i.length;d++){const s=i[d],u=s.attributes;for(let n=0;n<u.length;n++){const r=u[n];r.value.indexOf("{{")!==-1&&s.setAttribute(r.name,r.value.replace(/\{\{\s*(\w+)\s*\}\}/g,l))}}return e}function ye(e,t,o,l,i,d){const s={};for(let n=0;n<e.children.length;n++){const r=e.children[n],a=r.getAttribute("data-ln-render-key");a&&(s[a]=r)}const u=document.createDocumentFragment();for(let n=0;n<t.length;n++){const r=t[n],a=String(l(r));let c=s[a];if(c)i(c,r,n);else{const f=W(o,d);if(!f||(P(f,r),c=f.firstElementChild,!c))continue;c.setAttribute("data-ln-render-key",a),i(c,r,n)}u.appendChild(c)}e.textContent="",e.appendChild(u)}function Ce(e,t){const o={},l=e.querySelectorAll("["+t+"]");for(let i=0;i<l.length;i++)o[l[i].getAttribute(t)]=l[i].textContent,l[i].remove();return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=P,window.lnCore.fill=x,window.lnCore.lnFill=be,window.lnCore.renderList=ye);function S(e,t,o){const l=e.getAttribute(t);return l===null?o:l}function L(e,t,o){const l=parseInt(e.getAttribute(t),10);return isNaN(l)?o:l}function V(e,t,o=!1){const l=e.getAttribute(t);if(l===null)return!!o;const i=l.trim().toLowerCase();return!(i==="false"||i==="0")}function X(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const z=new Map;function K(e,t){const o=(e?e.join("|"):"")+"::"+t;if(z.has(o))return z.get(o);const l=new Set(e||[]),i=function(d,s){const u=d.getAttribute(s);return u!==null&&l.has(u)?u:t};return z.set(o,i),i}function J(e,t,o){const l=parseFloat(e.getAttribute(t));return isNaN(l)?o:l}function Q(e,t,o){const l=e.getAttribute(t);if(!l)return o;try{return JSON.parse(l)}catch{return o}}function G(e,t,o,l,i){if(!e||t===null)return!0;const d=l||"ln-component",s=e.type;if(s==="trigger"||s==="marker"||s==="string"||s==="list"||!s||t===""&&e.fallback!==void 0)return!0;const u=n=>{i?console.warn(n,i):console.warn(n)};if(s==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(u(`[${d}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(s==="enum"){const n=e.values||[];return n.includes(t)?!0:(u(`[${d}] Invalid value "${t}" for attribute "${o}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(s==="integer"){if(!/^-?\d+$/.test(t))return u(`[${d}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(u(`[${d}] Value ${n} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(u(`[${d}] Value ${n} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(s==="float")return isNaN(Number(t))?(u(`[${d}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(s==="json")try{return JSON.parse(t),!0}catch(n){return u(`[${d}] Invalid JSON for attribute "${o}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function Z(e,t,o){for(const l in o){const[i,d,s]=o[l];Object.defineProperty(e,l,{get:function(){return i(t,d,s)},enumerable:!0,configurable:!0})}return e}function Y(e){const t={};for(const o in e){const l=e[o];if(!l||!l.prop)continue;let i=l.read;if(!i&&l.type)switch(l.type){case"enum":i=K(l.values,l.fallback);break;case"integer":i=L;break;case"float":i=J;break;case"boolean":i=V;break;case"list":i=X;break;case"json":i=Q;break;case"string":default:i=S;break}i||(i=S),t[l.prop]=[i,o,l.fallback]}return t}function ve(e){const t={};for(const o in e){const l=e[o];l&&l.effect&&(t[o]=l.effect)}return Object.keys(t).length?t:null}function Ae(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=Z,window.lnCore.attrSpec=Y,window.lnCore.attrStr=S,window.lnCore.attrInt=L,window.lnCore.attrBool=V,window.lnCore.attrList=X,window.lnCore.attrEnum=K,window.lnCore.attrFloat=J,window.lnCore.attrJson=Q);function I(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function ee(e,t,o,l){if(e.nodeType!==1)return;const d=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",s={selector:t,attribute:o,ComponentFn:l};if(e.matches&&e.matches(d)&&I(e,s),e.querySelectorAll){const u=e.querySelectorAll(d);for(let n=0;n<u.length;n++)I(u[n],s)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function xe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function _e(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 te(){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 Se(e){const t=te(),o=e.observed||[];for(let l=0;l<o.length;l++){const i=o[l];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const l in e.attributes){t.byDeclaredAttr.has(l)||t.byDeclaredAttr.set(l,[]);const i=t.byDeclaredAttr.get(l);i.some(d=>d.componentTag===e.componentTag)||i.push({spec:e.attributes[l],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const l=Ae(e);if(l===null)t.reactiveWildcard.push(e);else for(const i of l)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function ne(e,t,o,l){for(let i=0;i<e.length;i++){const d=e[i];if(!t[d.attribute])continue;const s=d.effects&&d.effects[o];s?s(t,o,l):d.onAttrChange&&(!d.declared||d.declared.has(o))&&d.onAttrChange(t,o,l)}}function Ie(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,l=te(),i=l.byAttr.get(t),d=$()&&l.byDeclaredAttr&&l.byDeclaredAttr.has(t);if(!o&&!i&&!d)return;const s=e.target;if(e.oldValue!==s.getAttribute(t)){if(d&&F(s)){const u=l.byDeclaredAttr.get(t),n=s.getAttribute(t);for(let r=0;r<u.length;r++)G(u[r].spec,n,t,u[r].componentTag,s)}if(window.lnCore._debugSink&&(o||i)&&window.lnCore._debugSink("attr",t,s,{oldValue:e.oldValue,newValue:s.getAttribute(t)}),o){const u=l.byReactive.get(t);u&&ne(u,s,t,e.oldValue),l.reactiveWildcard.length&&ne(l.reactiveWildcard,s,t,e.oldValue)}if(i)for(let u=0;u<i.length;u++){const n=i[u];if(n.handler){n.handler(s,t,e.oldValue);continue}n.onAttributeChange&&s[n.attribute]?n.onAttributeChange(s,t):(ee(s,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(s))}}}function Ee(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,k(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{Ie(t[o])}catch(l){console.error("[ln-core] mutation handler failed",t[o].target,l)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function R(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function O(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function T(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(l){console.error("["+t.attribute+"] destroy failed",e,l)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ke(e){const t=R();if(!t.length)return;const o=e.target;if(o){const i=o.nodeType===1?o:o.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}const l=O();if(e.target&&l.length)for(let i=0;i<l.length;i++){const d=l[i],s=d.query,u=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;u&&d.onSubtreeChange(u,e)}for(let i=0;i<e.addedNodes.length;i++){const d=e.addedNodes[i];if(d.nodeType===1){const s=!!(d.firstElementChild||d.children&&d.children.length);for(let u=0;u<t.length;u++){const n=t[u];if(n.selector&&n.attribute&&n.ComponentFn){if(!s)d.matches&&d.matches(n.query)&&I(d,n);else if(d.matches&&d.matches(n.query)&&I(d,n),d.querySelectorAll){const r=d.querySelectorAll(n.query);for(let a=0;a<r.length;a++)I(r[a],n)}}n.onInit&&n.onInit(d)}}}for(let i=0;i<e.removedNodes.length;i++){const d=e.removedNodes[i];if(d.nodeType===1){const s=!!(d.firstElementChild||d.children&&d.children.length);for(let u=0;u<t.length;u++){const n=t[u],r=n.query;if(r){if(!s)d.matches&&d.matches(r)&&T(d,n);else if(d.matches&&d.matches(r)&&T(d,n),d.querySelectorAll){const a=d.querySelectorAll(r);for(let c=0;c<a.length;c++)T(a[c],n)}}}}}}function oe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,k(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const l=t[o];if(l.type==="childList")try{ke(l)}catch(i){console.error("[ln-core] lifecycle handler failed",l.target,i)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Le(e){R().push(e),e.onSubtreeChange&&e.query&&O().push(e),oe()}function re(e,t,o,l,i={}){const d=i.extraAttributes||[],s=i.onAttributeChange||null,u=i.onSubtreeChange||null,n=i.onInit||null,r=i.onAttrChange||null,a=i.effects||null,c=i.attributes||null,f=c?ve(c):a,p=c?new Set(Object.keys(c)):null,w=i.persist||null;function b(A){const _=A||document.body;if(ee(_,e,t,o),c&&$())for(const E in c){const He=c[E],M=Array.from(_.querySelectorAll("["+E+"]"));_.matches&&_.matches("["+E+"]")&&M.push(_);for(let U=0;U<M.length;U++){const B=M[U];F(B)&&G(He,B.getAttribute(E),E,l,B)}}n&&n(_)}const g=[];if(e.indexOf("[")!==-1){const A=/\[([\w-]+)/g;let _;for(;(_=A.exec(e))!==null;)g.push(_[1])}else g.push(e);Se({selector:e,attribute:t,componentTag:l,attributes:c,ComponentFn:o,onInit:n,observed:g.concat(d),onAttributeChange:s,onAttrChange:r,effects:f,declared:p,persist:w}),Ee();const v=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,m=i.subtreeQuery||(v?e:"["+e+"]"),h={selector:e,attribute:t,ComponentFn:o,onInit:n,onSubtreeChange:u,query:m};R().push(h),u&&m&&O().push(h),oe(),window[t]=b,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=re,window.lnCore.observeLifecycle=Le);function y(){xe()>0?_e(function(){b(document.body)}):b(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",y):y(),b}function ie(e){return(e||"").replace(/^#/,"")}function N(e){const t=e===void 0?location.hash:e,o={},l=ie(t);if(!l)return o;const i=l.split("&");for(let d=0;d<i.length;d++){const s=i[d];if(!s)continue;const u=s.indexOf(":"),n=u>-1?s.slice(0,u):s,r=u>-1?s.slice(u+1):"";if(n)try{o[n]=decodeURIComponent(r)}catch{o[n]=r}}return o}function Fe(e){if(!e)return null;const t=N();return e in t?t[e]:null}function De(e,t){if(!e)return;const o=N();t==null?delete o[e]:o[e]=String(t);const i=Object.keys(o).map(function(d){const s=o[d];return s===""?d:d+":"+encodeURIComponent(s)}).join("&");ie(location.hash)!==i&&(location.hash=i)}function qe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ze(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 l=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return l?t?l+"-"+t:l:t||null}function Re(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 Te(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ne(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),l=e.slice(t+1),i=l?l.split(",").map(function(d){try{return decodeURIComponent(d)}catch{return d}}).filter(Boolean):[];return{key:o,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=N,window.lnCore.hashGet=Fe,window.lnCore.hashSet=De,window.lnCore.hashLinkClick=qe,window.lnCore.resolveHashNamespace=ze,window.lnCore.hashSortEncode=Re,window.lnCore.hashSortDecode=Oe,window.lnCore.hashFilterEncode=Te,window.lnCore.hashFilterDecode=Ne);function Me(){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=Me);function Ue(e){if(!e)return null;const t=String(e).split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).map(o=>o.startsWith(".")?o.slice(1):o);return t.length?t:null}function le(e){return!e||typeof e!="string"||!e.includes(".")?"":e.split(".").pop().toLowerCase()}function Be(e,t){if(!t||t.length===0)return!0;if(!e)return!1;const o=le(e.name),l=String(e.type||"").toLowerCase();return t.some(i=>{if(i.includes("/")){if(i.endsWith("/*")){const d=i.slice(0,-1);return l.startsWith(d)}return l===i}return o===i})}function $e(e,t="en",o={}){if(typeof e!="number"||isNaN(e)||e===0)return"0 "+(o["unit-b"]||"B");const l=1024,i=[o["unit-b"]||"B",o["unit-kb"]||"KB",o["unit-mb"]||"MB",o["unit-gb"]||"GB"],d=Math.floor(Math.log(e)/Math.log(l)),s=Math.min(d,i.length-1),u=e/Math.pow(l,s);return new Intl.NumberFormat(t,{maximumFractionDigits:1,minimumFractionDigits:0}).format(u)+" "+i[s]}(function(){const e="data-ln-upload",t="lnUpload",o="file",l="file_ids[]";if(window[t]!==void 0)return;const i={"data-ln-upload":{prop:"uploadUrl",read:S,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:S,type:"string",fallback:"",description:"Endpoint URL pattern for deleting uploaded files"},"data-ln-upload-max-size":{prop:"maxSize",read:L,type:"integer",fallback:0,min:0,description:"Maximum allowed file size in bytes (0 for unlimited)"},"data-ln-upload-max-files":{prop:"maxFiles",read:L,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:S,type:"string",fallback:o,description:"Form data field name used for file payloads"},"data-ln-upload-ids-field":{prop:"idsFieldName",read:S,type:"string",fallback:l,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=Y(i);function s(r,a,c){return $e(r,a,c)}function u(){const r=document.querySelector('meta[name="csrf-token"]');return r?r.getAttribute("content"):""}function n(r){this.dom=r,Z(this,r,d),this.dict=Ce(r,"data-ln-upload-dict"),this.locale=pe(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=Ue(a),this.uploadedFiles=new Map,this.fileIdCounter=0,this._dragDepth=0,this._hydrate(),this._bindEvents(),this}n.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 g=p.querySelector('[data-ln-field="name"]'),v=p.querySelector('[data-ln-field="sizeText"]'),m=p.getAttribute("data-ln-upload-size"),h=m?parseInt(m,10):null;r.uploadedFiles.set(b,{serverId:w||null,name:g?g.textContent.trim():"",size:h!==null&&!isNaN(h)?h:v?v.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()},n.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)}},n.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)},n.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){C(a.dom,"ln-upload:invalid",{file:p,reason:"max-files"});continue}if(!Be(p,a.allowedExts)){C(a.dom,"ln-upload:invalid",{file:p,reason:"accept"});continue}if(a.maxSize>0&&p.size>a.maxSize){C(a.dom,"ln-upload:invalid",{file:p,reason:"max-size"});continue}D(a.dom,"ln-upload:before-upload",{file:p}).defaultPrevented||a._uploadSingleFile(p)}},n.prototype._uploadSingleFile=function(r){const a=this,c="file-"+ ++a.fileIdCounter,f=le(r.name);let p=null;if(this.list){const m=we(this.dom,"ln-upload-item","ln-upload");if(m&&(p=m.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 m=0;m<b.length;m++){const h=b[m];!h.name||h.name===a.idsFieldName||h.type==="file"||(h.type==="checkbox"||h.type==="radio")&&!h.checked||w.append(h.name,h.value)}const g=new XMLHttpRequest;a.uploadedFiles.set(c,{serverId:null,name:r.name,size:r.size,xhr:g}),g.upload.addEventListener("progress",function(m){if(m.lengthComputable){const h=Math.round(m.loaded/m.total*100);if(p){const y=p.querySelector("[data-ln-progress]");y&&y.setAttribute("data-ln-progress",String(h)),x(p,{sizeText:h+"%"})}C(a.dom,"ln-upload:progress",{localId:c,file:r,percent:h,loaded:m.loaded,total:m.total})}}),g.addEventListener("load",function(){const m=a.uploadedFiles.get(c);if(m&&delete m.xhr,g.status>=200&&g.status<300){let h;try{h=JSON.parse(g.responseText)}catch(A){v(a.dict.error||"Error",g.status,A);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 A=p.querySelector('[data-ln-upload-action="remove"]');A&&(A.disabled=!1)}m&&(m.serverId=y,m.size=h.size||r.size,m.name=h.name||r.name),a._syncHiddenInputs(),C(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(g.responseText).message||""}catch{}v(h,g.status,null)}}),g.addEventListener("error",function(){const m=a.uploadedFiles.get(c);m&&delete m.xhr,v("",0,null)});function v(m,h,y){if(p){p.setAttribute("data-ln-upload-state","error"),x(p,{sizeText:a.dict.error||"Error",uploading:!1,error:!0});const A=p.querySelector('[data-ln-upload-action="remove"]');A&&(A.disabled=!1)}C(a.dom,"ln-upload:error",{file:r,message:m,status:h,error:y})}a.uploadUrl?(g.open("POST",a.uploadUrl),g.setRequestHeader("X-CSRF-TOKEN",u()),g.setRequestHeader("X-Requested-With","XMLHttpRequest"),g.setRequestHeader("Accept","application/json"),g.send(w)):console.warn("[ln-upload] No upload URL configured (missing data-ln-upload)")},n.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[g,v]of a.uploadedFiles)if(String(v.serverId)===String(r)){c=g,f=v;break}if(!c||!f||D(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(),C(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(),C(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(g){g.ok?(w&&w.remove(),a.uploadedFiles.delete(c),a._syncHiddenInputs(),C(a.dom,"ln-upload:removed",{localId:c,serverId:f.serverId})):(w&&(w.removeAttribute("data-ln-upload-state"),x(w,{deleting:!1})),C(a.dom,"ln-upload:error",{file:f,message:"",status:g.status}))}).catch(function(g){w&&(w.removeAttribute("data-ln-upload-state"),x(w,{deleting:!1})),C(a.dom,"ln-upload:error",{file:f,message:"",status:0,error:g})})},n.prototype.clear=function(){const r=this;if(!D(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":u(),"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}}).catch(function(){})}r.uploadedFiles.clear(),r.list&&(r.list.innerHTML=""),r._syncHiddenInputs(),C(r.dom,"ln-upload:cleared",{})}},n.prototype.getFileIds=function(){return Array.from(this.uploadedFiles.values()).map(function(r){return r.serverId}).filter(Boolean)},n.prototype.getFiles=function(){return Array.from(this.uploadedFiles.values()).map(function(r){return{serverId:r.serverId,name:r.name,size:r.size}})},n.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]}},re(e,t,n,"ln-upload",{attributes:i})})()})();
|