UNPKG

web-component-stencil-test

Version:
1 lines 11.3 kB
let t,e,n,l=0,s=!1,o=!1,r=!1,c=!1;const i=window,a=document,u={t:0,l:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,l)=>t.addEventListener(e,n,l),rel:(t,e,n,l)=>t.removeEventListener(e,n,l)},f=(()=>!!a.documentElement.attachShadow)(),m=(()=>{try{return new CSSStyleSheet,!0}catch(t){}return!1})(),p=new WeakMap,$=t=>p.get(t),d=(t,e)=>p.set(e.s=t,e),w=(t,e)=>e in t,h=t=>console.error(t),y=new Map,b=new Map,_=[],j=[],g=[],v=(t,e)=>n=>{t.push(n),s||(s=!0,e&&4&u.t?R(M):u.raf(M))},S=(t,e)=>{let n=0,l=0;for(;n<t.length&&(l=performance.now())<e;)try{t[n++](l)}catch(s){h(s)}n===t.length?t.length=0:0!==n&&t.splice(0,n)},M=()=>{l++,(t=>{for(let n=0;n<t.length;n++)try{t[n](performance.now())}catch(e){h(e)}t.length=0})(_);const t=2==(6&u.t)?performance.now()+10*Math.ceil(l*(1/22)):1/0;S(j,t),S(g,t),j.length>0&&(g.push(...j),j.length=0),(s=_.length+j.length+g.length>0)?u.raf(M):l=0},R=t=>Promise.resolve().then(t),k=v(j,!0),O={},U=t=>"object"==(t=typeof t)||"function"===t,L=()=>i.CSS&&i.CSS.supports&&i.CSS.supports("color","var(--c)")?Promise.resolve():__sc_import_test("./p-1635c1a0.js").then(()=>{u.o=i.__stencil_cssshim}),P=async()=>{u.o=i.__stencil_cssshim;const t=new RegExp("/test(\\.esm)?\\.js($|\\?|#)"),e=Array.from(a.querySelectorAll("script")).find(e=>t.test(e.src)||"test"===e.getAttribute("data-stencil-namespace")),n=e["data-opts"];{const t=new URL(".",new URL(e.getAttribute("data-resources-url")||e.src,i.location.href));return C(t.href),window.customElements||await __sc_import_test("./p-d0882b30.js"),Object.assign(Object.assign({},n),{resourcesUrl:t.href})}},C=t=>{const e=(()=>`__sc_import_${"test".replace(/\s|-/g,"_")}`)();try{i[e]=new Function("w",`return import(w);//${Math.random()}`)}catch(n){const l=new Map;i[e]=n=>{const s=new URL(n,t).href;let o=l.get(s);if(!o){const t=a.createElement("script");t.type="module",t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${e}.m = m;`],{type:"application/javascript"})),o=new Promise(n=>{t.onload=()=>{n(i[e].m),t.remove()}}),l.set(s,o),a.head.appendChild(t)}return o}}},x=new WeakMap,E=t=>"sc-"+t,T=(t,e,...n)=>{let l=null,s=null,o=!1,r=!1,c=[];const i=e=>{for(let n=0;n<e.length;n++)l=e[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof t&&!U(l))&&(l=String(l)),o&&r?c[c.length-1].i+=l:c.push(o?A(null,l):l),r=o)};if(i(n),e){e.name&&(s=e.name);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter(e=>t[e]).join(" "))}}const a=A(t,null);return a.u=e,c.length>0&&(a.p=c),a.$=s,a},A=(t,e)=>({t:0,h:t,i:e,_:null,p:null,u:null,$:null}),F={},W=(t,e,n,l,s,o)=>{if(n===l)return;let r=w(t,e),c=e.toLowerCase();if("class"===e){const e=t.classList,s=N(n),o=N(l);e.remove(...s.filter(t=>t&&!o.includes(t))),e.add(...o.filter(t=>t&&!s.includes(t)))}else if("ref"===e)l&&l(t);else if(r||"o"!==e[0]||"n"!==e[1]){const c=U(l);if((r||c&&null!==l)&&!s)try{if(t.tagName.includes("-"))t[e]=l;else{let s=null==l?"":l;null!=n&&t[e]==s||(t[e]=s)}}catch(a){}null==l||!1===l?t.removeAttribute(e):(!r||4&o||s)&&!c&&t.setAttribute(e,l=!0===l?"":l)}else e="-"===e[2]?e.slice(3):w(i,c)?c.slice(2):c[2]+e.slice(3),n&&u.rel(t,e,n,!1),l&&u.ael(t,e,l,!1)},H=/\s/,N=t=>t?t.split(H):[],q=(t,e,n,l)=>{const s=11===e._.nodeType&&e._.host?e._.host:e._,o=t&&t.u||O,r=e.u||O;for(l in o)l in r||W(s,l,o[l],void 0,n,e.t);for(l in r)W(s,l,o[l],r[l],n,e.t)},B=(l,s,r,i)=>{let u,f,m,p=s.p[r],$=0;if(o||(c=!0,"slot"===p.h&&(t&&i.classList.add(t+"-s"),p.t|=p.p?2:1)),null!==p.i)u=p._=a.createTextNode(p.i);else if(1&p.t)u=p._=a.createTextNode("");else if(u=p._=a.createElement(2&p.t?"slot-fb":p.h),q(null,p,!1),(t=>null!=t)(t)&&u["s-si"]!==t&&u.classList.add(u["s-si"]=t),p.p)for($=0;$<p.p.length;++$)(f=B(l,p,$,u))&&u.appendChild(f);return u["s-hn"]=n,3&p.t&&(u["s-sr"]=!0,u["s-cr"]=e,u["s-sn"]=p.$||"",(m=l&&l.p&&l.p[r])&&m.h===p.h&&l._&&V(l._,!1)),u},V=(t,e)=>{u.t|=1;const l=t.childNodes;for(let s=l.length-1;s>=0;s--){const t=l[s];t["s-hn"]!==n&&t["s-ol"]&&(J(t).insertBefore(t,I(t)),t["s-ol"].remove(),t["s-ol"]=void 0,c=!0),e&&V(t,e)}u.t&=-2},z=(t,e,l,s,o,r)=>{let c,i=t["s-cr"]&&t["s-cr"].parentNode||t;for(i.shadowRoot&&i.tagName===n&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=B(null,l,o,t))&&(s[o]._=c,i.insertBefore(c,I(e)))},D=(t,e,n,l,s)=>{for(;e<=n;++e)(l=t[e])&&(s=l._,Z(l),r=!0,s["s-ol"]?s["s-ol"].remove():V(s,!0),s.remove())},G=(t,e)=>t.h===e.h&&("slot"!==t.h||t.$===e.$),I=t=>t&&t["s-ol"]||t,J=t=>(t["s-ol"]?t["s-ol"]:t).parentNode,K=(t,e)=>{const n=e._=t._,l=t.p,s=e.p;let o;null===e.i?("slot"===e.h||q(t,e,!1),null!==l&&null!==s?((t,e,n,l)=>{let s,o=0,r=0,c=e.length-1,i=e[0],a=e[c],u=l.length-1,f=l[0],m=l[u];for(;o<=c&&r<=u;)null==i?i=e[++o]:null==a?a=e[--c]:null==f?f=l[++r]:null==m?m=l[--u]:G(i,f)?(K(i,f),i=e[++o],f=l[++r]):G(a,m)?(K(a,m),a=e[--c],m=l[--u]):G(i,m)?("slot"!==i.h&&"slot"!==m.h||V(i._.parentNode,!1),K(i,m),t.insertBefore(i._,a._.nextSibling),i=e[++o],m=l[--u]):G(a,f)?("slot"!==i.h&&"slot"!==m.h||V(a._.parentNode,!1),K(a,f),t.insertBefore(a._,i._),a=e[--c],f=l[++r]):(s=B(e&&e[r],n,r,t),f=l[++r],s&&J(i._).insertBefore(s,I(i._)));o>c?z(t,null==l[u+1]?null:l[u+1]._,n,l,r,u):r>u&&D(e,o,c)})(n,l,e,s):null!==s?(null!==t.i&&(n.textContent=""),z(n,null,e,s,0,s.length-1)):null!==l&&D(l,0,l.length-1)):(o=n["s-cr"])?o.parentNode.textContent=e.i:t.i!==e.i&&(n.data=e.i)},Q=t=>{let e,n,l,s,o,r,c=t.childNodes;for(n=0,l=c.length;n<l;n++)if(1===(e=c[n]).nodeType){if(e["s-sr"])for(o=e["s-sn"],e.hidden=!1,s=0;s<l;s++)if(c[s]["s-hn"]!==e["s-hn"])if(r=c[s].nodeType,""!==o){if(1===r&&o===c[s].getAttribute("slot")){e.hidden=!0;break}}else if(1===r||3===r&&""!==c[s].textContent.trim()){e.hidden=!0;break}Q(e)}},X=[],Y=t=>{let e,n,l,s,o=t.childNodes,c=o.length,i=0,a=0,u=0;for(c=o.length;i<c;i++){if((e=o[i])["s-sr"]&&(n=e["s-cr"]))for(s=e["s-sn"],a=(l=n.parentNode.childNodes).length-1;a>=0;a--)(n=l[a])["s-cn"]||n["s-nr"]||n["s-hn"]===e["s-hn"]||((3===(u=n.nodeType)||8===u)&&""===s||1===u&&null===n.getAttribute("slot")&&""===s||1===u&&n.getAttribute("slot")===s)&&(X.some(t=>t.j===n)||(r=!0,n["s-sn"]=s,X.push({g:e,j:n})));1===e.nodeType&&Y(e)}},Z=t=>{t.u&&t.u.ref&&t.u.ref(null),t.p&&t.p.forEach(Z)},tt=(t,e)=>{e&&!t.v&&e["s-p"].push(new Promise(e=>t.v=e))},et=(t,e,n,l)=>{if(e.t|=16,4&e.t)return void(e.t|=512);const s=e.s,o=()=>nt(t,e,n,s,l),r=t["s-rc"];let c;return tt(e,e.S),l&&(c=ot(s,"componentWillLoad")),r&&(r.forEach(t=>t()),t["s-rc"]=void 0),rt(c,()=>k(o))},nt=(l,s,i,m,p)=>{p&&((t,e)=>{const n=((t,e)=>{let n=E(e.M),l=b.get(n);if(t=11===t.nodeType?t:a,l)if("string"==typeof l){let e,s=x.get(t=t.head||t);s||x.set(t,s=new Set),s.has(n)||((e=a.createElement("style")).setAttribute("data-styles",""),e.innerHTML=l,t.insertBefore(e,t.querySelector("link")),s&&s.add(n))}else t.adoptedStyleSheets.includes(l)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,l]);return n})(f&&t.shadowRoot?t.shadowRoot:t.getRootNode(),e);10&e.t&&(t["s-sc"]=n,t.classList.add(n+"-h"))})(l,i);try{((l,s,i,m)=>{n=l.tagName;const p=s.R||A(null,null),$=(t=>t&&t.h===F)(m)?m:T(null,null,m);if($.h=null,$.t|=4,s.R=$,$._=p._=l.shadowRoot||l,t=l["s-sc"],e=l["s-cr"],o=f&&0!=(1&i.t),c=r=!1,K(p,$),c){Y($._);for(let t=0;t<X.length;t++){const e=X[t];if(!e.j["s-ol"]){const t=a.createTextNode("");t["s-nr"]=e.j,e.j.parentNode.insertBefore(e.j["s-ol"]=t,e.j)}}u.t|=1;for(let t=0;t<X.length;t++){const e=X[t],n=e.g.parentNode;let l=e.g.nextSibling,s=e.j["s-ol"];for(;s=s.previousSibling;){let t=s["s-nr"];if(t&&t["s-sn"]===e.j["s-sn"]&&n===t.parentNode&&(!(t=t.nextSibling)||!t["s-nr"])){l=t;break}}(!l&&n!==e.j.parentNode||e.j.nextSibling!==l)&&e.j!==l&&n.insertBefore(e.j,l)}u.t&=-2}r&&Q($._),X.length=0})(l,s,i,m.render())}catch($){h($)}s.t&=-17,s.t|=2;{const t=l["s-p"],e=()=>lt(l,s,i);0===t.length?e():(Promise.all(t).then(e),s.t|=4,t.length=0)}},lt=(t,e,n)=>{const l=e.S;64&e.t||(e.t|=64,t.classList.add("hydrated"),e.k(t),l||st()),e.O(t),e.v&&(e.v(),e.v=void 0),512&e.t&&R(()=>et(t,e,n,!1)),e.t&=-517},st=()=>{a.documentElement.classList.add("hydrated"),u.t|=2},ot=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(l){h(l)}},rt=(t,e)=>t&&t.then?t.then(e):e(),ct=(t,e,n)=>{if(e.U){t.watchers&&(e.L=t.watchers);const l=Object.entries(e.U),s=t.prototype;if(l.forEach(([t,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(s,t,{get(){return((t,e)=>$(t).P.get(e))(this,t)},set(n){((t,e,n,l)=>{const s=$(this),o=s.C,r=s.P.get(e),c=s.t,i=s.s;if(!((n=((t,e)=>null==t||U(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?parseFloat(t):1&e?String(t):t)(n,l.U[e][0]))===r||8&c&&void 0!==r)&&(s.P.set(e,n),i)){if(l.L&&128&c){const t=l.L[e];t&&t.forEach(t=>{try{i[t](n,r,e)}catch(l){h(l)}})}2==(18&c)&&et(o,s,l,!1)}})(0,t,n,e)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(s,t,{value(...e){const n=$(this);return n.T.then(()=>n.s[t](...e))}})}),1&n){const e=new Map;s.attributeChangedCallback=function(t,n,l){u.jmp(()=>{const n=e.get(t);this[n]=(null!==l||"boolean"!=typeof this[n])&&l})},t.observedAttributes=l.filter(([t,e])=>15&e[0]).map(([t,n])=>{const l=n[1]||t;return e.set(l,t),l})}}return t},it=(t,e={})=>{const n=[],l=e.exclude||[],s=a.head,o=i.customElements,r=s.querySelector("meta[charset]"),c=a.createElement("style");let d;Object.assign(u,e),u.l=new URL(e.resourcesUrl||"./",a.baseURI).href,e.syncQueue&&(u.t|=4),t.forEach(t=>t[1].forEach(e=>{const s={t:e[0],M:e[1],U:e[2],A:e[3]};s.U=e[2],s.L={},!f&&1&s.t&&(s.t|=8);const r=s.M,c=class extends HTMLElement{constructor(t){super(t),(t=>{const e={t:0,C:t,P:new Map};e.T=new Promise(t=>e.O=t),e.F=new Promise(t=>e.k=t),t["s-p"]=[],t["s-rc"]=[],p.set(t,e)})(t=this),1&s.t&&(f?t.attachShadow({mode:"open"}):"shadowRoot"in t||(t.shadowRoot=t))}connectedCallback(){d&&(clearTimeout(d),d=null),u.jmp(()=>((t,e)=>{if(0==(1&u.t)){const n=$(t);if(!(1&n.t)){let l;n.t|=1,l||(4&e.t||8&e.t)&&(t=>{const e=t["s-cr"]=a.createComment("");e["s-cn"]=!0,t.insertBefore(e,t.firstChild)})(t);{let e=t;for(;e=e.parentNode||e.host;)if(e["s-p"]){tt(n,n.S=e);break}}e.U&&Object.entries(e.U).forEach(([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}}),R(()=>(async(t,e,n,l,s)=>{if(0==(32&e.t)){e.t|=32,(s=(t=>{const e=t.M.replace(/-/g,"_"),n=t.W,l=y.get(n);return l?l[e]:__sc_import_test(`./${n}.entry.js`).then(t=>(y.set(n,t),t[e]),h)})(n)).then&&(s=await s),s.isProxied||(n.L=s.watchers,ct(s,n,2),s.isProxied=!0),e.t|=8;try{new s(e)}catch(c){h(c)}e.t&=-9,e.t|=128;const t=E(n.M);if(!b.has(t)&&s.style){let e=s.style;8&n.t&&(e=await __sc_import_test("./p-affe7c09.js").then(n=>n.scopeCss(e,t,!1))),((t,e,n)=>{let l=b.get(t);m&&n?(l=l||new CSSStyleSheet).replace(e):l=e,b.set(t,l)})(t,e,!!(1&n.t))}}const o=e.S,r=()=>et(t,e,n,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(t,n,e))}}})(this,s))}disconnectedCallback(){u.jmp(()=>void 0)}"s-hmr"(t){}forceUpdate(){((t,e)=>{{const n=$(t);2==(18&n.t)&&et(t,n,e,!1)}})(this,s)}componentOnReady(){return $(this).F}};s.W=t[0],l.includes(r)||o.get(r)||(n.push(r),o.define(r,ct(c,s,1)))})),c.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",c.setAttribute("data-styles",""),s.insertBefore(c,r?r.nextSibling:s.firstChild),u.jmp(()=>d=setTimeout(st,30))},at=(t,e,n)=>{const l=ut(t);return{emit:t=>l.dispatchEvent(new CustomEvent(e,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:t}))}},ut=t=>$(t).C;export{F as H,L as a,it as b,at as c,T as h,P as p,d as r};