PageSourceSearch

https://www.decathlontravel.com/build/live_controller-DPGwCUd3.js

js decathlontravel.com collected 2026-09-24 11:52:27 UTC 46,833 bytes, 2 lines download raw bytes

1import{eB as fe}from"./props-BjkcojzL.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d008caf2-cc27-4e2a-9e5f-9fb7dbcc6508",e._sentryDebugIdIdentifier="sentry-dbid-d008caf2-cc27-4e2a-9e5f-9fb7dbcc6508")}catch{}})();var pe=class{constructor(e,t,n){this.isResolved=!1,this.promise=e,this.promise.then(s=>(this.isResolved=!0,s)),this.actions=t,this.updatedModels=n}containsOneOfActions(e){return this.actions.filter(t=>e.includes(t)).length>0}areAnyModelsUpdated(e){return this.updatedModels.filter(t=>e.includes(t)).length>0}},me=class{constructor(e,t="post",n="same-origin"){this.url=e,this.method=t,this.credentials=n}buildRequest(e,t,n,s,i,h){const c=this.url.split("?");let[m]=c;const[,l]=c,u=new URLSearchParams(l||""),d={};d.credentials=this.credentials,d.headers={Accept:"application/vnd.live-component+html","X-Requested-With":"XMLHttpRequest","X-Live-Url":window.location.pathname+window.location.search};const y=Object.entries(h).reduce((M,k)=>M+k.length,0),b=Object.keys(s).length>0;if(t.length===0&&y===0&&this.method==="get"&&this.willDataFitInUrl(JSON.stringify(e),JSON.stringify(n),u,JSON.stringify(s),JSON.stringify(i)))u.set("props",JSON.stringify(e)),u.set("updated",JSON.stringify(n)),Object.keys(i).length>0&&u.set("propsFromParent",JSON.stringify(i)),b&&u.set("children",JSON.stringify(s)),d.method="GET";else{d.method="POST";const M={props:e,updated:n};Object.keys(i).length>0&&(M.propsFromParent=i),b&&(M.children=s),t.length>0&&(t.length===1?(M.args=t[0].args,m+=`/${encodeURIComponent(t[0].name)}`):(m+="/_batch",M.actions=t));const k=new FormData;k.append("data",JSON.stringify(M));for(const[S,O]of Object.entries(h)){const $=O.length;for(let R=0;R<$;++R)k.append(S,O[R])}d.body=k}const U=u.toString();return{url:`${m}${U.length>0?`?${U}`:""}`,fetchOptions:d}}willDataFitInUrl(e,t,n,s,i){return(new URLSearchParams(e+t+s+i).toString()+n.toString()).length<1500}},ge=class{constructor(e,t="post",n="same-origin"){this.requestBuilder=new me(e,t,n)}makeRequest(e,t,n,s,i,h){const{url:c,fetchOptions:m}=this.requestBuilder.buildRequest(e,t,n,s,i,h);return new pe(fetch(c,m),t.map(l=>l.name),Object.keys(n))}},ve=class{constructor(e){this.response=e}async getBody(){return this.body||(this.body=await this.response.text()),this.body}getLiveUrl(){return this.liveUrl===void 0&&(this.liveUrl=this.response.headers.get("X-Live-Url")),this.liveUrl}};function H(e){return e.innerHTML?e.outerHTML.slice(0,e.outerHTML.indexOf(e.innerHTML)):e.outerHTML}let N=new WeakMap,V=new Map;const be=e=>{N.set(e.element,e),V.set(e,e.name)},ye=e=>{N.delete(e.element),V.delete(e)},Ye=e=>new Promise((t,n)=>{let s=0;const i=10,h=setInterval(()=>{const c=N.get(e);c&&(clearInterval(h),t(c)),s++,s>i&&(clearInterval(h),n(new Error(`Component not found for element ${H(e)}`)))},5)}),Ee=(e,t,n)=>{const s=[];return V.forEach((i,h)=>{t&&(e===h||!h.element.contains(e.element))||n&&i!==n||s.push(h)}),s},we=e=>{const t=[];return V.forEach((n,s)=>{if(e===s||!e.element.contains(s.element))return;let i=!1;V.forEach((h,c)=>{i||c!==s&&c.element.contains(s.element)&&(i=!0)}),t.push(s)}),t},Me=e=>{let t=e.element.parentElement;for(;t;){const n=N.get(t);if(n)return n;t=t.parentElement}return null};function P(e){const t=[];if(!e)return t;let n="",s="",i=[],h=[],c="action";const m=()=>{if(n)return n;if(t.length===0)throw new Error("Could not find any directives");return t[t.length-1].action},l=()=>{t.push({action:n,args:i,modifiers:h,getString:()=>e}),n="",s="",i=[],h=[],c="action"},u=()=>{i.push(s.trim()),s=""},d=()=>{if(i.length>1)throw new Error(`The modifier "${n}()" does not support multiple arguments.`);h.push({name:n,value:i.length>0?i[0]:null}),n="",i=[],c="action"};for(let y=0;y<e.length;y++){const b=e[y];switch(c){case"action":if(b==="("){c="arguments";break}if(b===" "){n&&l();break}if(b==="|"){d();break}n+=b;break;case"arguments":if(b===")"){u(),c="after_arguments";break}if(b===","){u();break}s+=b;break;case"after_arguments":if(b==="|"){d();break}if(b!==" ")throw new Error(`Missing space after ${m()}()`);l();break}}switch(c){case"action":case"after_arguments":n&&l();break;default:throw new Error(`Did you forget to add a closing ")" after "${n}"?`)}return t}function G(e){const t=[];return e.forEach(n=>{t.push(...Ae(n).split(" "))}),t}function Ae(e){return e.replace(/[\s]+/g," ").trim()}function I(e){return e.replace(/\[]$/,"").split("[").map(t=>t.replace("]","")).join(".")}function x(e,t){if(e instanceof HTMLInputElement){if(e.type==="checkbox"){const n=L(e,!1);if(n!==null){const s=t.get(n.action);if(Array.isArray(s))return K(e,s);if(Object(s)===s)return K(e,Object.values(s))}return e.hasAttribute("value")?e.checked?e.getAttribute("value"):null:e.checked}return ee(e)}return e instanceof HTMLSelectElement?e.multiple?Array.from(e.selectedOptions).map(n=>n.value):e.value:e.hasAttribute("data-value")?e.dataset.value:"value"in e?e.value:e.hasAttribute("value")?e.getAttribute("value"):null}function B(e,t){if(e instanceof HTMLInputElement){if(e.type==="file")return;if(e.type==="radio"){e.checked=e.value==t;return}if(e.type==="checkbox"){Array.isArray(t)?e.checked=t.some(n=>n==e.value):e.hasAttribute("value")?e.checked=e.value==t:e.checked=t;return}}if(e instanceof HTMLSelectElement){const n=[].concat(t).map(s=>`${s}`);
1Array.from(e.options).forEach(s=>{s.selected=n.includes(s.value)});return}t=t===void 0?"":t,e.value=t}function Z(e){if(!e.dataset.model)return[];const t=P(e.dataset.model);return t.forEach(n=>{if(n.args.length>0)throw new Error(`The data-model="${e.dataset.model}" format is invalid: it does not support passing arguments to the model.`);n.action=I(n.action)}),t}function L(e,t=!0){const n=Z(e);if(n.length>0)return n[0];if(e.getAttribute("name")){const s=e.closest("form");if(s&&"model"in s.dataset){const i=P(s.dataset.model||"*")[0];if(i.args.length>0)throw new Error(`The data-model="${s.dataset.model}" format is invalid: it does not support passing arguments to the model.`);return i.action=I(e.getAttribute("name")),i}}if(!t)return null;throw new Error(`Cannot determine the model name for "${H(e)}": the element must either have a "data-model" (or "name" attribute living inside a <form data-model="*">).`)}function q(e,t){return t.element===e?!0:t.element.contains(e)?e.closest('[data-controller~="live"]')===t.element:!1}function j(e){const t=e.cloneNode(!0);if(!(t instanceof HTMLElement))throw new Error("Could not clone element");return t}function ke(e){const t=document.createElement("template");if(e=e.trim(),t.innerHTML=e,t.content.childElementCount>1)throw new Error(`Component HTML contains ${t.content.childElementCount} elements, but only 1 root element is allowed.`);const n=t.content.firstElementChild;if(!n)throw new Error("Child not found");if(!(n instanceof HTMLElement))throw new Error(`Created element is not an HTMLElement: ${e.trim()}`);return n}const K=(e,t)=>{const n=[...t],s=ee(e),i=t.indexOf(s);return e.checked?(i===-1&&n.push(s),n):(i>-1&&n.splice(i,1),n)},ee=e=>e.dataset.value?e.dataset.value:e.value;function Te(e){return e instanceof HTMLInputElement&&["text","email","password","search","tel","url"].includes(e.type)}function Ce(e){return e instanceof HTMLTextAreaElement}function Se(e){return e instanceof HTMLInputElement&&["number","range"].includes(e.type)}var Pe=class{constructor(){this.hooks=new Map}register(e,t){const n=this.hooks.get(e)||[];n.push(t),this.hooks.set(e,n)}unregister(e,t){const n=this.hooks.get(e)||[],s=n.indexOf(t);s!==-1&&(n.splice(s,1),this.hooks.set(e,n))}triggerHook(e,...t){(this.hooks.get(e)||[]).forEach(n=>{n(...t)})}},Y=(function(){let e=new Set,t={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:b,afterNodeAdded:b,beforeNodeMorphed:b,afterNodeMorphed:b,beforeNodeRemoved:b,afterNodeRemoved:b,beforeAttributeUpdated:b},head:{style:"merge",shouldPreserve:function(r){return r.getAttribute("im-preserve")==="true"},shouldReAppend:function(r){return r.getAttribute("im-re-append")==="true"},shouldRemove:b,afterHeadMorphed:b}};function n(r,a,o={}){r instanceof Document&&(r=r.documentElement),typeof a=="string"&&(a=ie(a));let f=re(a),p=M(r,f,o);return s(r,f,p)}function s(r,a,o){if(o.head.block){let f=r.querySelector("head"),p=a.querySelector("head");if(f&&p){let g=y(p,f,o);Promise.all(g).then(function(){s(r,a,Object.assign(o,{head:{block:!1,ignore:!0}}))});return}}if(o.morphStyle==="innerHTML")return c(a,r,o),r.children;if(o.morphStyle==="outerHTML"||o.morphStyle==null){let f=oe(a,r,o),p=f?.previousSibling,g=f?.nextSibling,v=h(r,f,o);return f?ae(p,v,g):[]}else throw"Do not understand how to morph style "+o.morphStyle}function i(r,a){return a.ignoreActiveValue&&r===document.activeElement}function h(r,a,o){if(!(o.ignoreActive&&r===document.activeElement))return a==null?o.callbacks.beforeNodeRemoved(r)===!1?r:(r.remove(),o.callbacks.afterNodeRemoved(r),null):S(r,a)?(o.callbacks.beforeNodeMorphed(r,a)===!1||(r instanceof HTMLHeadElement&&o.head.ignore||(r instanceof HTMLHeadElement&&o.head.style!=="morph"?y(a,r,o):(l(a,r,o),i(r,o)||c(a,r,o))),o.callbacks.afterNodeMorphed(r,a)),r):o.callbacks.beforeNodeRemoved(r)===!1||o.callbacks.beforeNodeAdded(a)===!1?r:(r.parentElement.replaceChild(a,r),o.callbacks.afterNodeAdded(a),o.callbacks.afterNodeRemoved(r),a)}function c(r,a,o){let f=r.firstChild,p=a.firstChild,g;for(;f;){if(g=f,f=g.nextSibling,p==null){if(o.callbacks.beforeNodeAdded(g)===!1)return;a.appendChild(g),o.callbacks.afterNodeAdded(g),T(o,g);continue}
1if(k(g,p,o)){h(p,g,o),p=p.nextSibling,T(o,g);continue}let v=$(r,a,g,p,o);if(v){p=O(p,v,o),h(v,g,o),T(o,g);continue}let E=R(r,a,g,p,o);if(E){p=O(p,E,o),h(E,g,o),T(o,g);continue}if(o.callbacks.beforeNodeAdded(g)===!1)return;a.insertBefore(g,p),o.callbacks.afterNodeAdded(g),T(o,g)}for(;p!==null;){let v=p;p=p.nextSibling,W(v,o)}}function m(r,a,o,f){return r==="value"&&f.ignoreActiveValue&&a===document.activeElement?!0:f.callbacks.beforeAttributeUpdated(r,a,o)===!1}function l(r,a,o){let f=r.nodeType;if(f===1){const p=r.attributes,g=a.attributes;for(const v of p)m(v.name,a,"update",o)||a.getAttribute(v.name)!==v.value&&a.setAttribute(v.name,v.value);for(let v=g.length-1;0<=v;v--){const E=g[v];m(E.name,a,"remove",o)||r.hasAttribute(E.name)||a.removeAttribute(E.name)}}(f===8||f===3)&&a.nodeValue!==r.nodeValue&&(a.nodeValue=r.nodeValue),i(a,o)||d(r,a,o)}function u(r,a,o,f){if(r[o]!==a[o]){let p=m(o,a,"update",f);p||(a[o]=r[o]),r[o]?p||a.setAttribute(o,r[o]):m(o,a,"remove",f)||a.removeAttribute(o)}}function d(r,a,o){if(r instanceof HTMLInputElement&&a instanceof HTMLInputElement&&r.type!=="file"){let f=r.value,p=a.value;u(r,a,"checked",o),u(r,a,"disabled",o),r.hasAttribute("value")?f!==p&&(m("value",a,"update",o)||(a.setAttribute("value",f),a.value=f)):m("value",a,"remove",o)||(a.value="",a.removeAttribute("value"))}else if(r instanceof HTMLOptionElement)u(r,a,"selected",o);else if(r instanceof HTMLTextAreaElement&&a instanceof HTMLTextAreaElement){let f=r.value,p=a.value;if(m("value",a,"update",o))return;f!==p&&(a.value=f),a.firstChild&&a.firstChild.nodeValue!==f&&(a.firstChild.nodeValue=f)}}function y(r,a,o){let f=[],p=[],g=[],v=[],E=o.head.style,C=new Map;for(const w of r.children)C.set(w.outerHTML,w);for(const w of a.children){let A=C.has(w.outerHTML),F=o.head.shouldReAppend(w),_=o.head.shouldPreserve(w);A||_?F?p.push(w):(C.delete(w.outerHTML),g.push(w)):E==="append"?F&&(p.push(w),v.push(w)):o.head.shouldRemove(w)!==!1&&p.push(w)}v.push(...C.values());let X=[];for(const w of v){let A=document.createRange().createContextualFragment(w.outerHTML).firstChild;if(o.callbacks.beforeNodeAdded(A)!==!1){if(A.href||A.src){let F=null,_=new Promise(function(ce){F=ce});A.addEventListener("load",function(){F()}),X.push(_)}a.appendChild(A),o.callbacks.afterNodeAdded(A),f.push(A)}}for(const w of p)o.callbacks.beforeNodeRemoved(w)!==!1&&(a.removeChild(w),o.callbacks.afterNodeRemoved(w));return o.head.afterHeadMorphed(a,{added:f,kept:g,removed:p}),X}function b(){}function U(r){let a={};return Object.assign(a,t),Object.assign(a,r),a.callbacks={},Object.assign(a.callbacks,t.callbacks),Object.assign(a.callbacks,r.callbacks),a.head={},Object.assign(a.head,t.head),Object.assign(a.head,r.head),a}function M(r,a,o){return o=U(o),{target:r,newContent:a,config:o,morphStyle:o.morphStyle,ignoreActive:o.ignoreActive,ignoreActiveValue:o.ignoreActiveValue,idMap:he(r,a),deadIds:new Set,callbacks:o.callbacks,head:o.head}}function k(r,a,o){return r==null||a==null?!1:r.nodeType===a.nodeType&&r.tagName===a.tagName?r.id!==""&&r.id===a.id?!0:D(o,r,a)>0:!1}function S(r,a){return r==null||a==null?!1:r.nodeType===a.nodeType&&r.tagName===a.tagName}function O(r,a,o){for(;r!==a;){let f=r;r=r.nextSibling,W(f,o)}return T(o,a),a.nextSibling}function $(r,a,o,f,p){let g=D(p,o,a),v=null;if(g>0){let E=f,C=0;for(;E!=null;){if(k(o,E,p))return E;if(C+=D(p,E,r),C>g)return null;E=E.nextSibling}}return v}function R(r,a,o,f,p){let g=f,v=o.nextSibling,E=0;for(;g!=null;){if(D(p,g,r)>0)return null;if(S(o,g))return g;if(S(v,g)&&(E++,v=v.nextSibling,E>=2))return null;g=g.nextSibling}return g}function ie(r){let a=new DOMParser,o=r.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(o.match(/<\/html>/)||o.match(/<\/head>/)||o.match(/<\/body>/)){let f=a.parseFromString(r,"text/html");if(o.match(/<\/html>/))return f.generatedByIdiomorph=!0,f;{let p=f.firstChild;return p?(p.generatedByIdiomorph=!0,p):null}}else{let f=a.parseFromString("<body><template>"+r+"</template></body>","text/html").body.querySelector("template").content;return f.generatedByIdiomorph=!0,f}}function re(r){if(r==null)return document.createElement("div");if(r.generatedByIdiomorph)return r;if(r instanceof Node){const a=document.createElement("div");return a.append(r),a}else{const a=document.createElement("div");for(const o of[...r])a.append(o);return a}}function ae(r,a,o){let f=[],p=[];for(;r!=null;)f.push(r),r=r.previousSibling;for(;f.length>0;){let g=f.pop();p.push(g),a.parentElement.insertBefore(g,a)}for(p.push(a);o!=null;)f.push(o),p.push(o),o=o.nextSibling;for(;f.length>0;)a.parentElement.insertBefore(f.pop(),a.nextSibling);return p}function oe(r,a,o){let f;f=r.firstChild;let p=f,g=0;for(;f;){let v=le(f,a,o);v>g&&(p=f,g=v),f=f.nextSibling}return p}function le(r,a,o){return S(r,a)?.5+D(o,r,a):0}function W(r,a){T(a,r),a.callbacks.beforeNodeRemoved(r)!==!1&&(r.remove(),a.callbacks.afterNodeRemoved(r))}function ue(r,a){return!r.deadIds.has(a)}function de(r,a,o){return(r.idMap.get(o)||e).has(a)}
1function T(r,a){let o=r.idMap.get(a)||e;for(const f of o)r.deadIds.add(f)}function D(r,a,o){let f=r.idMap.get(a)||e,p=0;for(const g of f)ue(r,g)&&de(r,g,o)&&++p;return p}function J(r,a){let o=r.parentElement,f=r.querySelectorAll("[id]");for(const p of f){let g=p;for(;g!==o&&g!=null;){let v=a.get(g);v==null&&(v=new Set,a.set(g,v)),v.add(p.id),g=g.parentElement}}}function he(r,a){let o=new Map;return J(r,o),J(a,o),o}return{morph:n,defaults:t}})();function z(e){e instanceof HTMLInputElement&&e.type==="file"||("value"in e?e.setAttribute("value",e.value):e.hasAttribute("value")&&e.setAttribute("value","")),Array.from(e.children).forEach(t=>{z(t)})}const Ie=(e,t)=>{for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n];t.setAttribute(s.name,s.value)}};function Le(e,t,n,s,i){const h=[],c=new Map,m=(l,u)=>{const d=c.get(l);if(!(d instanceof HTMLElement))throw new Error(`Original element with id ${l} not found`);if(h.push(l),!u)return null;const y=j(d);return d.replaceWith(y),y};t.querySelectorAll("[data-live-preserve]").forEach(l=>{const u=l.id;if(!u)throw new Error("The data-live-preserve attribute requires an id attribute to be set on the element");const d=e.querySelector(`#${u}`);if(!(d instanceof HTMLElement))throw new Error(`The element with id "${u}" was not found in the original HTML`);l.removeAttribute("data-live-preserve"),c.set(u,d),Ie(l,d)}),Y.morph(e,t,{callbacks:{beforeNodeMorphed:(l,u)=>{if(!(l instanceof Element)||!(u instanceof Element)||l===e)return!0;if(l.id&&c.has(l.id)){if(l.id===u.id)return!1;const d=m(l.id,!0);if(!d)throw new Error("missing clone");return Y.morph(d,u),!1}if(l instanceof HTMLElement&&u instanceof HTMLElement){if(typeof l.__x<"u"){if(!window.Alpine)throw new Error("Unable to access Alpine.js though the global window.Alpine variable. Please make sure Alpine.js is loaded before Symfony UX LiveComponent.");if(typeof window.Alpine.morph!="function")throw new Error("Unable to access Alpine.js morph function. Please make sure the Alpine.js Morp
1h plugin is installed and loaded, see https://alpinejs.dev/plugins/morph for more information.");window.Alpine.morph(l.__x,u)}if(i.wasElementAdded(l))return l.insertAdjacentElement("afterend",u),!1;n.includes(l)&&B(u,s(l)),l===document.activeElement&&l!==document.body&&L(l,!1)!==null&&B(u,s(l));const d=i.getChangedElement(l);if(d&&d.applyToElement(u),l.nodeName.toUpperCase()!=="OPTION"&&l.isEqualNode(u)){const y=j(l);z(y);const b=j(u);if(z(b),y.isEqualNode(b))return!1}}return l.hasAttribute("data-skip-morph")||l.id&&l.id!==u.id?(l.innerHTML=u.innerHTML,!0):l.parentElement?.hasAttribute("data-skip-morph")?!1:!l.hasAttribute("data-live-ignore")},beforeNodeRemoved(l){return l instanceof HTMLElement?l.id&&c.has(l.id)?(m(l.id,!1),!0):i.wasElementAdded(l)?!1:!l.hasAttribute("data-live-ignore"):!0}}}),h.forEach(l=>{const u=e.querySelector(`#${l}`),d=c.get(l);if(!(u instanceof HTMLElement)||!(d instanceof HTMLElement))throw new Error("Missing elements.");u.replaceWith(d)})}var Q=class{constructor(){this.changedItems=new Map,this.removedItems=new Map}setItem(e,t,n){if(this.removedItems.has(e)){const s=this.removedItems.get(e);if(this.removedItems.delete(e),s.original===t)return}if(this.changedItems.has(e)){const s=this.changedItems.get(e);if(s.original===t){this.changedItems.delete(e);return}this.changedItems.set(e,{original:s.original,new:t});return}this.changedItems.set(e,{original:n,new:t})}removeItem(e,t){let n=t;this.changedItems.has(e)&&(n=this.changedItems.get(e).original,this.changedItems.delete(e),n===null)||this.removedItems.has(e)||this.removedItems.set(e,{original:n})}getChangedItems(){return Array.from(this.changedItems,([e,{new:t}])=>({name:e,value:t}))}getRemovedItems(){return Array.from(this.removedItems.keys())}isEmpty(){return this.changedItems.size===0&&this.removedItems.size===0}},Oe=class{constructor(){this.addedClasses=new Set,this.removedClasses=new Set,this.styleChanges=new Q,this.attributeChanges=new Q}addClass(e){this.removedClasses.delete(e)||this.addedClasses.add(e)}removeClass(e){this.addedClasses.delete(e)||this.removedClasses.add(e)}addStyle(e,t,n){this.styleChanges.setItem(e,t,n)}removeStyle(e,t){this.styleChanges.removeItem(e,t)}addAttribute(e,t,n){this.attributeChanges.setItem(e,t,n)}removeAttribute(e,t){this.attributeChanges.removeItem(e,t)}getAddedClasses(){return[...this.addedClasses]}getRemovedClasses(){return[...this.removedClasses]}getChangedStyles(){return this.styleChanges.getChangedItems()}getRemovedStyles(){return this.styleChanges.getRemovedItems()}getChangedAttributes(){return this.attributeChanges.getChangedItems()}getRemovedAttributes(){return this.attributeChanges.getRemovedItems()}applyToElement(e){e.classList.add(...this.addedClasses),e.classList.remove(...this.removedClasses),this.styleChanges.getChangedItems().forEac
1h(t=>{/!\s*important/i.test(t.value)?e.style.setProperty(t.name,t.value.replace(/!\s*important/i,"").trim(),"important"):e.style.setProperty(t.name,t.value)}),this.styleChanges.getRemovedItems().forEach(t=>{e.style.removeProperty(t)}),this.attributeChanges.getChangedItems().forEach(t=>{e.setAttribute(t.name,t.value)}),this.attributeChanges.getRemovedItems().forEach(t=>{e.removeAttribute(t)})}isEmpty(){return this.addedClasses.size===0&&this.removedClasses.size===0&&this.styleChanges.isEmpty()&&this.attributeChanges.isEmpty()}},Re=class{constructor(e,t){this.changedElements=new WeakMap,this.changedElementsCount=0,this.addedElements=[],this.removedElements=[],this.isStarted=!1,this.element=e,this.shouldTrackChangeCallback=t,this.mutationObserver=new MutationObserver(this.onMutations.bind(this))}start(){this.isStarted||(this.mutationObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0}),this.isStarted=!0)}stop(){this.isStarted&&(this.mutationObserver.disconnect(),this.isStarted=!1)}getChangedElement(e){return this.changedElements.has(e)?this.changedElements.get(e):null}getAddedElements(){return this.addedElements}wasElementAdded(e){return this.addedElements.includes(e)}handlePendingChanges(){this.onMutations(this.mutationObserver.takeRecords())}onMutations(e){const t=new WeakMap;for(const n of e){const s=n.target;if(!this.shouldTrackChangeCallback(s)||this.isElementAddedByTranslation(s))continue;let i=!1;for(const h of this.addedElements)if(h.contains(s)){i=!0;break}if(!i)switch(n.type){case"childList":this.handleChildListMutation(n);break;case"attributes":t.has(s)||t.set(s,[]),t.get(s).includes(n.attributeName)||(this.handleAttributeMutation(n),t.set(s,[...t.get(s),n.attributeName]));break}}}handleChildListMutation(e){e.addedNodes.forEach(t=>{if(t instanceof Element){if(this.removedElements.includes(t)){this.removedElements.splice(this.removedElements.indexOf(t),1);return}this.isElementAddedByTranslation(t)||this.addedElements.push(t)}}),e.removedNodes.forEach(t=>{if(t instanceof Element){if(this.addedElements.includes(t)){this.addedElements.splice(this.addedElements.indexOf(t),1);return}this.removedElements.push(t)}})}handleAttributeMutation(e){const t=e.target;this.changedElements.has(t)||(this.changedElements.set(t,new Oe),this.changedElementsCount++);const n=this.changedElements.get(t);switch(e.attributeName){case"class":this.handleClassAttributeMutation(e,n);break;case"style":this.handleStyleAttributeMutation(e,n);break;default:this.handleGenericAttributeMutation(e,n)}n.isEmpty()&&(this.changedElements.delete(t),this.changedElementsCount--)}handleClassAttributeMutation(e,t){const n=e.target,s=(e.oldValue||"").match(/(\S+)/gu)||[],i=[].slice.call(n.classList),h=i.filter(m=>!s.includes(m)),c=s.filter(m=>!i.includes(m));h.forEach(m=>{t.addClass(m)}),c.forEach(m=>{t.removeClass(m)})}handleStyleAttributeMutation(e,t){const n=e.target,s=e.oldValue||"",i=this.extractStyles(s),h=n.getAttribute("style")||"",c=this.extractStyles(h),m=Object.keys(c).filter(u=>i[u]===void 0||i[u]!==c[u]),l=Object.keys(i).filter(u=>!c[u]);m.forEach(u=>{t.addStyle(u,c[u],i[u]===void 0?null:i[u])}),l.forEach(u=>{t.removeStyle(u,i[u])})}handleGenericAttributeMutation(e,t){const n=e.attributeName,s=e.target;let i=e.oldValue,h=s.getAttribute(n);
1if(i===n&&(i=""),h===n&&(h=""),!s.hasAttribute(n)){if(i===null)return;t.removeAttribute(n,e.oldValue);return}h!==i&&t.addAttribute(n,s.getAttribute(n),e.oldValue)}extractStyles(e){const t={};return e.split(";").forEach(n=>{const s=n.split(":");if(s.length===1)return;const i=s[0].trim();t[i]=s.slice(1).join(":").trim()}),t}isElementAddedByTranslation(e){return e.tagName==="FONT"&&e.getAttribute("style")==="vertical-align: inherit;"}},De=class{constructor(e,t){this.elementEventListeners=[{event:"input",callback:n=>this.handleInputEvent(n)}],this.component=e,this.modelElementResolver=t,this.unsyncedInputs=new Fe}activate(){this.elementEventListeners.forEach(({event:e,callback:t})=>{this.component.element.addEventListener(e,t)})}deactivate(){this.elementEventListeners.forEach(({event:e,callback:t})=>{this.component.element.removeEventListener(e,t)})}markModelAsSynced(e){this.unsyncedInputs.markModelAsSynced(e)}handleInputEvent(e){const t=e.target;t&&this.updateModelFromElement(t)}updateModelFromElement(e){if(!q(e,this.component))return;if(!(e instanceof HTMLElement))throw new Error("Could not update model for non HTMLElement");const t=this.modelElementResolver.getModelName(e);this.unsyncedInputs.add(e,t)}getUnsyncedInputs(){return this.unsyncedInputs.allUnsyncedInputs()}getUnsyncedModels(){return Array.from(this.unsyncedInputs.getUnsyncedModelNames())}resetUnsyncedFields(){this.unsyncedInputs.resetUnsyncedFields()}},Fe=class{constructor(){this.unsyncedNonModelFields=[],this.unsyncedModelNames=[],this.unsyncedModelFields=new Map}add(e,t=null){if(t){this.unsyncedModelFields.set(t,e),this.unsyncedModelNames.includes(t)||this.unsyncedModelNames.push(t);return}this.unsyncedNonModelFields.push(e)}resetUnsyncedFields(){this.unsyncedModelFields.forEach((e,t)=>{this.unsyncedModelNames.includes(t)||this.unsyncedModelFields.delete(t)})}allUnsyncedInputs(){return[...this.unsyncedNonModelFields,...this.unsyncedModelFields.values()]}markModelAsSynced(e){const t=this.unsyncedModelNames.indexOf(e);t!==-1&&this.unsyncedModelNames.splice(t,1)}getUnsyncedModelNames(){return this.unsyncedModelNames}};function He(e,t){const{currentLevelData:n,finalKey:s}=Ve(e,t);if(n!==void 0)return n[s]}const Ve=(e,t)=>{const n=JSON.parse(JSON.stringify(e));let s=n;const i=t.split(".");for(let c=0;c<i.length-1;c++)s=s[i[c]];const h=i[i.length-1];return{currentLevelData:s,finalData:n,finalKey:h,parts:i}};var qe=class{constructor(e){this.props={},this.dirtyProps={},this.pendingProps={},this.updatedPropsFromParent={},this.props=e}get(e){const t=I(e);return this.dirtyProps[t]!==void 0?this.dirtyProps[t]:this.pendingProps[t]!==void 0?this.pendingProps[t]:this.props[t]!==void 0?this.props[t]:He(this.props,t)}has(e){return this.get(e)!==void 0}set(e,t){const n=I(e);return this.get(n)===t?!1:(this.dirtyProps[n]=t,!0)}getOriginalProps(){return{...this.props}}getDirtyProps(){return{...this.dirtyProps}}getUpdatedPropsFromParent(){return{...this.updatedPropsFromParent}}flushDirtyPropsToPending(){this.pendingProps={...this.dirtyProps},this.dirtyProps={}}reinitializeAllProps(e){this.props=e,this.updatedPropsFromParent={},this.pendingProps={}}pushPendingPropsBackToDirty(){this.dirtyProps={...this.pendingProps,...this.dirtyProps},this.pendingProps={}}storeNewPropsFromParent(e){let t=!1;for(const[n,s]of Object.entries(e))this.get(n)!==s&&(t=!0);return t&&(this.updatedPropsFromParent=e),t}},Ue=class{constructor(e,t,n,s,i,h,c){this.fingerprint="",this.defaultDebounce=150,this.backendRequest=null,this.pendingActions=[],this.pendingFiles={},this.isRequestPending=!1,this.requestDebounceTimeout=null,this.element=e,this.name=t,this.backend=h,this.elementDriver=c,this.id=i,this.listeners=new Map,s.forEac
1h(m=>{this.listeners.has(m.event)||this.listeners.set(m.event,[]),this.listeners.get(m.event)?.push(m.action)}),this.valueStore=new qe(n),this.unsyncedInputsTracker=new De(this,c),this.hooks=new Pe,this.resetPromise(),this.externalMutationTracker=new Re(this.element,m=>q(m,this)),this.externalMutationTracker.start()}addPlugin(e){e.attachToComponent(this)}connect(){be(this),this.hooks.triggerHook("connect",this),this.unsyncedInputsTracker.activate(),this.externalMutationTracker.start()}disconnect(){ye(this),this.hooks.triggerHook("disconnect",this),this.clearRequestDebounceTimeout(),this.unsyncedInputsTracker.deactivate(),this.externalMutationTracker.stop()}on(e,t){this.hooks.register(e,t)}off(e,t){this.hooks.unregister(e,t)}set(e,t,n=!1,s=!1){const i=this.nextRequestPromise,h=I(e);if(!this.valueStore.has(h))throw new Error(`Invalid model name "${e}".`);const c=this.valueStore.set(h,t);return this.hooks.triggerHook("model:set",e,t,this),this.unsyncedInputsTracker.markModelAsSynced(h),n&&c&&this.debouncedStartRequest(s),i}getData(e){const t=I(e);if(!this.valueStore.has(t))throw new Error(`Invalid model "${e}".`);return this.valueStore.get(t)}action(e,t={},n=!1){const s=this.nextRequestPromise;return this.pendingActions.push({name:e,args:t}),this.debouncedStartRequest(n),s}files(e,t){this.pendingFiles[e]=t}render(){const e=this.nextRequestPromise;return this.tryStartingRequest(),e}getUnsyncedModels(){return this.unsyncedInputsTracker.getUnsyncedModels()}emit(e,t,n=null){this.performEmit(e,t,!1,n)}emitUp(e,t,n=null){this.performEmit(e,t,!0,n)}emitSelf(e,t){this.doEmit(e,t)}performEmit(e,t,n,s){Ee(this,n,s).forEach(i=>{i.doEmit(e,t)})}doEmit(e,t){this.listeners.has(e)&&(this.listeners.get(e)||[]).forEach(n=>{this.action(n,t,1)})}isTurboEnabled(){return typeof Turbo<"u"&&!this.element.closest('[data-turbo="false"]')}tryStartingRequest(){if(!this.backendRequest){this.performRequest();return}this.isRequestPending=!0}performRequest(){const e=this.nextRequestPromiseResolve;this.resetPromise(),this.unsyncedInputsTracker.resetUnsyncedFields();const t={};for(const[h,c]of Object.entries(this.pendingFiles))c.files&&(t[h]=c.files);const n=this.pendingActions.slice(0,50),s=this.pendingActions.slice(50),i={props:this.valueStore.getOriginalProps(),actions:n,updated:this.valueStore.getDirtyProps(),children:{},updatedPropsFromParent:this.valueStore.getUpdatedPropsFromParent(),files:t};this.hooks.triggerHook("request:started",i),this.backendRequest=this.backend.makeRequest(i.props,i.actions,i.updated,i.children,i.updatedPropsFromParent,i.files),this.hooks.triggerHook("loading.state:started",this.element,this.backendRequest),this.pendingActions=s,this.valueStore.flushDirtyPropsToPending(),this.isRequestPending=s.length>0,this.backendRequest.promise.then(async h=>{const c=new ve(h),m=await c.getBody();for(const d of Object.values(this.pendingFiles))d.value="";const l=c.response.headers;if(!l.get("Content-Type")?.includes("application/vnd.live-component+html")&&!l.get("X-Live-Redirect")){const d={displayError:!0};return this.valueStore.pushPendingPropsBackToDirty(),this.hooks.triggerHook("response:error",c,d),d.displayError&&this.renderError(m),this.backendRequest=null,e(c),h}const u=c.getLiveUrl();return u&&history.replaceState(history.state,"",new URL(u+window.location.hash,window.location.origin)),this.processRerender(m,c),this.backendRequest=null,e(c),this.isRequestPending&&(this.isRequestPending=!1,this.performRequest()),h})}processRerender(e,t){const n={shouldRender:!0};if(this.hooks.triggerHook("render:started",e,t,n),!n.shouldRender)return;if(t.response.headers.get("Location")){this.isTurboEnabled()?Turbo.visit(t.response.headers.get("Location")):window.location.href=t.response.headers.get("Location")||"";return}this.hooks.triggerHook("loading.state:finished",this.element);const s={};Object.keys(this.valueStore.getDirtyProps()).forEach(l=>{s[l]=this.valueStore.get(l)});let i;try{if(i=ke(e),!i.matches("[data-controller~=live]"))throw new Error("A live component template must contain a single root controller element.")}catch(l){throw console.error(`There was a problem with the '${this.name}' component HTML returned:`,{id:this.id}),l}this.externalMutationTracker.handlePendingChanges(),this.externalMutationTracker.stop(),Le(this.element,i,this.unsyncedInputsTracker.getUnsyncedInputs(),l=>x(l,this.valueStore),this.externalMutationTracker),this.externalMutationTracker.start();const h=this.elementDriver.getComponentProps();this.valueStore.reinitializeAllProps(h);const c=this.elementDriver.getEventsToEmit(),m=this.elementDriver.getBrowserEventsToDispatch();
1Object.keys(s).forEach(l=>{this.valueStore.set(l,s[l])}),c.forEach(({event:l,data:u,target:d,componentName:y})=>{if(d==="up"){this.emitUp(l,u,y);return}if(d==="self"){this.emitSelf(l,u);return}this.emit(l,u,y)}),m.forEach(({event:l,payload:u})=>{this.element.dispatchEvent(new CustomEvent(l,{detail:u,bubbles:!0}))}),this.hooks.triggerHook("render:finished",this)}calculateDebounce(e){return e===!0?this.defaultDebounce:e===!1?0:e}clearRequestDebounceTimeout(){this.requestDebounceTimeout&&(clearTimeout(this.requestDebounceTimeout),this.requestDebounceTimeout=null)}debouncedStartRequest(e){this.clearRequestDebounceTimeout(),this.requestDebounceTimeout=window.setTimeout(()=>{this.render()},this.calculateDebounce(e))}renderError(e){let t=document.getElementById("live-component-error");t?t.innerHTML="":(t=document.createElement("div"),t.id="live-component-error",t.style.padding="50px",t.style.backgroundColor="rgba(0, 0, 0, .5)",t.style.zIndex="100000",t.style.position="fixed",t.style.top="0px",t.style.bottom="0px",t.style.left="0px",t.style.right="0px",t.style.display="flex",t.style.flexDirection="column");const n=document.createElement("iframe");n.style.borderRadius="5px",n.style.flexGrow="1",t.appendChild(n),document.body.prepend(t),document.body.style.overflow="hidden",n.contentWindow&&(n.contentWindow.document.open(),n.contentWindow.document.write(e),n.contentWindow.document.close());const s=i=>{i&&(i.outerHTML=""),document.body.style.overflow="visible"};t.addEventListener("click",()=>s(t)),t.setAttribute("tabindex","0"),t.addEventListener("keydown",i=>{i.key==="Escape"&&s(t)}),t.focus()}resetPromise(){this.nextRequestPromise=new Promise(e=>{this.nextRequestPromiseResolve=e})}_updateFromParentProps(e){this.valueStore.storeNewPropsFromParent(e)&&this.render()}};function Ne(e){return new Proxy(e,{get(t,n){if(n in t||typeof n!="string"){if(typeof t[n]=="function"){const s=t[n];return(...i)=>s.apply(t,i)}return Reflect.get(t,n)}return t.valueStore.has(n)?t.getData(n):s=>t.action.apply(t,[n,s])},set(t,n,s){return n in t?(t[n]=s,!0):(t.set(n,s),!0)}})}var $e=class{constructor(e){this.controller=e}getModelName(e){const t=L(e,!1);return t?t.action:null}getComponentProps(){return this.controller.propsValue}getEventsToEmit(){return this.controller.eventsToEmitValue}getBrowserEventsToDispatch(){return this.controller.eventsToDispatchValue}};function te(e){let t=!0,n=null,s=!1,i=null,h=null,c=null,m=null;e.modifiers.forEach(d=>{switch(d.name){case"on":if(!d.value)throw new Error(`The "on" modifier in ${e.getString()} requires a value - e.g. on(change).`);if(!["input","change"].includes(d.value))throw new Error(`The "on" modifier in ${e.getString()} only accepts the arguments "input" or "change".`);n=d.value;break;case"norender":t=!1;break;case"debounce":s=d.value?Number.parseInt(d.value):!0;break;case"min_length":i=d.value?Number.parseInt(d.value):null;break;case"max_length":h=d.value?Number.parseInt(d.value):null;break;case"min_value":c=d.value?Number.parseFloat(d.value):null;break;case"max_value":m=d.value?Number.parseFloat(d.value):null;break;default:throw new Error(`Unknown modifier "${d.name}" in data-model="${e.getString()}".`)}});const[l,u]=e.action.split(":");return{modelName:l,innerModelName:u||null,shouldRender:t,debounce:s,targetEventName:n,minLength:i,maxLength:h,minValue:c,maxValue:m}}var _e=class{constructor(e){this.parentModelBindings=[],this.component=e,this.parentModelBindings=Z(this.component.element).map(te)}attachToComponent(e){e.on("request:started",t=>{t.children=this.getChildrenFingerprints()}),e.on("model:set",(t,n)=>{this.notifyParentModelChange(t,n)})}getChildrenFingerprints(){const e={};
1return this.getChildren().forEach(t=>{if(!t.id)throw new Error("missing id");e[t.id]={fingerprint:t.fingerprint,tag:t.element.tagName.toLowerCase()}}),e}notifyParentModelChange(e,t){const n=Me(this.component);n&&this.parentModelBindings.forEach(s=>{(s.innerModelName||"value")===e&&n.set(s.modelName,t,s.shouldRender,s.debounce)})}getChildren(){return we(this.component)}},je=class{constructor(){this.intersectionObserver=null}attachToComponent(e){e.element.attributes.getNamedItem("loading")?.value==="lazy"&&(e.on("connect",()=>{this.getObserver().observe(e.element)}),e.on("disconnect",()=>{this.intersectionObserver?.unobserve(e.element)}))}getObserver(){return this.intersectionObserver||(this.intersectionObserver=new IntersectionObserver((e,t)=>{e.forEach(n=>{n.isIntersecting&&(n.target.dispatchEvent(new CustomEvent("live:appear")),t.unobserve(n.target))})})),this.intersectionObserver}},Be=class{attachToComponent(e){e.on("loading.state:started",(t,n)=>{this.startLoading(e,t,n)}),e.on("loading.state:finished",t=>{this.finishLoading(e,t)}),this.finishLoading(e,e.element)}startLoading(e,t,n){this.handleLoadingToggle(e,!0,t,n)}finishLoading(e,t){this.handleLoadingToggle(e,!1,t,null)}handleLoadingToggle(e,t,n,s){t?this.addAttributes(n,["busy"]):this.removeAttributes(n,["busy"]),this.getLoadingDirectives(e,n).forEach(({element:i,directives:h})=>{t?this.addAttributes(i,["data-live-is-loading"]):this.removeAttributes(i,["data-live-is-loading"]),h.forEach(c=>{this.handleLoadingDirective(i,t,c,s)})})}handleLoadingDirective(e,t,n,s){const i=ze(n.action,t),h=[],c=[];let m=0;const l=new Map;if(l.set("delay",d=>{t&&(m=d.value?Number.parseInt(d.value):200)}),l.set("action",d=>{if(!d.value)throw new Error(`The "action" in data-loading must have an action name - e.g. action(foo). It's missing for "${n.getString()}"`);h.push(d.value)}),l.set("model",d=>{if(!d.value)throw new Error(`The "model" in data-loading must have an action name - e.g. model(foo). It's missing for "${n.getString()}"`);c.push(d.value)}),n.modifiers.forEach(d=>{if(l.has(d.name)){(l.get(d.name)??(()=>{}))(d);return}throw new Error(`Unknown modifier "${d.name}" used in data-loading="${n.getString()}". Available modifiers are: ${Array.from(l.keys()).join(", ")}.`)}),t&&h.length>0&&s&&!s.containsOneOfActions(h)||t&&c.length>0&&s&&!s.areAnyModelsUpdated(c))return;let u;switch(i){case"show":u=()=>this.showElement(e);break;case"hide":u=()=>this.hideElement(e);break;case"addClass":u=()=>this.addClass(e,n.args);break;case"removeClass":u=()=>this.removeClass(e,n.args);break;case"addAttribute":u=()=>this.addAttributes(e,n.args);break;case"removeAttribute":u=()=>this.removeAttributes(e,n.args);break;default:throw new Error(`Unknown data-loading action "${i}"`)}if(m){window.setTimeout(()=>{s&&!s.isResolved&&u()},m);return}u()}getLoadingDirectives(e,t){const n=[];let s=Array.from(t.querySelectorAll("[data-loading]"));return s=s.filter(i=>q(i,e)),t.hasAttribute("data-loading")&&(s=[t,...s]),s.forEach(i=>{if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))throw new Error("Invalid Element Type");const h=P(i.dataset.loading||"show");n.push({element:i,directives:h})}),n}showElement(e){e.style.display="revert"}hideElement(e){e.style.display="none"}addClass(e,t){e.classList.add(...G(t))}removeClass(e,t){e.classList.remove(...G(t)),e.classList.length===0&&e.removeAttribute("class")}addAttributes(e,t){t.forEach(n=>{e.setAttribute(n,"")})}removeAttributes(e,t){t.forEach(n=>{e.removeAttribute(n)})}};const ze=(e,t)=>{switch(e){case"show":return t?"show":"hide";case"hide":return t?"hide":"show";case"addClass":return t?"addClass":"removeClass";case"removeClass":return t?"removeClass":"addClass";case"addAttribute":return t?"addAttribute":"removeAttribute";case"removeAttribute":return t?"removeAttribute":"addAttribute"}throw new Error(`Unknown data-loading action "${e}"`)};var xe=class{constructor(){this.isConnected=!1}attachToComponent(e){e.on("render:started",(t,n,s)=>{this.isConnected||(s.shouldRender=!1)}),e.on("connect",()=>{this.isConnected=!0}),e.on("disconnect",()=>{this.isConnected=!1})}},We=class{constructor(e){this.isPollingActive=!0,this.pollingIntervals=[],this.component=e}addPoll(e,t){this.polls.push({actionName:e,duration:t}),this.isPollingActive&&this.initiatePoll(e,t)}startAllPolling(){this.isPollingActive||(this.isPollingActive=!0,this.polls.forEac
1h(({actionName:e,duration:t})=>{this.initiatePoll(e,t)}))}stopAllPolling(){this.isPollingActive=!1,this.pollingIntervals.forEach(e=>{clearInterval(e)})}clearPolling(){this.stopAllPolling(),this.polls=[],this.startAllPolling()}initiatePoll(e,t){let n;e==="$render"?n=()=>{this.component.render()}:n=()=>{this.component.action(e,{},0)};const s=window.setInterval(()=>{n()},t);this.pollingIntervals.push(s)}},Je=class{attachToComponent(e){this.element=e.element,this.pollingDirector=new We(e),this.initializePolling(),e.on("connect",()=>{this.pollingDirector.startAllPolling()}),e.on("disconnect",()=>{this.pollingDirector.stopAllPolling()}),e.on("render:finished",()=>{this.initializePolling()})}addPoll(e,t){this.pollingDirector.addPoll(e,t)}clearPolling(){this.pollingDirector.clearPolling()}initializePolling(){if(this.clearPolling(),this.element.dataset.poll===void 0)return;const e=this.element.dataset.poll;P(e||"$render").forEach(t=>{let n=2e3;t.modifiers.forEach(s=>{s.name==="delay"?s.value&&(n=Number.parseInt(s.value)):console.warn(`Unknown modifier "${s.name}" in data-poll "${e}".`)}),this.addPoll(t.action,n)})}},Xe=class{attachToComponent(e){this.synchronizeValueOfModelFields(e),e.on("render:finished",()=>{this.synchronizeValueOfModelFields(e)})}synchronizeValueOfModelFields(e){e.element.querySelectorAll("[data-model]").forEach(t=>{if(!(t instanceof HTMLElement))throw new Error("Invalid element using data-model.");if(t instanceof HTMLFormElement||!q(t,e))return;const n=L(t);if(!n)return;const s=n.action;e.getUnsyncedModels().includes(s)||(e.valueStore.has(s)&&B(t,e.valueStore.get(s)),t instanceof HTMLSelectElement&&!t.multiple&&e.valueStore.set(s,x(t,e.valueStore)))})}},Ge=class{attachToComponent(e){e.on("model:set",t=>{this.handleModelSet(t,e.valueStore)})}handleModelSet(e,t){if(t.has("validatedFields")){const n=[...t.get("validatedFields")];n.includes(e)||n.push(e),t.set("validatedFields",n)}}},ne=class se extends fe{constructor(...t){super(...t),this.pendingActionTriggerModelElement=null,this.elementEventListeners=[{event:"input",callback:n=>this.handleInputEvent(n)},{event:"change",callback:n=>this.handleChangeEvent(n)}],this.pendingFiles={}}initialize(){this.mutationObserver=new MutationObserver(this.onMutations.bind(this)),this.createComponent()}connect(){this.connectComponent(),this.mutationObserver.observe(this.element,{attributes:!0})}disconnect(){this.disconnectComponent(),this.mutationObserver.disconnect()}update(t){if(t.type==="input"||t.type==="change")throw new Error(`Since LiveComponents 2.3, you no longer need data-action="live#update" on form elements. Found on element: ${H(t.currentTarget)}`);this.updateModelFromElementEvent(t.currentTarget,null)}action(t){const n=t.params;if(!n.action)throw new Error(`No action name provided on element: ${H(t.currentTarget)}. Did you forget to add the "data-live-action-param" attribute?`);const s=n.action,i={...n};delete i.action;const h=P(s);let c=!1;h.forEach(m=>{let l={};const u=new Map;u.set("stop",()=>{t.stopPropagation()}),u.set("self",()=>{t.target,t.currentTarget}),u.set("debounce",d=>{c=d.value?Number.parseInt(d.value):!0}),u.set("files",d=>{d.value?this.pendingFiles[d.value]&&(l[d.value]=this.pendingFiles[d.value]):l=this.pendingFiles}),m.modifiers.forEach(d=>{if(u.has(d.name)){(u.get(d.name)??(()=>{}))(d);return}console.warn(`Unknown modifier ${d.name} in action "${s}". Available modifiers are: ${Array.from(u.keys()).join(", ")}.`)});for(const[d,y]of Object.entries(l))y.files&&this.component.files(d,y),delete this.pendingFiles[d];this.component.action(m.action,i,c),L(t.currentTarget,!1)&&(this.pendingActionTriggerModelElement=t.currentTarget)})}$render(){return this.component.render()}emit(t){this.getEmitDirectives(t).forEach(({name:n,data:s,nameMatch:i})=>{this.component.emit(n,s,i)})}emitUp(t){this.getEmitDirectives(t).forEach(({name:n,data:s,nameMatch:i})=>{this.component.emitUp(n,s,i)})}emitSelf(t){this.getEmitDirectives(t).forEach(({name:n,data:s})=>{this.component.emitSelf(n,s)})}$updateModel(t,n,s=!0,i=!0){return this.component.set(t,n,s,i)}propsUpdatedFromParentValueChanged(){this.component._updateFromParentProps(this.propsUpdatedFromParentValue)}fingerprintValueChanged(){this.component.fingerprint=this.fingerprintValue}getEmitDirectives(t){const n=t.params;if(!n.event)throw new Error(`No event name provided on element: ${H(t.currentTarget)}. Did you forget to add the "data-live-event-param" attribute?`);const s=n.event,i={...n};delete i.event;const h=P(s),c=[];return h.forEach(m=>{let l=null;
1m.modifiers.forEach(u=>{if(u.name==="name")l=u.value;else throw new Error(`Unknown modifier ${u.name} in event "${s}".`)}),c.push({name:m.action,data:i,nameMatch:l})}),c}createComponent(){const t=this.element.id||null;this.component=new Ue(this.element,this.nameValue,this.propsValue,this.listenersValue,t,se.backendFactory(this),new $e(this)),this.proxiedComponent=Ne(this.component),Object.defineProperty(this.element,"__component",{value:this.proxiedComponent,writable:!0}),this.hasDebounceValue&&(this.component.defaultDebounce=this.debounceValue),[new Be,new je,new Ge,new xe,new Je,new Xe,new _e(this.component)].forEach(n=>{this.component.addPlugin(n)})}connectComponent(){this.component.connect(),this.mutationObserver.observe(this.element,{attributes:!0}),this.elementEventListeners.forEach(({event:t,callback:n})=>{this.component.element.addEventListener(t,n)}),this.dispatchEvent("connect")}disconnectComponent(){this.component.disconnect(),this.elementEventListeners.forEach(({event:t,callback:n})=>{this.component.element.removeEventListener(t,n)}),this.dispatchEvent("disconnect")}handleInputEvent(t){const n=t.target;n&&this.updateModelFromElementEvent(n,"input")}handleChangeEvent(t){const n=t.target;n&&this.updateModelFromElementEvent(n,"change")}updateModelFromElementEvent(t,n){if(!q(t,this.component))return;if(!(t instanceof HTMLElement))throw new Error("Could not update model for non HTMLElement");if(t instanceof HTMLInputElement&&t.type==="file"){const m=t.name;t.files?.length?this.pendingFiles[m]=t:this.pendingFiles[m]&&delete this.pendingFiles[m]}const s=L(t,!1);if(!s)return;const i=te(s);if(i.targetEventName||(i.targetEventName="input"),this.pendingActionTriggerModelElement===t&&(i.shouldRender=!1),n==="change"&&i.targetEventName==="input"&&(i.targetEventName="change"),n&&i.targetEventName!==n)return;i.debounce===!1&&(i.targetEventName==="input"?i.debounce=!0:i.debounce=0);const h=x(t,this.component.valueStore),c=h===""||h===null||h===void 0;if(!((Te(t)||Ce(t))&&(!c&&i.minLength!==null&&typeof h=="string"&&h.length<i.minLength||!c&&i.maxLength!==null&&typeof h=="string"&&h.length>i.maxLength))){if(Se(t)&&!c){const m=Number(h);if(i.minValue!==null&&m<i.minValue||i.maxValue!==null&&m>i.maxValue)return}this.component.set(i.modelName,h,i.shouldRender,i.debounce)}}dispatchEvent(t,n={},s=!0,i=!1){n.controller=this,n.component=this.proxiedComponent,this.dispatch(t,{detail:n,prefix:"live",cancelable:i,bubbles:s})}onMutations(t){t.forEach(n=>{n.type==="attributes"&&n.attributeName==="id"&&this.element.id!==this.component.id&&(this.disconnectComponent(),this.createComponent(),this.connectComponent())})}};ne.values={name:String,url:String,props:{type:Object,default:{}},propsUpdatedFromParent:{type:Object,default:{}},listeners:{type:Array,default:[]},eventsToEmit:{type:Array,default:[]},eventsToDispatch:{type:Array,default:[]},debounce:{type:Number,default:150},fingerprint:{type:String,default:""},requestMethod:{type:String,default:"post"},fetchCredentials:{type:String,default:"same-origin"}};ne.backendFactory=e=>new ge(e.urlValue,e.requestMethodValue,e.fetchCredentialsValue);export{Ue as Component,ne as default,Ye as getComponent};
2//# sourceMappingURL=live_controller-DPGwCUd3.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.