-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdist.js
1 lines (1 loc) · 1.09 KB
/
dist.js
1
import{text as t,h as e}from"https://unpkg.com/hyperapp";const l=t=>" "==t||"\t"==t||"\n"==t||"\r"==t;export default(n,...r)=>((n,r)=>{let o,f,p,a,h,u=[],g="",m=0,s=!0;const c=e=>(e||0===e)&&u.push("string"==typeof e?t(e):"number"==typeof e?t(""+e):e),i=(t,l=t.flat(2))=>{c(o.call?o(p,l):e(o,p,l)),m=0},y=t=>{t&&(g=g.trimEnd()),g&&c(g),s=!1,g=""},d=()=>{a=[u,o,p,a],u=[],m=0},b=(t=m)=>{o=g,g="",p={},m=t},x=(t=m)=>{p[g]=!0,m=t,g=""},E=t=>{p[f]=t,m=5,g=""},j=()=>{let t=u;[u,o,p,a]=a,i(t)};for(let t=0;t<n.length;t++){for(let e=0;e<n[t].length;e++)h=n[t][e],0==m?"<"==h?m=2:l(h)?"\n"==h?s=!0:s||(m=1,g=h):(m=1,g=h):1==m?"<"==h?m=2:"\n"==h?(y(!1),s=!0,m=0):g+=h:2==m?"/"==h?(m=3,y(!0)):(m=4,y(!1),g=h):3==m?">"==h&&j():4==m?l(h)?b(5):"/"==h?b(6):">"==h?(b(),d()):g+=h:6==m?">"==h&&i([]):5==m?"."==h||("/"==h?m=6:">"==h?d():l(h)||(g=h,m=7)):7==m?"="==h?(f=g,m=8):">"==h?(x(),d()):"/"==h?x(6):l(h)?x(5):g+=h:8==m?'"'==h&&(m=9,g=""):9==m&&('"'==h?E(g):g+=h);2==m?(o=r[t],p={},m=5):1==m?(y(!r[t]),c(r[t])):5==m?p={...p,...r[t]}:8==m?E(r[t]):9==m?g+=r[t]:0==m&&null!=r[t]&&c(r[t])}return u=u.flat(2),u.length>1?u:u[0]})(n,r);