Notes/static/js/lib/htm/htm.umd.js

2 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-06-15 07:24:23 +02:00
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).htm=t()}(this,function(){const e=(t,n,s,u)=>{let o;n[0]=0;for(let l=1;l<n.length;l++){const h=n[l++],p=n[l]?(n[0]|=h?1:2,s[n[l++]]):n[++l];3===h?u[0]=p:4===h?u[1]=Object.assign(u[1]||{},p):5===h?(u[1]=u[1]||{})[n[++l]]=p:6===h?u[1][n[++l]]+=p+"":h?(o=t.apply(p,e(t,p,s,["",null])),u.push(o),p[0]?n[0]|=2:(n[l-2]=0,n[l]=o)):u.push(p)}return u},t=function(e){let t,n,s=1,u="",o="",l=[0];const h=e=>{1===s&&(e||(u=u.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?l.push(0,e,u):3===s&&(e||u)?(l.push(3,e,u),s=2):2===s&&"..."===u&&e?l.push(4,e,0):2===s&&u&&!e?l.push(5,0,!0,u):s>=5&&((u||!e&&5===s)&&(l.push(s,0,u,n),s=6),e&&(l.push(s,e,0,n),s=6)),u=""};for(let p=0;p<e.length;p++){p&&(1===s&&h(),h(p));for(let f=0;f<e[p].length;f++)t=e[p][f],1===s?"<"===t?(h(),l=[l],s=3):u+=t:4===s?"--"===u&&">"===t?(s=1,u=""):u=t+u[0]:o?t===o?o="":u+=t:'"'===t||"'"===t?o=t:">"===t?(h(),s=1):s&&("="===t?(s=5,n=u,u=""):"/"===t&&(s<5||">"===e[p][f+1])?(h(),3===s&&(l=l[0]),s=l,(l=l[0]).push(2,0,s),s=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(h(),s=2):u+=t),3===s&&"!--"===u&&(s=4,l=l[0])}return h(),l},n=new Map;return function(s){let u=n.get(this);return u||(u=new Map,n.set(this,u)),u=e(this,u.get(s)||(u.set(s,u=t(s)),u),arguments,[]),u.length>1?u:u[0]}});