PageSourceSearch

https://ctja.org/wp-content/themes/ctja/public/build/assets/vendor/@swup/parallel-plugin-BJdlPToF.js

js ctja.org collected 2026-09-30 08:27:58 UTC 3,314 bytes, 1 lines download raw bytes

1import{v as f}from"../swup-Cichald6.js";import{e as d}from"./plugin-BtDWckxY.js";function p(){return p=Object.assign?Object.assign.bind():function(u){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(u[i]=t[i])}return u},p.apply(this,arguments)}class g extends d{constructor(e={}){super(),this.name="SwupParallelPlugin",this.requires={swup:">=4.6"},this.defaults={containers:[],keep:0},this.options=void 0,this.originalContainers=null,this.parallelContainers=[],this.startVisit=t=>{this.originalContainers=null,this.visitHasPotentialParallelAnimation(t)&&(t.animation.wait=!0,t.animation.parallel=!0)},this.skipOutAnimation=(t,i)=>{this.isParallelVisit(t)&&(i.skip=!0)},this.insertContainers=t=>{if(!this.isParallelVisit(t))return;const i=this.getParallelContainersForVisit(t);this.parallelContainers=i,this.swup.hooks.call("content:insert",{containers:i},()=>{for(const{all:n,next:s,previous:o,keep:l,remove:c}of i)n.forEach((r,h)=>r.style.setProperty("--swup-parallel-container",`${h}`)),o.setAttribute("aria-hidden","true"),o.before(s),t.animation.animate&&(s.classList.add("is-next-container"),f(s),s.classList.remove("is-next-container")),o.classList.add("is-previous-container"),l.forEach(r=>r.classList.add("is-kept-container")),c.forEach(r=>r.classList.add("is-removing-container"))}),this.originalContainers=t.containers;const a=this.parallelContainers.map(({selector:n})=>n);t.containers=t.containers.filter(n=>!a.includes(n))},this.resetContainers=t=>{this.originalContainers&&(t.containers=this.originalContainers)},this.cleanupContainers=()=>{const t=this.parallelContainers;this.swup.hooks.call("content:remove",{containers:t},()=>{for(const{remove:i,next:a}of t)i.forEach(n=>n.remove()),a.classList.remove("is-next-container")}),this.parallelContainers=[]},this.options=p({},this.defaults,e)}mount(){this.options.containers.length||(this.options.containers=this.swup.options.containers),this.swup.hooks.create("content:insert"),this.swup.hooks.create("content:remove"),this.on("visit:start",this.startVisit,{priority:1}),this.before("animation:out:await",this.skipOutAnimation,{priority:1}),this.before("content:replace",this.insertContainers,{priority:1}),this.on("content:replace",this.resetContainers),this.on("visit:end",this.cleanupContainers)}getParallelContainersForVisit(e){const{containers:t}=this.options,i=t.filter(a=>e.containers.includes(a));return i.length?i.reduce((a,n)=>{let{keep:s}=this.options;s=typeof s=="object"?s[n]:s,s=Math.max(0,Number(s));const o=e.to.document.querySelector(n),l=Array.from(document.querySelectorAll(n)),c=l[0],r=l.slice(0,s),h=l.slice(s),m=[...new Set([o,c,...r,...h])];return o&&c?[...a,{selector:n,next:o,previous:c,keep:r,remove:h,all:m}]:(console.warn(`Parallel container ${n} not found`),a)},[]):(console.warn("No parallel containers found in list of replaced containers"),[])}isParallelVisit(e){return e.animation.parallel}markVisitAsParallelAnimation(e){e.animation.wait=!0,e.animation.parallel=!0}visitHasPotentialParallelAnimation(e){return e.animation.parallel!==!1&&this.visitHasParallelContainers(e)}visitHasParallelContainers(e){return this.options.containers.some(t=>{const i=document.querySelector(t);return i==null?void 0:i.matches(e.containers.join(","))})}}export{g as e};

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.