lantun 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rizkianakbar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,73 @@
1
- # Temporary Holding Version
1
+ # lantun
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Add read-aloud to any website with one script tag: text-to-speech with sentence and word highlighting, plus reading aids for low vision, dyslexia and ADHD.**
4
+
5
+ Lantun adds a small dock to your page. Readers press play and hear the article while it highlights along. A second button opens reading aids: text size, spacing, dyslexia font, colour modes, reading guide and more. It works on plain HTML, WordPress, Ghost, Webflow or any CMS theme, with no build step, backend or account.
6
+
7
+ **[Try the live demo →](https://lantun.rzknkbr.xyz)** Open any sample article and press play.
8
+
9
+ ![Lantun reading an article aloud, highlighting the current sentence and word](https://raw.githubusercontent.com/rizkianakbar/lantun/main/docs/screenshots/playing.png)
10
+
11
+ ## Usage
12
+
13
+ Paste these two lines before `</body>`:
14
+
15
+ ```html
16
+ <script src="https://cdn.jsdelivr.net/npm/lantun@0.1/dist/widget.js"></script>
17
+ <script src="https://cdn.jsdelivr.net/npm/lantun@0.1/dist/voice-kitten.js"></script>
18
+ ```
19
+
20
+ That's it. Lantun finds the article by itself, skipping menus, ads, captions and "Read also" links, and shows the dock when the page loads.
21
+
22
+ The second line adds lifelike English voices, generated on the reader's device. Keep it: browser voices often sound robotic. Nothing downloads until a reader picks one of these voices (about 31 MB, once).
23
+
24
+ ## Options
25
+
26
+ Add attributes to the first tag. All are optional.
27
+
28
+ ```html
29
+ <script
30
+ src="https://cdn.jsdelivr.net/npm/lantun@0.1/dist/widget.js"
31
+ data-content-selector="article .entry-content"
32
+ data-color="#7c3aed"
33
+ ></script>
34
+ ```
35
+
36
+ | Attribute | Default | What it does |
37
+ | ------------------------ | ------------------------ | ------------------------------------------------------- |
38
+ | `data-content-selector` | auto-detected | Where the article body is. |
39
+ | `data-exclude-selectors` | none | Comma-separated selectors that are never read aloud. |
40
+ | `data-position` | `right` | Dock side: `right` or `left`. |
41
+ | `data-color` | `#f5b841` | Highlight and accent colour; any CSS colour. |
42
+ | `data-lang` | `<html lang>`, then `en` | Article language; picks the voices and the UI language. |
43
+ | `data-tts` | `true` | `false` turns off listening. |
44
+ | `data-a11y` | `true` | `false` turns off reading aids. |
45
+ | `data-z-index` | `2147483000` | Stacking order. |
46
+ | `data-auto-init` | `true` | `false` waits for you to call `LantunReader.init()`. |
47
+
48
+ - **Skip part of the page:** add `data-reader-skip` to any element.
49
+ - **Strict Content-Security-Policy:** add your `nonce` to the script tag; Lantun reuses it for its styles.
50
+ - **Versions:** `lantun@0.1` gets bug fixes automatically, never breaking changes. Use `lantun@0.1.1` to pin an exact version.
51
+
52
+ ## JavaScript API
53
+
54
+ The script exposes `window.LantunReader`:
55
+
56
+ | Function | Description |
57
+ | -------------------- | ---------------------------------------------------------------------------- |
58
+ | `init(options?)` | Starts the widget (only needed with `data-auto-init="false"`). |
59
+ | `destroy()` | Removes everything Lantun added to the page. |
60
+ | `play()` / `pause()` | Controls playback. Browsers allow `play()` only after a user interaction. |
61
+ | `on(event, handler)` | Listens to `sentence`, `word`, `end` or `error`, and returns an unsubscribe. |
62
+
63
+ ## Using a bundler?
64
+
65
+ Install [`@lantun/core`](https://www.npmjs.com/package/@lantun/core) for JavaScript apps, or [`@lantun/react`](https://www.npmjs.com/package/@lantun/react) for React and Next.js.
66
+
67
+ ## Links
68
+
69
+ - [Live demo](https://lantun.rzknkbr.xyz)
70
+ - [GitHub](https://github.com/rizkianakbar/lantun) (full docs and screenshots)
71
+ - [Issues](https://github.com/rizkianakbar/lantun/issues)
72
+
73
+ MIT licensed.
@@ -0,0 +1 @@
1
+ (function(){Float32Array.from({length:512},(e,t)=>.5-.5*Math.cos(2*Math.PI*t/512)),Float64Array.from({length:256},(e,t)=>Math.cos(2*Math.PI*t/512)),Float64Array.from({length:256},(e,t)=>Math.sin(2*Math.PI*t/512)),e(512);function e(e){let t=new Uint16Array(e),n=Math.log2(e);for(let r=0;r<e;r++){let e=0;for(let t=0;t<n;t++)e|=(r>>t&1)<<n-1-t;t[r]=e}return t}function t(e,t){let n=e.length*2,r=new ArrayBuffer(44+n),i=new DataView(r);function a(e,t){for(let n=0;n<t.length;n++)i.setUint8(e+n,t.charCodeAt(n))}a(0,`RIFF`),i.setUint32(4,36+n,!0),a(8,`WAVE`),a(12,`fmt `),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),a(36,`data`),i.setUint32(40,n,!0);for(let t=0;t<e.length;t++){let n=Math.max(-1,Math.min(1,e[t]));i.setInt16(44+t*2,n*32767,!0)}return r}var n=`data:audio/wav;base64,${btoa(String.fromCharCode(...new Uint8Array(t(new Float32Array(240),24e3))))}`,r=24e3,i=[`Jasper`,`Luna`,`Bruno`,`Rosie`,`Hugo`,`Leo`],a={Jasper:`male`,Luna:`female`,Bruno:`male`,Rosie:`female`,Hugo:`male`,Leo:`male`},o={Jasper:.78,Luna:.87,Bruno:.85,Rosie:.9,Hugo:.87,Leo:.98},s=`https://huggingface.co/KittenML/kitten-tts-nano-0.8-int8/resolve/main`,c=`https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.2/dist`,l={model:`${s}/kitten_tts_nano_v0_8.onnx`,voices:`${s}/voices.npz`,config:`${s}/config.json`,ort:`${c}/ort.wasm.min.mjs`,ortWasm:`${c}/ort-wasm-simd-threaded.wasm`,phonemizer:`https://cdn.jsdelivr.net/npm/phonemizer@1.2.1/dist/phonemizer.js`},u=3995e4,d=31e6,f=/[,;:—](?=\s)/g;function p(...e){try{localStorage.getItem(`lantun:debug`)&&console.info(`[Lantun] kitten:`,...e)}catch{}}function m(){}function h(e){e.clip.then(e=>URL.revokeObjectURL(e.url),m)}function g(e){let t=e?.name??``;return i.includes(t)?t:i[0]}function _(e,t){return`${g(e)}|${t}`}function v(e){return{id:`kitten:${e}`,name:e,lang:`en-US`,local:!0,isDefault:!1,engine:`kitten`,downloadBytes:d,gender:a[e]}}function y(e){return Array.from(e.text.matchAll(/\S+/g),t=>e.offset+(t.index??0))}function b(e=window){let t=e.navigator;return typeof WebAssembly==`object`&&typeof e.Worker==`function`&&typeof e.Audio==`function`&&typeof DecompressionStream==`function`&&!t.connection?.saveData&&(t.deviceMemory??4)>=2}function x(e){if(e.length<90)return[{text:e,offset:0}];for(let t of e.matchAll(f)){let n=(t.index??0)+1;if(n<25)continue;if(n>e.length-25)break;let r=e.slice(n).trimStart();return[{text:e.slice(0,n),offset:0},{text:r,offset:e.length-r.length}]}return[{text:e,offset:0}]}function S(e,a={},s=window){let c={...l,...a.sources},d=b(s)?(a.voices??i).map(v):[],f=new Set,S=new Map,C=new Map,w=[],T={state:`idle`,progress:0},E=null,D=1,O=null,k=1,A=!1,j=0,M,N=0,P=null,F=null;function I(e){T=e;for(let t of f)t(e)}function L(){E?.terminate(),E=null;for(let e of S.values())e.reject(Error(`Voice engine failed to load`));S.clear();for(let e of C.values())h(e);C.clear(),I({state:`error`,progress:0,error:`failed`})}function R(e,t){if(t<.5||(w.push(e/1e3/t*k),w.length<4))return;let n=w.slice(1).slice(-3),r=n.reduce((e,t)=>e+t,0)/n.length;r>.85&&(p(`too slow: synthesis takes ${r.toFixed(2)}× the listening time`),I({state:`error`,progress:0,error:`slow`}))}function z(e){let n=S.get(e.id);if(S.delete(e.id),!n)return;let i=e.samples.length/r,a=new Blob([t(e.samples,r)],{type:`audio/wav`});p(`clip ${e.id}: ${Math.round(e.ms)} ms for ${i.toFixed(1)} s of audio`),R(e.ms,i),n.resolve({url:URL.createObjectURL(a),seconds:i,starts:e.starts})}function B(e){switch(e.type){case`progress`:T.state===`loading`&&I({state:`loading`,progress:Math.min(.99,e.loaded/u)});return;case`ready`:I({state:`ready`,progress:1});return;case`audio`:z(e);return;case`error`:if(e.id===void 0){p(`load failed:`,e.message),L();return}p(`clip ${e.id} failed:`,e.message),S.get(e.id)?.reject(Error(e.message)),S.delete(e.id)}}function V(e){E?.postMessage(e)}function H(){if(E)return E;try{E=e()}catch{return L(),null}return E.onmessage=e=>B(e.data),E.onerror=L,I({state:`loading`,progress:0}),V({type:`load`,sources:c}),E}function U(){for(let[e,t]of C){if(C.size<=10)return;C.delete(e),h(t)}}function W(e,t){let n=_(e,t),r=C.get(n);if(r)return C.delete(n),C.set(n,r),r;let i=D++,a=g(e),s=new Promise((e,n)=>{S.set(i,{resolve:e,reject:n}),p(`queue clip ${i}: "${t.slice(0,40)}"`),V({type:`synth`,id:i,text:t,voice:a,speed:o[a]})}),c={id:i,clip:s};return s.catch(()=>{C.get(n)?.id===i&&C.delete(n)}),C.set(n,c),U(),c}function G(e){for(let[t,n]of C){let r=S.get(n.id);r&&!e.has(n.id)&&(C.delete(t),S.delete(n.id),r.reject(Error(`dropped`)))}V({type:`drop`,keep:[...e]})}function K(){clearInterval(M),M=void 0,F=null,O&&(O.onended=null,O.pause())}function q(){if(O)return O;let e=new(s.Audio??Audio);return e.preload=`auto`,e.preservesPitch=!0,O=e,e}function J(e,t,n){let r=q(),i=0,a=!1;function o(){return n===j}function s(e){o()&&t.onError({code:e.name===`NotAllowedError`?`not-allowed`:`audio-failed`,message:e.message})}function c(e){o()&&e.message!==`dropped`&&t.onError({code:`synthesis-failed`,message:e.message})}function l(e,n){if(!o())return;let c=y(e.part),l=0;function d(){for(;l<c.length&&(n.starts[l]??1/0)<=r.currentTime;)t.onWord(c[l++]??0,!1)}function f(){o()&&(a||(a=!0,t.onStart?.()),N&&p(`silence before "${e.part.text.slice(0,30)}": ${Math.round(performance.now()-N)} ms`),N=0,clearInterval(M),M=setInterval(d,30),d())}function m(){r.onended=()=>{N=performance.now(),o()&&(clearInterval(M),d(),i++,u())},r.src=n.url,r.playbackRate=k,r.play().then(f,s)}A?F=m:m()}function u(){let n=e[i];n?n.clip.then(e=>l(n,e),c):t.onEnd()}u()}return{id:`kitten`,reliablePause:!0,slowStart:!0,liveRate:!0,status(){return T},subscribe(e){return f.add(e),()=>f.delete(e)},getVoices(){return Promise.resolve(d)},speak(e,t){K();let r=++j,i=q();if(A=!1,k=e.rate,i.src||(i.src=n,i.play().catch(m)),T.state===`error`&&(w.length=0,I({state:`idle`,progress:0})),!H()){t.onError({code:`engine-failed`,message:`HD voice is unavailable on this page.`});return}let a=C.get(_(e.voice,e.text)),o=a?[{part:{text:e.text,offset:0},...a}]:x(e.text).map(t=>({part:t,...W(e.voice,t.text)})),s=new Set(o.map(e=>e.id));P=s,queueMicrotask(()=>{P===s&&G(s)}),J(o,t,r)},prepare(e){if(T.state===`error`||!H())return;let t=W(e.voice,e.text);P?.add(t.id),t.clip.catch(m)},setRate(e){k=e,O&&(O.playbackRate=e)},pause(){A=!0,O?.pause()},resume(){A=!1;let e=F;F=null,e?e():O?.play().catch(m)},cancel(){j++,K()}}}var C='var L=Float32Array.from({length:512},(t,e)=>.5-.5*Math.cos(2*Math.PI*e/512)),Q=Float64Array.from({length:256},(t,e)=>Math.cos(2*Math.PI*e/512)),X=Float64Array.from({length:256},(t,e)=>Math.sin(2*Math.PI*e/512)),tt=et(512);function et(t){let e=new Uint16Array(t),r=Math.log2(t);for(let s=0;s<t;s++){let n=0;for(let i=0;i<r;i++)n|=(s>>i&1)<<r-1-i;e[s]=n}return e}function nt(t,e,r=75){let s=2*Math.PI*r/e,n=Math.sin(s)/Math.SQRT2,i=Math.cos(s),c=1+n,o=(1+i)/2/c,a=-(1+i)/c,l=-2*i/c,f=(1-n)/c,p=0,m=0,y=0,h=0;for(let d=0;d<t.length;d++){let b=t[d],u=o*b+a*p+o*m-l*y-f*h;m=p,p=b,h=y,y=u,t[d]=u}}function R(t,e,r){for(let n=0;n<512;n++){let i=tt[n];if(n<i){let c=t[n],o=e[n];t[n]=t[i],e[n]=e[i],t[i]=c,e[i]=o}}let s=r?1:-1;for(let n=2;n<=512;n<<=1){let i=n>>1,c=512/n;for(let o=0;o<512;o+=n)for(let a=0;a<i;a++){let l=Q[a*c],f=s*X[a*c],p=o+a,m=p+i,y=t[m],h=e[m],d=y*l-h*f,b=y*f+h*l,u=t[p],w=e[p];t[m]=u-d,e[m]=w-b,t[p]=u+d,e[p]=w+b}}}function rt(t,e){let r=new Float64Array(e);for(let c=0;c<e;c++){let o=0;for(let a=0;a<257;a++)o+=t[c*257+a]**2;r[c]=o}let n=Array.from({length:e},(c,o)=>o).sort((c,o)=>r[c]-r[o]).slice(0,Math.max(4,Math.floor(e*.15))),i=new Float32Array(257);for(let c=0;c<257;c++){let o=0,a=0;for(let p of n){let m=t[p*257+c]??0;o+=m,a+=m*m}let l=o/n.length,f=Math.max(0,a/n.length-l*l);i[c]=l+1.5*Math.sqrt(f)}return i}function ot(t){let e=Math.min(120,t.length>>1);for(let r=0;r<e;r++){let s=r/e,n=t.length-1-r;t[r]=t[r]*s,t[n]=t[n]*s}}function k(t,e){let r=Float32Array.from(t);nt(r,e);let s=Math.max(1,Math.ceil((r.length+512)/128)),n=new Float32Array(s*128+512);n.set(r,256);let i=new Float32Array(s*512),c=new Float32Array(s*512),o=new Float32Array(s*257);for(let h=0;h<s;h++){let d=i.subarray(h*512,(h+1)*512),b=c.subarray(h*512,(h+1)*512);for(let u=0;u<512;u++)d[u]=n[h*128+u]*L[u];R(d,b,!1);for(let u=0;u<257;u++){let w=d[u],A=b[u];o[h*257+u]=Math.sqrt(w*w+A*A)}}let a=rt(o,s),l=new Float32Array(n.length),f=new Float32Array(n.length),p=new Float32Array(257),m=new Float32Array(257).fill(1);for(let h=0;h<s;h++){for(let u=0;u<257;u++){let w=o[h*257+u]/(a[u]+1e-9),A=Math.min(1,Math.max(0,(w-1)/1));p[u]=.06+(1-.06)*A*A*(3-2*A)}for(let u=0;u<257;u++){let w=p[u],A=((p[u-1]??w)+2*w+(p[u+1]??w))/4;m[u]=Math.max(A,m[u]*.5)}let d=i.subarray(h*512,(h+1)*512),b=c.subarray(h*512,(h+1)*512);for(let u=0;u<257;u++){let w=m[u];d[u]=d[u]*w,b[u]=b[u]*w,u>0&&u<256&&(d[512-u]=d[u],b[512-u]=-b[u])}R(d,b,!0);for(let u=0;u<512;u++){let w=L[u],A=h*128+u;l[A]=l[A]+d[u]/512*w,f[A]=f[A]+w*w}}let y=new Float32Array(r.length);for(let h=0;h<r.length;h++){let d=f[h+256];y[h]=d>1e-6?l[h+256]/d:0}return ot(y),y}function C(t,e){let r=Math.round(e*.02),s=[],n=0;for(let o=0;o+r<=t.length;o+=r){let a=0;for(let l=o;l<o+r;l++){let f=t[l];a+=f*f,n=Math.max(n,Math.abs(f))}s.push(Math.sqrt(a/r))}if(!s.length||n===0)return t;s.sort((o,a)=>o-a);let i=s[Math.floor(s.length*.9)]??0,c=Math.min(2,Math.max(1/2,.2/(i||1)),.95/n);for(let o=0;o<t.length;o++)t[o]=t[o]*c;return t}function st(t,e){let r=t.length*2,s=new ArrayBuffer(44+r),n=new DataView(s);function i(c,o){for(let a=0;a<o.length;a++)n.setUint8(c+a,o.charCodeAt(a))}i(0,"RIFF"),n.setUint32(4,36+r,!0),i(8,"WAVE"),i(12,"fmt "),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,e,!0),n.setUint32(28,e*2,!0),n.setUint16(32,2,!0),n.setUint16(34,16,!0),i(36,"data"),n.setUint32(40,r,!0);for(let c=0;c<t.length;c++){let o=Math.max(-1,Math.min(1,t[c]));n.setInt16(44+c*2,o*32767,!0)}return s}var Tt=`data:audio/wav;base64,${btoa(String.fromCharCode(...new Uint8Array(st(new Float32Array(240),24e3))))}`;async function at(t){let e=new Response(t).body;if(!e)throw new Error("Streams are unavailable");let r=e.pipeThrough(new DecompressionStream("deflate-raw"));return new Uint8Array(await new Response(r).arrayBuffer())}async function it(t){let e=new DataView(t),r=t.byteLength-22;for(;r>=0&&e.getUint32(r,!0)!==101010256;)r--;if(r<0)throw new Error("Not a zip file");let s=e.getUint16(r+10,!0),n=e.getUint32(r+16,!0),i=new Map,c=new TextDecoder;for(let o=0;o<s;o++){if(e.getUint32(n,!0)!==33639248)throw new Error("Corrupt zip directory");let a=e.getUint16(n+10,!0),l=e.getUint32(n+20,!0),f=e.getUint16(n+28,!0),p=e.getUint16(n+30,!0),m=e.getUint16(n+32,!0),y=e.getUint32(n+42,!0),h=c.decode(new Uint8Array(t,n+46,f)),d=y+30+e.getUint16(y+26,!0)+e.getUint16(y+28,!0),b=new Uint8Array(t,d,l);if(a===0)i.set(h,b);else if(a===8)i.set(h,await at(b));else throw new Error(`Unsupported zip method ${a}`);n+=46+f+p+m}return i}function ct(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),r=t[6]!==void 0&&t[6]>=2,s=r?e.getUint32(8,!0):e.getUint16(8,!0),n=(r?12:10)+s,i=new TextDecoder().decode(t.subarray(r?12:10,n)),c=/\'descr\':\\s*\'([^\']+)\'/.exec(i)?.[1],o=(/\'shape\':\\s*\\(([^)]*)\\)/.exec(i)?.[1]??"").split(",").map(m=>m.trim()).filter(Boolean).map(Number);if(/\'fortran_order\':\\s*True/.test(i))throw new Error("Fortran-order arrays are not supported");let a=o.length>1?o[0]??1:1,l=o.slice(o.length>1?1:0).reduce((m,y)=>m*y,1),f=t.slice(n),p;if(c==="<f4")p=new Float32Array(f.buffer);else if(c==="<f8")p=Float32Array.from(new Float64Array(f.buffer));else throw new Error(`Unsupported npy dtype ${c}`);return{data:p,rows:a,cols:l}}async function B(t){let e=new Map;for(let[r,s]of await it(t))r.endsWith(".npy")&&e.set(r.slice(0,-4),ct(s));return e}var I=`[${\';:,.!?\\xA1\\xBF\\u2014\\u2026"\\xAB\\xBB\\u201C\\u201D()[]{}\'.replace(/[\\]\\\\[^-]/g,"\\\\$&")}]`,N=["$",...\';:,.!?\\xA1\\xBF\\u2014\\u2026"\\xAB\\xBB"" \',..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",..."\\u0251\\u0250\\u0252\\xE6\\u0253\\u0299\\u03B2\\u0254\\u0255\\xE7\\u0257\\u0256\\xF0\\u02A4\\u0259\\u0258\\u025A\\u025B\\u025C\\u025D\\u025E\\u025F\\u0284\\u0261\\u0260\\u0262\\u029B\\u0266\\u0267\\u0127\\u0265\\u029C\\u0268\\u026A\\u029D\\u026D\\u026C\\u026B\\u026E\\u029F\\u0271\\u026F\\u0270\\u014B\\u0273\\u0272\\u0274\\xF8\\u0275\\u0278\\u03B8\\u0153\\u0276\\u0298\\u0279\\u027A\\u027E\\u027B\\u0280\\u0281\\u027D\\u0282\\u0283\\u0288\\u02A7\\u0289\\u028A\\u028B\\u2C71\\u028C\\u0263\\u0264\\u028D\\u03C7\\u028E\\u028F\\u0291\\u0290\\u0292\\u0294\\u02A1\\u0295\\u02A2\\u01C0\\u01C1\\u01C2\\u01C3\\u02C8\\u02CC\\u02D0\\u02D1\\u02BC\\u02B4\\u02B0\\u02B1\\u02B2\\u02B7\\u02E0\\u02E4\\u02DE\\u2193\\u2191\\u2192\\u2197\\u2198\'\\u0329\'\\u1D7B"],v=new Map(N.map((t,e)=>[t,e])),Rt=N.length,O=/[\\p{L}\\p{M}\\p{N}_]+|[^\\p{L}\\p{M}\\p{N}_\\s]/gu,z=new RegExp(`^(${I}*)(.*?)(${I}*)$`,"su"),D=v.get(" ");function ut(t){return t.replace(/[‘’‚‛′]/g,"\'").replace(/[“”„‟″]/g,\'"\').replace(/[–―]/g,"\\u2014").replace(/\\s+/g," ").trim()}function lt(t){return/[.!?,;:]$/.test(t)?t:`${t},`}function ft(t){let e=[];for(let r of(t.match(O)??[]).join(" ")){let s=v.get(r);s!==void 0&&e.push(s)}return e}function mt(t,e){if(t.length===e)return t.map((o,a)=>a);let r=t.map(o=>Math.max(1,o.length)),s=r.reduce((o,a)=>o+a,0),n=[],i=0,c=r[0]??0;for(let o=0;o<e;o++){let a=(o+.5)/e*s;for(;a>c&&i<t.length-1;)c+=r[++i]??0;n.push(i)}return n}async function H(t,e){let r=t.match(/\\S+/g)??[],s=r.map((l,f)=>{let[,p="",m="",y=""]=z.exec(ut(f===r.length-1?lt(l):l))??[];return{lead:p,core:m,trail:y}}),n=s.map(()=>""),i=[];async function c(){let l=i.filter(m=>s[m]?.core);if(i=[],!l.length)return;let f=(await e(l.map(m=>s[m]?.core).join(" "))).trim().split(/\\s+/).filter(Boolean),p=mt(l.map(m=>s[m]?.core??""),f.length);f.forEach((m,y)=>{let h=l[p[y]??0]??0;n[h]=n[h]?`${n[h]} ${m}`:m})}for(let[l,f]of s.entries())f.lead&&await c(),i.push(l),f.trail&&await c();await c();let o=[0],a=[];for(let[l,f]of s.entries()){let p=ft(f.lead+(n[l]??"")+f.trail);p.length&&o.length>1&&o.push(D),a.push(o.length),o.push(...p)}return o.push(10,0),{ids:o,words:a}}function $(t,e,r){let s=new Float64Array(e.length+1);for(let n=0;n<e.length;n++)s[n+1]=s[n]+Number(e[n]);return Float32Array.from(t,n=>s[Math.min(n,e.length)]*r)}var W="lantun-voice-kitten-v1";var K=0,S=null,P=[],T=!1;function x(t,e=[]){self.postMessage(t,e)}function j(t){return String(t?.message??t)}function q(t){K+=t,x({type:"progress",loaded:K})}function gt(t,e){let r=new Uint8Array(e),s=0;for(let n of t)r.set(n,s),s+=n.length;return r}function yt(){return new Promise(t=>setTimeout(t,0))}async function _(t){let e=await caches.open(W).catch(()=>null),r=await e?.match(t);if(r){let a=await r.arrayBuffer();return q(a.byteLength),a}let s=await fetch(t);if(!s.ok||!s.body)throw new Error(`HTTP ${s.status} for ${t}`);let n=s.body.getReader(),i=[],c=0;for(;;){let{done:a,value:l}=await n.read();if(a)break;i.push(l),c+=l.length,q(l.length)}let o=gt(i,c);return await e?.put(t,new Response(o)).catch(()=>{}),o.buffer}async function wt(t){let[e,r,s,n,i,c]=await Promise.all([import(t.ort),import(t.phonemizer),_(t.model),_(t.ortWasm),_(t.voices).then(B),fetch(t.config).then(f=>f.json())]);e.env.wasm.wasmBinary=n,e.env.wasm.wasmPaths=t.ortWasm.slice(0,t.ortWasm.lastIndexOf("/")+1),e.env.wasm.numThreads=self.crossOriginIsolated?Math.min(4,navigator.hardwareConcurrency||1):1;let o=await e.InferenceSession.create(s,{executionProviders:["wasm"],graphOptimizationLevel:"all"}),a=new Map;async function l(f){let p=a.get(f);if(p!==void 0)return p;let m=(await r.phonemize(f,"en-us")).join(" ").replace(/_/g,"").replace(/\\n/g," ");return a.size>5e3&&a.clear(),a.set(f,m),m}return{ort:e,session:o,phonemize:l,voices:i,config:c}}async function bt(t,e,r,s){let n=t.voices.get(t.config.voice_aliases?.[r]??r);if(!n)throw new Error(`Unknown voice ${r}`);let{ids:i,words:c}=await H(e,t.phonemize),o=Math.min(e.length,n.rows-1),{Tensor:a}=t.ort,l=await t.session.run({input_ids:new a("int64",BigInt64Array.from(i,BigInt),[1,i.length]),style:new a("float32",n.data.slice(o*n.cols,(o+1)*n.cols),[1,n.cols]),speed:new a("float32",new Float32Array([s]),[1])}),f=l.waveform?.data,p=l.duration?.data;if(!f||!p)throw new Error("Model returned no audio");let m=Math.max(0,Number(p[0]??0)*600-1200),y=$(c,p,600/24e3).map(d=>Math.max(0,d-m/24e3)),h=f.subarray(m,Math.max(m,f.length-5e3));return{samples:C(k(h,24e3),24e3),starts:y}}async function At(t){try{let e=await S,r=performance.now(),{samples:s,starts:n}=await bt(e,t.text,t.voice,t.speed);x({type:"audio",id:t.id,samples:s,starts:n,ms:performance.now()-r},[s.buffer,n.buffer])}catch(e){x({type:"error",id:t.id,message:j(e)})}}async function V(){if(!(T||!S)){T=!0;try{let t=P.shift();for(;t;)await At(t),await yt(),t=P.shift()}finally{T=!1}}}function Mt(t){let e=t.data;switch(e.type){case"load":S??(S=wt(e.sources)),S.then(()=>x({type:"ready"}),r=>x({type:"error",message:j(r)})),V();return;case"synth":P.push(e),V();return;case"drop":{let r=new Set(e.keep);P=P.filter(s=>r.has(s.id))}}}self.onmessage=Mt;\n';function w(){let e=URL.createObjectURL(new Blob([C],{type:`text/javascript`}));return new Worker(e,{type:`module`})}function T(e){return S(w,e)}try{let e=window,t=T();e.LantunReader?.registerVoices?e.LantunReader.registerVoices(t):(e.__lantunVoices??(e.__lantunVoices=[]),e.__lantunVoices.push(t))}catch(e){console.warn(`[Lantun]`,e)}})();
package/dist/widget.js ADDED
@@ -0,0 +1,6 @@
1
+ var LantunReader=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t,n,r){let i=e.createElement(`style`);return n&&(i.nonce=n),r&&(i.id=r),i.textContent=t,i}function n(e,t){for(let n of t.split(`;`)){let t=n.indexOf(`:`);t>0&&e.style.setProperty(n.slice(0,t).trim(),n.slice(t+1).trim(),`important`)}}var r=`lantun:`;function i(){try{return globalThis.localStorage??null}catch{return null}}function a(e){try{let t=i()?.getItem(r+e);return t?JSON.parse(t):null}catch{return null}}function o(e,t){try{i()?.setItem(r+e,JSON.stringify(t))}catch{}}function s(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function c(e){let t=e,n=new Set;function r(e){for(let n in e)if(!Object.is(e[n],t[n]))return!0;return!1}return{get(){return t},set(e){if(r(e)){t={...t,...e};for(let e of n)e(t)}},subscribe(e){return n.add(e),()=>n.delete(e)}}}var l=`lantun-ax`,u=`ax-morph`,d={text:0,line:0,spacing:0,font:`default`,contrast:`default`,desaturate:!1,links:!1,cursor:!1,guide:!1,mask:!1,still:!1,noImages:!1},f=[100,115,130,150],p=[0,1,2,3],m=[`default`,`readable`,`dyslexic`],h=[`default`,`dark`,`light`,`high`,`invert`],g={lowVision:{text:2,contrast:`high`,cursor:!0,links:!0},dyslexia:{font:`dyslexic`,line:1,spacing:1,guide:!0},adhd:{mask:!0,still:!0},seizure:{still:!0,desaturate:!0},elderly:{text:2,font:`readable`,cursor:!0}},_=Object.keys(g),v={desaturate:`ax-desaturate`,links:`ax-links`,cursor:`ax-cursor`,guide:`ax-guide`,mask:`ax-mask`,still:`ax-still`,noImages:`ax-no-images`},y=Object.keys(v),b=[...f.slice(1).map(e=>`ax-text-${e}`),...[1,2,3].map(e=>`ax-line-${e}`),...[1,2,3].map(e=>`ax-spacing-${e}`),`ax-font-readable`,`ax-font-dyslexic`,...h.slice(1).map(e=>`ax-contrast-${e}`),...Object.values(v)],x=Object.keys(d);function S(e){return{...d,...g[e]}}function C(e,t){return x.every(n=>e[n]===t[n])}function w(e){return _.find(t=>C(S(t),e))??null}function T(e){return C(e,d)}function E(e){let t={...d};if(!s(e))return t;p.includes(e.text)&&(t.text=e.text),p.includes(e.line)&&(t.line=e.line),p.includes(e.spacing)&&(t.spacing=e.spacing),m.includes(e.font)&&(t.font=e.font),h.includes(e.contrast)&&(t.contrast=e.contrast);for(let n of y){let r=e[n];typeof r==`boolean`&&(t[n]=r)}return t}function D(e){let t=[];e.text&&t.push(`ax-text-${f[e.text]}`),e.line&&t.push(`ax-line-${e.line}`),e.spacing&&t.push(`ax-spacing-${e.spacing}`),e.font!=="default"&&t.push(`ax-font-${e.font}`),e.contrast!=="default"&&t.push(`ax-contrast-${e.contrast}`);for(let n of y)e[n]&&t.push(v[n]);return t}var O=`p,li,dt,dd,blockquote,figcaption,caption,td,th,label,legend,summary,pre,h1,h2,h3,h4,h5,h6`,ee=`i,svg,svg *,[class*="icon"],[class*="fa-"],[class^="fa "],.material-icons,.material-symbols-outlined,.dashicons,[aria-hidden="true"]`,k=`img,picture,video,canvas,iframe,svg,svg *,object,embed`,A=`lantun-reader,lantun-overlay`,j=`ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif`,M=`https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic@5.3.0/files/opendyslexic-latin`,te=`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M9 5v34l9-8 6 13 7-3-6-13h12z' fill='%23000' stroke='%23fff' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 9 5,auto`;function N(e,t){return`html.ax-text-${e} :is(${O}):not(:is(${O}) *){zoom:${t}}`}function P(e,t){return`html.ax-line-${e} body :is(${O}){line-height:${t}!important}`}function F(e,t){return`html.ax-spacing-${e} body *:not(${ee}){letter-spacing:${t}em!important;word-spacing:${t*2}em!important}`}var I=[`html.ax-morph::view-transition{pointer-events:none}`,`html.ax-morph::view-transition-old(root),html.ax-morph::view-transition-new(root){animation-duration:.22s;animation-timing-function:cubic-bezier(.2,.8,.2,1)}`,`html.ax-morph::view-transition-old(lantun-ui){display:none}`,`html.ax-morph::view-transition-group(lantun-ui),html.ax-morph::view-transition-new(lantun-ui){animation:none}`,N(115,1.15),N(130,1.3),N(150,1.5),P(1,1.75),P(2,2.05),P(3,2.4),F(1,.05),F(2,.1),F(3,.16),`html.ax-font-readable body *:not(${ee}){font-family:${j}!important}`,`@font-face{font-family:"OpenDyslexic";src:url(${M}-400-normal.woff2) format("woff2");font-weight:400;font-display:swap}`,`@font-face{font-family:"OpenDyslexic";src:url(${M}-700-normal.woff2) format("woff2");font-weight:700;font-display:swap}`,`html.ax-font-dyslexic body *:not(${ee}){font-family:"OpenDyslexic",${j}!important}`,`html.ax-contrast-dark{--ax-invert:invert(1) hue-rotate(180deg);background-color:#fff!important}`,`html.ax-contrast-invert{--ax-invert:invert(1);background-color:#fff!important}`,`html.ax-desaturate{--ax-gray:grayscale(1)}`,`html:is(.ax-contrast-dark,.ax-contrast-invert,.ax-desaturate){filter:var(--ax-invert,) var(--ax-gray,)!important}`,`html.ax-contrast-dark :is(img,video,canvas,iframe,svg image,[style*="background-image"]):not(picture *){filter:invert(1) hue-rotate(180deg)!important}`,`html.ax-contrast-dark :is(${A}){filter:invert(1) hue-rotate(180deg)!important}`,`html.ax-contrast-invert :is(${A}){filter:invert(1)!important}`,`html.ax-contrast-light body,html.ax-contrast-light body *:not(${k}){background-color:#fff!important;color:#141414!important;border-color:#c4c4c4!important;text-shadow:none!important}`,`html.ax-contrast-light body a[href],html.ax-contrast-light body a[href] *{color:#0b57d0!important}`,`html.ax-contrast-high body,html.ax-contrast-high body *:not(${k}){background-color:#000!important;background-image:none!important;color:#fff!important;border-color:#fff!important;text-shadow:none!important;box-shadow:none!important}`,`html.ax-contrast-high body a[href],html.ax-contrast-high body a[href] *{color:#ffe14d!important;text-decoration:underline!important}`,`html.ax-links body a[href]{text-decoration:underline!important;text-decoration-thickness:2px!important;text-underline-offset:3px!important;outline:2px solid #e8a200!important;outline-offset:2px!important;background-color:#fff4c2!important;color:#111!important}`,`html.ax-links body a[href] *{color:#111!important}`,`html.ax-cursor,html.ax-cursor *{cursor:${te}!important}`,`html.ax-still *,html.ax-still *::before,html.ax-still *::after{animation-play-state:paused!important;transition:none!important;scroll-behavior:auto!important}`,`html.ax-no-images :is(img,picture,video,canvas,[role="img"]){visibility:hidden!important}`,`html.ax-no-images body *:not(${A}){background-image:none!important}`].join(`
2
+ `);function ne(){return E(a(`ax`))}function re(e,n){let r=e.getElementById(l);if(r instanceof HTMLStyleElement)return r;let i=t(e,I,n,l);return(e.head??e.documentElement).append(i),i}function ie(e,t){let n=new Set(D(t)),r=e.documentElement.classList;for(let e of b)r.toggle(e,n.has(e))}function ae(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function oe(e,t=null){let n=ne();D(n).length&&(re(e,t),ie(e,n))}function se(e,t=null){let n=c(ne()),r=re(e,t),i=e.documentElement,a=new Set,s=0,l=!0,f=n.get();function p(){for(let t of Array.from(e.querySelectorAll(`video`)))t.paused||(t.pause(),a.add(t))}function m(){for(let e of a)e.play().catch(()=>{});a.clear()}function h(e){n.get().still&&e.target instanceof HTMLVideoElement&&(e.target.pause(),a.add(e.target))}function g(t,n){function r(){l&&ie(e,t)}if(n||ae()||e.visibilityState!==`visible`||typeof e.startViewTransition!=`function`){r();return}function a(){--s===0&&i.classList.remove(u)}i.classList.add(u),s++;try{e.startViewTransition(r).finished.then(a,a)}catch{a(),r()}}e.addEventListener(`play`,h,!0),ie(e,f),f.still&&p();let _=n.subscribe(e=>{g(e,e.still||f.still),e.still!==f.still&&(e.still?p():m()),f=e,o(`ax`,e)});return{store:n,update(e){let t={...e};e.guide&&(t.mask=!1),e.mask&&(t.guide=!1),n.set(t)},toggleProfile(e,t){n.set(t?{...d}:S(e))},reset(){n.set({...d})},destroy(){l=!1,_(),e.removeEventListener(`play`,h,!0),m(),i.classList.remove(...b,u),r.remove()}}}function L(...e){console.warn(`[Lantun]`,...e)}function R(e,t){return function(...n){try{return t(...n)}catch(t){L(`${e}() failed`,t);return}}}function ce(){try{return globalThis.localStorage?.getItem(`lantun:debug`)===`1`}catch{return!1}}function z(...e){ce()&&console.info(`[Lantun]`,...e)}function le(){let e=new Map;return{on(t,n){let r=e.get(t);return r||(r=new Set,e.set(t,r)),r.add(n),()=>r.delete(n)},emit(t,n){for(let r of e.get(t)??[])try{r(n)}catch(e){L(`'${t}' listener threw:`,e)}},clear(){e.clear()}}}var ue=[245,184,65],de=2147483e3,fe=[`right`,`left`,`bottom-right`,`bottom-left`];function pe(e){return e&&fe.includes(e)&&e.endsWith(`left`)?`left`:`right`}function me(e){return e===void 0?void 0:e!==`false`&&e!==`0`}function he(e={},t=document){return{contentSelector:e.contentSelector?.trim()||null,excludeSelectors:Array.isArray(e.excludeSelectors)?e.excludeSelectors:[],position:pe(e.position),color:e.color?.trim()||`#f5b841`,lang:e.lang?.trim()||t.documentElement.lang.trim()||`en`,features:{tts:e.features?.tts??!0,a11y:e.features?.a11y??!0},zIndex:Number.isFinite(e.zIndex)?e.zIndex:de,nonce:e.nonce?.trim()||null}}function ge(e){let t={},n=me(e.tts),r=me(e.a11y),i=Number(e.zIndex);return e.contentSelector&&(t.contentSelector=e.contentSelector),e.excludeSelectors&&(t.excludeSelectors=e.excludeSelectors.split(`,`).map(e=>e.trim()).filter(Boolean)),e.position&&(t.position=e.position),e.color&&(t.color=e.color),e.lang&&(t.lang=e.lang),(n!==void 0||r!==void 0)&&(t.features={tts:n,a11y:r}),e.zIndex&&Number.isFinite(i)&&(t.zIndex=i),t}var _e=.15,ve=.85,ye=.3,be=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]),xe=/^(INPUT|TEXTAREA|SELECT)$/,B={passive:!0,capture:!0};function Se(e){let t=e.target;return be.has(e.key)&&!t?.isContentEditable&&!xe.test(t?.tagName??``)&&!t?.shadowRoot}function Ce(e,t={}){let n=t.pauseMs??5e3,r=e.document,i=0;function a(){i=Date.now()+n}function o(e){Se(e)&&a()}function s(e){e.target===r.documentElement&&a()}function c(){return e.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}return e.addEventListener(`wheel`,a,B),e.addEventListener(`touchmove`,a,B),e.addEventListener(`keydown`,o,B),e.addEventListener(`pointerdown`,s,B),{follow(t){if(Date.now()<i||r.hidden||typeof t.getBoundingClientRect!=`function`)return;let n=t.getBoundingClientRect();if(!n.height)return;let a=e.innerHeight,o=a*_e,s=a*ve,l=n.height>s-o;(n.top<o||n.top>s||!l&&n.bottom>s)&&e.scrollBy({top:n.top-a*ye,behavior:c()?`auto`:`smooth`})},destroy(){e.removeEventListener(`wheel`,a,B),e.removeEventListener(`touchmove`,a,B),e.removeEventListener(`keydown`,o,B),e.removeEventListener(`pointerdown`,s,B)}}}var we=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Te=/^rgba?\(\s*(\d+(?:\.\d+)?)[\s,]+(\d+(?:\.\d+)?)[\s,]+(\d+(?:\.\d+)?)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i,Ee=[255,255,255],De=[0,0,0];function Oe(e){let t=e.length<=4?Array.from(e,e=>e+e).join(``):e;return t.length===8&&t.slice(6)===`00`?null:[0,2,4].map(e=>parseInt(t.slice(e,e+2),16))}function ke(e){let t=e.trim(),n=we.exec(t)?.[1];if(n)return Oe(n);let r=Te.exec(t);if(!r)return null;let i=r[4];return i!==void 0&&parseFloat(i)===0?null:[r[1],r[2],r[3]].map(e=>Math.min(255,Math.round(Number(e))))}function Ae(e,t){let n=ke(e);if(n||!t.body)return n;let r=t.createElement(`span`);if(r.style.color=e,!r.style.color)return null;t.body.append(r);try{return ke(getComputedStyle(r).color)}finally{r.remove()}}function je(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function Me([e,t,n]){return .2126*je(e)+.7152*je(t)+.0722*je(n)}function Ne(e,t){let n=Me(e),r=Me(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Pe(e){let t=Ne(e,Ee);return t>=4.5||t>=Ne(e,De)?Ee:De}function Fe(e){for(let t=e;t;t=t.parentElement){let e=ke(getComputedStyle(t).backgroundColor);if(e)return e}return Ee}function Ie(e){return Me(e)<.18}function V([e,t,n],r=1){return r===1?`rgb(${e} ${t} ${n})`:`rgb(${e} ${t} ${n} / ${r})`}function Le([e,t,n]){return[255-e,255-t,255-n]}function Re(e){return Math.min(255,Math.max(0,Math.round(e)))}function ze([e,t,n]){return[Re(-.574*e+1.43*t+.144*n),Re(.426*e+.43*t+.144*n),Re(.426*e+1.43*t-.856*n)]}function Be(e){return ze(Le(e))}var Ve=new Set(`address article aside blockquote dd details div dl dt fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr li main nav ol p pre section summary table tbody td tfoot th thead tr ul`.split(` `));function He(e,t){for(let n=e.parentElement;n&&n!==t;n=n.parentElement)if(Ve.has(n.localName))return n;return t}function Ue(e){return e===32||e===10||e===9||e===13||e===12}function We(){return!1}function Ge(e,t=We){let n=``,r=[],i=[],a=[],o=[],s=`none`,c=null,l=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode(e){return e.nodeType!==Node.ELEMENT_NODE||!t(e)?NodeFilter.FILTER_ACCEPT:(s===`none`&&(s=`space`),NodeFilter.FILTER_REJECT)}});for(let t=l.nextNode();t;t=l.nextNode()){if(t.nodeType!==Node.TEXT_NODE){t.localName===`br`&&(s=`break`);continue}let l=t.data,u=-1;for(let d=0;d<l.length;d++)if(Ue(l.charCodeAt(d)))s===`none`&&(s=`space`);else{if(u<0){let n=He(t,e);n!==c&&(c&&(s=`break`),c=n),u=r.push(t)-1}a.length&&s!==`none`&&(n+=s===`break`?`
3
+ `:` `,a.push(-1),o.push(-1)),s=`none`,i.length===u&&i.push(a.length),n+=l[d],a.push(u),o.push(d)}}return{text:n,nodes:r,nodeIndex:Int32Array.from(a),nodeOffset:Int32Array.from(o),nodeStart:i}}function Ke(e,t,n){let{nodeIndex:r,nodeOffset:i,nodes:a}=e,o=Math.max(t,0),s=Math.min(n,r.length)-1;for(;o<=s&&r[o]<0;)o++;for(;s>=o&&r[s]<0;)s--;if(o>s)return null;let c=a[r[o]],l=a[r[s]];try{let e=c.ownerDocument.createRange();return e.setStart(c,i[o]),e.setEnd(l,i[s]+1),e}catch{return null}}var qe=new WeakMap;function Je(e,t){let n=qe.get(e);return n||(n=new Map(e.nodes.map((e,t)=>[e,t])),qe.set(e,n)),n.get(t)??-1}function Ye(e,t,n){let{nodes:r,nodeStart:i,nodeIndex:a,nodeOffset:o,text:s}=e,c=t.nodeType===Node.TEXT_NODE?Je(e,t):-1;if(c>=0){let e=i[c+1]??s.length;for(let t=i[c];t<e;t++)if(a[t]===c&&o[t]>=n)return t;return e}try{let e=(t.ownerDocument??t).createRange(),a=0,o=r.length;for(e.setStart(t,n);a<o;){let t=a+o>>1;e.comparePoint(r[t],0)<0?a=t+1:o=t}return a<r.length?i[a]:s.length}catch{return-1}}var Xe=`lantun-sentence`,Ze=`lantun-word`,Qe=`lantun-highlight`,$e=.18,et=.28,tt=.35,nt=.45;function rt(e=window){let t=e;return!!t.CSS?.highlights&&typeof t.Highlight==`function`}function it(e,t){return Ie(e)?tt:Me(t)>.4?et:$e}function at(e){return e}function ot({color:e,background:t}){let n=it(t,e),r=Pe(e),i=`::highlight(${Xe})`,a=`::highlight(${Ze})`;function o(t,n,o){return`${t}${i}{background-color:${V(n(e),o)}}${t}${a}{background-color:${V(n(e))};color:${V(n(r))}}`}return[o(``,at,n),o(`html.ax-contrast-dark `,Be,tt),o(`html.ax-contrast-invert `,Le,tt),`@media (forced-colors:active){${i}{background-color:transparent;text-decoration:underline}${a}{background-color:Highlight;color:HighlightText}}`,`@media print{${i}{background-color:transparent}${a}{background-color:transparent;color:inherit}}`].join(`
4
+ `)}function st(e,n,r){let i=n,a=i.CSS?.highlights,o=i.Highlight,s=new o,c=new o,l=t(e,ot(r),r.nonce,Qe);c.priority=1,a.set(Xe,s),a.set(Ze,c),e.head.append(l);function u(e,t){e.clear(),t&&e.add(t)}return{sentence(e){u(s,e)},word(e){u(c,e)},destroy(){a.delete(Xe),a.delete(Ze),l.remove()}}}function ct(e,r,i){let a=e.createElement(`lantun-overlay`),o=a.attachShadow({mode:`open`}),s={s:null,w:null};n(a,`all:initial;position:absolute;top:0;left:0;width:0;height:0;overflow:visible;pointer-events:none;z-index:${i.zIndex-1}`),a.setAttribute(`aria-hidden`,`true`),o.append(t(e,`div{position:absolute;pointer-events:none;mix-blend-mode:multiply;border-radius:2px}@media print{div{display:none}}.s{background:${V(i.color,it(i.background,i.color))}}.w{background:${V(i.color,nt)}}`,i.nonce)),e.documentElement.append(a);function c(){for(let e of Array.from(o.querySelectorAll(`div`)))e.remove();let t=e.createDocumentFragment();for(let n of[`s`,`w`]){let i=s[n];if(i&&typeof i.getClientRects==`function`)for(let a of Array.from(i.getClientRects())){if(!a.width||!a.height)continue;let i=e.createElement(`div`);i.className=n,i.style.cssText=`left:${a.left+r.scrollX}px;top:${a.top+r.scrollY}px;width:${a.width}px;height:${a.height}px`,t.append(i)}}o.append(t)}return r.addEventListener(`resize`,c),{sentence(e){s.s=e,c()},word(e){s.w=e,c()},destroy(){r.removeEventListener(`resize`,c),a.remove()}}}function lt(e,t,n){return rt(t)?st(e,t,n):ct(e,t,n)}function ut(e){let t=lt(e.doc,e.win,{color:Ae(e.color,e.doc)??ue,background:Fe(e.root),zIndex:e.zIndex,nonce:e.nonce}),n=Ce(e.win);return{sentence(r,i){let a=Ke(e.map,r,i);t.word(null),t.sentence(a),a&&n.follow(a)},word(r,i){let a=Ke(e.map,r,i);t.word(a),a&&n.follow(a)},clear(){t.sentence(null),t.word(null)},destroy(){t.destroy(),n.destroy()}}}var dt=.5,ft=.25,pt=4e3;function mt(e){if(!Number.isFinite(e))return 1;let t=Math.round(e/ft)*ft;return Math.min(3,Math.max(dt,t))}function ht(e,t){return e.words.find(e=>e.end>t)}function gt(e){let{driver:t,text:n,sentences:r,lang:i,emit:a}=e,o=`idle`,s=0,c=-1,l=null,u=mt(e.rate??1),d=e.voice??null,f=0,p=!1,m,h;function g(e){return Math.min(Math.max(e,0),Math.max(r.length-1,0))}function _(e){o!==e&&(o=e,a(`state`,e))}function v(){clearTimeout(m),m=void 0}function y(e){v(),m=setTimeout(ee,e/(14*u)*2e3+pt)}function b(){t.cancel(),clearTimeout(h),h=void 0,v()}function x(e){let t=r[e-1],i=r[e];return t&&i&&n.slice(t.end,i.start).includes(`
5
+ `)?350/u:0}function S(){let e=r[s];e&&a(`sentence`,{index:s,start:e.start,end:e.end,text:n.slice(e.start,e.end)})}function C(e){s=e,c=-1,l=null,f=0}function w(){v(),s=r.length,_(`ended`),a(`end`,void 0)}function T(){if(!t.prepare)return;let e=Math.min(s+2,r.length-1);for(let a=s+1;a<=e;a++){let e=r[a];e&&t.prepare({text:n.slice(e.start,e.end),lang:i,rate:u,voice:d})}}function E(){let e=r[s];if(!e){w();return}let o=Math.max(c,e.start);o===e.start&&S(),t.speak({text:n.slice(o,e.end),lang:i,rate:u,voice:d},{onStart(){y(e.end-o)},onWord(t,r=!1){let i=ht(e,o+t);y(e.end-(i?.start??o)),i&&i!==l&&(l=i,a(`word`,{sentence:s,start:i.start,end:i.end,text:n.slice(i.start,i.end),estimated:r}))},onEnd(){v();let e=x(s+1);C(s+1),e?h=setTimeout(()=>{h=void 0,E()},e):E()},onError:k}),t.slowStart||y(e.end-o),T()}function D(){b(),p=!1,c=l?.start??-1,o===`playing`&&E()}function O(e){f++<2?D():(a(`error`,e),C(s+1),E())}function ee(){t.cancel(),O({code:`stalled`,message:`Speech stopped responding; skipped a sentence.`})}function k(e){v(),c=l?.start??-1,e.code===`interrupted`||e.code===`canceled`?_(`paused`):e.code===`not-allowed`?(a(`error`,e),_(`idle`)):O(e)}function A(e){r.length&&(b(),p=!1,C(g(e)),o===`playing`?E():(S(),o===`ended`&&_(`paused`)))}function j(){p=!1,t.resume(),_(`playing`);let e=r[s];e&&y(e.end-(l?.start??e.start))}let M={play(e){if(e!==void 0)b(),p=!1,C(g(e));else if(o===`playing`)return;else if(p){j();return}else s>=r.length&&C(0);_(`playing`),E()},pause(){o===`playing`&&(t.reliablePause&&!h?(v(),t.pause(),p=!0):(b(),c=l?.start??-1),_(`paused`))},toggle(){o===`playing`?M.pause():M.play()},next(){s+1<r.length?A(s+1):(b(),w())},prev(){let e=r[s];A(e&&l&&l.start-e.start>30?s:s-1)},seek:A,setRate(e){let n=mt(e);n!==u&&(u=n,t.liveRate?t.setRate?.(n):(o===`playing`||p)&&D())},setVoice(e){e?.id!==d?.id&&(d=e,(o===`playing`||p)&&D())},getState(){return{status:o,index:s,rate:u,voice:d}},destroy(){b(),o=`idle`}};return M}var _t=RegExp(`(?:^|[\\s(“"'‘])(?:Mr|Mrs|Ms|Mx|Dr|dr|drg|Prof|Ir|Hj|KH|Bpk|Sdr|Sdri|Yth|yth|Gen|Gov|Sen|Rep|Lt|Col|Capt|Sgt|Rev|Hon|St|Mt|Ft|Jl|Jln|Kec|Kab|Kel|Prov|Jan|Feb|Mar|Apr|Jun|Jul|Aug|Agu|Agt|Sep|Sept|Oct|Okt|Nov|Dec|Des|No|Nos|Vol|vs|Fig|Tbk|translit|lit|e\\.g|i\\.e|a\\.n|s\\.d|\\p{Lu})\\.$`,`u`),vt=/(?:[^.!?…\n]|[.!?…](?=[\p{L}\p{N}]))+(?:[.!?…]+["'”’)\]]*)?/gu,yt=/[\p{L}\p{N}](?:[\p{L}\p{N}\p{M}]|['’.-](?=[\p{L}\p{N}]))*/gu,bt=/[,;:–—]/,xt=typeof Intl<`u`&&typeof Intl.Segmenter==`function`;function St(e){try{return Intl.getCanonicalLocales(e)[0]??`en`}catch{return`en`}}function Ct(e,t,n=0){return Array.from(t.matchAll(e),e=>[n+(e.index??0),n+(e.index??0)+e[0].length])}function wt(e,[t,n]){for(;t<n&&/\s/.test(e[t]);)t++;for(;n>t&&/\s/.test(e[n-1]);)n--;return[t,n]}function Tt(e,t){let n=[];for(let r of t){let t=n[n.length-1];t&&_t.test(e.slice(t[0],t[1]))&&!e.slice(t[1],r[0]).includes(`
6
+ `)?t[1]=r[1]:n.push(r)}return n}function Et(e,[t,n],r,i){if(n-t<=i||r.length<2)return[{start:t,end:n,words:r}];let a=t+(n-t)/Math.ceil((n-t)/i),o=0,s=1/0;for(let n=0;n<r.length-1;n++){let c=r[n];if(c.end-t>i)break;let l=bt.test(e.slice(c.end,r[n+1].start)),u=Math.abs(c.end-a)-(l?i*.25:0);u<s&&(s=u,o=n)}let c=r[o],l=r[o+1];return[{start:t,end:c.end+e.slice(c.end,l.start).trimEnd().length,words:r.slice(0,o+1)},...Et(e,[l.start,n],r.slice(o+1),i)]}function Dt(e,t,n={}){let{maxLength:r=200,native:i=xt}=n,a=St(t),o=i?new Intl.Segmenter(a,{granularity:`sentence`}):null,s=i?new Intl.Segmenter(a,{granularity:`word`}):null,c=Tt(e,(o?Array.from(o.segment(e),e=>[e.index,e.index+e.segment.length]):Ct(vt,e)).map(t=>wt(e,t)).filter(([e,t])=>t>e));function l([t,n]){let r=e.slice(t,n);if(!s)return Ct(yt,r,t).map(([e,t])=>({start:e,end:t}));let i=[];for(let e of s.segment(r))e.isWordLike&&i.push({start:t+e.index,end:t+e.index+e.segment.length});return i}return c.flatMap(t=>{let n=l(t);return n.length?Et(e,t,n,r):[]})}function Ot(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i].end<=t?n=i+1:r=i}return Math.min(n,e.length-1)}function kt(){return[]}function At(e){let t=new Map,n=e;function r(n){return(n?.engine?t.get(n.engine):void 0)??e}return{id:`mixed`,get reliablePause(){return n?.reliablePause??!1},get slowStart(){return n?.slowStart??!1},get liveRate(){return n?.liveRate??!1},setRate(e){n?.setRate?.(e)},async getVoices(){return(await Promise.all([e?e.getVoices().catch(kt):[],...Array.from(t.values(),e=>e.getVoices().catch(kt))])).flat()},speak(e,t){let i=r(e.voice);n&&n!==i&&n.cancel(),n=i,i?i.speak(e,t):t.onError({code:`unsupported`,message:`No speech engine for this voice.`})},prepare(e){r(e.voice)?.prepare?.(e)},pause(){n?.pause()},resume(){n?.resume()},cancel(){e?.cancel();for(let e of t.values())e.cancel()},add(e){t.set(e.id,e)}}}var jt=1500,Mt=.4;function Nt(e){return Array.from(e.matchAll(/\S+/g),e=>e.index??0)}function Pt(e,t={}){let n=t.detectMs??500,r=new Map,i=new Map,a=[],o=null,s=null;function c(){a.forEach(clearTimeout),a=[]}function l(e,t,n,r){let a=t/(n/1e3)/r,o=i.get(e);i.set(e,o===void 0?a:o+(a-o)*Mt)}return{id:e.id,get reliablePause(){return e.reliablePause},get slowStart(){return e.slowStart},getVoices(){return e.getVoices()},prepare(t){e.prepare?.(t)},speak(u,d){c(),o=s=null;let f=u.voice?.id??`default:${u.lang}`,p=Nt(u.text),m=0,h=0,g=!1,_=!1;function v(e){g=!0;let t=(i.get(f)??14)*u.rate/1e3,n=-1;for(let r of p){let i=r/t-e;i>0?a.push(setTimeout(()=>d.onWord(r,!0),i)):n=r}n>=0&&d.onWord(n,!0)}function y(){_||(r.set(f,!1),t.onFallback?.(u.voice,u.lang),v(Date.now()-m))}o=()=>{h=Date.now()-m,c()},s=()=>{m=Date.now()-h,g&&v(h)},e.speak(u,{onStart(){m=Date.now(),d.onStart?.();let e=r.get(f);e===!1?v(0):e===void 0&&a.push(setTimeout(y,n))},onWord(e){g||(_=!0,r.set(f,!0),d.onWord(e))},onEnd(){c();let e=Date.now()-m;g&&m&&e>500&&u.text.length>20&&l(f,u.text.length,e,u.rate),d.onEnd()},onError(e){c(),d.onError(e)}})},pause(){o?.(),e.pause()},resume(){s?.(),e.resume()},cancel(){c(),o=s=null,e.cancel()}}}var Ft=new Map([[`in`,`id`],[`iw`,`he`],[`ji`,`yi`]]),It=/^(Albert|Bad News|Bahh|Bells|Boing|Bubbles|Cellos|Good News|Jester|Organ|Pipe Organ|Superstar|Trinoids|Whisper|Wobble|Zarvox|Deranged|Hysterical)\b/,Lt=/^(Eddy|Flo|Grandma|Grandpa|Reed|Rocko|Sandy|Shelley|Fred|Junior|Ralph|Kathy|Princess)\b/,Rt=/\b(Natural|Neural|Premium|Enhanced)\b/i,zt=/^Microsoft\s(?!.*\bOnline\b)/,Bt=/^Google\s/;function Vt(e){let[t=``,...n]=e.toLowerCase().replace(/_/g,`-`).split(`-`);return[Ft.get(t)??t,...n].join(`-`)}function Ht(e){return Vt(e).split(`-`)[0]??``}function Ut(e){return e.engine?6:Rt.test(e.name)?5:Bt.test(e.name)?4:Lt.test(e.name)?0:zt.test(e.name)?1:e.local?3:2}function Wt(e,t){return Ut(e)*10+(Vt(e.lang)===t?12:0)+ +!!e.local+ +!!e.isDefault}function Gt(e,t){let n=Ht(t);return e.filter(e=>Ht(e.lang)===n)}function Kt(e,t){let n=Vt(t),r=new Map;for(let i of Gt(e,t))It.test(i.name)||r.set(i,Wt(i,n));return Array.from(r.keys()).sort((e,t)=>r.get(t)-r.get(e)||e.name.localeCompare(t.name))}function qt(e,t,n){let r=Kt(e,t);return(n?r.find(e=>e.id===n):void 0)??r.find(e=>!e.engine)??r[0]??null}var Jt=new Map;function Yt(e){if(!Jt.has(e)){let t=null;try{t=new Intl.DisplayNames([e],{type:`region`})}catch{}Jt.set(e,t)}return Jt.get(e)??null}function Xt(e,t){try{return Yt(t)?.of(e)??e}catch{return e}}function Zt(e){return e.replace(/^Microsoft\s+/,``).replace(/\s+Online\b/,``).replace(/\s*\((Natural|Neural|Premium|Enhanced)\)/i,``).replace(/\s+-\s+.*$/,``).replace(/\s*\([^)]*\([^)]*\)\)$/,``).trim()||e}function Qt(e){return e.engine?`hd`:Rt.test(e.name)?`natural`:e.local?`device`:`online`}function $t(e,t){let n=Vt(e.lang).split(`-`)[1]?.toUpperCase();return{name:e.engine?e.name:Zt(e.name),region:n?Xt(n,t):``,kind:Qt(e)}}function en(e,t,n){if(!e.length||e.some(e=>e.engine||Rt.test(e.name)))return null;let r=/Macintosh|iPhone|iPad/.test(t);return/iPhone|iPad/.test(t)||r&&n>1?`ios`:/Edg\/|Android/.test(t)?null:r&&!/Chrome\/|Firefox\//.test(t)?`mac`:`edge`}var tn={unsupported:{code:`unsupported`,message:`This browser cannot read text aloud.`},"no-content":{code:`no-content`,message:`No readable article text found.`}},nn=`positions`,rn=`settings`,an=/^(utm_|fbclid$|gclid$|mc_|ref$|_ga$)/,on=/article|body|content|entry|main|post|story|text|detail|isi|berita|artikel/i,sn=/comment|sidebar|widget|footer|masthead|menu|nav|related|popular|share|social|sponsor|promo|banner|breadcrumb|cookie|subscribe|newsletter|tags?\b|meta|author|byline|caption|gpt-ad|(?:^|[\s_-])(?:ads?|advert\w*)(?:$|[\s_-])/i,cn=[1,2,6],ln={div:5,article:5,pre:3,td:3,blockquote:3,ol:-3,ul:-3,dl:-3,li:-3,form:-3,h1:-5,h2:-5,h3:-5,h4:-5,h5:-5,h6:-5,th:-5},un=`[data-reader-skip],nav,aside,footer,[role="navigation"],[role="complementary"],[role="note"],figure,figcaption,[class*="caption"],[class*="credit"],.sr-only,.screen-reader-text,.visually-hidden,.visuallyhidden,script,style,noscript,template,iframe,object,embed,svg,math,canvas,video,audio,button,select,textarea,input,form,pre,[hidden],[aria-hidden="true"],.ad,.ads,.advert,.advertisement,.ad-slot,.adsbygoogle,[id^="div-gpt-ad"],[data-ad-unit],[data-ad-slot]`,dn=/^\s*(baca juga|lihat juga|simak juga|read more|read also|see also|related)\s*:/i,fn=`sup:has(> a[href^="#"])`,pn=new Set([`left`,`right`,`inline-start`,`inline-end`]);function mn(e){return(e.textContent??``).length}function hn(e){let t=`${e.getAttribute(`class`)??``} ${e.id}`;return(on.test(t)?25:0)-(sn.test(t)?25:0)}function gn(e){return(ln[e.localName]??0)+hn(e)}function _n(e){let t=mn(e);if(!t)return 1;let n=0;for(let t of Array.from(e.getElementsByTagName(`a`)))n+=mn(t);return Math.min(n/t,1)}function vn(e){let t=0;for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE&&(t+=(n.nodeValue??``).trim().length);return t}function yn(e){let t=Array.from(e.getElementsByTagName(`p`));for(let n of Array.from(e.getElementsByTagName(`div`)))vn(n)>=80&&t.push(n);return t}function bn(e){return 1+(e.match(/[,،,]/g)?.length??0)+Math.min(Math.floor(e.length/100),3)}function xn(e){return(e.localName===`p`||e.localName===`li`)&&dn.test((e.textContent??``).slice(0,40))}function Sn(){try{return CSS.supports(`selector(:has(*))`)}catch{return!1}}function Cn(e){return e.localName===`table`&&pn.has(getComputedStyle(e).cssFloat)}function wn(e){return typeof e.checkVisibility!=`function`||e.checkVisibility()?!1:getComputedStyle(e).display!==`contents`}function Tn(e,t){try{return e.createDocumentFragment().querySelector(t),!0}catch{return L(`Ignoring invalid excludeSelectors entry: ${t}`),!1}}function En(e=[],t=document){let n=e.map(e=>e.trim()).filter(e=>e&&Tn(t,e)),r=[un,...Sn()?[fn]:[],...n].join(`,`);return function(e){return e.matches(r)||xn(e)||Cn(e)||wn(e)}}function Dn(e,t,n){for(let r=e;r&&r!==n;r=r.parentElement)if(t(r))return!0;return!1}function On(e,t){let n=e.body;if(!n)return null;let r=n.querySelector(`[itemprop="articleBody"]`);if(r&&(r.textContent??``).trim().length>=200)return r;let i=new Map;for(let r of yn(n)){let a=(r.textContent??``).trim();if(a.length<25||Dn(r,t,n))continue;let o=bn(a),s=r.localName===`p`?r.parentElement:r;for(let t of cn){if(!s||s===e.documentElement)break;i.set(s,(i.get(s)??gn(s))+o/t),s=s.parentElement}}let a=null,o=0;for(let[e,t]of i){if(t<=o)continue;let n=t*(1-_n(e));n>o&&(a=e,o=n)}return a??e.querySelector(`article`)??e.querySelector(`main,[role="main"]`)??n}function kn(e,t,n){if(t)try{let n=e.querySelector(t);if(n)return n;L(`contentSelector "${t}" matched nothing; falling back to auto-detect.`)}catch{L(`contentSelector "${t}" is not a valid selector; falling back to auto-detect.`)}return On(e,n)}function An(e=window){return`speechSynthesis`in e&&typeof e.SpeechSynthesisUtterance==`function`}function jn(e){return e.voiceURI||e.name}function Mn(e){return{id:jn(e),name:e.name,lang:e.lang,local:e.localService,isDefault:e.default}}function Nn(e,t=jt){return new Promise(n=>{let r=e.getVoices();if(r.length){n(r.map(Mn));return}function i(){clearTimeout(a),e.removeEventListener(`voiceschanged`,i),n(e.getVoices().map(Mn))}let a=setTimeout(i,t);e.addEventListener(`voiceschanged`,i)})}function Pn(e=window){let t=e.speechSynthesis,n=e.SpeechSynthesisUtterance??SpeechSynthesisUtterance,r=null,i;function a(){clearTimeout(i),i=void 0;let e=r!==null||t.speaking||t.pending;return r=null,e&&t.cancel(),e}function o(e,i){let a=new n(e.text),o=e.voice?t.getVoices().find(t=>jn(t)===e.voice?.id):void 0;a.lang=e.voice?.lang??e.lang,a.rate=e.rate,o&&(a.voice=o);function s(){return r===a}a.onstart=()=>{s()&&i.onStart?.()},a.onboundary=e=>{s()&&e.name!==`sentence`&&i.onWord(e.charIndex)},a.onend=()=>{s()&&(r=null,i.onEnd())},a.onerror=e=>{s()&&(r=null,i.onError({code:e.error,message:`Speech failed: ${e.error}`}))},r=a,t.paused&&t.resume(),t.speak(a)}return{id:`webspeech`,reliablePause:!1,getVoices(){return Nn(t)},speak(e,t){a()?i=setTimeout(()=>o(e,t),50):o(e,t)},pause(){t.pause()},resume(){t.resume()},cancel(){a()}}}function Fn(e,t){let n=En(t.excludeSelectors,e),r=kn(e,t.contentSelector,n);if(!r)return null;let i=Ge(r,n);return{root:r,map:i,sentences:Dt(i.text,t.lang)}}function In(e){return An(e)?Pn(e):null}function Ln(e,t,n){let r=e.caretPositionFromPoint?.(t,n);if(r)return{node:r.offsetNode,offset:r.offset};let i=e.caretRangeFromPoint?.(t,n);return i?{node:i.startContainer,offset:i.startOffset}:null}function Rn(e,t){let n=0,r=e.length-1;for(;n<r;){let i=n+r+1>>1;e[i]<=t?n=i:r=i-1}return n}function zn(){let e=a(rn),t={rate:1,voices:{}};if(!s(e))return t;if(typeof e.rate==`number`&&(t.rate=mt(e.rate)),s(e.voices))for(let[n,r]of Object.entries(e.voices))typeof r==`string`&&(t.voices[n]=r);return t}function Bn(e){o(rn,e)}function Vn(e){let t=new URLSearchParams(e.search);for(let e of Array.from(t.keys()))an.test(e)&&t.delete(e);let n=t.toString();return`${e.origin}${e.pathname}${n?`?${n}`:``}`}function Hn(e){return e.replace(/\s+/g,` `).trim().slice(0,48).toLowerCase()}function Un(e){return s(e)&&typeof e.index==`number`&&typeof e.sentenceCount==`number`&&typeof e.fingerprint==`string`&&typeof e.timestamp==`number`}function Wn(){let e=a(nn),t={};if(!s(e))return t;for(let[n,r]of Object.entries(e))Un(r)&&(t[n]=r);return t}function Gn(e,t,n,r){let i=Wn();i[e]={index:t,sentenceCount:n,fingerprint:Hn(r),timestamp:Date.now()};let a=Object.entries(i).sort((e,t)=>t[1].timestamp-e[1].timestamp).slice(0,40);o(nn,Object.fromEntries(a))}function Kn(e){let t=Wn();e in t&&(delete t[e],o(nn,t))}function qn(e,t,n){let r=Wn()[e];if(!r)return null;if(r.index<n&&Hn(t(r.index))===r.fingerprint)return r.index;for(let e=0;e<n;e++)if(Hn(t(e))===r.fingerprint)return e;return null}function Jn(e,t,n={}){let r=n.doc??document,i=n.win??window,a=n.driver===void 0?In(i):n.driver,o=At(a&&Pt(a,{onFallback(e,t){z(`Voice "${e?.name??`default for ${t}`}" fires no word boundaries; estimating word timing.`)}})),s=new Map,l=[],u=Ht(e.lang)||`en`,d=zn(),f=Vn(i.location),p=null,m=[],h=0,g=null,_=null,v=!1,y=``;function b(){return a!==null||s.size>0}let x=c({status:`idle`,index:0,total:0,progress:0,duration:0,remaining:0,remainingAfter:0,rate:d.rate,voices:[],voice:null,voicesLoaded:!b(),resume:null,issue:b()?null:`unsupported`,engine:null,fallback:null});function S(e){let t=p?.sentences[e];return t&&p?p.map.text.slice(t.start,t.end):``}function C(e,t){let n=m[e]??h,r=m[e+1]??h,i=15*t;return{progress:h?n/h:0,duration:h/i,remaining:(h-n)/i,remainingAfter:(h-r)/i}}function w(e){return b()?e?null:`no-content`:`unsupported`}function T(){g?.destroy(),g=null,_?.destroy(),_=null}function E(){if(p?.root.isConnected&&p.map.nodes[0]?.isConnected!==!1)return p;T(),f=Vn(i.location),p=Fn(r,e);let t=p?.sentences??[];h=0,m=t.map(e=>{let t=h;return h+=e.end-e.start,t});let n=qn(f,S,t.length),a=n!==null&&n>0&&n<t.length-1;return x.set({total:t.length,index:0,...C(0,x.get().rate),resume:a?{index:n,progress:C(n,1).progress}:null,issue:w(t.length)}),p}let D=function(e,n){if(!v){switch(e){case`state`:{let e=n;x.set(e===`playing`?{status:e,issue:null,resume:null}:{status:e});return}case`sentence`:{let e=n;_?.sentence(e.start,e.end),x.set({index:e.index,...C(e.index,x.get().rate)}),Gn(f,e.index,x.get().total,e.text);break}case`word`:{let e=n;_?.word(e.start,e.end);break}case`end`:_?.clear(),Kn(f),x.set({index:0,...C(0,x.get().rate)});break;case`error`:n.code===`not-allowed`&&x.set({issue:`not-allowed`})}t(e,n)}};function O(){let t=E();return!b()||!t?.sentences.length?null:g||(_=ut({doc:r,win:i,map:t.map,root:t.root,color:e.color,zIndex:e.zIndex,nonce:e.nonce}),g=gt({driver:o,text:t.map.text,sentences:t.sentences,lang:e.lang,rate:x.get().rate,voice:x.get().voice,emit:D}),g)}function ee(e){return e?.engine?s.get(e.engine)?.status()??null:null}function k(){let{voice:t,status:n,resume:r,index:i,rate:a}=x.get();if(!t?.engine||n===`playing`)return;let s=E(),c=s?.sentences[r?.index??i];s&&c&&o.prepare?.({text:s.map.text.slice(c.start,c.end),lang:e.lang,rate:a,voice:t})}function A(e){x.set({voice:e,engine:ee(e)}),g?.setVoice(e),k()}function j(){o.getVoices().then(t=>{if(v)return;let n=Kt(t,e.lang),r=x.get().voice,i=(r&&n.find(e=>e.id===r.id))??qt(n,e.lang,d.voices[u]);x.set({voices:n,voicesLoaded:!0}),r&&i?.id===r.id||A(i)},()=>x.set({voicesLoaded:!0}))}function M(t,n){if(v||x.get().voice?.engine!==t.id)return;if(n.state!==`error`){x.set({engine:n});return}let r=qt(x.get().voices.filter(e=>!e.engine),e.lang);delete d.voices[u],Bn(d),x.set({fallback:{reason:n.error??`failed`,voice:r}}),A(r)}function te(){g?.pause()}function N(){let e=p??E(),t=r.getSelection();if(!e||!t||t.isCollapsed||!t.rangeCount)return null;let n=t.getRangeAt(0);if(!e.root.contains(n.startContainer))return null;let i=Ye(e.map,n.startContainer,n.startOffset);return i<0?null:Ot(e.sentences,i)}function P(){let e=N();if(e===null)return;let t=`${e}:${r.getSelection()?.toString()??``}`;if(t!==y)return y=t,e}function F(){function e(){v||E()}let t=i.requestIdleCallback;t?t.call(i,e,{timeout:2e3}):setTimeout(e,200)}let I={store:x,play(e){if(v)return;let n=O();if(!n){let e=b()?`no-content`:`unsupported`;x.set({issue:e}),t(`error`,tn[e]);return}let r=e??(x.get().status===`playing`?void 0:P());n.play(r)},pause(){g?.pause()},toggle(){x.get().status===`playing`?I.pause():I.play()},next(){O()?.next()},prev(){O()?.prev()},seek(e){O()?.seek(e)},seekTo(e){if(!E())return;let t=Math.min(Math.max(e,0),1)*h;I.seek(Rn(m,t))},setRate(e){let t=mt(e);g?.setRate(t),d.rate=t,Bn(d),x.set({rate:t,...C(x.get().index,t)})},setVoice(e){let t=x.get().voices.find(t=>t.id===e);t&&(d.voices[u]=e,Bn(d),x.set({fallback:null}),A(t))},addEngine(e){if(v||s.has(e.id))return;let t=b();s.set(e.id,e),o.add(e),l.push(e.subscribe(t=>M(e,t))),t||(x.set({issue:null}),F()),j()},sentenceAtPoint(e,t){let n=E(),i=n&&Ln(r,e,t);if(!n||!i||!n.root.contains(i.node))return null;let a=Ye(n.map,i.node,i.offset);if(a<0||a>=n.map.text.length)return null;let o=Ot(n.sentences,a),s=n.sentences[o],c=s?Ke(n.map,s.start,s.end):null,l=typeof c?.getClientRects==`function`?c.getClientRects()[0]:void 0;return l?{index:o,rect:l}:null},selectionSentence:N,destroy(){v=!0,T();for(let e of l)e();i.removeEventListener(`pagehide`,te)}};return i.addEventListener(`pagehide`,te),a&&j(),b()&&F(),I}var H,Yn,U,Xn,Zn,Qn,$n,er,tr,nr,rr=Symbol.for(`pv`),ir={},ar=[],or=/^m(i|n|o|s|text|space)$/,sr=Array.isArray,cr=ar.slice,lr=Object.assign;function ur(e){e&&e.parentNode&&e.remove()}function dr(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:rr,__v:i||++Yn,__i:-1,__u:0};return!i&&H.vnode&&H.vnode(a),a}function fr(e){return e.children}function pr(e,t){this.props=e,this.context=t,this.__g=0}function W(e,t){if(t==null)return e.__&&W(e.__,e.__i+1);for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:W(e)}function mr(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),mr(e)}function hr(e){(8&e.__g||(e.__g|=8,U.push(e),Zn++))&&Xn==H.debounceRendering||((Xn=H.debounceRendering)||queueMicrotask)(gr)}function gr(){var e,t,n,r,i,a,o,s,c;try{for(t=1;U.length;)U.length>t&&U.sort(Qn),e=U.shift(),t=U.length,8&e.__g&&(r=void 0,i=void 0,a=(i=(n=e).__v).__e,o=[],s=[],(c=n.__P)&&((r=lr({constructor:rr},i)).__v=i.__v+1,H.vnode&&H.vnode(r),wr(c,r,i,n.__n,c.namespaceURI,32&i.__u?[a]:null,o,a||W(i),32&i.__u,s),r.__v=i.__v,r.__.__k[r.__i]=r,Dr(o,r,s),i.__=i.__e=null,r.__e!=a&&mr(r)))}finally{(Zn=U.length)&&(Xn||queueMicrotask)(gr)}}function _r(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r.__k||ar,v=t.length;for(c=vr(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=~p.__i&&_[p.__i]||ir,p.__i=d,g=wr(e,p,f,i,a,o,s,c,l,u),m=p.__e,(f.ref!=p.ref||8&f.__u)&&(f.ref&&kr(f.ref,null,p,f),p.ref&&u.push(p.ref,p.__c||m,p)),h=h||m,4&p.__u?(c=yr(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-21);return n.__e=h,c}function vr(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m=n.length,h=m,g=0,_=0,v=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor===String?o=v[a]=dr(null,o):sr(o)?o=v[a]=dr(fr,{children:o}):o.constructor===rr&&o.__b?o=v[a]=dr(o.type,o.props,o.key,o.ref,o.__v):v[a]=o,c=a+g,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=br(o,n,c,h))&&(h--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=16,l==c-1?g--:l==c+1?g++:l!=c&&(l>c?g--:g++,_=1)):(~l||(i>m?g--:i<m&&g++),typeof o.type!=`function`&&(o.__u|=4))):v[a]=null;if(_){for(u=[],d=[],a=0;a<i;a++)if((o=v[a])&&16&o.__u){for(g=0,f=u.length;g<f;)u[p=g+f>>1]<o.__i?g=p+1:f=p;u[g]=o.__i,d[a]=g+1}for(g=u.length;a--;)d[a]&&(d[a]==g?g--:v[a].__u|=4)}if(h)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=W(s)),Ar(s,s));return r}function yr(e,t,n,r){var i,a,o,s;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=yr(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=W(e))&&!t.parentNode&&(t=null),o=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(o!=s&&(!r&&n.moveBefore&&o.parentNode?n.moveBefore(o,t):n.insertBefore(o,t||null)),t=o;(t=t&&t.nextSibling)&&t.nodeType==8&&!t.data.startsWith(`$s`););return t}function br(e,t,n,r){var i,a=e.key,o=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&o==s.type)return n;if(r>+!!c){for(i=n-1;i>=0;i--)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i;for(i=n+1;i<t.length;i++)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i}return-1}function xr(e,t,n){n??(n=``),t[0]==`-`?e.setProperty(t,n):e[t]=n}function Sr(e,t,n,r,i){var a,o;if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||xr(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||xr(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)(e.__e||(e.__e={}))[t]=n,n&&r||(o=nr[t]||(nr[t]=Cr(t)),(e.__a||(e.__a={}))[t]=tr,a=t!=(t=t.replace(er,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),n?e.addEventListener(t,o,a):e.removeEventListener(t,o,a));else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;return}catch{}if(typeof n==`function`)return;n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n)}}function Cr(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[$n]==null)t[$n]=tr++;else if(t[$n]<this.__a[e])return;return n(H.event?H.event(t):t)}}}function wr(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O=t.type;if(t.constructor!==rr)return null;128&n.__u&&(c=32&n.__u,u=n.__c.__z)&&(t.__u|=c,d=a=[],u.nodeType==8?s=Tr(u,a):a.push(u),s=a[0]||s),(u=H.__b)&&u(t);n:if(typeof O==`function`){f=o.length;try{if(_=t.props,v=(u=O.prototype)&&u.render,y=(u=O.contextType)&&r[u.__c],b=u?y?y.props.value:u.__:r,(p=n.__c)?(t.__c=p,2&p.__g&&(p.__g|=1)):(v?t.__c=p=new O(_,b):(t.__c=p=new pr(_,b),p.constructor=O,p.render=jr),y&&y.sub(p),p.state||(p.state={}),p.__n=r,p.__g|=8,p.__h=[],p.__k=[]),v&&(p.__s||(p.__s=p.state),O.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=lr({},p.__s)),lr(p.__s,O.getDerivedStateFromProps(_,p.__s)))),m=p.props,h=p.state,p.__v=t,n.__c){if(_!==m&&v&&!O.getDerivedStateFromProps&&p.componentWillReceiveProps&&p.componentWillReceiveProps(_,b),t.__v==n.__v&&!(8&p.__g)||!(4&p.__g)&&p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(_,p.__s,b)){t.__v!=n.__v&&(p.props=_,p.state=p.__s,p.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ar.push.apply(p.__h,p.__k),p.__k=[],p.__h.length&&o.push(p),s=W(n);break n}p.componentWillUpdate&&p.componentWillUpdate(_,p.__s,b),v&&p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(m,h,g)})}else v&&!O.getDerivedStateFromProps&&p.componentWillMount&&p.componentWillMount(),v&&p.componentDidMount&&p.__h.push(p.componentDidMount);if(p.context=b,p.props=_,p.__P=e,p.__g&=-5,x=H.__r,S=0,v)p.state=p.__s,p.__g&=-9,x&&x(t),u=p.render(p.props,p.state,p.context),ar.push.apply(p.__h,p.__k),p.__k=[];else do p.__g&=-9,x&&x(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(8&p.__g&&++S<25);p.state=p.__s,p.getChildContext&&(r=lr({},r,p.getChildContext())),v&&n.__c&&p.getSnapshotBeforeUpdate&&(g=p.getSnapshotBeforeUpdate(m,h)),C=u&&u.type===fr&&u.key==null?u.props.children:u,_.__P&&(u=s,i=(e=_.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&Ar(e,e)}),n.__k=null),s=n.__k?W(n,0):null),s=_r(e,sr(C)?C:[C],t,n,r,i,a,o,s,c,l),_.__P&&(t.__e=null,s=u),t.__u&=-161,d&&d.some(ur),p.__h.length&&o.push(p),1&p.__g&&(p.__g&=-4)}catch(e){if(o.length=f,t.__v=null,c||a){if(e.then){if(w=0,t.__u|=128|c,a){for(~(E=a.indexOf(s||void 0))||(E=a.length);(D=a[E-1])&&D.nodeType==8;)E--;for(;E<a.length;E++)if(D=a[E]){if(a[E]=null,D.nodeType==8){if(D.data.startsWith(`$s`))w++||(T=D);else if(w&&D.data.startsWith(`/$s`)&&!--w)break}else if(!w)break}}if(!T){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;T=s}(u=Tr(T=t.__c.__z||(t.__c.__z=T)))?(t.__e=T,s=u):t.__e=s,s=s&&s.nextSibling}else a&&a.some(ur)}else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),e.then||Er(t),H.__e(e,t,n)}}else s=t.__e=Or(n.__e,t,n,r,i,a,o,c,l,e);return(u=H.diffed)&&u(t),s}function Tr(e,t){if(e&&e.nodeType==8&&e.data.startsWith(`$s`))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith(`$s`))n++;else if(e.data.startsWith(`/$s`)&&!--n)return e}t&&t.push(e)}}function Er(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Er))}function Dr(e,t,n){for(var r=0;r<n.length;)kr(n[r++],n[r++],n[r++]);H.__c&&H.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){H.__e(e,t.__v)}})}function Or(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y=n.props||ir,b=t.props,x=t.type;if(x==`svg`?i=`http://www.w3.org/2000/svg`:x==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||(i=`http://www.w3.org/1999/xhtml`),a){for(u=0;u<a.length;u++)if((m=a[u])&&(x?m.localName==x:m.nodeType==3)){e=m,a[u]=null;break}}if(!e){if(_=l.ownerDocument||document,!x)return _.createTextNode(b);e=_.createElementNS(i,x,b.is&&b),s&&(H.__m&&H.__m(t,a),s=!1),a=null}if(x){if(l=x==`template`&&e.content||e,a=x==`textarea`&&b.defaultValue!=null?null:a&&cr.call(l.childNodes),!s&&a)for(y={},u=0;u<e.attributes.length;u++)y[(m=e.attributes[u]).name]=m.value;for(u in y)m=y[u],u==`dangerouslySetInnerHTML`?f=m:u==`children`||u in b||u==`value`&&`defaultValue`in b||u==`checked`&&`defaultChecked`in b||Sr(e,u,null,m,i);for(u in v=1&n.__u,b)m=b[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||!(y[u]!==m||v&&m!=null)||Sr(e,u,m,y[u],i);d?(s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(f&&(e.textContent=``),(x==`foreignObject`||i==`http://www.w3.org/1998/Math/MathML`&&or.test(x))&&(i=`http://www.w3.org/1999/xhtml`),_r(l,sr(p)?p:[p],t,n,r,i,a,o,a?a[0]:n.__k&&W(n,0),s,c),a&&a.some(ur)),s&&x!=`textarea`||(u=`value`,x==`progress`&&h==null?e.removeAttribute(u):h==null||h===e[u]&&(x!=`progress`||h)||Sr(e,u,h,y[u],i),u=`checked`,g!=null&&g!=e[u]&&Sr(e,u,g,y[u],i))}else y===b||s&&e.data==b||(e.data=b);return e}function kr(e,t,n,r){try{typeof e==`function`?t?t.__x=e(t)||1:r&&(r=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t==`function`?t():e(null)):e.current=t}catch(e){H.__e(e,n)}}function Ar(e,t,n){var r,i,a,o;if(H.unmount&&H.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||kr(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){H.__e(e,t)}r.__P=r.__n=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Ar(r[o],t,typeof e.type!=`function`||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(i=Tr(r,a=[]))&&(r==e.__e&&a.some(ur),ur(i),ur(r)),(r=e.__e)&&(n||ur(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function jr(e,t,n){return this.constructor(e,n)}function Mr(e,t){var n,r,i,a;H.__&&H.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=dr(fr,{children:[e]}),i=[],a=[],wr(t,t.__k,r||ir,ir,t.namespaceURI,r?null:t.firstChild?cr.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a),Dr(i,t.__k,a),t.__k.props.children=null}H={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((o=(a=i.constructor)&&a.getDerivedStateFromError)&&i.setState(a.getDerivedStateFromError(e)),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=1),o&&8&i.__g)return void(i.__g|=2)}catch(t){e=t}}throw Zn=0,e}},Yn=0,pr.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=lr({},this.state)),typeof e==`function`&&(e=e(lr({},n),this.props)),e&&(lr(n,e),this.__v&&(t&&this.__k.push(t),hr(this)))},pr.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),hr(this))},pr.prototype.render=fr,U=[],Zn=0,Qn=function(e,t){return e.__v.__b-t.__v.__b},$n=Symbol(),er=/(PointerCapture)$|Capture$/i,tr=0,nr={};var Nr=Symbol.for(`pv`),Pr=0;Array.isArray;function G(e,t,n,r,i,a){t||(t={});var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:Nr,__v:--Pr,__i:-1,__u:0};return(i||a)&&(l.__source=i,l.__self=a),H.vnode&&H.vnode(l),l}var Fr,K,Ir,Lr,Rr=Object.is,zr=0,Br=[],Vr=[],q=H,Hr=q.__b,Ur=q.__r,Wr=q.diffed,Gr=q.__c,Kr=q.unmount,qr=q.__;function Jr(e,t){q.__h&&q.__h(K,e,zr||t),zr=0;var n=K.__H||(K.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function J(e){return zr=1,Yr(ai,e)}function Yr(e,t,n){var r=Jr(Fr++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ai(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Rr(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=K,!K.__f)){K.__f=!0;var i=K.shouldComponentUpdate;K.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,Rr(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function Y(e,t){var n=Jr(Fr++,3);!q.__s&&ii(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,K.__H.__h.push(n))}function Xr(e,t){var n=Jr(Fr++,4);!q.__s&&ii(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,K.__h.push(n))}function X(e){return zr=5,Zr(function(){return{current:e}},[])}function Zr(e,t){var n=Jr(Fr++,7);return ii(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function Qr(){var e;do{for(;e=Vr.shift();)try{ni(e)}catch(t){q.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Br.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ni),t.__h.some(ri),t.__h=[]}catch(n){t.__h=[],q.__e(n,e.__v)}}}while(Vr.length)}q.__b=function(e){K=null,Hr&&Hr(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qr&&qr(e,t)},q.__r=function(e){Ur&&Ur(e),Fr=0;var t=(K=e.__c).__H;t&&(Ir==K?K.__h=[]:(t.__h.some(ni),t.__h.some(ri),Fr=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),Ir=K},q.diffed=function(e){Wr&&Wr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&ti(Br.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),Ir=K=null},q.__c=function(e,t){t.some(function(e){try{e.__h.some(ni),e.__h=e.__h.filter(function(e){return!e.__||ri(e)})}catch(t){e.__h=[function(){throw t}]}}),Gr&&Gr(e,t)},q.unmount=function(e){Kr&&Kr(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}r.__P=n,ti(Vr.push(r))}else ni(r)}catch(e){t=e}}),r.__H=void 0,t&&q.__e(t,r.__v))};var $r=typeof requestAnimationFrame==`function`;function ei(e){var t,n=function(){clearTimeout(r),$r&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);$r&&(t=requestAnimationFrame(n))}function ti(e){e!=1&&Lr==q.requestAnimationFrame||((Lr=q.requestAnimationFrame)||ei)(Qr)}function ni(e){var t=K,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),K=t}function ri(e){var t=K;e.__c=e.__(),K=t}function ii(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!Rr(t,e[n])})}function ai(e,t){return typeof t==`function`?t(e):t}function Z(e){let{children:t,size:n=20,fill:r}=e;return G(`svg`,{width:n,height:n,viewBox:`0 0 24 24`,fill:r?`currentColor`:`none`,stroke:r?`none`:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,focusable:`false`,children:t})}function oi(e){return G(Z,{size:e.size,fill:!0,children:G(`path`,{d:`M8 5.6v12.8a1 1 0 0 0 1.5.86l10.4-6.4a1 1 0 0 0 0-1.72L9.5 4.74A1 1 0 0 0 8 5.6Z`})})}function si(e){return G(Z,{size:e.size,fill:!0,children:[G(`rect`,{x:`6`,y:`5`,width:`4.2`,height:`14`,rx:`1.3`}),G(`rect`,{x:`13.8`,y:`5`,width:`4.2`,height:`14`,rx:`1.3`})]})}function ci(e){let{size:t=18,ahead:n}=e;return G(Z,{size:t,children:[G(`g`,{transform:n?`matrix(-1 0 0 1 24 0)`:void 0,children:[G(`path`,{d:`M5.4 8.6A7.6 7.6 0 1 1 4.4 12.4`}),G(`path`,{d:`M4.8 4.2v4.6h4.6`})]}),G(`path`,{d:`M9.6 10.8h4.8M9.6 14h3.2`,"stroke-width":`1.8`})]})}function li(e){let{size:t=18}=e;return G(Z,{size:t,children:[G(`circle`,{cx:`9`,cy:`8.5`,r:`3.5`}),G(`path`,{d:`M2.5 20c.4-3.4 3.1-5.5 6.5-5.5s6.1 2.1 6.5 5.5M16.6 6.2a3.6 3.6 0 0 1 0 4.8M19.2 3.8a7.2 7.2 0 0 1 0 9.6`})]})}function ui(e){let{size:t=18}=e;return G(Z,{size:t,children:G(`path`,{d:`M6 6l12 12M18 6 6 18`})})}function di(e){let{size:t=22}=e;return G(Z,{size:t,children:[G(`circle`,{cx:`12`,cy:`4.6`,r:`1.6`,fill:`currentColor`,stroke:`none`}),G(`path`,{d:`M5 8.4c2.3.7 4.6 1 7 1s4.7-.3 7-1M12 9.4v4.4M12 13.8l-3 6.4M12 13.8l3 6.4`})]})}function fi(e){let{size:t=16}=e;return G(Z,{size:t,children:G(`path`,{d:`m5 12.5 4.2 4L19 7`})})}function pi(){return G(Z,{size:16,children:G(`path`,{d:`M6 12h12`})})}function mi(){return G(Z,{size:16,children:G(`path`,{d:`M12 6v12M6 12h12`})})}var hi={left:`m14.5 6-6 6 6 6`,right:`m9.5 6 6 6-6 6`,up:`m6 14.5 6-6 6 6`,down:`m6 9.5 6 6 6-6`};function gi(e){return G(Z,{size:14,children:G(`path`,{d:hi[e.dir]})})}function _i(e){let{size:t=13}=e;return G(Z,{size:t,fill:!0,children:G(`path`,{d:`M12 2.5l2 6.4 6.5 2.1-6.5 2.1-2 6.4-2-6.4-6.5-2.1 6.5-2.1Z`})})}function vi(){return G(Z,{size:12,fill:!0,children:[G(`circle`,{cx:`9`,cy:`7`,r:`1.5`}),G(`circle`,{cx:`15`,cy:`7`,r:`1.5`}),G(`circle`,{cx:`9`,cy:`12`,r:`1.5`}),G(`circle`,{cx:`15`,cy:`12`,r:`1.5`}),G(`circle`,{cx:`9`,cy:`17`,r:`1.5`}),G(`circle`,{cx:`15`,cy:`17`,r:`1.5`})]})}function yi(){return G(Z,{size:18,children:[G(`path`,{d:`M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z`}),G(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}function bi(){return G(Z,{size:18,children:G(`path`,{d:`M12 6.5C10 5 7.5 4.5 4 4.5v13c3.5 0 6 .5 8 2 2-1.5 4.5-2 8-2v-13c-3.5 0-6 .5-8 2ZM12 6.5v13`})})}function xi(){return G(Z,{size:18,children:[G(`path`,{d:`M4 8.5V6a2 2 0 0 1 2-2h2.5M15.5 4H18a2 2 0 0 1 2 2v2.5M20 15.5V18a2 2 0 0 1-2 2h-2.5M8.5 20H6a2 2 0 0 1-2-2v-2.5`}),G(`circle`,{cx:`12`,cy:`12`,r:`2.5`})]})}function Si(){return G(Z,{size:18,children:[G(`path`,{d:`M12 3.5 4.5 6.5v5c0 4.5 3.2 7.8 7.5 9 4.3-1.2 7.5-4.5 7.5-9v-5L12 3.5Z`}),G(`path`,{d:`M8.5 12.5c1.2-1.3 2.3-1.3 3.5 0s2.3 1.3 3.5 0`})]})}function Ci(){return G(Z,{size:18,children:[G(`circle`,{cx:`6.5`,cy:`14.5`,r:`3.5`}),G(`circle`,{cx:`17.5`,cy:`14.5`,r:`3.5`}),G(`path`,{d:`M10 14c1.3-.8 2.7-.8 4 0M3 14l1.5-6.5L7 6.5M21 14l-1.5-6.5L17 6.5`})]})}function wi(){return G(Z,{size:22,children:G(`path`,{d:`M11 6.5h9M11 12h9M11 17.5h9M5 4.5v15M2.8 7 5 4.5 7.2 7M2.8 17 5 19.5 7.2 17`})})}function Ti(){return G(Z,{size:22,children:G(`path`,{d:`M6 13.5 9 5l3 8.5M7 10.5h4M14.5 13.5V5h2.7a2.1 2.1 0 0 1 0 4.2h-2.7 3.1a2.15 2.15 0 0 1 0 4.3h-3.1M3.5 19h17M6 17l-2.5 2L6 21M18 17l2.5 2-2.5 2`})})}function Ei(){return G(Z,{size:22,children:G(`path`,{d:`M3.5 18.5 8.5 5.5l5 13M5.4 13.5h6.2M20 10.5v8M20 13.2c-.5-1.7-1.6-2.7-3.1-2.7-1.9 0-3.1 1.6-3.1 4s1.2 4 3.1 4c1.5 0 2.6-1 3.1-2.7`})})}function Di(){return G(Z,{size:22,children:[G(`path`,{d:`M4 4.5v14.5M20 4.5v14.5`}),G(`circle`,{cx:`7.6`,cy:`15.2`,r:`3.6`}),G(`circle`,{cx:`16.4`,cy:`15.2`,r:`3.6`,"stroke-width":`2.8`})]})}function Oi(){return G(Z,{size:22,children:[G(`path`,{d:`M10 14a4.5 4.5 0 0 0 6.4 0l3-3a4.5 4.5 0 0 0-6.4-6.4l-1.2 1.2`}),G(`path`,{d:`M14 10a4.5 4.5 0 0 0-6.4 0l-3 3a4.5 4.5 0 0 0 6.4 6.4l1.2-1.2`})]})}function ki(){return G(Z,{size:22,children:[G(`path`,{d:`M5 3.5 18.5 10l-6 1.8-2.4 6L5 3.5Z`}),G(`path`,{d:`m12.8 12 5.7 6.5`})]})}function Ai(){return G(Z,{size:22,children:[G(`path`,{d:`M4 5.5h16M4 18.5h11`,opacity:`.45`}),G(`rect`,{x:`2.5`,y:`9.5`,width:`19`,height:`5`,rx:`1.5`})]})}function ji(){return G(Z,{size:22,children:[G(`rect`,{x:`2.5`,y:`3.5`,width:`19`,height:`17`,rx:`2.5`}),G(`path`,{d:`M2.5 9.5h19M2.5 14.5h19`}),G(`path`,{d:`M5 6.5h14M5 17.5h14`,opacity:`.45`})]})}function Mi(){return G(Z,{size:22,children:[G(`circle`,{cx:`12`,cy:`12`,r:`9`}),G(`path`,{d:`M9.8 9v6M14.2 9v6`})]})}function Ni(){return G(Z,{size:22,children:G(`path`,{d:`M8 4h11a2 2 0 0 1 2 2v11M19 21H5a2 2 0 0 1-2-2V5M3 15l4.5-4.5 5 5M14 14l1.5-1.5 4 4M3 3l18 18`})})}function Pi(){return G(Z,{size:18,children:[G(`circle`,{cx:`12`,cy:`12`,r:`8.5`}),G(`path`,{d:`M12 3.5v17a8.5 8.5 0 0 0 0-17Z`,fill:`currentColor`,stroke:`none`})]})}function Fi(){return G(`span`,{class:`bars`,"aria-hidden":`true`,children:[G(`i`,{}),G(`i`,{}),G(`i`,{}),G(`i`,{})]})}function Ii(e){return G(`span`,{class:`pips`,"aria-hidden":`true`,children:Array.from({length:e.max},(t,n)=>G(`i`,{class:n<e.value?`f`:void 0},n))})}function Li(e){let{icon:t,label:n,on:r,onChange:i}=e;return G(`button`,{type:`button`,class:`tile`,role:`switch`,"aria-checked":r,onClick:()=>i(!r),children:[G(`span`,{class:`ck`,"aria-hidden":`true`,children:G(fi,{size:10})}),t,G(`span`,{class:`tl`,children:n})]})}function Ri(e){let{icon:t,label:n,value:r,max:i,valueText:a,onChange:o}=e;return G(`button`,{type:`button`,class:`tile`,"data-on":r?``:void 0,"aria-label":`${n}, ${a}`,onClick:()=>o((r+1)%(i+1)),children:[t,G(`span`,{class:`tl`,children:[n,G(Ii,{value:r,max:i})]})]})}function zi(e){let{icon:t,label:n,on:r,onChange:i}=e;return G(`button`,{type:`button`,class:`toggle`,role:`switch`,"aria-checked":r,onClick:()=>i(!r),children:[t,G(`span`,{children:n}),G(`span`,{class:`knobs`,"aria-hidden":`true`})]})}var Bi=`lantun-reader`,Vi=`dock`,Hi=`hint-voice`,Ui=`position:fixed;inset:0;pointer-events:none;display:block;margin:0;padding:0;border:0;width:auto;height:auto;max-width:none;max-height:none;background:none;opacity:1;visibility:visible;transform:none;overflow:visible;clip-path:none;contain:none;view-transition-name:lantun-ui`,Wi=[22,21,19],Gi=7e3,Ki={x:.5,y:1,o:`h`},qi={left:`right`,right:`left`,top:`down`,bottom:`up`},Ji=[.75,1,1.25,1.5,2],Yi=2*Math.PI*22,Xi={edge:`tipEdge`,mac:`tipMac`,ios:`tipIos`},Zi=[{value:`default`,label:`contrastDefault`,bg:`#f4f4f5`,fg:`#18181b`},{value:`dark`,label:`dark`,bg:`#16161a`,fg:`#e6e6e9`},{value:`light`,label:`light`,bg:`#fffaf0`,fg:`#3b3b3b`},{value:`high`,label:`high`,bg:`#000`,fg:`#ffe500`},{value:`invert`,label:`invert`,bg:`linear-gradient(135deg,#f4f4f5 50%,#18181b 50%)`,fg:`transparent`}],Qi=c({status:`idle`,index:0,total:0,progress:0,duration:0,remaining:0,remainingAfter:0,rate:1,voices:[],voice:null,voicesLoaded:!0,resume:null,issue:null,engine:null,fallback:null}),$i=c({...d}),ea={minutes:`{n} min`,region:`Listen to this article`,play:`Play`,pause:`Pause`,prev:`Previous sentence`,next:`Next sentence`,voiceOf:`Voice · {v}`,voiceOfHd:`Voice · {v}, lifelike`,chooseVoice:`Choose voice`,hdGroup:`Lifelike voices`,hdGroupSub:`Made on your device · works offline`,female:`Female`,male:`Male`,hdGroupDownload:`Made on your device · one-time {mb} MB download`,builtInGroup:`Built-in voices`,tryHd:`Want a more natural voice? Try a lifelike one.`,tryVoice:`Prefer a different voice? There are {n} to choose from.`,speed:`Speed`,slower:`Slower`,faster:`Faster`,voice:`Voice`,natural:`Natural`,hdSize:`One-time {mb} MB download`,hdLoading:`Downloading… {p}%`,hdReady:`Ready · works offline`,hdUnavailable:`Not available on this device`,preparing:`Preparing {v} · {p}`,preparingSub:`one-time download, then it works offline`,hdSlow:`This device is too slow for lifelike voices, so {v} is reading instead.`,hdFailed:`The lifelike voice couldn’t load, so {v} is reading instead.`,online:`Online`,device:`On device`,noVoice:`No voice for this language is installed, so your browser’s default voice is used.`,listenFor:`Listen · {n} min`,hide:`Hide`,show:`Show reader`,move:`Drag to move · double-click to reset`,dismiss:`Dismiss`,resumed:`Continuing from {p}%`,tipEdge:`For a more human voice, open this page in Microsoft Edge.`,tipMac:`For a more human voice, add an Enhanced voice in System Settings › Accessibility › Spoken Content.`,tipIos:`For a more human voice, download an Enhanced voice in Settings › Accessibility › Spoken Content › Voices.`,progress:`Reading position`,sentenceOf:`Sentence {i} of {n}`,left:`{t} left`,startOver:`Start over`,playFromHere:`Play from here`,notAllowed:`Press play to start listening.`,playing:`Playing`,paused:`Paused`,finished:`Finished`,speedSet:`Speed {r}×`,voiceSet:`Voice: {v}`,a11y:`Reading aids and accessibility`,a11yTitle:`Reading aids`,closePanel:`Close reading aids`,profiles:`Profiles`,profilesHint:`One tap sets several options at once.`,lowVisionHint:`Larger text, high contrast, big cursor and highlighted links.`,dyslexiaHint:`Dyslexia-friendly font, wider spacing and a reading guide.`,adhdHint:`A reading mask to hold focus, and no animations.`,seizureHint:`No animations or flashing, and muted colours.`,elderlyHint:`Larger, clearer text and a big cursor.`,lowVision:`Low vision`,dyslexia:`Dyslexia`,adhd:`ADHD`,seizure:`Seizure-safe`,elderly:`Elderly`,text:`Text`,textSize:`Text size`,smaller:`Smaller text`,larger:`Larger text`,lineHeight:`Line height`,letterSpacing:`Letter spacing`,fontReadable:`Readable font`,fontDyslexic:`Dyslexia font`,color:`Colour`,contrastDefault:`Default`,dark:`Dark`,light:`Light`,high:`High`,invert:`Invert`,desaturate:`Grayscale`,aids:`Reading & focus`,links:`Highlight links`,cursor:`Big cursor`,guide:`Reading guide`,mask:`Reading mask`,still:`Pause animations`,noImages:`Hide images`,reset:`Reset`,resetAll:`Reset all accessibility settings`,off:`Off`,on:`on`,level:`level {n} of {m}`,settingsReset:`Accessibility settings reset`,profileOn:`{p} profile on`},ta={minutes:`{n} mnt`,region:`Dengarkan artikel ini`,play:`Putar`,pause:`Jeda`,prev:`Kalimat sebelumnya`,next:`Kalimat berikutnya`,voiceOf:`Suara · {v}`,voiceOfHd:`Suara · {v}, realistis`,chooseVoice:`Pilih suara`,hdGroup:`Suara realistis`,hdGroupSub:`Dibuat di perangkat Anda · bisa offline`,female:`Perempuan`,male:`Laki-laki`,hdGroupDownload:`Dibuat di perangkat Anda · unduh sekali {mb} MB`,builtInGroup:`Suara bawaan`,tryHd:`Ingin suara yang lebih alami? Coba suara realistis.`,tryVoice:`Ingin suara lain? Ada {n} pilihan.`,speed:`Kecepatan`,slower:`Lebih lambat`,faster:`Lebih cepat`,voice:`Suara`,natural:`Alami`,hdSize:`Unduh sekali {mb} MB`,hdLoading:`Mengunduh… {p}%`,hdReady:`Siap · bisa offline`,hdUnavailable:`Tidak tersedia di perangkat ini`,preparing:`Menyiapkan {v} · {p}`,preparingSub:`unduh sekali, lalu bisa offline`,hdSlow:`Perangkat ini terlalu lambat untuk suara realistis, jadi {v} yang membacakan.`,hdFailed:`Suara realistis gagal dimuat, jadi {v} yang membacakan.`,online:`Online`,device:`Di perangkat`,noVoice:`Belum ada suara untuk bahasa ini, jadi suara bawaan browser yang dipakai.`,listenFor:`Dengarkan · {n} mnt`,hide:`Sembunyikan`,show:`Tampilkan pembaca`,move:`Seret untuk memindahkan · klik dua kali untuk mengembalikan`,dismiss:`Tutup`,resumed:`Melanjutkan dari {p}%`,tipEdge:`Untuk suara yang lebih alami, buka halaman ini di Microsoft Edge.`,tipMac:`Untuk suara yang lebih alami, tambahkan suara Enhanced di Pengaturan Sistem › Aksesibilitas › Konten Lisan.`,tipIos:`Untuk suara yang lebih alami, unduh suara Enhanced di Pengaturan › Aksesibilitas › Konten Lisan › Suara.`,progress:`Posisi membaca`,sentenceOf:`Kalimat {i} dari {n}`,left:`sisa {t}`,startOver:`Dari awal`,playFromHere:`Putar dari sini`,notAllowed:`Tekan putar untuk mulai mendengarkan.`,playing:`Diputar`,paused:`Dijeda`,finished:`Selesai`,speedSet:`Kecepatan {r}×`,voiceSet:`Suara: {v}`,a11y:`Bantuan membaca dan aksesibilitas`,a11yTitle:`Bantuan membaca`,closePanel:`Tutup bantuan membaca`,profiles:`Profil`,profilesHint:`Satu ketukan mengatur beberapa pilihan sekaligus.`,lowVisionHint:`Teks lebih besar, kontras tinggi, kursor besar, dan tautan ditandai.`,dyslexiaHint:`Huruf ramah disleksia, jarak lebih lega, dan garis panduan baca.`,adhdHint:`Masker baca agar tetap fokus, dan tanpa animasi.`,seizureHint:`Tanpa animasi atau kedipan, dan warna diredam.`,elderlyHint:`Teks lebih besar dan jelas, serta kursor besar.`,lowVision:`Low vision`,dyslexia:`Disleksia`,adhd:`ADHD`,seizure:`Aman kejang`,elderly:`Lansia`,text:`Teks`,textSize:`Ukuran teks`,smaller:`Perkecil teks`,larger:`Perbesar teks`,lineHeight:`Jarak baris`,letterSpacing:`Jarak huruf`,fontReadable:`Huruf jelas`,fontDyslexic:`Huruf disleksia`,color:`Warna`,contrastDefault:`Bawaan`,dark:`Gelap`,light:`Terang`,high:`Kontras`,invert:`Balik`,desaturate:`Hitam putih`,aids:`Baca & fokus`,links:`Tandai tautan`,cursor:`Kursor besar`,guide:`Panduan baca`,mask:`Masker baca`,still:`Hentikan animasi`,noImages:`Sembunyikan gambar`,reset:`Atur ulang`,resetAll:`Atur ulang semua pengaturan aksesibilitas`,off:`Mati`,on:`aktif`,level:`tingkat {n} dari {m}`,settingsReset:`Pengaturan aksesibilitas diatur ulang`,profileOn:`Profil {p} aktif`};function na(e){let t=e.toLowerCase();return t.startsWith(`id`)||t.startsWith(`in`)?ta:ea}function Q(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??``))}function ra(e){return String(e).padStart(2,`0`)}function ia(e){let t=Math.max(0,Math.round(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}:${ra(r)}:${ra(t%60)}`:`${r}:${ra(t%60)}`}function aa(e){return String(e)}function oa(e,t,n){return Math.min(Math.max(e,t),Math.max(t,n))}function sa(e,t,n,r){return{left:e,top:t,width:n,height:r,right:e+n,bottom:t+r}}function ca(e){let t=parseFloat(e.style.left),n=parseFloat(e.style.top);if(Number.isFinite(t)&&Number.isFinite(n))return sa(t,n,e.offsetWidth,e.offsetHeight);let r=e.getBoundingClientRect();return sa(r.left,r.top,r.width,r.height)}function la(e,t){return sa(t.left+e.offsetLeft,t.top+e.offsetTop,e.offsetWidth,e.offsetHeight)}function ua(){return typeof matchMedia!=`function`||matchMedia(`(prefers-reduced-motion: reduce)`).matches}function da(){let e=document.documentElement;return{width:e.clientWidth||window.innerWidth,height:e.clientHeight||window.innerHeight}}function fa(e,t,n){let{width:r,height:i}=da(),a=e.offsetWidth,o=e.offsetHeight;e.style.left=`${Math.round(oa(t*r-a/2,12,r-12-a))}px`,e.style.top=`${Math.round(oa(n*i-o/2,12,i-12-o))}px`}function pa(e,t,n,r,i){let a=oa(e/r,0,1),o=oa(t/i,0,1);return e<80?{x:0,y:o,o:`v`}:e>r-80?{x:1,y:o,o:`v`}:t<80?{x:a,y:0,o:`h`}:t>i-80?{x:a,y:1,o:`h`}:{x:a,y:o,o:n}}function ma(e){return e.o===`h`?e.y<.5?`top`:`bottom`:e.x<.5?`left`:`right`}function ha(e){return e.o===`h`?e.y<.5?`up`:`down`:e.x<.5?`left`:`right`}function ga(e,t,n,r){let i=-1;e.key===`ArrowRight`||e.key===`ArrowDown`?i=(n+1)%t:e.key===`ArrowLeft`||e.key===`ArrowUp`?i=(n-1+t)%t:e.key===`Home`?i=0:e.key===`End`&&(i=t-1),i<0||(e.preventDefault(),e.stopPropagation(),r(i),e.currentTarget.querySelectorAll(`[role="radio"]`)[i]?.focus())}function _a(e){return e.map(e=>Math.round(e+(255-e)*.15))}function va(e){let t=e;for(let e=0;e<10&&Ne(t,Wi)<3;e++)t=_a(t);return t}function ya(e,t){return!!e&&t.issue!==`unsupported`&&t.issue!==`no-content`}function ba(e){return e?``:void 0}function xa(e){return Math.round(e/1e6)}function Sa(e,t,n){return t?.state===`loading`?Q(n.hdLoading,{p:Math.round(t.progress*100)}):t?.state===`error`?n.hdUnavailable:t?.state===`ready`||!e.downloadBytes?n.hdReady:Q(n.hdSize,{mb:xa(e.downloadBytes)})}function Ca(e,t){return!!e&&e.index===t.index&&e.x===t.x&&e.y===t.y}function wa(e,t){requestAnimationFrame(()=>e?.querySelector(t)?.focus())}function Ta(e){let[t,n]=J(e.get());return Y(()=>(n(e.get()),e.subscribe(n)),[e]),t}function Ea(e,t,n){let r=X(n);r.current=n,Y(()=>{if(!e)return;function n(e){let n=e.composedPath();t.some(e=>e.current&&n.includes(e.current))||r.current()}return document.addEventListener(`pointerdown`,n,!0),()=>document.removeEventListener(`pointerdown`,n,!0)},[e])}function Da(e){let t=X(e);t.current=e,Y(()=>{let e=0,n=da().height/2;function r(){e=0,t.current(n)}function i(t){n=t.clientY,e||(e=requestAnimationFrame(r))}return t.current(n),window.addEventListener(`pointermove`,i,{passive:!0}),()=>{window.removeEventListener(`pointermove`,i),cancelAnimationFrame(e)}},[])}function Oa(e){let[t,n]=J(Date.now),r=X(Date.now()),i=e.status===`playing`;return Y(()=>{r.current=Date.now(),n(r.current)},[e.remaining,i]),Y(()=>{if(!i)return;let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[i]),i?Math.max(e.remainingAfter,e.remaining-(t-r.current)/1e3):e.remaining}function ka(e,t,n,r){Xr(()=>{let r=e.current;if(!r)return;function i(){r&&!(`drag`in r.dataset)&&fa(r,t,n)}i();let a=requestAnimationFrame(()=>{r.dataset.ready=``}),o=typeof ResizeObserver==`function`?new ResizeObserver(i):null;return window.addEventListener(`resize`,i),o?.observe(r),()=>{cancelAnimationFrame(a),window.removeEventListener(`resize`,i),o?.disconnect()}},[t,n,...r])}function Aa(e,t){function n(n){let r=e.current,i=t.current;if(!r||!i)return;let{width:a,height:o}=da(),s=i.closest(`.dock`)??i,c=ca(s),l=i===s?c:la(i,c),u=s.getAttribute(`data-o`)===`h`,d=c.top+c.height/2>o/2;r.style.maxHeight=u?`${Math.round((d?c.top:o-c.bottom)-12-12)}px`:``;let f=r.offsetWidth,p=r.offsetHeight,m,h,g=0,_=0;if(u)m=oa(l.left+l.width/2-f/2,12,a-f-12),h=d?c.top-12-p:c.bottom+12,_=d?10:-10;else{let e=c.left+c.width/2>a/2,t=Number(r.dataset.top),i=!n&&r.dataset.top&&Number.isFinite(t);m=e?c.left-12-f:c.right+12,h=i?t:l.top+l.height/2-p/2,g=e?10:-10}h=Math.round(oa(h,12,o-p-12)),r.dataset.top=String(h),r.style.setProperty(`--top`,`${h}px`),r.style.setProperty(`--left`,`${Math.round(oa(m,12,a-f-12))}px`),r.style.setProperty(`--px`,`${g}px`),r.style.setProperty(`--py`,`${_}px`)}Xr(()=>n(!1)),Xr(()=>{function e(){n(!0)}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[])}function ja(e,t,n,r){let i=X({onStart:n,onEnd:r,o:t});return i.current={onStart:n,onEnd:r,o:t},function(t){let n=e.current;if(!n||t.button!==0)return;t.preventDefault();let r=t.currentTarget,a=n.getBoundingClientRect(),o=a.left+a.width/2,s=a.top+a.height/2,c=o-t.clientX,l=s-t.clientY;function u(e){o=e.clientX+c,s=e.clientY+l;let{width:t,height:r}=da();fa(n,o/t,s/r)}function d(){r.removeEventListener(`pointermove`,u),r.removeEventListener(`pointerup`,d),r.removeEventListener(`pointercancel`,d),delete n.dataset.drag;let{width:e,height:t}=da();i.current.onEnd(pa(o,s,i.current.o,e,t))}r.setPointerCapture?.(t.pointerId),n.dataset.drag=``,i.current.onStart(),r.addEventListener(`pointermove`,u),r.addEventListener(`pointerup`,d),r.addEventListener(`pointercancel`,d)}}function Ma(){let[e]=J(()=>typeof matchMedia==`function`?matchMedia(`(max-width: 540px)`):null),[t,n]=J(e?.matches??!1);return Y(()=>{if(!e)return;function t(){n(e.matches)}return e.addEventListener?.(`change`,t),()=>e.removeEventListener?.(`change`,t)},[e]),t}function Na(e,t,n=!1){let r=e||null,[i,a]=J(r);return Y(()=>{if(r!==null){a(r);return}if(n||ua()){a(null);return}let e=setTimeout(()=>a(null),t);return()=>clearTimeout(e)},[r]),{shown:r??i,leaving:r===null&&i!==null}}var Pa={lowVision:yi,dyslexia:bi,adhd:xi,seizure:Si,elderly:Ci},Fa=[{key:`guide`,Icon:Ai},{key:`mask`,Icon:ji},{key:`links`,Icon:Oi},{key:`cursor`,Icon:ki},{key:`still`,Icon:Mi},{key:`noImages`,Icon:Ni}];function Ia(e){let{ax:t,s:n,t:r,panelRef:i,anchor:a,onClose:o,announce:s,leaving:c}=e,l=X(null),u=w(n),d=Math.max(0,Zi.findIndex(e=>e.value===n.contrast));Y(()=>l.current?.focus(),[]),Aa(i,a);function p(e){t.update(e)}function m(e){return e?Q(r.level,{n:e,m:3}):r.off}function h(e){p({text:e}),s(`${r.textSize} ${f[e]}%`)}function g(){t.reset(),s(r.settingsReset),l.current?.focus()}function v(e){let n=u===e;t.toggleProfile(e,n),s(n?r.settingsReset:Q(r.profileOn,{p:r[e]}))}function y(e){ga(e,Zi.length,d,e=>p({contrast:Zi[e]?.value??`default`}))}return G(`section`,{class:`pop panel surface`,role:`dialog`,"aria-labelledby":`lt-ax-title`,ref:i,"data-leave":ba(c),children:[G(`div`,{class:`phead`,children:[G(`h2`,{id:`lt-ax-title`,children:r.a11yTitle}),G(`button`,{type:`button`,class:`reset`,"aria-label":r.resetAll,disabled:T(n),onClick:g,children:r.reset}),G(`button`,{type:`button`,class:`ghost sm`,"aria-label":r.closePanel,onClick:o,children:G(ui,{})})]}),G(`div`,{class:`body`,children:[G(`h3`,{children:r.profiles}),G(`div`,{class:`chips`,children:_.map((e,t)=>{let n=Pa[e];return G(`button`,{ref:t===0?l:void 0,type:`button`,class:`pchip`,"aria-pressed":u===e,onClick:()=>v(e),children:[G(n,{}),r[e]]},e)})}),G(`p`,{class:`hint`,children:u?r[`${u}Hint`]:r.profilesHint}),G(`h3`,{children:r.text}),G(`div`,{class:`size`,role:`group`,"aria-label":r.textSize,children:[G(`button`,{type:`button`,class:`step`,"aria-label":r.smaller,disabled:n.text===0,onClick:()=>h(n.text-1),children:G(`span`,{class:`a sm`,children:`A`})}),G(`div`,{class:`val`,"aria-hidden":`true`,children:[G(`span`,{children:r.textSize}),G(`b`,{children:[f[n.text],`%`]}),G(Ii,{value:n.text+1,max:f.length})]}),G(`button`,{type:`button`,class:`step`,"aria-label":r.larger,disabled:n.text===3,onClick:()=>h(n.text+1),children:G(`span`,{class:`a lg`,children:`A`})})]}),G(`div`,{class:`tiles two`,children:[G(Ri,{icon:G(wi,{}),label:r.lineHeight,value:n.line,max:3,valueText:m(n.line),onChange:e=>p({line:e})}),G(Ri,{icon:G(Ti,{}),label:r.letterSpacing,value:n.spacing,max:3,valueText:m(n.spacing),onChange:e=>p({spacing:e})}),G(Li,{icon:G(Ei,{}),label:r.fontReadable,on:n.font===`readable`,onChange:e=>p({font:e?`readable`:`default`})}),G(Li,{icon:G(Di,{}),label:r.fontDyslexic,on:n.font===`dyslexic`,onChange:e=>p({font:e?`dyslexic`:`default`})})]}),G(`h3`,{id:`lt-color`,children:r.color}),G(`div`,{class:`swatches`,role:`radiogroup`,"aria-labelledby":`lt-color`,onKeyDown:y,children:Zi.map((e,t)=>G(`button`,{type:`button`,class:`sw`,role:`radio`,"aria-checked":t===d,tabIndex:t===d?0:-1,onClick:()=>p({contrast:e.value}),children:[G(`span`,{class:`prev ${e.value}`,style:{background:e.bg,color:e.fg},"aria-hidden":`true`,children:G(`span`,{children:`Aa`})}),r[e.label]]},e.value))}),G(zi,{icon:G(Pi,{}),label:r.desaturate,on:n.desaturate,onChange:e=>p({desaturate:e})}),G(`h3`,{children:r.aids}),G(`div`,{class:`tiles`,children:Fa.map(({key:e,Icon:t})=>G(Li,{icon:G(t,{}),label:r[e],on:n[e],onChange:t=>p({[e]:t})},e))})]})]})}function La(e){let{state:t,t:n,place:r,open:i,axOn:a,triggers:o}=e,s=Oa(t),c=ja(e.dockRef,r.o,()=>e.onOpen(null),e.onMove);ka(e.dockRef,r.x,r.y,[r.o,a===null]);let l=t.status===`playing`,u=l||t.status===`paused`,d=t.issue!==`unsupported`&&t.issue!==`no-content`?e.reader:null,f=Math.max(1,Math.round(t.duration/60)),p=Q(n.sentenceOf,{i:Math.min(t.index+1,t.total),n:t.total}),m=t.voice?$t(t.voice,e.lang).name:n.voice,h=t.engine?.state===`loading`&&u?t.engine.progress:null,g=h!==null,_=g?`${Math.round(h*100)}%`:``,v=Q(n.preparing,{v:m,p:_}),y=h??t.progress,b=Math.max(t.total,1),x=g?` load`:``,S=Q(n.listenFor,{n:f}),C=Q(n.minutes,{n:f});g?(S=`${v} · ${n.preparingSub}`,C=_):u&&(S=`${p} · ${Q(n.left,{t:ia(s)})}`,C=ia(s));function w(t){return()=>e.onOpen(i===t?null:t)}function T(t){if(!d||t.metaKey||t.ctrlKey||t.altKey)return;let n=t.target.tagName===`BUTTON`;if(t.key===`k`||t.key===`K`||t.key===` `&&!n)e.onToggle();else if(t.key===`ArrowLeft`||t.key===`ArrowUp`)d.prev();else if(t.key===`ArrowRight`||t.key===`ArrowDown`)d.next();else return;t.preventDefault()}function E(){e.onMove({x:r.x<.5?0:1,y:.5,o:`v`})}return G(`div`,{class:`dock`,ref:e.dockRef,"data-o":r.o,"data-leave":ba(e.leaving),children:[G(`div`,{class:`rail surface`,role:`region`,"aria-label":n.region,"data-active":u?``:void 0,onKeyDown:T,children:[G(`div`,{class:`grip`,"aria-hidden":`true`,title:n.move,onPointerDown:c,onDblClick:E,children:G(vi,{})}),d&&G(fr,{children:[G(`div`,{class:`xtra`,children:G(`button`,{type:`button`,class:`ghost`,"aria-label":n.prev,"data-tip":n.prev,disabled:g,onClick:()=>d.prev(),children:G(ci,{})})}),G(`div`,{class:`playwrap`,children:[u&&G(`div`,{class:`ring${x}`,role:`progressbar`,"aria-label":n.progress,"aria-valuemin":1,"aria-valuemax":b,"aria-valuenow":Math.min(t.index+1,b),"aria-valuetext":g?v:p,children:G(`svg`,{viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[G(`circle`,{cx:`24`,cy:`24`,r:`22`}),G(`circle`,{cx:`24`,cy:`24`,r:`22`,class:`prg`,"stroke-dasharray":Yi,"stroke-dashoffset":Yi*(1-y)})]})}),G(`button`,{type:`button`,class:`play${x}`,"aria-label":l?n.pause:n.play,"data-tip":S,onClick:e.onToggle,"data-lt":`play`,children:l?G(si,{size:13}):G(oi,{size:14})})]}),G(`span`,{class:`time${x}`,"aria-hidden":`true`,children:C}),G(`div`,{class:`xtra`,children:G(`button`,{type:`button`,class:`ghost`,"aria-label":n.next,"data-tip":n.next,disabled:g,onClick:()=>d.next(),children:G(ci,{ahead:!0})})}),G(`span`,{class:`sep`}),G(`button`,{type:`button`,class:`ghost vb`,ref:o.voice,"aria-label":Q(t.voice?.engine?n.voiceOfHd:n.voiceOf,{v:m}),"aria-expanded":i===`voice`,"aria-haspopup":`dialog`,"data-tip":Q(n.voiceOf,{v:m}),"data-hint":e.hint?``:void 0,"data-lt":`voice`,onClick:w(`voice`),children:[G(li,{}),t.voice?.engine&&G(`i`,{class:`dot`})]}),G(`button`,{type:`button`,class:`speed`,ref:o.speed,"aria-label":`${n.speed}, ${aa(t.rate)}×`,"aria-expanded":i===`speed`,"aria-haspopup":`dialog`,"data-tip":n.speed,onClick:w(`speed`),children:[aa(t.rate),`×`]})]}),G(`button`,{type:`button`,class:`ghost hide`,"aria-label":n.hide,"data-tip":n.hide,onClick:e.onHide,"data-lt":`hide`,children:G(gi,{dir:ha(r)})})]}),a!==null&&G(`button`,{type:`button`,class:`puck surface`,ref:o.ax,"aria-label":a?`${n.a11y}, ${n.on}`:n.a11y,"aria-expanded":i===`ax`,"aria-haspopup":`dialog`,"data-tip":n.a11yTitle,"data-lt":`ax`,onClick:w(`ax`),children:[G(di,{size:18}),a&&G(`i`,{class:`dot`})]})]})}var Ra={passive:!0};function za(e){let t=e.selectionSentence();if(t===null)return null;let n=document.getSelection()?.getRangeAt(0).getBoundingClientRect();if(!n)return null;let{width:r,height:i}=da();return{index:t,x:Math.min(Math.max(8,n.left),r-180),y:Math.min(n.bottom+10,i-110)}}function Ba(e){let{reader:t,t:n,current:r,onPlay:i}=e,[a,o]=J(null),[s,c]=J(null),l=X(null);Y(()=>{if(!window.matchMedia?.(`(hover: hover) and (pointer: fine)`).matches)return;let e=0,n=0,r=0,i=0,a=!1;function s(){n||(n=window.setTimeout(()=>o(null),450))}function c(){if(e=0,a)return;let c=t.sentenceAtPoint(r,i);if(!c||Math.abs(c.rect.top+c.rect.height/2-i)>400){s();return}clearTimeout(n),n=0;let l={index:c.index,x:Math.max(4,c.rect.left-28-10),y:c.rect.top+c.rect.height/2-14};o(e=>Ca(e,l)?e:l)}function u(t){a=!!l.current&&t.composedPath().includes(l.current),r=t.clientX,i=t.clientY,e||(e=requestAnimationFrame(c))}function d(){o(null)}return document.addEventListener(`mousemove`,u,Ra),window.addEventListener(`scroll`,d,Ra),()=>{document.removeEventListener(`mousemove`,u),window.removeEventListener(`scroll`,d),cancelAnimationFrame(e),clearTimeout(n)}},[t]),Y(()=>{let e=0;function n(){clearTimeout(e),e=window.setTimeout(()=>c(za(t)),220)}function r(){c(null)}return document.addEventListener(`selectionchange`,n),window.addEventListener(`scroll`,r,Ra),()=>{document.removeEventListener(`selectionchange`,n),window.removeEventListener(`scroll`,r),clearTimeout(e)}},[t]);function u(){a&&(i(a.index),o(null))}function d(){s&&(i(s.index),c(null))}return G(fr,{children:[G(`button`,{ref:l,type:`button`,class:`here${a&&a.index!==r?` on`:``}`,style:a?{top:`${a.y}px`,left:`${a.x}px`}:{visibility:`hidden`},"aria-label":n.playFromHere,tabIndex:-1,onClick:u,children:G(oi,{size:14})}),s&&G(`button`,{type:`button`,class:`selchip surface`,style:{top:`${s.y}px`,left:`${s.x}px`},onMouseDown:e=>e.preventDefault(),onClick:d,children:[G(`span`,{class:`disc`,children:G(oi,{size:11})}),n.playFromHere]})]})}function Va(){let e=X(null);return Da(t=>{e.current&&(e.current.style.transform=`translateY(${t}px)`)}),G(`div`,{class:`guide`,ref:e,"aria-hidden":`true`})}function Ha(){let e=X(null),t=X(null);return Da(n=>{e.current&&(e.current.style.transform=`translateY(${n-64-da().height}px)`),t.current&&(t.current.style.transform=`translateY(${n+64}px)`)}),G(fr,{children:[G(`div`,{class:`shade`,ref:e,"aria-hidden":`true`}),G(`div`,{class:`shade`,ref:t,"aria-hidden":`true`})]})}function Ua(e){let{reader:t,state:n,t:r,popRef:i,anchor:a,leaving:o}=e,s=X(null),{rate:c}=n,l=(c-dt)/(3-dt)*100;return Y(()=>s.current?.focus(),[]),Aa(i,a),G(`div`,{class:`pop speedpop surface`,role:`dialog`,"aria-label":r.speed,ref:i,"data-leave":ba(o),children:[G(`div`,{class:`label`,children:[r.speed,G(`b`,{children:[aa(c),`×`]})]}),G(`div`,{class:`stepper`,children:[G(`button`,{type:`button`,class:`ghost sm`,"aria-label":r.slower,disabled:c<=dt,onClick:()=>t.setRate(c-ft),children:G(pi,{})}),G(`input`,{ref:s,class:`range`,type:`range`,min:dt,max:3,step:ft,value:c,"aria-label":r.speed,"aria-valuetext":`${aa(c)}×`,style:{"--p":`${l}%`},onInput:e=>t.setRate(Number(e.currentTarget.value))}),G(`button`,{type:`button`,class:`ghost sm`,"aria-label":r.faster,disabled:c>=3,onClick:()=>t.setRate(c+ft),children:G(mi,{})})]}),G(`div`,{class:`presets`,children:Ji.map(e=>G(`button`,{type:`button`,"aria-pressed":c===e,onClick:()=>t.setRate(e),children:[e,`×`]},e))})]})}function Wa(e,t){return typeof e==`number`&&e>=0&&e<=1?e:t}function Ga(e){let t=a(Vi);return s(t)?{x:Wa(t.x,e),y:Wa(t.y,.5),o:t.o===`h`?`h`:`v`,hidden:t.hidden===!0}:{x:e,y:.5,o:`v`,hidden:!1}}function Ka(e){o(Vi,e)}function qa(e){let{reader:t,state:n,t:r,lang:i,popRef:a,anchor:o,leaving:s}=e,c=X(null),l=n.voices.filter(e=>e.engine),u=n.voices.filter(e=>!e.engine),d=[...l,...u],f=l[0]?.downloadBytes??0,p=n.engine?.state===`ready`||!f,m=Math.max(0,d.findIndex(e=>e.id===n.voice?.id)),h=en(d,navigator.userAgent,navigator.maxTouchPoints||0);Aa(a,o),Y(()=>{let e=c.current?.querySelector(`[aria-checked="true"]`);e?.focus({preventScroll:!0}),e?.scrollIntoView?.({block:`nearest`})},[]);function g(e,t,i){if(t.kind===`hd`)return i?Sa(e,n.engine,r):[e.gender&&r[e.gender],t.region].filter(Boolean).join(` · `);let a=t.kind===`online`?r.online:t.kind===`device`?r.device:``;return[t.region,a].filter(Boolean).join(` · `)}function _(e,n){let a=$t(e,i),o=n===m;return G(`button`,{type:`button`,class:`opt`,role:`radio`,"aria-checked":o,tabIndex:o?0:-1,onClick:()=>t.setVoice(e.id),children:[G(`span`,{class:`av`,"aria-hidden":`true`,children:a.name.slice(0,1)}),G(`span`,{class:`n`,children:[G(`b`,{children:[a.name,a.kind===`natural`&&G(`span`,{class:`tag`,children:r.natural})]}),G(`span`,{class:`sub`,children:g(e,a,o)})]}),G(`span`,{class:`tick`,children:G(fi,{})})]},e.id)}function v(e){ga(e,d.length,m,e=>t.setVoice(d[e]?.id??``))}return G(`div`,{class:`pop voicepop surface`,role:`dialog`,"aria-label":r.voice,ref:a,"data-leave":ba(s),children:[d.length?G(`div`,{class:`voices`,role:`radiogroup`,"aria-label":r.voice,ref:c,onKeyDown:v,children:[l.length>0&&G(`div`,{class:`group`,"aria-hidden":`true`,children:[G(`b`,{children:[G(_i,{}),r.hdGroup]}),G(`span`,{children:p?r.hdGroupSub:Q(r.hdGroupDownload,{mb:xa(f)})})]}),l.map(_),l.length>0&&u.length>0&&G(`div`,{class:`group`,"aria-hidden":`true`,children:G(`b`,{children:r.builtInGroup})}),u.map((e,t)=>_(e,t+l.length))]}):n.voicesLoaded&&G(`p`,{class:`empty`,children:r.noVoice}),h&&!l.length&&G(`p`,{class:`tip`,children:r[Xi[h]]})]})}function Ja(e){let{reader:t,ax:n,t:r,lang:i,side:s,accent:c,accentInk:l}=e,u=Ta(t?.store??Qi),d=Ta(n?.store??$i),f=Ma(),[p,m]=J(()=>Ga(s===`left`?0:1)),[h,g]=J(null),[_,v]=J(null),[y,b]=J(``),x=X(null),S=X(null),C=X(null),w=X(null),E=X(u),D={speed:X(null),voice:X(null),ax:X(null)},O=u.status===`playing`,ee=ya(t,u),k=f?Ki:p,A=ma(k),j=d.still,M=Na(!p.hidden,160,j),te=Na(p.hidden,160,j),N=Na(p.hidden?null:h,160,j),P=Na(!p.hidden&&!h?_:null,160,j);function F(e){b(``),setTimeout(()=>b(e),50)}function I(e){v(e),F(e.text)}function ne(e){m(t=>{let n={...t,...e};return Ka(n),n})}function re(e){return e?$t(e,i).name:r.voice}function ie(e){u.status===`playing`&&u.index>=2&&e.index<2&&!_&&!h&&u.voices.length>1&&!u.voice?.engine&&a(`hint-voice`)!==!0&&(o(Hi,!0),I({text:u.voices.some(e=>e.engine)?r.tryHd:Q(r.tryVoice,{n:u.voices.length}),voiceHint:!0,action:{label:r.chooseVoice,run:()=>g(`voice`)}}))}if(Y(()=>{let e=E.current;E.current=u,e.status!==u.status&&(u.status===`playing`?F(r.playing):u.status===`paused`?F(r.paused):u.status===`ended`&&F(r.finished)),e.rate!==u.rate&&F(Q(r.speedSet,{r:aa(u.rate)})),e.voice&&u.voice&&e.voice.id!==u.voice.id&&F(Q(r.voiceSet,{v:re(u.voice)})),u.fallback&&u.fallback!==e.fallback&&I({text:Q(u.fallback.reason===`slow`?r.hdSlow:r.hdFailed,{v:re(u.fallback.voice)})}),u.issue===`not-allowed`&&e.issue!==`not-allowed`&&I({text:r.notAllowed,action:{label:r.play,run:()=>t?.play()}}),ie(e)},[u]),Y(()=>{if(!_)return;let e=setTimeout(()=>v(null),Gi);return()=>clearTimeout(e)},[_]),Ea(h!==null,[C,D.speed,D.voice,D.ax],()=>g(null)),Aa(w,S),!ee&&!n)return null;function ae(){let e=h&&D[h];g(null),e?.current?.focus()}function oe(){if(!t)return;if(O){t.pause();return}let e=u.resume;e?(t.play(e.index),I({text:Q(r.resumed,{p:Math.round(e.progress*100)}),action:{label:r.startOver,run:()=>t.play(0)}})):t.play()}function se(){g(null),v(null),ne({hidden:!0}),wa(x.current,`[data-lt="show"]`)}function L(){ne({hidden:!1}),wa(x.current,`[data-lt="hide"]`)}function R(e){e.key===`Escape`&&h&&(e.preventDefault(),ae())}function ce(){_?.action?.run(),v(null)}let z=P.shown;return G(`div`,{class:`lt`,ref:x,"data-side":A,"data-still":j?``:void 0,style:{"--a":c,"--ai":l},onKeyDown:R,children:[d.guide&&G(Va,{}),d.mask&&G(Ha,{}),te.shown&&G(`button`,{type:`button`,class:`tab surface${O?` on`:``}`,"aria-label":r.show,style:{"--x":k.x,"--y":k.y},"data-lt":`show`,"data-leave":ba(te.leaving),tabIndex:te.leaving?-1:void 0,onClick:L,children:O?G(Fi,{}):G(gi,{dir:qi[A]})}),M.shown&&G(La,{reader:t,state:u,t:r,lang:i,place:k,open:h,leaving:M.leaving,hint:!!z?.voiceHint&&!P.leaving,axOn:n?!T(d):null,dockRef:S,triggers:D,onToggle:oe,onOpen:g,onHide:se,onMove:ne}),N.shown===`speed`&&t&&G(Ua,{reader:t,state:u,t:r,popRef:C,anchor:D.speed,leaving:N.leaving}),N.shown===`voice`&&t&&G(qa,{reader:t,state:u,t:r,lang:i,popRef:C,anchor:D.voice,leaving:N.leaving}),N.shown===`ax`&&n&&G(Ia,{ax:n,s:d,t:r,panelRef:C,anchor:D.ax,onClose:ae,announce:F,leaving:N.leaving}),z&&G(`div`,{class:`toast surface`,ref:w,"data-leave":ba(P.leaving),children:[z.voiceHint&&G(_i,{size:16}),G(`span`,{children:z.text}),z.action&&G(`button`,{type:`button`,class:`btn primary`,onClick:ce,children:z.action.label}),G(`button`,{type:`button`,class:`ghost sm`,"aria-label":r.dismiss,onClick:()=>v(null),children:G(ui,{size:16})})]}),ee&&t&&G(Ba,{reader:t,t:r,current:O?u.index:null,onPlay:e=>t.play(e)}),G(`div`,{class:`sr`,role:`status`,"aria-live":`polite`,children:y})]})}var Ya=`:host{all:initial}.lt{--bg:#161513;--bg2:#201e1b;--bg3:#2c2a26;--ln:rgba(255,244,228,.08);--ln2:rgba(255,244,228,.16);--tx:#f7f4ee;--mu:#aba69c;--hv:rgba(255,244,228,.07);--sh:0 1px 2px rgba(0,0,0,.2),0 18px 44px -10px rgba(0,0,0,.5);--ease:cubic-bezier(.2,.8,.2,1);--out:cubic-bezier(.4,0,1,1);--gap:12px;--cell:32px;--pad:4px;--rw:calc(var(--cell) + var(--pad)*2);--dx:16px;--dy:0px;--safe:env(safe-area-inset-bottom,0px);color-scheme:dark;font:400 14px/1.4 ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;color:var(--tx);letter-spacing:normal;word-spacing:normal;text-align:left;text-transform:none;white-space:normal;font-style:normal;direction:ltr;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.lt[data-side=left]{--dx:-16px}.lt[data-side=top]{--dx:0px;--dy:-16px}.lt[data-side=bottom]{--dx:0px;--dy:16px}.lt *,.lt *:before,.lt *:after{box-sizing:border-box}:where(.lt) :where(button,input,h2,h3,p){font:inherit;color:inherit;letter-spacing:inherit;margin:0}:where(.lt) button{background:none;border:0;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation;user-select:none;-webkit-user-select:none;transition:background-color .15s,color .15s,border-color .15s,transform .16s var(--ease),opacity .15s}:where(.lt) button:where(:active:not(:disabled)){transform:scale(.94)}:where(.lt) button:where(:disabled){cursor:default}.lt :focus{outline:none}.lt :focus-visible{outline:2px solid #fff;outline-offset:0;box-shadow:0 0 0 4px #0b0b0d}.lt svg{display:block;flex:none}.sr{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.surface{background:var(--bg);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:auto}.ghost{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;color:var(--tx)}.ghost.sm{width:32px;height:32px}.ghost:disabled{opacity:.35}@media(hover:hover){.ghost:not(:disabled):hover,.opt:hover{background:var(--hv)}}.dock{position:fixed;left:0;top:0;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;animation:lt-in .36s var(--ease) both}.dock[data-ready]{transition:left .32s var(--ease),top .32s var(--ease)}.dock[data-o=h]{flex-direction:row}.dock[data-drag]{transition:none}.dock[data-leave]{animation:lt-out .16s var(--out) both}.dock[data-leave] *{pointer-events:none!important}.rail{width:var(--rw);padding:var(--pad) 0;border-radius:calc(var(--rw)/2);display:flex;flex-direction:column;align-items:center}.dock[data-o=h] .rail{width:auto;height:var(--rw);padding:0 var(--pad);flex-direction:row}.rail .ghost,.grip,.playwrap,.time,.speed,.hide{width:var(--cell);height:var(--cell);flex:none}.dock[data-drag] .rail,.dock[data-drag] .puck{box-shadow:0 1px 2px #0003,0 26px 60px -12px #0009}.grip{display:grid;place-items:center;color:var(--mu);opacity:.6;cursor:grab;touch-action:none;transition:opacity .15s}.dock[data-o=v] .grip svg{transform:rotate(90deg)}@media(hover:hover){.grip:hover{opacity:1}}.dock[data-drag] .grip{cursor:grabbing;opacity:1}.xtra{display:flex;flex:none;max-height:var(--cell);max-width:var(--cell);overflow:hidden;transition:max-height .34s var(--ease),max-width .34s var(--ease),opacity .22s .1s}.rail:not([data-active]) .xtra{opacity:0;visibility:hidden;transition:max-height .3s var(--ease),max-width .3s var(--ease),opacity .1s,visibility 0s .3s}.dock[data-o=v] .rail:not([data-active]) .xtra{max-height:0}.dock[data-o=h] .rail:not([data-active]) .xtra{max-width:0}.playwrap{position:relative;display:grid;place-items:center}.play{width:calc(var(--cell) - 6px);height:calc(var(--cell) - 6px);border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;box-shadow:0 3px 10px -4px color-mix(in srgb,var(--a) 75%,transparent);transition:width .3s var(--ease),height .3s var(--ease),transform .16s var(--ease),background-color .2s,color .2s}.play.load{background:var(--bg3);color:var(--a);box-shadow:none}.play svg{animation:lt-swap .2s var(--ease)}.ring{position:absolute;inset:0;pointer-events:none;animation:lt-fade .3s both}.ring svg{width:100%;height:100%;transform:rotate(-90deg)}.ring circle{fill:none;stroke:var(--ln2);stroke-width:2.5}.ring .prg{stroke:var(--a);stroke-linecap:round;transition:stroke-dashoffset .6s var(--ease)}.ring.load .prg{animation:lt-breathe 1.6s ease-in-out infinite}.time{display:grid;place-items:center;font-size:10px;font-weight:600;letter-spacing:-.02em;color:var(--mu);font-variant-numeric:tabular-nums;white-space:nowrap;transition:color .2s}.time.load{color:var(--a)}.sep{width:16px;height:1px;flex:none;background:var(--ln2);margin:var(--pad) 0}.dock[data-o=h] .sep{width:1px;height:16px;margin:0 var(--pad)}.vb{position:relative}.vb[aria-expanded=true]{background:var(--hv)}.vb[data-hint]{background:color-mix(in srgb,var(--a) 16%,transparent);color:var(--a);box-shadow:0 0 0 2px color-mix(in srgb,var(--a) 40%,transparent)}.speed{border-radius:50%;font-size:10px;font-weight:700;letter-spacing:-.03em;font-variant-numeric:tabular-nums;white-space:nowrap}.speed[aria-expanded=true]{background:var(--hv)}.hide{color:var(--mu)}.dot{position:absolute;top:5px;right:4px;width:6px;height:6px;border-radius:50%;background:var(--a);box-shadow:0 0 0 2px var(--bg);animation:lt-pop-dot .25s var(--ease)}.puck{position:relative;width:var(--rw);height:var(--rw);flex:none;border-radius:14px;display:grid;place-items:center;color:var(--tx)}.puck[aria-expanded=true]{background:var(--bg3);border-color:var(--ln2)}.puck .dot{top:7px;right:7px;width:7px;height:7px}.puck[aria-expanded=true] .dot{box-shadow:0 0 0 2px var(--bg3)}@media(hover:hover){.speed:hover{background:var(--hv)}.hide:hover{color:var(--tx)}.puck:not([aria-expanded=true]):hover{background:var(--bg2)}}@media(hover:hover)and (pointer:fine){.dock [data-tip]:after{content:attr(data-tip);position:absolute;top:50%;right:calc(100% + 14px);padding:6px 10px;border-radius:9px;background:var(--bg);border:1px solid var(--ln2);box-shadow:var(--sh);color:var(--tx);font-size:12.5px;font-weight:500;letter-spacing:0;white-space:nowrap;pointer-events:none;opacity:0;transform:translate(4px,-50%);transition:opacity .12s,transform .15s var(--ease)}.dock [data-tip]{position:relative}.dock [data-tip]:hover:after{opacity:1;transform:translateY(-50%);transition-delay:.4s}.lt[data-side=left] .dock [data-tip]:after{right:auto;left:calc(100% + 14px);transform:translate(-4px,-50%)}.lt[data-side=left] .dock [data-tip]:hover:after{transform:translateY(-50%)}.lt[data-side=bottom] .dock [data-tip]:after,.lt[data-side=top] .dock [data-tip]:after{right:auto;left:50%;top:auto;bottom:calc(100% + 14px);transform:translate(-50%,4px)}.lt[data-side=top] .dock [data-tip]:after{bottom:auto;top:calc(100% + 14px);transform:translate(-50%,-4px)}.lt[data-side=bottom] .dock [data-tip]:hover:after,.lt[data-side=top] .dock [data-tip]:hover:after{transform:translate(-50%)}.dock[data-drag] [data-tip]:after,.dock [aria-expanded=true]:after{display:none}}.tab{position:fixed;top:clamp(40px,calc(var(--y,.5)*100%),calc(100% - 40px));right:0;width:28px;height:56px;transform:translateY(-50%);border-radius:14px 0 0 14px;border-right:0;display:grid;place-items:center;color:var(--tx);transition:width .2s var(--ease),height .2s var(--ease);animation:lt-tab .3s .08s var(--ease) both}.lt[data-side=left] .tab{right:auto;left:0;border-radius:0 14px 14px 0;border-right:1px solid var(--ln);border-left:0}.lt[data-side=bottom] .tab,.lt[data-side=top] .tab{top:auto;bottom:0;right:auto;left:clamp(40px,calc(var(--x,.5)*100%),calc(100% - 40px));width:56px;height:28px;transform:translate(-50%);border-radius:14px 14px 0 0;border:1px solid var(--ln);border-bottom:0}.lt[data-side=top] .tab{bottom:auto;top:0;border-radius:0 0 14px 14px;border-top:0;border-bottom:1px solid var(--ln)}.tab:active{transform:translateY(-50%)}.lt[data-side=bottom] .tab:active,.lt[data-side=top] .tab:active{transform:translate(-50%)}.tab[data-leave]{animation:lt-tab-out .14s var(--out) both;pointer-events:none}@media(hover:hover){.lt[data-side=left] .tab:hover,.lt[data-side=right] .tab:hover{width:34px}.lt[data-side=bottom] .tab:hover,.lt[data-side=top] .tab:hover{height:34px}}.pop,.toast{position:fixed;top:var(--top,50%);left:var(--left,auto);animation:lt-pop .22s var(--ease) both}.pop[data-leave],.toast[data-leave]{animation:lt-pop-out .14s var(--out) both;pointer-events:none}.pop{width:min(320px,calc(100% - 24px));max-height:calc(100% - 24px);border-radius:20px;display:flex;flex-direction:column}.speedpop{width:min(300px,calc(100% - 24px));padding:16px 16px 14px}.label{display:flex;justify-content:space-between;align-items:baseline;font-size:12.5px;font-weight:600;color:var(--mu);margin-bottom:8px}.label b{font-size:15px;font-weight:650;color:var(--tx);font-variant-numeric:tabular-nums}.stepper{display:flex;align-items:center;gap:8px}.range{flex:1;-webkit-appearance:none;appearance:none;height:28px;background:transparent;cursor:pointer}.range::-webkit-slider-runnable-track{height:4px;border-radius:4px;background:linear-gradient(to right,var(--a) var(--p),var(--ln2) var(--p))}.range::-moz-range-track{height:4px;border-radius:4px;background:linear-gradient(to right,var(--a) var(--p),var(--ln2) var(--p))}.range::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;margin-top:-7px;border-radius:50%;background:#fff;border:0;box-shadow:0 1px 4px #00000073}.range::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#fff;border:0;box-shadow:0 1px 4px #00000073}.range:focus-visible{box-shadow:none;outline:2px solid #fff;outline-offset:2px;border-radius:6px}.presets{display:flex;gap:4px;margin-top:8px}.presets button{flex:1;height:30px;border-radius:9px;font-size:12.5px;font-weight:600;color:var(--mu);font-variant-numeric:tabular-nums}.presets button[aria-pressed=true]{background:var(--bg3);color:var(--tx)}@media(hover:hover){.presets button:hover{color:var(--tx)}}.voicepop{padding:6px}.voices{display:flex;flex-direction:column;gap:2px;min-height:0;max-height:min(540px,calc(100vh - 40px));overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,244,228,.22) transparent;scroll-padding-top:58px}.group{position:sticky;top:0;z-index:1;display:flex;flex-direction:column;gap:1px;padding:10px 10px 6px;background:var(--bg)}.group+.opt{margin-top:0}.opt+.group{margin-top:6px;box-shadow:0 -1px 0 var(--ln)}.group b{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;color:var(--mu)}.group b svg{color:var(--a)}.group:first-child b{color:var(--tx)}.group span{font-size:11.5px;color:var(--mu);opacity:.8}.opt{display:flex;align-items:center;gap:11px;width:100%;min-height:50px;padding:6px 10px;border-radius:14px;text-align:left}.opt[aria-checked=true]{background:var(--bg2)}.av{flex:none;width:32px;height:32px;border-radius:50%;background:var(--bg3);display:grid;place-items:center;font-size:13.5px;font-weight:700;color:var(--tx);transition:background-color .2s,color .2s}.opt[aria-checked=true] .av{background:var(--a);color:var(--ai)}.opt .n{flex:1;min-width:0}.opt .n b{display:block;font-weight:600;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.opt .sub{display:block;font-size:12px;color:var(--mu);margin-top:1px}.opt .tick{color:var(--a);opacity:0;transform:scale(.6);transition:opacity .15s,transform .2s var(--ease)}.opt[aria-checked=true] .tick{opacity:1;transform:none}.tag{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:5px;font-size:10.5px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;vertical-align:1px;color:var(--a);background:color-mix(in srgb,var(--a) 16%,transparent)}.empty,.tip{font-size:12.5px;color:var(--mu);line-height:1.5}.empty{padding:10px}.tip{margin:6px;padding:10px 12px;border-radius:12px;background:var(--bg2)}.panel{width:min(368px,calc(100% - 24px))}.phead{display:flex;align-items:center;gap:4px;padding:12px 10px 4px 18px}.phead h2{flex:1;font-size:16px;font-weight:650;letter-spacing:-.01em}.reset{height:30px;padding:0 12px;border-radius:999px;font-size:13px;font-weight:600;color:var(--a)}.reset:disabled{color:var(--mu);opacity:.5}@media(hover:hover){.reset:not(:disabled):hover{background:var(--hv)}}.body{overflow:auto;padding:0 14px 16px;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,244,228,.22) transparent}.panel h3{margin:16px 2px 8px;font-size:12.5px;font-weight:600;color:var(--mu)}.chips{display:flex;flex-wrap:wrap;gap:6px}.pchip{height:34px;padding:0 13px 0 10px;border-radius:999px;display:flex;align-items:center;gap:7px;font-size:13px;font-weight:600;background:var(--bg2);border:1px solid var(--ln)}.pchip svg{color:var(--mu)}.pchip[aria-pressed=true]{background:var(--a);color:var(--ai);border-color:transparent}.pchip[aria-pressed=true] svg{color:inherit}@media(hover:hover){.pchip[aria-pressed=false]:hover{border-color:var(--ln2)}}.hint{margin:8px 2px 0;min-height:36px;font-size:12.5px;line-height:1.45;color:var(--mu)}.size{display:flex;align-items:center;gap:6px;padding:6px;border-radius:14px;background:var(--bg2);border:1px solid var(--ln);margin-bottom:6px}.step{width:44px;height:44px;border-radius:10px;background:var(--bg3);display:grid;place-items:center}.step:disabled{opacity:.35}@media(hover:hover){.step:not(:disabled):hover{background:#33333b}}.step .a{font-weight:700;line-height:1}.step .sm{font-size:13px}.step .lg{font-size:20px}.val{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px}.val span{font-size:11.5px;color:var(--mu)}.val b{font-size:15px;font-weight:650;font-variant-numeric:tabular-nums;line-height:1.1}.pips{display:flex;gap:3px}.pips i{display:block;width:12px;height:3px;border-radius:2px;background:var(--ln2);transition:background-color .15s}.pips i.f{background:var(--a)}.tiles{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.tiles.two{grid-template-columns:repeat(2,1fr)}.tile{position:relative;min-height:76px;padding:12px 6px 10px;border-radius:14px;background:var(--bg2);border:1px solid var(--ln);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;font-size:12.5px;font-weight:600;line-height:1.2;text-align:center}.tile svg{color:var(--mu);transition:color .15s}.tile[aria-checked=true],.tile[data-on]{background:color-mix(in srgb,var(--a) 15%,var(--bg2));border-color:color-mix(in srgb,var(--a) 65%,transparent)}.tile[aria-checked=true] svg,.tile[data-on] svg{color:var(--a)}.tile .ck{position:absolute;top:7px;right:7px;width:16px;height:16px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;transform:scale(0);transition:transform .18s var(--ease)}.tile[aria-checked=true] .ck{transform:scale(1)}.tile .ck svg{color:inherit;stroke-width:3.2}.tl{display:flex;flex-direction:column;align-items:center;gap:6px}.tiles.two .tile{flex-direction:row;justify-content:flex-start;min-height:54px;padding:8px 12px;gap:10px;text-align:left}.tiles.two .tl{align-items:flex-start;gap:5px}@media(hover:hover){.tile:hover{border-color:var(--ln2)}}.swatches{display:grid;grid-template-columns:repeat(5,1fr);gap:4px}.sw{display:flex;flex-direction:column;align-items:center;gap:6px;padding:6px 2px 7px;border-radius:12px;font-size:11.5px;font-weight:600;color:var(--mu);white-space:nowrap}.sw .prev{width:100%;max-width:48px;aspect-ratio:1;border-radius:11px;display:grid;place-items:center;font-size:16px;font-weight:700;border:1px solid var(--ln2);transition:box-shadow .15s}.sw .invert span{background:linear-gradient(135deg,#18181b 50%,#f4f4f5 50%);-webkit-background-clip:text;background-clip:text}.sw[aria-checked=true]{color:var(--tx)}.sw[aria-checked=true] .prev{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--a)}@media(hover:hover){.sw[aria-checked=false]:hover{color:var(--tx)}}.toggle{display:flex;align-items:center;gap:10px;width:100%;min-height:46px;margin-top:6px;padding:0 12px;border-radius:14px;background:var(--bg2);border:1px solid var(--ln);font-size:13px;font-weight:600;text-align:left}.toggle svg{color:var(--mu)}.toggle span:first-of-type{flex:1}.knobs{position:relative;flex:none;width:36px;height:22px;border-radius:999px;background:var(--bg3);transition:background-color .18s}.knobs:after{content:"";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .2s var(--ease)}.toggle[aria-checked=true] .knobs{background:var(--a)}.toggle[aria-checked=true] .knobs:after{transform:translate(14px)}.toast{max-width:min(340px,calc(100% - 24px));display:flex;align-items:center;gap:8px;padding:6px 6px 6px 14px;border-radius:16px;font-size:13px;font-weight:500}.toast span{flex:1;min-width:0}.btn{height:32px;padding:0 12px;border-radius:999px;font-size:13px;font-weight:600;white-space:nowrap}.btn.primary{background:var(--a);color:var(--ai)}.bars{display:inline-flex;align-items:center;gap:2px;height:12px}.bars i{display:block;width:2.5px;height:100%;border-radius:2px;background:var(--a);transform:scaleY(.35);transform-origin:50% 50%}.on .bars i{animation:lt-bar .9s ease-in-out infinite alternate}.on .bars i:nth-child(2){animation-delay:-.45s;animation-duration:.7s}.on .bars i:nth-child(3){animation-delay:-.2s;animation-duration:1.1s}.on .bars i:nth-child(4){animation-delay:-.6s;animation-duration:.8s}.here{position:fixed;top:0;left:0;width:28px;height:28px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;box-shadow:0 4px 12px -2px #00000059;pointer-events:auto;opacity:0;transform:scale(.6);transition:opacity .15s,transform .18s var(--ease)}.here.on{opacity:1;transform:scale(1)}.selchip{position:fixed;top:0;left:0;height:34px;padding:0 13px 0 9px;border-radius:999px;display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;animation:lt-in-soft .2s var(--ease) both}.selchip .disc{width:20px;height:20px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center}.guide{position:fixed;left:0;right:0;top:0;height:30px;margin-top:-15px;pointer-events:none;background:#ffd65a29;border-top:2px solid rgba(240,180,0,.85);border-bottom:2px solid rgba(240,180,0,.85);will-change:transform}.shade{position:fixed;left:0;right:0;top:0;height:100%;pointer-events:none;background:#08080aa8;will-change:transform}@keyframes lt-in{0%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.96)}}@keyframes lt-out{to{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.96)}}@keyframes lt-tab{0%{opacity:0}}@keyframes lt-tab-out{to{opacity:0}}@keyframes lt-pop{0%{opacity:0;transform:translate(var(--px,0px),var(--py,0px)) scale(.97)}}@keyframes lt-pop-out{to{opacity:0;transform:translate(calc(var(--px,0px)*.6),calc(var(--py,0px)*.6)) scale(.98)}}@keyframes lt-sheet{0%{opacity:0;transform:translateY(24px)}}@keyframes lt-sheet-out{to{opacity:0;transform:translateY(16px)}}@keyframes lt-in-soft{0%{opacity:0;transform:translateY(8px) scale(.97)}}@keyframes lt-swap{0%{opacity:0;transform:scale(.7)}}@keyframes lt-fade{0%{opacity:0}}@keyframes lt-pop-dot{0%{transform:scale(0)}}@keyframes lt-bar{to{transform:scaleY(1)}}@keyframes lt-breathe{50%{opacity:.45}}@media(max-width:540px){.lt{--gap:8px;--cell:40px}.grip{display:none}.speed,.time{font-size:11px}.puck{border-radius:16px}.pop,.toast{top:auto;bottom:calc(8px + var(--safe));left:8px;right:8px;width:auto;max-width:none;transform-origin:center bottom;animation-name:lt-sheet}.pop[data-leave],.toast[data-leave]{animation-name:lt-sheet-out}.pop{max-height:min(80vh,640px);border-radius:24px}}@media(prefers-reduced-motion:reduce){.lt *,.lt *:before,.lt *:after{animation-duration:0s!important;animation-delay:0s!important;transition-duration:0s!important;transition-delay:0s!important}}.lt[data-still] *,.lt[data-still] *:before,.lt[data-still] *:after{animation-duration:0s!important;animation-delay:0s!important;transition-duration:0s!important;transition-delay:0s!important}@media print{.lt{display:none!important}}@media(forced-colors:active){.surface,.play,.speed,.pchip,.tile,.size,.toggle,.sw .prev,.disc{border:1px solid CanvasText}.ring .prg,.pips i.f,.knobs,.dot{background:Highlight;stroke:Highlight}.tile[aria-checked=true],.tile[data-on],.pchip[aria-pressed=true]{outline:2px solid Highlight}}`;function Xa(e,r,i,a){let o=e.createElement(Bi),s=o.attachShadow({mode:`open`}),c=e.createElement(`div`),l=va(Ae(r.color,e)??ue);return n(o,`${Ui};z-index:${r.zIndex}`),s.append(t(e,Ya,r.nonce),c),e.documentElement.append(o),Mr(G(Ja,{reader:i,ax:a,t:na(r.lang),lang:r.lang,side:r.position,accent:V(l),accentInk:V(Pe(l))}),c),{destroy(){Mr(null,c),o.remove()}}}var Za=null,$=null,Qa=null,$a=null,eo=le(),to=[];function no(){$a?.destroy(),$?.destroy(),Qa?.destroy(),$a=$=Qa=null,Za=null}var ro=R(`registerVoices`,function(e){to.some(t=>t.id===e.id)||(to.push(e),$?.addEngine(e))}),io=R(`init`,function(e){if(Za){L(`init() called twice; call destroy() first. Ignoring.`);return}let t=he(e);Za=t;try{if(t.features.a11y&&(oe(document,t.nonce),Qa=se(document,t.nonce)),t.features.tts){let e=Jn(t,eo.emit);$=e;for(let t of to)e.addEngine(t)}($||Qa)&&($a=Xa(document,t,$,Qa))}catch(e){throw no(),e}}),ao=R(`destroy`,function(){no(),eo.clear()}),oo=R(`play`,function(){Za?$?$.play():L(`play() ignored: the tts feature is disabled.`):L(`play() called before init().`)}),so=R(`pause`,function(){$?.pause()}),co=R(`on`,function(e,t){return eo.on(e,t)});window.__lantunVoices?.splice(0).forEach(ro);var lo=document.currentScript,uo=lo?ge(lo.dataset):{};lo?.nonce&&(uo.nonce=lo.nonce);try{uo.features?.a11y!==!1&&oe(document,uo.nonce??null)}catch(e){console.warn(`[Lantun]`,e)}function fo(){io(uo)}return lo?.dataset.autoInit!==`false`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,fo,{once:!0}):fo()),e.destroy=ao,e.init=io,e.on=co,e.pause=so,e.play=oo,e.registerVoices=ro,e})({});
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "lantun",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Add read-aloud to any website with one script tag: text-to-speech with word highlighting, plus reading aids for low vision, dyslexia and ADHD. No build step, no backend.",
5
+ "keywords": [
6
+ "text-to-speech",
7
+ "tts",
8
+ "read-aloud",
9
+ "accessibility",
10
+ "a11y",
11
+ "widget",
12
+ "script-tag",
13
+ "cdn"
14
+ ],
15
+ "license": "MIT",
16
+ "author": "rizkianakbar",
17
+ "homepage": "https://lantun.rzknkbr.xyz",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/rizkianakbar/lantun.git",
21
+ "directory": "apps/cdn"
22
+ },
23
+ "bugs": "https://github.com/rizkianakbar/lantun/issues",
24
+ "type": "module",
25
+ "unpkg": "dist/widget.js",
26
+ "jsdelivr": "dist/widget.js",
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "devDependencies": {
34
+ "@lantun/core": "^0.1.1",
35
+ "@lantun/voice-kitten": "^0.1.1",
36
+ "@size-limit/file": "^14.3.0",
37
+ "size-limit": "^14.3.0",
38
+ "typescript": "^7.0.2",
39
+ "vite": "^8.3.5"
40
+ },
41
+ "size-limit": [
42
+ {
43
+ "path": "dist/widget.js",
44
+ "limit": "40 KB",
45
+ "gzip": true
46
+ },
47
+ {
48
+ "path": "dist/voice-kitten.js",
49
+ "limit": "8 KB",
50
+ "gzip": true
51
+ }
52
+ ],
53
+ "scripts": {
54
+ "build": "vite build && vite build -c vite.voice.config.ts",
55
+ "typecheck": "tsc --noEmit",
56
+ "size": "size-limit",
57
+ "serve": "vite preview --port 4173 --strictPort"
58
+ }
6
59
  }