2 lines
1.6 KiB
JavaScript
2 lines
1.6 KiB
JavaScript
import{P as e,Q as t,T as s,U as r}from"./main-bd0f996b.js";import{a as n,c as o,u as i,m as l,s as a}from"./c.b764d104.js";function f(e){if(!e||"object"!=typeof e)return e;if("[object Date]"==Object.prototype.toString.call(e))return new Date(e.getTime());if(Array.isArray(e))return e.map(f);var t={};return Object.keys(e).forEach((function(s){t[s]=f(e[s])})),t}const c=(e,t,s)=>{const r=new Map;for(let n=t;n<=s;n++)r.set(e[n],n);return r},u=e(class extends t{constructor(e){if(super(e),e.type!==s.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,s){let r;void 0===s?s=t:void 0!==t&&(r=t);const n=[],o=[];let i=0;for(const t of e)n[i]=r?r(t,i):i,o[i]=s(t,i),i++;return{values:o,keys:n}}render(e,t,s){return this.dt(e,t,s).values}update(e,[t,s,f]){var u;const d=n(e),{values:p,keys:h}=this.dt(t,s,f);if(!Array.isArray(d))return this.at=h,p;const y=null!==(u=this.at)&&void 0!==u?u:this.at=[],v=[];let b,m,g=0,j=d.length-1,x=0,A=p.length-1;for(;g<=j&&x<=A;)if(null===d[g])g++;else if(null===d[j])j--;else if(y[g]===h[x])v[x]=o(d[g],p[x]),g++,x++;else if(y[j]===h[A])v[A]=o(d[j],p[A]),j--,A--;else if(y[g]===h[A])v[A]=o(d[g],p[A]),i(e,v[A+1],d[g]),g++,A--;else if(y[j]===h[x])v[x]=o(d[j],p[x]),i(e,d[g],d[j]),j--,x++;else if(void 0===b&&(b=c(h,x,A),m=c(y,g,j)),b.has(y[g]))if(b.has(y[j])){const t=m.get(h[x]),s=void 0!==t?d[t]:null;if(null===s){const t=i(e,d[g]);o(t,p[x]),v[x]=t}else v[x]=o(s,p[x]),i(e,d[g],s),d[t]=null;x++}else l(d[j]),j--;else l(d[g]),g++;for(;x<=A;){const t=i(e,v[A+1]);o(t,p[x]),v[x++]=t}for(;g<=j;){const e=d[g++];null!==e&&l(e)}return this.at=h,a(e,v),r}}),d=(e,t)=>e&&e.config.components.includes(t);export{u as c,f as d,d as i};
|