@jkun/watermark
Version:
Stencil Component Starter
2 lines • 7.66 kB
JavaScript
let t,e,n=!1;const l={},s=t=>"object"==(t=typeof t)||"function"===t,o=(t,e,...n)=>{let l=null,o=!1,i=!1;const c=[],u=e=>{for(let n=0;n<e.length;n++)l=e[n],Array.isArray(l)?u(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof t&&!s(l))&&(l+=""),o&&i?c[c.length-1].t+=l:c.push(o?r(null,l):l),i=o)};if(u(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}const a=r(t,null);return a.l=e,c.length>0&&(a.o=c),a},r=(t,e)=>({i:0,u:t,t:e,$:null,o:null,l:null}),i={},c=new WeakMap,u=t=>"sc-"+t.h,a=(t,e,n,l,o,r)=>{if(n!==l){let i=R(t,e);if(e.toLowerCase(),"class"===e){const e=t.classList,s=y(n),o=y(l);e.remove(...s.filter((t=>t&&!o.includes(t)))),e.add(...o.filter((t=>t&&!s.includes(t))))}else if("style"===e){for(const e in n)l&&null!=l[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in l)n&&l[e]===n[e]||(e.includes("-")?t.style.setProperty(e,l[e]):t.style[e]=l[e])}else if("ref"===e)l&&l(t);else{const c=s(l);if((i||c&&null!==l)&&!o)try{if(t.tagName.includes("-"))t[e]=l;else{const s=null==l?"":l;"list"===e?i=!1:null!=n&&t[e]==s||(t[e]=s)}}catch(t){}null==l||!1===l?!1===l&&""!==t.getAttribute(e)||t.removeAttribute(e):(!i||4&r||o)&&!c&&t.setAttribute(e,l=!0===l?"":l)}}},f=/\s/,y=t=>t?t.split(f):[],$=(t,e,n,s)=>{const o=11===e.$.nodeType&&e.$.host?e.$.host:e.$,r=t&&t.l||l,i=e.l||l;for(s in r)s in i||a(o,s,r[s],void 0,n,e.i);for(s in i)a(o,s,r[s],i[s],n,e.i)},h=(e,n,l)=>{const s=n.o[l];let o,r,i=0;if(o=s.$=V.createElement(s.u),$(null,s,!1),null!=t&&o["s-si"]!==t&&o.classList.add(o["s-si"]=t),s.o)for(i=0;i<s.o.length;++i)r=h(e,s,i),r&&o.appendChild(r);return o},d=(t,n,l,s,o,r)=>{let i,c=t;for(c.shadowRoot&&c.tagName===e&&(c=c.shadowRoot);o<=r;++o)s[o]&&(i=h(null,l,o),i&&(s[o].$=i,c.insertBefore(i,n)))},m=(t,e,n,l,s)=>{for(;e<=n;++e)(l=t[e])&&(s=l.$,b(l),s.remove())},p=(t,e)=>t.u===e.u,w=(t,e)=>{const n=e.$=t.$,l=t.o,s=e.o;"slot"===e.u||$(t,e,!1),null!==l&&null!==s?((t,e,n,l)=>{let s,o=0,r=0,i=e.length-1,c=e[0],u=e[i],a=l.length-1,f=l[0],y=l[a];for(;o<=i&&r<=a;)null==c?c=e[++o]:null==u?u=e[--i]:null==f?f=l[++r]:null==y?y=l[--a]:p(c,f)?(w(c,f),c=e[++o],f=l[++r]):p(u,y)?(w(u,y),u=e[--i],y=l[--a]):p(c,y)?(w(c,y),t.insertBefore(c.$,u.$.nextSibling),c=e[++o],y=l[--a]):p(u,f)?(w(u,f),t.insertBefore(u.$,c.$),u=e[--i],f=l[++r]):(s=h(e&&e[r],n,r),f=l[++r],s&&c.$.parentNode.insertBefore(s,c.$));o>i?d(t,null==l[a+1]?null:l[a+1].$,n,l,r,a):r>a&&m(e,o,i)})(n,l,e,s):null!==s?d(n,null,e,s,0,s.length-1):null!==l&&m(l,0,l.length-1)},b=t=>{t.l&&t.l.ref&&t.l.ref(null),t.o&&t.o.map(b)},S=(t,e)=>{e&&!t.m&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.m=e)))},g=(t,e)=>{if(t.i|=16,!(4&t.i))return S(t,t.p),Y((()=>j(t,e)));t.i|=512},j=(t,e)=>{const n=t.S;return P(void 0,(()=>v(t,n,e)))},v=async(t,e,n)=>{const l=t.g,s=l["s-rc"];n&&(t=>{const e=t.j,n=t.g,l=e.i,s=((t,e)=>{let n=u(e);const l=D.get(n);if(t=11===t.nodeType?t:V,l)if("string"==typeof l){let e,s=c.get(t=t.head||t);s||c.set(t,s=new Set),s.has(n)||(e=V.createElement("style"),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})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(t);M(t,e),s&&(s.map((t=>t())),l["s-rc"]=void 0);{const e=l["s-p"],n=()=>k(t);0===e.length?n():(Promise.all(e).then(n),t.i|=4,e.length=0)}},M=(n,l)=>{try{l=l.render(),n.i&=-17,n.i|=2,((n,l)=>{const s=n.g,c=n.v||r(null,null),u=(t=>t&&t.u===i)(l)?l:o(null,null,l);e=s.tagName,u.u=null,u.i|=4,n.v=u,u.$=c.$=s.shadowRoot||s,t=s["s-sc"],w(c,u)})(n,l)}catch(t){U(t,n.g)}return null},k=t=>{const e=t.g,n=t.S,l=t.p;64&t.i||(t.i|=64,x(e),O(n,"componentDidLoad"),t.M(e),l||C()),t.m&&(t.m(),t.m=void 0),512&t.i&&X((()=>g(t,!1))),t.i&=-517},C=()=>{x(V.documentElement),X((()=>(t=>{const e=_.ce("appload",{detail:{namespace:"ivy-watermark"}});return t.dispatchEvent(e),e})(F)))},O=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(t){U(t)}},P=(t,e)=>t&&t.then?t.then(e):e(),x=t=>t.classList.add("hydrated"),E=(t,e,n)=>{if(e.k){t.watchers&&(e.C=t.watchers);const l=Object.entries(e.k),o=t.prototype;if(l.map((([t,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(o,t,{get(){return((t,e)=>T(this).O.get(e))(0,t)},set(n){((t,e,n,l)=>{const o=T(t),r=o.g,i=o.O.get(e),c=o.i,u=o.S;if(n=((t,e)=>null==t||s(t)?t:1&e?t+"":t)(n,l.k[e][0]),(!(8&c)||void 0===i)&&n!==i&&(!Number.isNaN(i)||!Number.isNaN(n))&&(o.O.set(e,n),u)){if(l.C&&128&c){const t=l.C[e];t&&t.map((t=>{try{u[t](n,i,e)}catch(t){U(t,r)}}))}2==(18&c)&&g(o,!1)}})(this,t,n,e)},configurable:!0,enumerable:!0})})),1&n){const e=new Map;o.attributeChangedCallback=function(t,n,l){_.jmp((()=>{const n=e.get(t);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(o.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;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},L=(t,e={})=>{const n=[],l=e.exclude||[],s=F.customElements,o=V.head,r=o.querySelector("meta[charset]"),i=V.createElement("style"),c=[];let a,f=!0;Object.assign(_,e),_.P=new URL(e.resourcesUrl||"./",V.baseURI).href,t.map((t=>{t[1].map((e=>{const o={i:e[0],h:e[1],k:e[2],L:e[3]};o.k=e[2],o.C={};const r=o.h,i=class extends HTMLElement{constructor(t){super(t),H(t=this,o),1&o.i&&t.attachShadow({mode:"open"})}connectedCallback(){a&&(clearTimeout(a),a=null),f?c.push(this):_.jmp((()=>(t=>{if(0==(1&_.i)){const e=T(t),n=e.j,l=()=>{};if(!(1&e.i)){e.i|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){S(e,e.p=n);break}}n.k&&Object.entries(n.k).map((([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n,l,s)=>{if(0==(32&e.i)){{if(e.i|=32,(s=q(n)).then){const t=()=>{};s=await s,t()}s.isProxied||(n.C=s.watchers,E(s,n,2),s.isProxied=!0);const t=()=>{};e.i|=8;try{new s(e)}catch(t){U(t)}e.i&=-9,e.i|=128,t()}if(s.style){let t=s.style;const e=u(n);if(!D.has(e)){const l=()=>{};((t,e,n)=>{let l=D.get(t);B&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=e:l.replaceSync(e)):l=e,D.set(t,l)})(e,t,!!(1&n.i)),l()}}}const o=e.p,r=()=>g(e,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,e,n)}l()}})(this)))}disconnectedCallback(){_.jmp((()=>{}))}componentOnReady(){return T(this).N}};o.T=t[0],l.includes(r)||s.get(r)||(n.push(r),s.define(r,E(i,o,1)))}))})),i.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",i.setAttribute("data-styles",""),o.insertBefore(i,r?r.nextSibling:o.firstChild),f=!1,c.length?c.map((t=>t.connectedCallback())):_.jmp((()=>a=setTimeout(C,30)))},N=new WeakMap,T=t=>N.get(t),A=(t,e)=>N.set(e.S=t,e),H=(t,e)=>{const n={i:0,g:t,j:e,O:new Map};return n.N=new Promise((t=>n.M=t)),t["s-p"]=[],t["s-rc"]=[],N.set(t,n)},R=(t,e)=>e in t,U=(t,e)=>(0,console.error)(t,e),W=new Map,q=t=>{const e=t.h.replace(/-/g,"_"),n=t.T,l=W.get(n);return l?l[e]:import(`./${n}.entry.js`).then((t=>(W.set(n,t),t[e])),U)
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/},D=new Map,F="undefined"!=typeof window?window:{},V=F.document||{head:{}},_={i:0,P:"",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),ce:(t,e)=>new CustomEvent(t,e)},z=t=>Promise.resolve(t),B=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(t){}return!1})(),G=[],I=[],J=(t,e)=>l=>{t.push(l),n||(n=!0,e&&4&_.i?X(Q):_.raf(Q))},K=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){U(t)}t.length=0},Q=()=>{K(G),K(I),(n=G.length>0)&&_.raf(Q)},X=t=>z().then(t),Y=J(I,!0);export{i as H,L as b,o as h,z as p,A as r,Y as w}