@bulmil/core
Version:

5 lines • 12 kB
JavaScript
/*!
* Bulmil - MIT License
*/
let t,e,l=!1,n=!1,o=!1,s=!1;const i={},r=t=>"object"==(t=typeof t)||"function"===t,c=(t,e,...l)=>{let n=null,o=null,s=!1,i=!1;const c=[],u=e=>{for(let l=0;l<e.length;l++)n=e[l],Array.isArray(n)?u(n):null!=n&&"boolean"!=typeof n&&((s="function"!=typeof t&&!r(n))&&(n+=""),s&&i?c[c.length-1].t+=n:c.push(s?f(null,n):n),i=s)};if(u(l),e){e.name&&(o=e.name);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}if("function"==typeof t)return t(null===e?{}:e,c,$);const a=f(t,null);return a.l=e,c.length>0&&(a.o=c),a.i=o,a},f=(t,e)=>({u:0,$:t,t:e,h:null,o:null,l:null,i:null}),u={},$={forEach:(t,e)=>t.map(a).forEach(e),map:(t,e)=>t.map(a).map(e).map(d)},a=t=>({vattrs:t.l,vchildren:t.o,vkey:t.m,vname:t.i,vtag:t.$,vtext:t.t}),d=t=>{if("function"==typeof t.vtag){const e=Object.assign({},t.vattrs);return t.vkey&&(e.key=t.vkey),t.vname&&(e.name=t.vname),c(t.vtag,e,...t.vchildren||[])}const e=f(t.vtag,t.vtext);return e.l=t.vattrs,e.o=t.vchildren,e.m=t.vkey,e.i=t.vname,e},h=(t,e,l,n,o,s,i)=>{let r,c,u,$;if(1===s.nodeType){for(r=s.getAttribute("c-id"),r&&(c=r.split("."),c[0]!==i&&"0"!==c[0]||(u={u:0,p:c[0],g:c[1],v:c[2],S:c[3],$:s.tagName.toLowerCase(),h:s,l:null,o:null,m:null,i:null,t:null},e.push(u),s.removeAttribute("c-id"),t.o||(t.o=[]),t.o[u.S]=u,t=u,n&&"0"===u.v&&(n[u.S]=u.h))),$=s.childNodes.length-1;$>=0;$--)h(t,e,l,n,o,s.childNodes[$],i);if(s.shadowRoot)for($=s.shadowRoot.childNodes.length-1;$>=0;$--)h(t,e,l,n,o,s.shadowRoot.childNodes[$],i)}else if(8===s.nodeType)c=s.nodeValue.split("."),c[1]!==i&&"0"!==c[1]||(r=c[0],u={u:0,p:c[1],g:c[2],v:c[3],S:c[4],h:s,l:null,o:null,m:null,i:null,$:null,t:null},"t"===r?(u.h=s.nextSibling,u.h&&3===u.h.nodeType&&(u.t=u.h.textContent,e.push(u),s.remove(),t.o||(t.o=[]),t.o[u.S]=u,n&&"0"===u.v&&(n[u.S]=u.h))):u.p===i&&("s"===r?(u.$="slot",s["s-sn"]=c[5]?u.i=c[5]:"",s["s-sr"]=!0,l.push(u),t.o||(t.o=[]),t.o[u.S]=u):"r"===r&&(o["s-cr"]=s,s["s-cn"]=!0)));else if(t&&"style"===t.$){const e=f(null,s.textContent);e.h=s,e.S="0",t.o=[e]}},y=(t,e)=>{if(1===t.nodeType){let l=0;for(;l<t.childNodes.length;l++)y(t.childNodes[l],e);if(t.shadowRoot)for(l=0;l<t.shadowRoot.childNodes.length;l++)y(t.shadowRoot.childNodes[l],e)}else if(8===t.nodeType){const l=t.nodeValue.split(".");"o"===l[0]&&(e.set(l[1]+"."+l[2],t),t.nodeValue="",t["s-en"]=l[3])}},m=new WeakMap,p=t=>"sc-"+t.k,b=(t,e,l,n,o,s)=>{if(l!==n){let i=X(t,e),c=e.toLowerCase();if("class"===e){const e=t.classList,o=g(l),s=g(n);e.remove(...o.filter((t=>t&&!s.includes(t)))),e.add(...s.filter((t=>t&&!o.includes(t))))}else if(i||"o"!==e[0]||"n"!==e[1]){const c=r(n);if((i||c&&null!==n)&&!o)try{if(t.tagName.includes("-"))t[e]=n;else{const o=null==n?"":n;"list"===e?i=!1:null!=l&&t[e]==o||(t[e]=o)}}catch(t){}null==n||!1===n?!1===n&&""!==t.getAttribute(e)||t.removeAttribute(e):(!i||4&s||o)&&!c&&t.setAttribute(e,n=!0===n?"":n)}else e="-"===e[2]?e.slice(3):X(lt,c)?c.slice(2):c[2]+e.slice(3),l&&ot.rel(t,e,l,!1),n&&ot.ael(t,e,n,!1)}},w=/\s/,g=t=>t?t.split(w):[],v=(t,e,l,n)=>{const o=11===e.h.nodeType&&e.h.host?e.h.host:e.h,s=t&&t.l||i,r=e.l||i;for(n in s)n in r||b(o,n,s[n],void 0,l,e.u);for(n in r)b(o,n,s[n],r[n],l,e.u)},S=(n,s,i)=>{const r=s.o[i];let c,f,u,$=0;if(l||(o=!0,"slot"===r.$&&(r.u|=r.o?2:1)),null!==r.t)c=r.h=nt.createTextNode(r.t);else if(1&r.u)c=r.h=nt.createTextNode("");else if(c=r.h=nt.createElement(2&r.u?"slot-fb":r.$),v(null,r,!1),r.o)for($=0;$<r.o.length;++$)f=S(n,r,$),f&&c.appendChild(f);return c["s-hn"]=e,3&r.u&&(c["s-sr"]=!0,c["s-cr"]=t,c["s-sn"]=r.i||"",u=n&&n.o&&n.o[i],u&&u.$===r.$&&n.h&&k(n.h,!1)),c},k=(t,l)=>{ot.u|=1;const n=t.childNodes;for(let t=n.length-1;t>=0;t--){const s=n[t];s["s-hn"]!==e&&s["s-ol"]&&(C(s).insertBefore(s,O(s)),s["s-ol"].remove(),s["s-ol"]=void 0,o=!0),l&&k(s,l)}ot.u&=-2},j=(t,e,l,n,o,s)=>{let i,r=t["s-cr"]&&t["s-cr"].parentNode||t;for(;o<=s;++o)n[o]&&(i=S(null,l,o),i&&(n[o].h=i,r.insertBefore(i,O(e))))},M=(t,e,l,o,s)=>{for(;e<=l;++e)(o=t[e])&&(n=!0,(s=o.h)["s-ol"]?s["s-ol"].remove():k(s,!0),s.remove())},x=(t,e)=>t.$===e.$&&("slot"!==t.$||t.i===e.i),O=t=>t&&t["s-ol"]||t,C=t=>(t["s-ol"]?t["s-ol"]:t).parentNode,R=(t,e)=>{const l=e.h=t.h,n=t.o,o=e.o,s=e.t;let i;null===s?("slot"===e.$||v(t,e,!1),null!==n&&null!==o?((t,e,l,n)=>{let o,s=0,i=0,r=e.length-1,c=e[0],f=e[r],u=n.length-1,$=n[0],a=n[u];for(;s<=r&&i<=u;)null==c?c=e[++s]:null==f?f=e[--r]:null==$?$=n[++i]:null==a?a=n[--u]:x(c,$)?(R(c,$),c=e[++s],$=n[++i]):x(f,a)?(R(f,a),f=e[--r],a=n[--u]):x(c,a)?("slot"!==c.$&&"slot"!==a.$||k(c.h.parentNode,!1),R(c,a),t.insertBefore(c.h,f.h.nextSibling),c=e[++s],a=n[--u]):x(f,$)?("slot"!==c.$&&"slot"!==a.$||k(f.h.parentNode,!1),R(f,$),t.insertBefore(f.h,c.h),f=e[--r],$=n[++i]):(o=S(e&&e[i],l,i),$=n[++i],o&&C(c.h).insertBefore(o,O(c.h)));s>r?j(t,null==n[u+1]?null:n[u+1].h,l,n,i,u):i>u&&M(e,s,r)})(l,n,e,o):null!==o?(null!==t.t&&(l.textContent=""),j(l,null,e,o,0,o.length-1)):null!==n&&M(n,0,n.length-1)):(i=l["s-cr"])?i.parentNode.textContent=s:t.t!==s&&(l.data=s)},T=t=>{const e=t.childNodes;let l,n,o,s,i,r;for(n=0,o=e.length;n<o;n++)if(l=e[n],1===l.nodeType){if(l["s-sr"])for(i=l["s-sn"],l.hidden=!1,s=0;s<o;s++)if(r=e[s].nodeType,e[s]["s-hn"]!==l["s-hn"]||""!==i){if(1===r&&i===e[s].getAttribute("slot")){l.hidden=!0;break}}else if(1===r||3===r&&""!==e[s].textContent.trim()){l.hidden=!0;break}T(l)}},E=[],I=t=>{let e,l,o,s,i,r,c=0;const f=t.childNodes,u=f.length;for(;c<u;c++){if(e=f[c],e["s-sr"]&&(l=e["s-cr"])&&l.parentNode)for(o=l.parentNode.childNodes,s=e["s-sn"],r=o.length-1;r>=0;r--)l=o[r],l["s-cn"]||l["s-nr"]||l["s-hn"]===e["s-hn"]||(N(l,s)?(i=E.find((t=>t.j===l)),n=!0,l["s-sn"]=l["s-sn"]||s,i?i.M=e:E.push({M:e,j:l}),l["s-sr"]&&E.map((t=>{N(t.j,l["s-sn"])&&(i=E.find((t=>t.j===l)),i&&!t.M&&(t.M=i.M))}))):E.some((t=>t.j===l))||E.push({j:l}));1===e.nodeType&&I(e)}},N=(t,e)=>1===t.nodeType?null===t.getAttribute("slot")&&""===e||t.getAttribute("slot")===e:t["s-sn"]===e||""===e,P=(t,e)=>{e&&!t.O&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.O=e)))},A=(t,e)=>{if(t.u|=16,!(4&t.u))return P(t,t.C),ht((()=>F(t,e)));t.u|=512},F=(t,e)=>{const l=t.R;return q(void 0,(()=>H(t,l,e)))},H=async(t,e,l)=>{const n=t.T,o=n["s-rc"];l&&(t=>{const e=t.I;((t,e)=>{let l=p(e);const n=et.get(l);if(t=11===t.nodeType?t:nt,n)if("string"==typeof n){let e,o=m.get(t=t.head||t);o||m.set(t,o=new Set),o.has(l)||(t.host&&(e=t.querySelector(`[sty-id="${l}"]`))?e.innerHTML=n:(e=nt.createElement("style"),e.innerHTML=n,t.insertBefore(e,t.querySelector("link"))),o&&o.add(l))}else t.adoptedStyleSheets.includes(n)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,n])})(t.T.getRootNode(),e)})(t);L(t,e),o&&(o.map((t=>t())),n["s-rc"]=void 0);{const e=n["s-p"],l=()=>U(t);0===e.length?l():(Promise.all(e).then(l),t.u|=4,e.length=0)}},L=(s,i)=>{try{i=i.render(),s.u&=-17,s.u|=2,((s,i)=>{const r=s.T,$=s.I,a=s.N||f(null,null),d=(t=>t&&t.$===u)(i)?i:c(null,null,i);if(e=r.tagName,$.P&&(d.l=d.l||{},$.P.map((([t,e])=>d.l[e]=r[t]))),d.$=null,d.u|=4,s.N=d,d.h=a.h=r,t=r["s-cr"],l=0!=(1&$.u),n=!1,R(a,d),ot.u|=1,o){let t,e,l,n,o,s;I(d.h);let i=0;for(;i<E.length;i++)t=E[i],e=t.j,e["s-ol"]||(l=nt.createTextNode(""),l["s-nr"]=e,e.parentNode.insertBefore(e["s-ol"]=l,e));for(i=0;i<E.length;i++)if(t=E[i],e=t.j,t.M){for(n=t.M.parentNode,o=t.M.nextSibling,l=e["s-ol"];l=l.previousSibling;)if(s=l["s-nr"],s&&s["s-sn"]===e["s-sn"]&&n===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&n!==e.parentNode||e.nextSibling!==o)&&e!==o&&(!e["s-hn"]&&e["s-ol"]&&(e["s-hn"]=e["s-ol"].parentNode.nodeName),n.insertBefore(e,o))}else 1===e.nodeType&&(e.hidden=!0)}n&&T(d.h),ot.u&=-2,E.length=0})(s,i)}catch(t){Y(t,s.T)}return null},U=t=>{const e=t.T,l=t.C;64&t.u||(t.u|=64,V(e),t.A(e),l||W()),t.O&&(t.O(),t.O=void 0),512&t.u&&dt((()=>A(t,!1))),t.u&=-517},W=()=>{V(nt.documentElement),dt((()=>(t=>{const e=ot.ce("appload",{detail:{namespace:"bulmil"}});return t.dispatchEvent(e),e})(lt)))},q=(t,e)=>t&&t.then?t.then(e):e(),V=t=>t.classList.add("hydrated"),_=(t,e,l)=>{if(e.F){const n=Object.entries(e.F),o=t.prototype;if(n.map((([t,[n]])=>{(31&n||2&l&&32&n)&&Object.defineProperty(o,t,{get(){return((t,e)=>J(this).H.get(e))(0,t)},set(l){((t,e,l,n)=>{const o=J(t),s=o.H.get(e),i=o.u,c=o.R;l=((t,e)=>null==t||r(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?parseFloat(t):1&e?t+"":t)(l,n.F[e][0]),8&i&&void 0!==s||l===s||Number.isNaN(s)&&Number.isNaN(l)||(o.H.set(e,l),c&&2==(18&i)&&A(o,!1))})(this,t,l,e)},configurable:!0,enumerable:!0})})),1&l){const l=new Map;o.attributeChangedCallback=function(t,e,n){ot.jmp((()=>{const e=l.get(t);if(this.hasOwnProperty(e))n=this[e],delete this[e];else if(o.hasOwnProperty(e)&&"number"==typeof this[e]&&this[e]==n)return;this[e]=(null!==n||"boolean"!=typeof this[e])&&n}))},t.observedAttributes=n.filter((([t,e])=>15&e[0])).map((([t,n])=>{const o=n[1]||t;return l.set(o,t),512&n[0]&&e.P.push([t,o]),o}))}}return t},z=t=>{if(0==(1&ot.u)){const e=J(t),l=e.I,n=()=>{};if(!(1&e.u)){let n;e.u|=1,n=t.getAttribute("s-id"),n&&((t,e,l,n)=>{const o=t.shadowRoot,s=[],i=n.N=f(e,null);ot.L||y(nt.body,ot.L=new Map),t["s-id"]=l,t.removeAttribute("s-id"),h(i,s,[],null,t,t,l),s.map((t=>{const l=t.p+"."+t.g,n=ot.L.get(l),s=t.h;n&&st&&""===n["s-en"]&&n.parentNode.insertBefore(s,n.nextSibling),o||(s["s-hn"]=e,n&&(s["s-ol"]=n,s["s-ol"]["s-nr"]=s)),ot.L.delete(l)}))})(t,l.k,n,e),n||12&l.u&&B(t);{let l=t;for(;l=l.parentNode||l.host;)if(1===l.nodeType&&l.hasAttribute("s-id")&&l["s-p"]||l["s-p"]){P(e,e.C=l);break}}l.F&&Object.entries(l.F).map((([e,[l]])=>{if(31&l&&t.hasOwnProperty(e)){const l=t[e];delete t[e],t[e]=l}})),(async(t,e,l,n,o)=>{if(0==(32&e.u)){{if(e.u|=32,(o=tt(l)).then){const t=()=>{};o=await o,t()}o.isProxied||(_(o,l,2),o.isProxied=!0);const t=()=>{};e.u|=8;try{new o(e)}catch(t){Y(t)}e.u&=-9,t()}if(o.style){let t=o.style;const e=p(l);if(!et.has(e)){const n=()=>{};((t,e,l)=>{let n=et.get(t);rt&&l?(n=n||new CSSStyleSheet,"string"==typeof n?n=e:n.replaceSync(e)):n=e,et.set(t,n)})(e,t,!!(1&l.u)),n()}}}const s=e.C,i=()=>A(e,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,e,l)}n()}},B=t=>{const e=t["s-cr"]=nt.createComment("");e["s-cn"]=!0,t.insertBefore(e,t.firstChild)},D=(t,e={})=>{const l=[],n=e.exclude||[],o=lt.customElements,s=nt.head,i=s.querySelector("meta[charset]"),r=nt.createElement("style"),c=[];let f,u=!0;Object.assign(ot,e),ot.U=new URL(e.resourcesUrl||"./",nt.baseURI).href,ot.u|=2,t.map((t=>{t[1].map((e=>{const s={u:e[0],k:e[1],F:e[2],W:e[3]};s.F=e[2],s.P=[];const i=s.k,r=class extends HTMLElement{constructor(t){super(t),Q(t=this,s)}connectedCallback(){f&&(clearTimeout(f),f=null),u?c.push(this):ot.jmp((()=>z(this)))}disconnectedCallback(){ot.jmp((()=>{}))}componentOnReady(){return J(this).q}};s.V=t[0],n.includes(i)||o.get(i)||(l.push(i),o.define(i,_(r,s,1)))}))})),r.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",r.setAttribute("data-styles",""),s.insertBefore(r,i?i.nextSibling:s.firstChild),u=!1,c.length?c.map((t=>t.connectedCallback())):ot.jmp((()=>f=setTimeout(W,30)))},G=new WeakMap,J=t=>G.get(t),K=(t,e)=>G.set(e.R=t,e),Q=(t,e)=>{const l={u:0,T:t,I:e,H:new Map};return l.q=new Promise((t=>l.A=t)),t["s-p"]=[],t["s-rc"]=[],G.set(t,l)},X=(t,e)=>e in t,Y=(t,e)=>(0,console.error)(t,e),Z=new Map,tt=t=>{const e=t.k.replace(/-/g,"_"),l=t.V,n=Z.get(l);return n?n[e]:import(`./${l}.entry.js`).then((t=>(Z.set(l,t),t[e])),Y)
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/},et=new Map,lt="undefined"!=typeof window?window:{},nt=lt.document||{head:{}},ot={u:0,U:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,l,n)=>t.addEventListener(e,l,n),rel:(t,e,l,n)=>t.removeEventListener(e,l,n),ce:(t,e)=>new CustomEvent(t,e)},st=!0,it=t=>Promise.resolve(t),rt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(t){}return!1})(),ct=[],ft=[],ut=(t,e)=>l=>{t.push(l),s||(s=!0,e&&4&ot.u?dt(at):ot.raf(at))},$t=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){Y(t)}t.length=0},at=()=>{$t(ct),$t(ft),(s=ct.length>0)&&ot.raf(at)},dt=t=>it().then(t),ht=ut(ft,!0);export{u as H,D as b,c as h,it as p,K as r}