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

6 lines
34 KiB
JavaScript
Raw Normal View History

2021-09-29 06:23:05 +02:00
(()=>{var Fe=!1,je=!1,J=[];function wt(e){Kr(e)}function Kr(e){J.includes(e)||J.push(e),zr()}function zr(){!je&&!Fe&&(Fe=!0,queueMicrotask(Vr))}function Vr(){Fe=!1,je=!0;for(let e=0;e<J.length;e++)J[e]();J.length=0,je=!1}var v,C,V,Ke,ze=!0;function Et(e){ze=!1,e(),ze=!0}function St(e){v=e.reactive,V=e.release,C=t=>e.effect(t,{scheduler:r=>{ze?wt(r):r()}}),Ke=e.raw}function Ve(e){C=e}function At(e){let t=()=>{};return[n=>{let i=C(n);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),V(i))}},()=>{t()}]}var Ot=[],Tt=[],Rt=[];function Ct(e){Rt.push(e)}function Mt(e){Tt.push(e)}function Nt(e){Ot.push(e)}function kt(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function Be(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])})}var qe=new MutationObserver(He),Ue=!1;function We(){qe.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),Ue=!0}function Hr(){Br(),qe.disconnect(),Ue=!1}var Z=[],Ge=!1;function Br(){Z=Z.concat(qe.takeRecords()),Z.length&&!Ge&&(Ge=!0,queueMicrotask(()=>{qr(),Ge=!1}))}function qr(){He(Z),Z.length=0}function m(e){if(!Ue)return e();Hr();let t=e();return We(),t}var Ye=!1,pe=[];function Dt(){Ye=!0}function Pt(){Ye=!1,He(pe),pe=[]}function He(e){if(Ye){pe=pe.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)=>{Be(s,o)}),n.forEach((o,s)=>{Ot.forEach(a=>a(s,o))});for(let o of t)r.includes(o)||Rt.forEach(s=>s(o));for(let o of r)t.includes(o)||Tt.forEach(s=>s(o));t=null,r=null,n=null,i=null}function B(e,t,r){return e._x_dataStack=[t,...Q(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(n=>n!==t)}}function Je(e,t){let r=e._x_dataStack[0];Object.entries(t).forEach(([n,i])=>{r[n]=i})}function Q(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?Q(e.host):e.parentNode?Q(e.parentNode):[]}function X(e){let t=new Proxy({},{ownKeys:()=>Array.from(new Set(e.flatMap(r=>Object.keys(r)))),has:(r,n)=>e.some(i=>i.hasOwnProperty(n)),get:(r,n)=>(e.find(i=>{if(i.hasOwnProperty(n)){let o=Object.getOwnPropertyDescriptor(i,n);if(o.get&&o.get._x_alreadyBound||o.set&&o.set._x_alreadyBound)return!0;if((o.get||o.set)&&o.enumerable){let s=o.get,a=o.set,c=o;s=s&&s.bind(t),a=a&&a.bind(t),s&&(s._x_alreadyBound=!0),a&&(a._x_alreadyBound=!0),Object.defineProperty(i,n,{...c,get:s,set:a})}return!0}return!1})||{})[n],set:(r,n,i)=>{let o=e.find(s=>s.hasOwnProperty(n));return o?o[n]=i:e[e.length-1][n]=i,!0}});return t}function It(e){let t=n=>typeof n=="object"&&!Array.isArray(n)&&n!==null,r=(n,i="")=>{Object.entries(n).forEach(([o,s])=>{let a=i===""?o:`${i}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?n[o]=s.initialize(e,a,o):t(s)&&s!==n&&!(s instanceof Element)&&r(s,a)})};return r(e)}function me(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(n,i,o){return e(this.initialValue,()=>Ur(n,i),s=>Ze(n,i,s),i,o)}};return t(r),n=>{if(typeof n=="object"&&n!==null&&n._x_interceptor){let i=r.initialize.bind(r);r.initialize=(o,s,a)=>{let c=n.initialize(o,s,a);return r.initialValue=c,i(o,s,a)}}else r.initialValue=n;return r}}function Ur(e,t){return t.split(".").reduce((r,n)=>r[n],e)}function Ze(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),Ze(e[t[0]],t.slice(1),r)}}var Lt={};fu
Expression: "${t}"
`,e),i}}var et="x-";function A(e=""){return et+e}function jt(e){et=e}var Kt={};function p(e,t){Kt[e]=t}function te(e,t,r){let n={};return Array.from(t).map(zt((o,s)=>n[o]=s)).filter(Vt).map(Qr(n,r)).sort(Xr).map(o=>Zr(e,o))}function Bt(e){return Array.from(e).map(zt()).filter(t=>!Vt(t))}var tt=!1,re=new Map,Ht=Symbol();function qt(e){tt=!0;let t=Symbol();Ht=t,re.set(t,[]);let r=()=>{for(;re.get(t).length;)re.get(t).shift()();re.delete(t)},n=()=>{tt=!1,r()};e(r),n()}function Zr(e,t){let r=()=>{},n=Kt[t.type]||r,i=[],o=d=>i.push(d),[s,a]=At(e);i.push(a);let c={Alpine:S,effect:s,cleanup:o,evaluateLater:h.bind(h,e),evaluate:b.bind(b,e)},l=()=>i.forEach(d=>d());kt(e,t.original,l);let u=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,c),n=n.bind(n,e,t,c),tt?re.get(Ht).push(n):n())};return u.runCleanups=l,u}var ge=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),_e=e=>e;function zt(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=Ut.reduce((o,s)=>s(o),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var Ut=[];function H(e){Ut.push(e)}function Vt({name:e}){return Wt().test(e)}var Wt=()=>new RegExp(`^${et}([^:^.]+)\\b`);function Qr(e,t){return({name:r,value:n})=>{let i=r.match(Wt()),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 rt="DEFAULT",ye=["ignore","ref","data","bind","init","for","model","transition","show","if",rt,"element"];function Xr(e,t){let r=ye.indexOf(e.type)===-1?rt:e.type,n=ye.indexOf(t.type)===-1?rt:t.type;return ye.indexOf(r)-ye.indexOf(n)}function $(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}var nt=[],it=!1;function q(e){nt.push(e),queueMicrotask(()=>{it||setTimeout(()=>{xe()})})}function xe(){for(it=!1;nt.length;)nt.shift()()}function Gt(){it=!0}function N(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>N(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)N(n,t,!1),n=n.nextElementSibling}function be(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}function Jt(){document.body||be("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),$(document,"alpine:init"),$(document,"alpine:initializing"),We(),Ct(t=>O(t,N)),Mt(t=>q(()=>en(t))),Nt((t,r)=>{te(t,r).forEach(n=>n())});let e=t=>!k(t.parentElement,!0);Array.from(document.querySelectorAll(Yt())).filter(e).forEach(t=>{O(t)}),$(document,"alpine:initialized")}var ot=[],Zt=[];function Qt(){return ot.map(e=>e())}function Yt(){return ot.concat(Zt).map(e=>e())}function ve(e){ot.push(e)}function Xt(e){Zt.push(e)}function k(e,t=!1){if(!e)return;if((t?Yt():Qt()).some(n=>e.matches(n)))return e;if(!!e.parentElement)return k(e.parentElement,t)}function er(e){return Qt().some(t=>e.matches(t))}function O(e,t=N){qt(()=>{t(e,(r,n)=>{te(r,r.attributes).forEach(i=>i()),r._x_ignore&&n()})})}function en(e){N(e,t=>Be(t))}function ne(e,t){return Array.isArray(t)?tr(e,t.join(" ")):typeof t=="object"&&t!==null?tn(e,t):typeof t=="function"?ne(e,t()):tr(e,t)}function tr(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)});return t=t===!0?t="":t||"",i(n(t))}function tn(e,t){let r=a=>a.split(" ").filter(Boolean),n=Object.entries(t).flatMap(([a,c])=>c?r(a):!1).filter(Boolean),i=Object.entries(t).flatMap(([a,c])=>c?!1:r(a)).filter(Boolean),o=[],s=[];return i.forEach(a=>{e.classList.contains(a)&&(e.classList.remove(a),s.push(a))}),n.forEach(a=>{e.classList.contains(a)||(e.classList.add(a),o.push(a))}),()=>{s.forEach(a=>e.classList.add(a)),o.forEach(a=>e.classList.remove(a))}}function F(e,t){return typeof t=="object"&&t!==null?rn(e,t):nn(e,t)}function rn(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{r[n]=e.style[n],e.style.setProperty(on(n),i)}),setTimeou