Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cdn.min.js « dist « dist « morph « packages « alpinejs - github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cad56f2326c03f7bdfed550487dd6716f6d76404 (plain)
1
(()=>{function C(e,t,i){return T(i),b(e,K(t)),e}var N,v,w,g,y,S,m,x,h=()=>{};function T(e={}){let t=i=>i.getAttribute("key");N=e.key||t,v=e.lookahead||!1,w=e.updating||h,g=e.updated||h,y=e.removing||h,S=e.removed||h,m=e.adding||h,x=e.added||h}function K(e){return document.createRange().createContextualFragment(e).firstElementChild}function b(e,t){if(e.isEqualNode(t))return;if(k(e,t))return V(e,t);let i=!1;if(!p(w,e,t,()=>i=!0)){if(O(t)){F(e,t),g(e,t);return}i||q(e,t),g(e,t),B(e,t)}}function k(e,t){return e.nodeType!=t.nodeType||e.nodeName!=t.nodeName||s(e)!=s(t)}function O(e){return e.nodeType===3||e.nodeType===8}function V(e,t){if(p(y,e))return;let i=t.cloneNode(!0);p(m,i)||(e.parentNode.replaceChild(i,e),S(e),x(i))}function F(e,t){let i=t.nodeValue;e.nodeValue!==i&&(e.nodeValue=i)}function q(e,t){if(e._x_isShown&&!t._x_isShown||!e._x_isShown&&t._x_isShown)return;let i=Array.from(e.attributes),o=Array.from(t.attributes);for(let u=i.length-1;u>=0;u--){let a=i[u].name;t.hasAttribute(a)||e.removeAttribute(a)}for(let u=o.length-1;u>=0;u--){let a=o[u].name,r=o[u].value;e.getAttribute(a)!==r&&e.setAttribute(a,r)}}function B(e,t){let i=e.childNodes,o=t.childNodes,u=A(o),a=A(i),r=t.firstChild,n=e.firstChild,c={};for(;r;){let l=s(r),d=s(n);if(!n)if(l&&c[l]){let f=c[l];e.appendChild(f),n=f}else{H(r,e),r=r.nextSibling;continue}if(v){let f=r.nextElementSibling;f&&n.isEqualNode(f)&&(n=_(r,n),d=s(n))}if(l!==d){if(!l&&d){c[d]=n,n=_(r,n),c[d].remove(),n=n.nextSibling,r=r.nextSibling;continue}if(l&&!d&&a[l]&&(n.parentElement.replaceChild(a[l],n),n=a[l]),l&&d){c[d]=n;let f=a[l];if(f)n.parentElement.replaceChild(f,n),n=f;else{c[d]=n,n=_(r,n),c[d].remove(),n=n.nextSibling,r=r.nextSibling;continue}}}b(n,r),r=r&&r.nextSibling,n=n&&n.nextSibling}for(;n;){if(!p(y,n)){let l=n;e.removeChild(l),S(l)}n=n.nextSibling}}function s(e){return e&&e.nodeType===1&&N(e)}function A(e){let t={};return e.forEach(i=>{let o=s(i);o&&(t[o]=i)}),t}function p(e,...t){let i=!1;return e(...t,()=>i=!0),i}function H(e,t){if(!p(m,e)){let i=e.cloneNode(!0);t.appendChild(i),x(i)}}function _(e,t){if(!p(m,e)){let i=e.cloneNode(!0);return t.parentElement.insertBefore(i,t),x(i),i}return t}function E(e){e.directive("morph",(t,{expression:i},{effect:o,evaluateLater:u})=>{let a=u(i);o(()=>{a(r=>{let n=t.firstElementChild||t.firstChild||t.appendChild(document.createTextNode(""));C(n,r)})})})}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(E)});})();