UNPKG

@huluvu424242/honey-slideshow

Version:

Text to Speech component wich is reading texts from DOM elements.

1 lines 13.4 kB
const e="honey-slideshow";let t,n,l,o=!1,s=!1,i=!1,r=!1,c=0,a=!1;const f="undefined"!=typeof window?window:{},u=f.CSS,d=f.document||{head:{}},p={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l)},h=(()=>(d.head.attachShadow+"").indexOf("[native")>-1)(),y=e=>Promise.resolve(e),$=(()=>{try{return new CSSStyleSheet,!0}catch(e){}return!1})(),w=(e,t,n,l)=>{n&&(n=n.filter(l?([e])=>16&e:([e])=>!(16&e))).map(([n,l,o])=>{const s=b(e,n),i=m(t,o),r=g(n);p.ael(s,l,i,r),(t.o=t.o||[]).push(()=>p.rel(s,l,i,r))})},m=(e,t)=>n=>{256&e.t?e.s[t](n):(e.i=e.i||[]).push([t,n])},b=(e,t)=>4&t?d:8&t?f:32&t?d.body:16&t?e.parentElement:e,g=e=>0!=(2&e),v="http://www.w3.org/1999/xlink",k=new WeakMap,j=(e,t)=>"sc-"+(t&&32&e.t?e.u+"-"+t:e.u),_=e=>Se.push(e),O=e=>me(e).p,S={},M=e=>"object"==(e=typeof e)||"function"===e,C="undefined"!=typeof Deno,D=!(C||"undefined"==typeof global||"function"!=typeof require||!global.process||"string"!=typeof __filename||global.origin&&"string"==typeof global.origin),R=(C&&Deno,D?process:C&&Deno,D?process:C&&Deno,(e,t,...n)=>{let l=null,o=null,s=null,i=!1,r=!1,c=[];const a=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?a(l):null!=l&&"boolean"!=typeof l&&((i="function"!=typeof e&&!M(l))&&(l+=""),i&&r?c[c.length-1].h+=l:c.push(i?x(null,l):l),r=i)};if(a(n),t){t.key&&(o=t.key),t.name&&(s=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter(t=>e[t]).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,c,U);const f=x(e,null);return f.$=t,c.length>0&&(f.m=c),f.g=o,f.v=s,f}),x=(e,t)=>({t:0,k:e,h:t,j:null,m:null,$:null,g:null,v:null}),T={},U={forEach:(e,t)=>e.map(L).forEach(t),map:(e,t)=>e.map(L).map(t).map(P)},L=e=>({vattrs:e.$,vchildren:e.m,vkey:e.g,vname:e.v,vtag:e.k,vtext:e.h}),P=e=>{const t=x(e.vtag,e.vtext);return t.$=e.vattrs,t.m=e.vchildren,t.g=e.vkey,t.v=e.vname,t},E=(e,t,n,l,o,s)=>{if(n!==l){let r=ve(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,o=F(n),s=F(l);t.remove(...o.filter(e=>e&&!s.includes(e))),t.add(...s.filter(e=>e&&!o.includes(e)))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if("ref"===t)l&&l(e);else if(r||"o"!==t[0]||"n"!==t[1]){const a=M(l);if((r||a&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{let o=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(i){}let f=!1;c!==(c=c.replace(/^xlink\:?/,""))&&(t=c,f=!0),null==l||!1===l?!1===l&&""!==e.getAttribute(t)||(f?e.removeAttributeNS(v,t):e.removeAttribute(t)):(!r||4&s||o)&&!a&&(l=!0===l?"":l,f?e.setAttributeNS(v,t,l):e.setAttribute(t,l))}else t="-"===t[2]?t.slice(3):ve(f,c)?c.slice(2):c[2]+t.slice(3),n&&p.rel(e,t,n,!1),l&&p.ael(e,t,l,!1)}},W=/\s/,F=e=>e?e.split(W):[],N=(e,t,n,l)=>{const o=11===t.j.nodeType&&t.j.host?t.j.host:t.j,s=e&&e.$||S,i=t.$||S;for(l in s)l in i||E(o,l,s[l],void 0,n,t.t);for(l in i)E(o,l,s[l],i[l],n,t.t)},q=(e,s,c,a)=>{let f,u,p,h=s.m[c],y=0;if(o||(i=!0,"slot"===h.k&&(t&&a.classList.add(t+"-s"),h.t|=h.m?2:1)),null!==h.h)f=h.j=d.createTextNode(h.h);else if(1&h.t)f=h.j=d.createTextNode("");else{if(r||(r="svg"===h.k),f=h.j=d.createElementNS(r?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&h.t?"slot-fb":h.k),r&&"foreignObject"===h.k&&(r=!1),N(null,h,r),null!=t&&f["s-si"]!==t&&f.classList.add(f["s-si"]=t),h.m)for(y=0;y<h.m.length;++y)u=q(e,h,y,f),u&&f.appendChild(u);"svg"===h.k?r=!1:"foreignObject"===f.tagName&&(r=!0)}return f["s-hn"]=l,3&h.t&&(f["s-sr"]=!0,f["s-cr"]=n,f["s-sn"]=h.v||"",p=e&&e.m&&e.m[c],p&&p.k===h.k&&e.j&&A(e.j,!1)),f},A=(e,t)=>{p.t|=1;const n=e.childNodes;for(let o=n.length-1;o>=0;o--){const e=n[o];e["s-hn"]!==l&&e["s-ol"]&&(G(e).insertBefore(e,z(e)),e["s-ol"].remove(),e["s-ol"]=void 0,i=!0),t&&A(e,t)}p.t&=-2},B=(e,t,n,o,s,i)=>{let r,c=e["s-cr"]&&e["s-cr"].parentNode||e;for(c.shadowRoot&&c.tagName===l&&(c=c.shadowRoot);s<=i;++s)o[s]&&(r=q(null,n,s,e),r&&(o[s].j=r,c.insertBefore(r,z(t))))},H=(e,t,n,l,o)=>{for(;t<=n;++t)(l=e[t])&&(o=l.j,Y(l),s=!0,o["s-ol"]?o["s-ol"].remove():A(o,!0),o.remove())},V=(e,t)=>e.k===t.k&&("slot"===e.k?e.v===t.v:e.g===t.g),z=e=>e&&e["s-ol"]||e,G=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,I=(e,t)=>{const n=t.j=e.j,l=e.m,o=t.m,s=t.k,i=t.h;let c;null===i?(r="svg"===s||"foreignObject"!==s&&r,"slot"===s||N(e,t,r),null!==l&&null!==o?((e,t,n,l)=>{let o,s,i=0,r=0,c=0,a=0,f=t.length-1,u=t[0],d=t[f],p=l.length-1,h=l[0],y=l[p];for(;i<=f&&r<=p;)if(null==u)u=t[++i];else if(null==d)d=t[--f];else if(null==h)h=l[++r];else if(null==y)y=l[--p];else if(V(u,h))I(u,h),u=t[++i],h=l[++r];else if(V(d,y))I(d,y),d=t[--f],y=l[--p];else if(V(u,y))"slot"!==u.k&&"slot"!==y.k||A(u.j.parentNode,!1),I(u,y),e.insertBefore(u.j,d.j.nextSibling),u=t[++i],y=l[--p];else if(V(d,h))"slot"!==u.k&&"slot"!==y.k||A(d.j.parentNode,!1),I(d,h),e.insertBefore(d.j,u.j),d=t[--f],h=l[++r];else{for(c=-1,a=i;a<=f;++a)if(t[a]&&null!==t[a].g&&t[a].g===h.g){c=a;break}c>=0?(s=t[c],s.k!==h.k?o=q(t&&t[r],n,c,e):(I(s,h),t[c]=void 0,o=s.j),h=l[++r]):(o=q(t&&t[r],n,r,e),h=l[++r]),o&&G(u.j).insertBefore(o,z(u.j))}i>f?B(e,null==l[p+1]?null:l[p+1].j,n,l,r,p):r>p&&H(t,i,f)})(n,l,t,o):null!==o?(null!==e.h&&(n.textContent=""),B(n,null,t,o,0,o.length-1)):null!==l&&H(l,0,l.length-1),r&&"svg"===s&&(r=!1)):(c=n["s-cr"])?c.parentNode.textContent=i:e.h!==i&&(n.data=i)},J=e=>{let t,n,l,o,s,i,r=e.childNodes;for(n=0,l=r.length;n<l;n++)if(t=r[n],1===t.nodeType){if(t["s-sr"])for(s=t["s-sn"],t.hidden=!1,o=0;o<l;o++)if(r[o]["s-hn"]!==t["s-hn"])if(i=r[o].nodeType,""!==s){if(1===i&&s===r[o].getAttribute("slot")){t.hidden=!0;break}}else if(1===i||3===i&&""!==r[o].textContent.trim()){t.hidden=!0;break}J(t)}},K=[],Q=e=>{let t,n,l,o,i,r,c=0,a=e.childNodes,f=a.length;for(;c<f;c++){if(t=a[c],t["s-sr"]&&(n=t["s-cr"]))for(l=n.parentNode.childNodes,o=t["s-sn"],r=l.length-1;r>=0;r--)n=l[r],n["s-cn"]||n["s-nr"]||n["s-hn"]===t["s-hn"]||(X(n,o)?(i=K.find(e=>e._===n),s=!0,n["s-sn"]=n["s-sn"]||o,i?i.O=t:K.push({O:t,_:n}),n["s-sr"]&&K.map(e=>{X(e._,n["s-sn"])&&(i=K.find(e=>e._===n),i&&!e.O&&(e.O=i.O))})):K.some(e=>e._===n)||K.push({_:n}));1===t.nodeType&&Q(t)}},X=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,Y=e=>{e.$&&e.$.ref&&e.$.ref(null),e.m&&e.m.map(Y)},Z=e=>me(e).S,ee=(e,t,n)=>{const l=Z(e);return{emit:e=>te(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},te=(e,t,n)=>{const l=new CustomEvent(t,n);return e.dispatchEvent(l),l},ne=(e,t)=>{t&&!e.M&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.M=t))},le=(e,t)=>{if(e.t|=16,!(4&e.t))return ne(e,e.C),Pe(()=>oe(e,t));e.t|=512},oe=(e,t)=>{const n=e.s;let l;return t&&(e.t|=256,e.i&&(e.i.map(([e,t])=>fe(n,e,t)),e.i=null),l=fe(n,"componentWillLoad")),l=ue(l,()=>fe(n,"componentWillRender")),ue(l,()=>se(e,n,t))},se=(e,r,c)=>{const a=e.S,f=a["s-rc"];c&&(e=>{const t=e.D,n=e.S,l=t.t,o=((e,t,n)=>{let l=j(t,n),o=Oe.get(l);if(e=11===e.nodeType?e:d,o)if("string"==typeof o){let t,n=k.get(e=e.head||e);n||k.set(e,n=new Set),n.has(l)||(t=d.createElement("style"),t.innerHTML=o,e.insertBefore(t,e.querySelector("link")),n&&n.add(l))}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(h&&n.shadowRoot?n.shadowRoot:n.getRootNode(),t,e.p);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"),2&l&&n.classList.add(o+"-s"))})(e);((e,r)=>{const c=e.S,a=e.D,f=e.R||x(null,null),u=(e=>e&&e.k===T)(r)?r:R(null,null,r);if(l=c.tagName,a.T&&(u.$=u.$||{},a.T.map(([e,t])=>u.$[t]=c[e])),u.k=null,u.t|=4,e.R=u,u.j=f.j=c.shadowRoot||c,t=c["s-sc"],n=c["s-cr"],o=h&&0!=(1&a.t),s=!1,I(f,u),p.t|=1,i){let e,t,n,l,o,s;Q(u.j);let i=0;for(;i<K.length;i++)e=K[i],t=e._,t["s-ol"]||(n=d.createTextNode(""),n["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=n,t));for(i=0;i<K.length;i++)if(e=K[i],t=e._,e.O){for(l=e.O.parentNode,o=e.O.nextSibling,n=t["s-ol"];n=n.previousSibling;)if(s=n["s-nr"],s&&s["s-sn"]===t["s-sn"]&&l===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&l!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),l.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}s&&J(u.j),p.t&=-2,K.length=0})(e,ie(e,r)),f&&(f.map(e=>e()),a["s-rc"]=void 0);{const t=a["s-p"],n=()=>re(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},ie=(e,t)=>{try{t=t.render&&t.render(),e.t&=-17,e.t|=2}catch(n){ke(n)}return t},re=e=>{const t=e.S,n=e.s,l=e.C;64&e.t?fe(n,"componentDidUpdate"):(e.t|=64,de(t),fe(n,"componentDidLoad"),e.U(t),l||ae()),e.L(t),e.M&&(e.M(),e.M=void 0),512&e.t&&Ue(()=>le(e,!1)),e.t&=-517},ce=e=>{{const t=me(e),n=t.S.isConnected;return n&&2==(18&t.t)&&le(t,!1),n}},ae=()=>{de(d.documentElement),p.t|=2,Ue(()=>te(f,"appload",{detail:{namespace:"honey-slideshow"}}))},fe=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(l){ke(l)}},ue=(e,t)=>e&&e.then?e.then(t):t(),de=e=>e.classList.add("hydrated"),pe=(e,t,n)=>{if(t.P){e.watchers&&(t.W=e.watchers);const l=Object.entries(t.P),o=e.prototype;if(l.map(([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(o,e,{get(){return((e,t)=>me(this).F.get(t))(0,e)},set(n){((e,t,n,l)=>{const o=me(e),s=o.F.get(t),i=o.t,r=o.s;if(n=((e,t)=>null==e||M(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.P[t][0]),!(8&i&&void 0!==s||n===s)&&(o.F.set(t,n),r)){if(l.W&&128&i){const e=l.W[t];e&&e.map(e=>{try{r[e](n,s,t)}catch(l){ke(l)}})}2==(18&i)&&le(o,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(o,e,{value(...t){const n=me(this);return n.N.then(()=>n.s[e](...t))}})}),1&n){const n=new Map;o.attributeChangedCallback=function(e,t,l){p.jmp(()=>{const t=n.get(e);this[t]=(null!==l||"boolean"!=typeof this[t])&&l})},e.observedAttributes=l.filter(([e,t])=>15&t[0]).map(([e,l])=>{const o=l[1]||e;return n.set(o,e),512&l[0]&&t.T.push([e,o]),o})}}return e},he=e=>{fe(e,"connectedCallback")},ye=(e,t={})=>{const n=[],l=t.exclude||[],o=f.customElements,s=d.head,i=s.querySelector("meta[charset]"),r=d.createElement("style"),c=[];let a,u=!0;Object.assign(p,t),p.l=new URL(t.resourcesUrl||"./",d.baseURI).href,t.syncQueue&&(p.t|=4),e.map(e=>e[1].map(t=>{const s={t:t[0],u:t[1],P:t[2],q:t[3]};s.P=t[2],s.q=t[3],s.T=[],s.W={},!h&&1&s.t&&(s.t|=8);const i=s.u,r=class extends HTMLElement{constructor(e){super(e),ge(e=this,s),1&s.t&&(h?e.attachShadow({mode:"open",delegatesFocus:!!(16&s.t)}):"shadowRoot"in e||(e.shadowRoot=e))}connectedCallback(){a&&(clearTimeout(a),a=null),u?c.push(this):p.jmp(()=>(e=>{if(0==(1&p.t)){const t=me(e),n=t.D,l=()=>{};if(w(e,t,n.q,!0),1&t.t)w(e,t,n.q,!1),he(t.s);else{t.t|=1,12&n.t&&(e=>{const t=e["s-cr"]=d.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){ne(t,t.C=n);break}}n.P&&Object.entries(n.P).map(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}}),Ue(()=>(async(e,t,n,l,o)=>{if(0==(32&t.t)){{if(t.t|=32,(o=_e(n)).then){const e=()=>{};o=await o,e()}o.isProxied||(n.W=o.watchers,pe(o,n,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(r){ke(r)}t.t&=-9,t.t|=128,e(),he(t.s)}if(o.style){let l=o.style;"string"!=typeof l&&(l=l[t.p=(e=>Se.map(t=>t(e)).find(e=>!!e))(e)]);const s=j(n,t.p);if(!Oe.has(s)){const e=()=>{};8&n.t&&(l=await __sc_import_honey_slideshow("./p-e6593f8b.js").then(e=>e.scopeCss(l,s,!1))),((e,t,n)=>{let l=Oe.get(e);$&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,Oe.set(e,l)})(s,l,!!(1&n.t)),e()}}}const s=t.C,i=()=>le(t,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(e,t,n))}l()}})(this))}disconnectedCallback(){p.jmp(()=>(()=>{if(0==(1&p.t)){const e=me(this),t=e.s;e.o&&(e.o.map(e=>e()),e.o=void 0),fe(t,"disconnectedCallback"),fe(t,"componentDidUnload")}})())}forceUpdate(){ce(this)}componentOnReady(){return me(this).A}};s.B=e[0],l.includes(i)||o.get(i)||(n.push(i),o.define(i,pe(r,s,1)))})),r.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",r.setAttribute("data-styles",""),s.insertBefore(r,i?i.nextSibling:s.firstChild),u=!1,c.length?c.map(e=>e.connectedCallback()):p.jmp(()=>a=setTimeout(ae,30))},$e=e=>{const t=new URL(e,p.l);return t.origin!==f.location.origin?t.href:t.pathname},we=new WeakMap,me=e=>we.get(e),be=(e,t)=>we.set(t.s=e,t),ge=(e,t)=>{const n={t:0,S:e,D:t,F:new Map};return n.N=new Promise(e=>n.L=e),n.A=new Promise(e=>n.U=e),e["s-p"]=[],e["s-rc"]=[],w(e,n,t.q,!1),we.set(e,n)},ve=(e,t)=>t in e,ke=e=>console.error(e),je=new Map,_e=e=>{const t=e.u.replace(/-/g,"_"),n=e.B,l=je.get(n);return l?l[t]:__sc_import_honey_slideshow(`./${n}.entry.js`).then(e=>(je.set(n,e),e[t]),ke)},Oe=new Map,Se=[],Me=[],Ce=[],De=[],Re=(e,t)=>n=>{e.push(n),a||(a=!0,t&&4&p.t?Ue(Te):p.raf(Te))},xe=(e,t)=>{let n=0,l=0;for(;n<e.length&&(l=performance.now())<t;)try{e[n++](l)}catch(o){ke(o)}n===e.length?e.length=0:0!==n&&e.splice(0,n)},Te=()=>{c++,(e=>{for(let n=0;n<e.length;n++)try{e[n](performance.now())}catch(t){ke(t)}e.length=0})(Me);{const e=2==(6&p.t)?performance.now()+14*Math.ceil(.1*c):1/0;xe(Ce,e),xe(De,e),Ce.length>0&&(De.push(...Ce),Ce.length=0),(a=Me.length+Ce.length+De.length>0)?p.raf(Te):c=0}},Ue=e=>y().then(e),Le=Re(Me,!1),Pe=Re(Ce,!0),Ee={isDev:!1,isBrowser:!0,isServer:!1,isTesting:!1};export{Ee as B,u as C,T as H,e as N,y as a,ye as b,ee as c,d,O as e,ce as f,Z as g,R as h,Le as i,Pe as j,$e as k,p,be as r,_ as s,f as w}