LocalCDN-Firefox-Chrome-Brave/resources/alpinejs/3.13.2/alpine.jsm

6 lines
42 KiB
JavaScript
Raw Normal View History

(()=>{var Ze=!1,Qe=!1,H=[],et=-1;function zt(e){En(e)}function En(e){H.includes(e)||H.push(e),vn()}function we(e){let t=H.indexOf(e);t!==-1&&t>et&&H.splice(t,1)}function vn(){!Qe&&!Ze&&(Ze=!0,queueMicrotask(Sn))}function Sn(){Ze=!1,Qe=!0;for(let e=0;e<H.length;e++)H[e](),et=e;H.length=0,et=-1,Qe=!1}var T,I,L,rt,tt=!0;function Vt(e){tt=!1,e(),tt=!0}function Ht(e){T=e.reactive,L=e.release,I=t=>e.effect(t,{scheduler:r=>{tt?zt(r):r()}}),rt=e.raw}function nt(e){I=e}function qt(e){let t=()=>{};return[n=>{let i=I(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),L(i))},i},()=>{t()}]}function q(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function O(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>O(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)O(n,t,!1),n=n.nextElementSibling}function v(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var Ut=!1;function Wt(){Ut&&v("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),Ut=!0,document.body||v("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),q(document,"alpine:init"),q(document,"alpine:initializing"),ce(),er(t=>S(t,O)),Q(t=>ae(t)),Se((t,r)=>{le(t,r).forEach(n=>n())});let e=t=>!U(t.parentElement,!0);Array.from(document.querySelectorAll(Yt())).filter(e).forEach(t=>{S(t)}),q(document,"alpine:initialized")}var it=[],Gt=[];function Jt(){return it.map(e=>e())}function Yt(){return it.concat(Gt).map(e=>e())}function Ee(e){it.push(e)}function ve(e){Gt.push(e)}function U(e,t=!1){return Z(e,r=>{if((t?Yt():Jt()).some(i=>r.matches(i)))return!0})}function Z(e,t){if(e){if(t(e))return e;if(e._x_teleportBack&&(e=e._x_teleportBack),!!e.parentElement)return Z(e.parentElement,t)}}function Xt(e){return Jt().some(t=>e.matches(t))}var Zt=[];function Qt(e){Zt.push(e)}function S(e,t=O,r=()=>{}){rr(()=>{t(e,(n,i)=>{r(n,i),Zt.forEach(o=>o(n,i)),le(n,n.attributes).forEach(o=>o()),n._x_ignore&&i()})})}function ae(e){O(e,t=>{ot(t),tr(t)})}var nr=[],ir=[],or=[];function er(e){or.push(e)}function Q(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,ir.push(t))}function Se(e){nr.push(e)}function Oe(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function ot(e,t){e._x_attributeCleanups&&Object.entries(e._x_attributeCleanups).forEach(([r,n])=>{(t===void 0||t.includes(r))&&(n.forEach(i=>i()),delete e._x_attributeCleanups[r])})}function tr(e){if(e._x_cleanups)for(;e._x_cleanups.length;)e._x_cleanups.pop()()}var at=new MutationObserver(ft),ct=!1;function ce(){at.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),ct=!0}function lt(){An(),at.disconnect(),ct=!1}var ue=[],st=!1;function An(){ue=ue.concat(at.takeRecords()),ue.length&&!st&&(st=!0,queueMicrotask(()=>{On(),st=!1}))}function On(){ft(ue),ue.length=0}function h(e){if(!ct)return e();lt();let t=e();return ce(),t}var ut=!1,Ae=[];function sr(){ut=!0}function ar(){ut=!1,ft(Ae),Ae=[]}function ft(e){if(ut){Ae=Ae.concat(e);return}let t=[],r=[],n=new Map,i=new Map;for(let o=0;o<e.length;o++)if(!e[o].target._x_ignoreMutationObserver&&(e[o].type==="childList"&&(e[o].addedNodes.forEach(s=>s.nodeType===1&&t.push(s)),e[o].removedNodes.forEach(s=>s.nodeType===1&&r.push(s))),e[o].type==="attributes")){let s=e[o].target,a=e[o].attributeName,c=e[o].oldValue,l=()=>{n.has(s)||n.set(s,[]),n.get(s).push({name:a,value:s.getAttribute(a)})},u=()=>{i.has(s)||i.set(s,[]),i.get(s).push(a)};s.hasAttribute(a)&&c===null?l():s.hasAttribute(a)?(u(),l()):u()}i.forEach((o,s)=>{ot(s,o)}),n.forEach((o,s)=>{nr.forEach(a=>a(s,o))});for(let o of r)t.includes(o)||(ir.forEach(s=>s(o)),ae(o));t.forEach(o=>{o._x_ignoreSelf=!0,o._x_ignore=!0});for(let o of t)
${r?'Expression: "'+r+`"
`:""}`,t),setTimeout(()=>{throw e},0)}var Me=!0;function Pe(e){let t=Me;Me=!1;let r=e();return Me=t,r}function R(e,t,r={}){let n;return x(e,t)(i=>n=i,r),n}function x(...e){return ur(...e)}var ur=ht;function fr(e){ur=e}function ht(e,t){let r={};fe(r,e);let n=[r,...$(e)],i=typeof t=="function"?Mn(n,t):Pn(n,t,e);return lr.bind(null,e,t,i)}function Mn(e,t){return(r=()=>{},{scope:n={},params:i=[]}={})=>{let o=t.apply(j([n,...e]),i);Ne(r,o)}}var mt={};function Nn(e,t){if(mt[e])return mt[e];let r=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(e.trim())||/^(let|const)\s/.test(e.trim())?`(async()=>{ ${e} })()`:e,o=(()=>{try{let s=new r(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`);return Object.defineProperty(s,"name",{value:`[Alpine] ${e}`}),s}catch(s){return ee(s,t,e),Promise.resolve()}})();return mt[e]=o,o}function Pn(e,t,r){let n=Nn(t,r);return(i=()=>{},{scope:o={},params:s=[]}={})=>{n.result=void 0,n.finished=!1;let a=j([o,...e]);if(typeof n=="function"){let c=n(n,a).catch(l=>ee(l,r,t));n.finished?(Ne(i,n.result,a,s,r),n.result=void 0):c.then(l=>{Ne(i,l,a,s,r)}).catch(l=>ee(l,r,t)).finally(()=>n.result=void 0)}}}function Ne(e,t,r,n,i){if(Me&&typeof t=="function"){let o=t.apply(r,n);o instanceof Promise?o.then(s=>Ne(e,s,r,n)).catch(s=>ee(s,i,t)):e(o)}else typeof t=="object"&&t instanceof Promise?t.then(o=>e(o)):e(t)}var yt="x-";function C(e=""){return yt+e}function dr(e){yt=e}var _t={};function d(e,t){return _t[e]=t,{before(r){if(!_t[r]){console.warn("Cannot find directive `${directive}`. `${name}` will use the default order of execution");return}let n=W.indexOf(r);W.splice(n>=0?n:W.indexOf("DEFAULT"),0,e)}}}function le(e,t,r){if(t=Array.from(t),e._x_virtualDirectives){let o=Object.entries(e._x_virtualDirectives).map(([a,c])=>({name:a,value:c})),s=bt(o);o=o.map(a=>s.find(c=>c.name===a.name)?{name:`x-bind:${a.name}`,value:`"${a.value}"`}:a),t=t.concat(o)}let n={};return t.map(mr((o,s)=>n[o]=s)).filter(_r).map(Dn(n,r)).sort(kn).map(o=>In(e,o))}function bt(e){return Array.from(e).map(mr()).filter(t=>!_r(t))}var gt=!1,de=new Map,pr=Symbol();function rr(e){gt=!0;let t=Symbol();pr=t,de.set(t,[]);let r=()=>{for(;de.get(t).length;)de.get(t).shift()();de.delete(t)},n=()=>{gt=!1,r()};e(r),n()}function pt(e){let t=[],r=a=>t.push(a),[n,i]=qt(e);return t.push(i),[{Alpine:F,effect:n,cleanup:r,evaluateLater:x.bind(x,e),evaluate:R.bind(R,e)},()=>t.forEach(a=>a())]}function In(e,t){let r=()=>{},n=_t[t.type]||r,[i,o]=pt(e);Oe(e,t.original,o);let s=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,i),n=n.bind(n,e,t,i),gt?de.get(pr).push(n):n())};return s.runCleanups=o,s}var Ie=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),De=e=>e;function mr(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=hr.reduce((o,s)=>s(o),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var hr=[];function te(e){hr.push(e)}function _r({name:e}){return gr().test(e)}var gr=()=>new RegExp(`^${yt}([^:^.]+)\\b`);function Dn(e,t){return({name:r,value:n})=>{let i=r.match(gr()),o=r.match(/:([a-zA-Z0-9\-_:]+)/),s=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[r]||r;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:s.map(c=>c.replace(".","")),expression:n,original:a}}}var xt="DEFAULT",W=["ignore","ref","data","id","bind","init","for","model","modelable","transition","show","if",xt,"teleport"];function kn(e,t){let r=W.indexOf(e.type)===-1?xt:e.type,n=W.indexOf(t.type)===-1?xt:t.type;return W.indexOf(r)-W.indexOf(n)}var wt=[],Et=!1;function re(e=()=>{}){return queueMicrotask(()=>{Et||setTimeout(()=>{ke()})}),new Promise(t=>{wt.push(()=>{e(),t()})})}function ke(){for(Et=!1;wt.length;)wt.shift()()}function xr(){Et=!0}function pe(e,t){return Array.isArray(t)?yr(e,t.join(" ")):typeof t=="object"&&t!==null?Ln(e,t):typeof t=="function"?pe(e,t()):yr(e,t)}function yr(e,t){let r=o=>o.split(" ").filter(Boolean),n=o=>o.split(" ").filter(s=>!e.classList.contains(s)).filter(Boolean),i=o=>(e.classList.add(...o),()=>{e.classList.remove(...o)});r