@axceera/playstep 0.0.0-stage → 0.2.0
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 +19 -0
- package/README.md +46 -2
- package/dist/capture-Cg3cKBI_.js +13 -0
- package/dist/cdn/capture.js +13 -0
- package/dist/cdn/launcher.js +1 -0
- package/dist/cdn/loader.js +1 -0
- package/dist/cdn/ui.js +1 -0
- package/dist/index.d.ts +189 -0
- package/dist/index.js +1 -0
- package/dist/launcher-button-CbdJMLHL.js +1 -0
- package/dist/text-rFw_ND9o.js +1 -0
- package/dist/ui-DrNa6Tw8.js +1 -0
- package/dist/util-D4Lqh5GT.js +1 -0
- package/package.json +54 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PlayStep
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
6
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
7
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
11
|
+
Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
14
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
15
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
16
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
|
+
|
|
18
|
+
Icons: Lucide (https://lucide.dev), ISC License. Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022
|
|
19
|
+
as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
package/README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @axceera/playstep
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Playable, video-first guides for any web app. Each step shows a few seconds of exactly what to do, spotlights the
|
|
4
|
+
real button, and checks itself off when the user does it.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @axceera/playstep
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { playstep } from '@axceera/playstep'
|
|
12
|
+
|
|
13
|
+
playstep.init({ appKey: 'ps_pub_xxx' })
|
|
14
|
+
playstep.identify(user.id, { plan: user.plan }) // the id is hashed before it leaves the browser
|
|
15
|
+
playstep.track('invoice_page_opened') // starts guides and completes `event` steps
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Mark the elements your guides point at with `data-guide`:
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<button data-guide="new-invoice-btn">New invoice</button>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Other calls: `playstep.start(guideId)`, `playstep.complete(stepId)`, `playstep.page(path)`,
|
|
25
|
+
`playstep.openLauncher()` (the list of guides people can replay, from your own menu), `playstep.resetProgress(guideId?)`
|
|
26
|
+
(let guides start again, keeping the user) and `playstep.reset()` (on sign-out).
|
|
27
|
+
|
|
28
|
+
## Script tag
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<script async src="https://cdn.playstep.app/sdk/v1/loader.js" data-app-key="ps_pub_xxx"></script>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
To pin a version, use its immutable path with the `integrity` hash from the release's `manifest.json`. The loader
|
|
35
|
+
carries the hashes of the chunks it loads, so pinning it covers everything that runs:
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<script async src="https://cdn.playstep.app/sdk/0.2.0/loader.js" integrity="sha384-…" crossorigin="anonymous"
|
|
39
|
+
data-app-key="ps_pub_xxx"></script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- About 3 KB gzipped until a guide shows; the guide UI (under 20 KB) loads only then.
|
|
43
|
+
- Renders in its own Shadow DOM: no CSS leaks in or out, and it never shifts your layout.
|
|
44
|
+
- Fails silent: if PlayStep cannot load, your app behaves as if it were not installed.
|
|
45
|
+
- No `eval`, no inline scripts: works under a strict Content Security Policy.
|
|
46
|
+
|
|
47
|
+
Docs: https://playstep.app/docs/sdk/web · React: [`@axceera/playstep-react`](https://www.npmjs.com/package/@axceera/playstep-react)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const e=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,t=/\+?\(?\d[\d\s().-]{5,}\d/g,n=/\d{6,}/g,r=/\b(?=[\w-]*\d)[\w-]{24,}\b/g;function i(i){return[e,r,n].some(e=>new RegExp(e.source).test(i))||[...i.matchAll(t)].some(e=>e[0].replace(/\D/g,``).length>=7)}function a(i){if(!i)return``;let a=i.replace(/\s+/g,` `).trim().replace(e,`[email]`).replace(r,`[id]`).replace(t,e=>e.replace(/\D/g,``).length>=7?`[number]`:e).replace(n,`[number]`);return a.length>80?`${a.slice(0,79)}…`:a}function o(e=80){let t=/^(:|radix-|headlessui-|react-|ember\d|mui-|v-|css-|sc-|jsx-)|\d{3,}|[a-f0-9]{8,}|__/i,n=/active|selected|current|open|hover|focus|disabled|hidden|show|visible|checked|loading/i,r=e=>(e??``).replace(/\s+/g,` `).trim().slice(0,80),i=e=>`"${e.replace(/["\\]/g,`\\$&`)}"`,a=e=>CSS.escape(e),o=e=>{try{return document.querySelectorAll(e).length===1}catch{return!1}},s=e=>{let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return n.visibility!==`hidden`&&n.display!==`none`&&Number(n.opacity||1)>.05},c=e=>{let t=e.getAttribute(`role`),n=e.tagName,r=(e.getAttribute(`type`)??``).toLowerCase();return t===`tab`||t===`menuitem`||t===`link`||t===`button`?t:t===`checkbox`||t===`switch`||n===`INPUT`&&(r===`checkbox`||r===`radio`)?`checkbox`:n===`A`?`link`:n===`BUTTON`||n===`SUMMARY`||n===`INPUT`&&/^(submit|button|reset|image)$/.test(r)?`button`:n===`SELECT`?`select`:n===`INPUT`||n===`TEXTAREA`?`input`:`other`},l=e=>{let r=e.tagName.toLowerCase(),s=[];e.id&&!t.test(e.id)&&s.push(`#${a(e.id)}`);for(let t of[`data-testid`,`data-test`,`data-cy`,`data-qa`]){let n=e.getAttribute(t);n&&s.push(`[${t}=${i(n)}]`)}for(let t of[`aria-label`,`name`,`title`,`placeholder`]){let n=e.getAttribute(t);n&&n.length<=80&&s.push(`${r}[${t}=${i(n)}]`)}let c=e.getAttribute(`href`);r===`a`&&c&&!/^javascript:/i.test(c)&&c.length<=200&&s.push(`a[href=${i(c)}]`);let l=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!t.test(e)&&!n.test(e));l.length&&s.push(`${r}.${l.slice(0,3).map(a).join(`.`)}`);for(let e of s)if(o(e))return e;let u=[],d=e;for(;d&&u.length<7;){if(d===document.body){u.unshift(`body`);break}if(d!==e&&d.id&&!t.test(d.id)){u.unshift(`#${a(d.id)}`);break}let n=d.tagName.toLowerCase(),r=d.parentElement?[...d.parentElement.children].filter(e=>e.tagName===d.tagName):[];u.unshift(r.length>1?`${n}:nth-of-type(${r.indexOf(d)+1})`:n),d=d.parentElement}let f=u.join(`>`);return o(f)?f:void 0},u=e=>{let t=e.getAttribute(`aria-label`)||e.getAttribute(`title`);if(t)return t;let n=e.getAttribute(`aria-labelledby`);if(n)return n.split(/\s+/).map(e=>document.getElementById(e)?.textContent??``).join(` `);let r=e.labels;return r?.length?r[0].innerText:``},d=[...document.querySelectorAll(`a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],[data-guide]`)].filter(e=>!e.closest(`[data-private],[aria-hidden=true],[inert]`)&&s(e)&&!e.parentElement?.closest(`a[href],button,[role=button],[role=link]`)).map((e,t)=>{let n=e.getBoundingClientRect(),r=n.bottom>0&&n.top<innerHeight;return{e,i:t,score:(e.hasAttribute(`data-guide`)?0:2)+ +!r}}).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,e).sort((e,t)=>e.i-t.i),f=[];for(let{e}of d){let t=c(e),n=e.getAttribute(`data-guide`),i=t===`input`||t===`select`?``:r(e.innerText||e.textContent),a=r(u(e))||(e.tagName===`INPUT`&&t===`button`?r(e.value):``),o=r(e.getAttribute(`placeholder`)),s=e.getAttribute(`href`),d;if(e.tagName===`A`&&s)try{let e=new URL(s,location.href);e.origin===location.origin&&(d=e.pathname)}catch{}let p=n?void 0:l(e);if(!n&&!p)continue;let m=e.getBoundingClientRect();f.push({ref:`e${f.length+1}`,role:t,...i?{text:i}:{},...a&&a!==i?{label:a}:{},...o?{placeholder:o}:{},...d?{href:d}:{},...n?{anchor:n.slice(0,64)}:{css:p.slice(0,300)},clickable:t!==`input`&&t!==`select`&&t!==`other`,rect:[m.left+scrollX,m.top+scrollY,m.width,m.height].map(Math.round)})}let p=[...document.querySelectorAll(`h1,h2,h3,[role=heading]`)].filter(e=>!e.closest(`[data-private]`)&&s(e)).map(e=>r(e.innerText)).filter(Boolean).slice(0,10);return{platform:`web`,path:location.pathname||`/`,...document.title?{title:r(document.title)}:{},headings:p,viewport:[innerWidth,innerHeight],elements:f}}const s=`playstep_preview`,c=`playstep_capture_on`,l={get:e=>{try{return sessionStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}catch{}}};function u(e){let t=e=>e&&a(e)||void 0;return{...e,title:t(e.title),headings:(e.headings??[]).map(e=>a(e)).filter(Boolean),elements:e.elements.map(e=>({...e,text:t(e.text),label:t(e.label),placeholder:t(e.placeholder),href:e.href&&!i(e.href)?e.href:void 0,css:e.css&&!i(e.css)?e.css:void 0})).filter(e=>e.anchor||e.css)}}function d(e,t){let n=document.createElement(`playstep-capture`),r=n.attachShadow({mode:`open`});document.body.appendChild(n);let i=document.createElement(`div`);i.className=`p`,i.setAttribute(`role`,`region`),i.setAttribute(`aria-label`,`PlayStep capture`),r.innerHTML=`<style>:host{all:initial}
|
|
2
|
+
.p{position:fixed;left:24px;bottom:24px;z-index:2147483001;width:320px;max-width:calc(100vw - 48px);box-sizing:border-box;padding:16px;border-radius:16px;background:#fff;color:#151823;font:14px/20px system-ui,-apple-system,"Segoe UI",sans-serif;box-shadow:0 12px 32px #15182333,0 0 0 1px #15182314}
|
|
3
|
+
h2{margin:0 0 4px;font-size:15px;line-height:22px;font-weight:700;display:flex;align-items:center;gap:8px}
|
|
4
|
+
p{margin:0 0 12px;color:#4a5163}
|
|
5
|
+
.dot{width:8px;height:8px;border-radius:50%;background:#e5484d;animation:b 1.6s ease-in-out infinite}
|
|
6
|
+
@keyframes b{50%{opacity:.35}}
|
|
7
|
+
.row{display:flex;gap:8px;flex-wrap:wrap}
|
|
8
|
+
button{font:600 14px/20px inherit;font-family:inherit;border:0;border-radius:999px;padding:8px 14px;cursor:pointer;background:#eef0f5;color:#151823}
|
|
9
|
+
button.go{background:#2e5bff;color:#fff}
|
|
10
|
+
button:focus-visible{outline:2px solid #2e5bff;outline-offset:2px}
|
|
11
|
+
.last{margin:-6px 0 12px;font-size:12px;color:#4a5163;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
12
|
+
@media (prefers-color-scheme:dark){.p{background:#151821;color:#e7e9ee;box-shadow:0 12px 32px #0008,0 0 0 1px #ffffff1a}p,.last{color:#b4bccb}button{background:#262a35;color:#e7e9ee}button.go{background:#4f78ff}}
|
|
13
|
+
@media (prefers-reduced-motion:reduce){.dot{animation:none}}</style>`,r.appendChild(i);let a=0,d=``,f,p=!1,m=(n=``)=>`${e.endpoint}${n}?key=${encodeURIComponent(t)}`,h=(e,t,n=!1)=>{let r=document.createElement(`button`);return r.textContent=e,n&&(r.className=`go`),r.onclick=t,r},g=(e,t,n,r={})=>{i.innerHTML=``;let a=document.createElement(`h2`);r.live&&(a.innerHTML=`<span class="dot" aria-hidden="true"></span>`),a.append(e);let o=document.createElement(`p`);if(o.textContent=t,o.setAttribute(`aria-live`,`polite`),i.append(a,o),r.note){let e=document.createElement(`div`);e.className=`last`,e.textContent=r.note,i.append(e)}let s=document.createElement(`div`);s.className=`row`,s.append(...n),i.append(s)},_=()=>{p=!0,clearTimeout(f),l.set(s,null),l.set(c,null),n.remove()},v=()=>{p=!0,l.set(s,null),l.set(c,null),g(`Capture link expired`,`Get a new link from Generate with AI in PlayStep.`,[h(`Close`,_,!0)])},y=e=>g(`Capturing · ${a} ${a===1?`page`:`pages`}`,`Open the pages your users need help with. Each one is added as you go.`,[h(`Capture this page`,()=>void b()),h(`Finish`,()=>void x(),!0)],{live:!0,note:e});async function b(){if(p)return;clearTimeout(f);let e=u(o());try{let t=await fetch(m(`/screens`),{method:`POST`,headers:{"content-type":`text/plain`},body:JSON.stringify(e)});if(t.status===404||t.status===410)return v();let n=await t.json().catch(()=>({}));if(!t.ok)return y(n.message??`That page could not be added.`);a=n.screens??a+1,d=location.pathname,y(`Added ${e.title||d}`)}catch{y(`PlayStep could not be reached. It will try again on the next page.`)}}async function x(){p=!0,await fetch(m(`/finish`),{method:`POST`}).catch(()=>void 0),l.set(s,null),l.set(c,null),g(`Capture finished`,`${a} ${a===1?`page`:`pages`} captured. Go back to PlayStep to generate tours.`,[h(`Close`,()=>n.remove(),!0)])}let S=()=>{p||l.get(c)!==`1`||location.pathname===d||(clearTimeout(f),f=setTimeout(()=>void b(),1200))};for(let e of[`pushState`,`replaceState`]){let t=history[e];history[e]=function(...e){t.apply(this,e),S()}}addEventListener(`popstate`,S);let C=()=>{l.set(c,`1`),y(),S()};return l.get(c)===`1`?fetch(m()).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{a=e.screens,C()}).catch(e=>e===404?v():C()):g(`Show PlayStep your app`,`Visit the pages your users need help with. PlayStep notes the buttons, links and headings on each page. Never what you type, and no screenshots.`,[h(`Start capturing`,C,!0),h(`Not now`,_)]),{captureNow:b,stop:_}}export{u as redactScreen,o as snapshotPage,d as start};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var __playstep_capture=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,n=/\+?\(?\d[\d\s().-]{5,}\d/g,r=/\d{6,}/g,i=/\b(?=[\w-]*\d)[\w-]{24,}\b/g;function a(e){return[t,i,r].some(t=>new RegExp(t.source).test(e))||[...e.matchAll(n)].some(e=>e[0].replace(/\D/g,``).length>=7)}function o(e){if(!e)return``;let a=e.replace(/\s+/g,` `).trim().replace(t,`[email]`).replace(i,`[id]`).replace(n,e=>e.replace(/\D/g,``).length>=7?`[number]`:e).replace(r,`[number]`);return a.length>80?`${a.slice(0,79)}…`:a}function s(e=80){let t=/^(:|radix-|headlessui-|react-|ember\d|mui-|v-|css-|sc-|jsx-)|\d{3,}|[a-f0-9]{8,}|__/i,n=/active|selected|current|open|hover|focus|disabled|hidden|show|visible|checked|loading/i,r=e=>(e??``).replace(/\s+/g,` `).trim().slice(0,80),i=e=>`"${e.replace(/["\\]/g,`\\$&`)}"`,a=e=>CSS.escape(e),o=e=>{try{return document.querySelectorAll(e).length===1}catch{return!1}},s=e=>{let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return n.visibility!==`hidden`&&n.display!==`none`&&Number(n.opacity||1)>.05},c=e=>{let t=e.getAttribute(`role`),n=e.tagName,r=(e.getAttribute(`type`)??``).toLowerCase();return t===`tab`||t===`menuitem`||t===`link`||t===`button`?t:t===`checkbox`||t===`switch`||n===`INPUT`&&(r===`checkbox`||r===`radio`)?`checkbox`:n===`A`?`link`:n===`BUTTON`||n===`SUMMARY`||n===`INPUT`&&/^(submit|button|reset|image)$/.test(r)?`button`:n===`SELECT`?`select`:n===`INPUT`||n===`TEXTAREA`?`input`:`other`},l=e=>{let r=e.tagName.toLowerCase(),s=[];e.id&&!t.test(e.id)&&s.push(`#${a(e.id)}`);for(let t of[`data-testid`,`data-test`,`data-cy`,`data-qa`]){let n=e.getAttribute(t);n&&s.push(`[${t}=${i(n)}]`)}for(let t of[`aria-label`,`name`,`title`,`placeholder`]){let n=e.getAttribute(t);n&&n.length<=80&&s.push(`${r}[${t}=${i(n)}]`)}let c=e.getAttribute(`href`);r===`a`&&c&&!/^javascript:/i.test(c)&&c.length<=200&&s.push(`a[href=${i(c)}]`);let l=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!t.test(e)&&!n.test(e));l.length&&s.push(`${r}.${l.slice(0,3).map(a).join(`.`)}`);for(let e of s)if(o(e))return e;let u=[],d=e;for(;d&&u.length<7;){if(d===document.body){u.unshift(`body`);break}if(d!==e&&d.id&&!t.test(d.id)){u.unshift(`#${a(d.id)}`);break}let n=d.tagName.toLowerCase(),r=d.parentElement?[...d.parentElement.children].filter(e=>e.tagName===d.tagName):[];u.unshift(r.length>1?`${n}:nth-of-type(${r.indexOf(d)+1})`:n),d=d.parentElement}let f=u.join(`>`);return o(f)?f:void 0},u=e=>{let t=e.getAttribute(`aria-label`)||e.getAttribute(`title`);if(t)return t;let n=e.getAttribute(`aria-labelledby`);if(n)return n.split(/\s+/).map(e=>document.getElementById(e)?.textContent??``).join(` `);let r=e.labels;return r?.length?r[0].innerText:``},d=[...document.querySelectorAll(`a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],[data-guide]`)].filter(e=>!e.closest(`[data-private],[aria-hidden=true],[inert]`)&&s(e)&&!e.parentElement?.closest(`a[href],button,[role=button],[role=link]`)).map((e,t)=>{let n=e.getBoundingClientRect(),r=n.bottom>0&&n.top<innerHeight;return{e,i:t,score:(e.hasAttribute(`data-guide`)?0:2)+ +!r}}).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,e).sort((e,t)=>e.i-t.i),f=[];for(let{e}of d){let t=c(e),n=e.getAttribute(`data-guide`),i=t===`input`||t===`select`?``:r(e.innerText||e.textContent),a=r(u(e))||(e.tagName===`INPUT`&&t===`button`?r(e.value):``),o=r(e.getAttribute(`placeholder`)),s=e.getAttribute(`href`),d;if(e.tagName===`A`&&s)try{let e=new URL(s,location.href);e.origin===location.origin&&(d=e.pathname)}catch{}let p=n?void 0:l(e);if(!n&&!p)continue;let m=e.getBoundingClientRect();f.push({ref:`e${f.length+1}`,role:t,...i?{text:i}:{},...a&&a!==i?{label:a}:{},...o?{placeholder:o}:{},...d?{href:d}:{},...n?{anchor:n.slice(0,64)}:{css:p.slice(0,300)},clickable:t!==`input`&&t!==`select`&&t!==`other`,rect:[m.left+scrollX,m.top+scrollY,m.width,m.height].map(Math.round)})}let p=[...document.querySelectorAll(`h1,h2,h3,[role=heading]`)].filter(e=>!e.closest(`[data-private]`)&&s(e)).map(e=>r(e.innerText)).filter(Boolean).slice(0,10);return{platform:`web`,path:location.pathname||`/`,...document.title?{title:r(document.title)}:{},headings:p,viewport:[innerWidth,innerHeight],elements:f}}let c=`playstep_preview`,l=`playstep_capture_on`,u={get:e=>{try{return sessionStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}catch{}}};function d(e){let t=e=>e&&o(e)||void 0;return{...e,title:t(e.title),headings:(e.headings??[]).map(e=>o(e)).filter(Boolean),elements:e.elements.map(e=>({...e,text:t(e.text),label:t(e.label),placeholder:t(e.placeholder),href:e.href&&!a(e.href)?e.href:void 0,css:e.css&&!a(e.css)?e.css:void 0})).filter(e=>e.anchor||e.css)}}function f(e,t){let n=document.createElement(`playstep-capture`),r=n.attachShadow({mode:`open`});document.body.appendChild(n);let i=document.createElement(`div`);i.className=`p`,i.setAttribute(`role`,`region`),i.setAttribute(`aria-label`,`PlayStep capture`),r.innerHTML=`<style>:host{all:initial}
|
|
2
|
+
.p{position:fixed;left:24px;bottom:24px;z-index:2147483001;width:320px;max-width:calc(100vw - 48px);box-sizing:border-box;padding:16px;border-radius:16px;background:#fff;color:#151823;font:14px/20px system-ui,-apple-system,"Segoe UI",sans-serif;box-shadow:0 12px 32px #15182333,0 0 0 1px #15182314}
|
|
3
|
+
h2{margin:0 0 4px;font-size:15px;line-height:22px;font-weight:700;display:flex;align-items:center;gap:8px}
|
|
4
|
+
p{margin:0 0 12px;color:#4a5163}
|
|
5
|
+
.dot{width:8px;height:8px;border-radius:50%;background:#e5484d;animation:b 1.6s ease-in-out infinite}
|
|
6
|
+
@keyframes b{50%{opacity:.35}}
|
|
7
|
+
.row{display:flex;gap:8px;flex-wrap:wrap}
|
|
8
|
+
button{font:600 14px/20px inherit;font-family:inherit;border:0;border-radius:999px;padding:8px 14px;cursor:pointer;background:#eef0f5;color:#151823}
|
|
9
|
+
button.go{background:#2e5bff;color:#fff}
|
|
10
|
+
button:focus-visible{outline:2px solid #2e5bff;outline-offset:2px}
|
|
11
|
+
.last{margin:-6px 0 12px;font-size:12px;color:#4a5163;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
12
|
+
@media (prefers-color-scheme:dark){.p{background:#151821;color:#e7e9ee;box-shadow:0 12px 32px #0008,0 0 0 1px #ffffff1a}p,.last{color:#b4bccb}button{background:#262a35;color:#e7e9ee}button.go{background:#4f78ff}}
|
|
13
|
+
@media (prefers-reduced-motion:reduce){.dot{animation:none}}</style>`,r.appendChild(i);let a=0,o=``,f,p=!1,m=(n=``)=>`${e.endpoint}${n}?key=${encodeURIComponent(t)}`,h=(e,t,n=!1)=>{let r=document.createElement(`button`);return r.textContent=e,n&&(r.className=`go`),r.onclick=t,r},g=(e,t,n,r={})=>{i.innerHTML=``;let a=document.createElement(`h2`);r.live&&(a.innerHTML=`<span class="dot" aria-hidden="true"></span>`),a.append(e);let o=document.createElement(`p`);if(o.textContent=t,o.setAttribute(`aria-live`,`polite`),i.append(a,o),r.note){let e=document.createElement(`div`);e.className=`last`,e.textContent=r.note,i.append(e)}let s=document.createElement(`div`);s.className=`row`,s.append(...n),i.append(s)},_=()=>{p=!0,clearTimeout(f),u.set(c,null),u.set(l,null),n.remove()},v=()=>{p=!0,u.set(c,null),u.set(l,null),g(`Capture link expired`,`Get a new link from Generate with AI in PlayStep.`,[h(`Close`,_,!0)])},y=e=>g(`Capturing · ${a} ${a===1?`page`:`pages`}`,`Open the pages your users need help with. Each one is added as you go.`,[h(`Capture this page`,()=>void b()),h(`Finish`,()=>void x(),!0)],{live:!0,note:e});async function b(){if(p)return;clearTimeout(f);let e=d(s());try{let t=await fetch(m(`/screens`),{method:`POST`,headers:{"content-type":`text/plain`},body:JSON.stringify(e)});if(t.status===404||t.status===410)return v();let n=await t.json().catch(()=>({}));if(!t.ok)return y(n.message??`That page could not be added.`);a=n.screens??a+1,o=location.pathname,y(`Added ${e.title||o}`)}catch{y(`PlayStep could not be reached. It will try again on the next page.`)}}async function x(){p=!0,await fetch(m(`/finish`),{method:`POST`}).catch(()=>void 0),u.set(c,null),u.set(l,null),g(`Capture finished`,`${a} ${a===1?`page`:`pages`} captured. Go back to PlayStep to generate tours.`,[h(`Close`,()=>n.remove(),!0)])}let S=()=>{p||u.get(l)!==`1`||location.pathname===o||(clearTimeout(f),f=setTimeout(()=>void b(),1200))};for(let e of[`pushState`,`replaceState`]){let t=history[e];history[e]=function(...e){t.apply(this,e),S()}}addEventListener(`popstate`,S);let C=()=>{u.set(l,`1`),y(),S()};return u.get(l)===`1`?fetch(m()).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{a=e.screens,C()}).catch(e=>e===404?v():C()):g(`Show PlayStep your app`,`Visit the pages your users need help with. PlayStep notes the buttons, links and headings on each page. Never what you type, and no screenshots.`,[h(`Start capturing`,C,!0),h(`Not now`,_)]),{captureNow:b,stop:_}}return e.redactScreen=d,e.snapshotPage=s,e.start=f,e})({});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __playstep_launcher=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=Number.parseInt(e.slice(1),16),n=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,r=.2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(t&255);return 1.05/(r+.05)>=(r+.05)/.0595?`#ffffff`:`#151823`}function n(e,n,r,i){let a=n.launcherGuides();if(!a.length)return;let o=a[0].theme?.accent??`#2e5bff`,s=a.filter(e=>!n.progress.guides[e.id]).length;e.innerHTML=`<button aria-label="Open guides" style="position:fixed;${r.slice(7)}:24px;bottom:24px;z-index:2147483000;padding:15px;border:0;border-radius:50%;cursor:pointer;background:${o};color:${t(o)};box-shadow:0 8px 24px #0004"><svg width=26 height=26 viewBox="0 0 24 24" fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 21a9 9 0 1 0-8.05-4.98L3 21l4.98-.95A8.96 8.96 0 0 0 12 21zM10 9v6l5-3z"/></svg>${s?`<b style="position:absolute;top:-2px;right:-2px;padding:0 6px;border-radius:9px;background:#ffc933;color:#151823;font:800 11px/20px sans-serif">${s}</b>`:``}</button>`,e.querySelector(`button`).onclick=i}return e.captureIntegrity=`sha256-0/qRUxY1cX42aRTyHZU7rrz7ezjqrcmF6An3+7eR2wE=`,e.drawLauncher=n,e})({});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){let e=e=>RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`)}$`),t=e=>e.length>1?e.replace(/\/+$/,``):e;function n(n,r){return e(t(n)).test(t(r))}function r(e,t){return(e??[]).every(e=>{let n=t[e.trait];return e.op===`exists`?n!=null:e.op===`in`?Array.isArray(e.value)&&e.value.includes(n):e.op===`eq`?n===e.value:n!==e.value})}function i(e){let{config:t,platform:i}=e,a=e.progress??{seen:!1,guides:{}},o=e.traits??{},s=null,c,l=t.flags||{},u=(t.guides??[]).filter(e=>e.spec_version<=2&&(e.targeting?.platforms??[`web`]).includes(i)),d=e=>u.find(t=>t.id===e),f=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n===void 0?{}:{step_id:t.steps[n].id,step_index:n}}),p=e=>!l.disabled&&(!l.paused_for_new_users||a.seen)&&r(e.targeting?.segments,o),m=e=>{let t=a.guides[e.id];return!s&&p(e)&&(!t||t.status!==`done`&&(t.status===`running`||!e.trigger.once))},h=(e,t,n)=>{a.guides[e.id]={version:e.version,step:n,status:t}},g=(e,t)=>(s={guide:e,index:t,status:`running`},c=void 0,a.seen=!0,h(e,`running`,t),[f(`guide_shown`,e),f(`step_shown`,e,t)]),_=()=>{let e=s,t=[f(`step_completed`,e.guide,e.index)];return e.index+1>=e.guide.steps.length?(s={...e,status:`completed`},h(e.guide,`done`,e.index),t.push(f(`guide_completed`,e.guide))):(s={...e,index:e.index+1},c=void 0,h(e.guide,`running`,e.index+1),t.push(f(`step_shown`,e.guide,e.index+1))),t},v=e=>{let t=u.find(t=>m(t)&&e(t));return t?g(t,0):[]},y,b=()=>v(e=>e.trigger.type===`first_visit`||e.trigger.type===`page_view`&&y!==void 0&&n(e.trigger.path,y));function x(e){let t=s?.status===`running`?s.guide.steps[s.index]:null;switch(e.type){case`init`:{y=e.path;let t=u.find(e=>a.guides[e.id]?.status===`running`&&p(e));if(t){let e=a.guides[t.id];return g(t,e.version===t.version?Math.min(e.step,t.steps.length-1):0)}return b()}case`page_view`:return y=e.path,v(t=>t.trigger.type===`page_view`&&n(t.trigger.path,e.path));case`reset_progress`:{let t=typeof e.guide==`string`?e.guide:void 0,n=t===void 0?void 0:d(t);return t!==void 0&&!n?[]:((!n||s?.guide===n)&&(s=null),n?delete a.guides[n.id]:a.guides={},[{type:`progress_reset`,guide_id:t},...b()])}case`event`:return t?.complete_on.type===`event`&&t.complete_on.name===e.name?_():v(t=>t.trigger.type===`event`&&t.trigger.name===e.name);case`tap`:return t?.complete_on.type===`tap_anchor`&&t.anchor===e.anchor?_():[];case`complete`:return t?.id===e.step?_():[];case`next`:return t?.complete_on.type===`next_button`?_():[];case`back`:return!t||s.index===0?[]:(s={...s,index:s.index-1},h(s.guide,`running`,s.index),[f(`step_shown`,s.guide,s.index)]);case`close`:if(s?.status!==`completed`)return[];case`dismiss`:{if(!s)return[];let e=s;return s=null,e.status===`completed`?[]:(h(e.guide,`dismissed`,e.index),[f(`guide_dismissed`,e.guide,e.index)])}case`start`:{let n=d(e.guide);if(!n||!p(n)||t===n.steps[0])return[];let r=[];return s?.status===`running`&&(h(s.guide,`dismissed`,s.index),r.push(f(`guide_dismissed`,s.guide,s.index))),s=null,r.concat(g(n,0))}case`anchor_missing`:return!t||t.anchor!==e.anchor||c===e.anchor?[]:(c=e.anchor,[{...f(`anchor_missing`,s.guide,s.index),anchor:e.anchor}]);case`identify`:return o={...o,...e.traits},[]}}return{get active(){return s},progress:a,dispatch:x,launcherGuides:()=>u.filter(e=>e.launcher!==!1&&p(e))}}let a={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{return null}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}};function o(e){let t=()=>setTimeout(e);document.readyState===`complete`?t():addEventListener(`load`,t)}let s=`0.2.0`,c=`playstep_preview`;function l(e,t,n,r=`web`){let l,u,d,f,p,m,h,g={},_=[],v=[],y=()=>`p:${l.appKey}`,b=()=>l.preview||a.set(y(),u.progress),x=e=>{let t={...e,ts:Date.now()};l?.onEvent?.(t),l&&!l.preview&&(f?f.send(t):v.push(t))},S=e=>{try{u&&x({type:`sdk_error`,message:String(e)})}catch{}},C=e=>(...t)=>{try{e(...t)}catch(e){S(e)}},w=(e,t)=>C(n=>T({type:e,[t]:n}));function T(e){if(!u)return void _.push(e);let t=u.dispatch(e);b(),t.forEach(x),u.active&&D(),f?.update()}function E(){return m??(m=document.body.appendChild(document.createElement(`playstep-root`)).attachShadow({mode:`open`}))}function D(){return p??(p=e().then(e=>{let t=E();return t.innerHTML=``,f=e.mount({engine:u,config:d,options:l,root:t,outbox:v,userId:()=>h,dispatch:C(T),emit:C(x)})}).catch(e=>void S(e)))}let O,k=C(()=>{u?u.launcherGuides().length&&D().then(e=>e?.openLauncher()):O=!0});function A(e){e.launcher?.enabled&&u.launcherGuides().length&&!p&&t&&t().then(t=>{p||t.drawLauncher(E(),u,e.launcher.position,k)}).catch(S)}async function j(){let e=l,t=(e.apiBase??`https://cdn.playstep.app`).replace(/\/$/,``),o=null;try{o=new URLSearchParams(location.search).get(c)||(e.config?null:sessionStorage.getItem(c))}catch{}e.preview||(e.preview=!!(e.config||o));let s=e.config;try{s??(s=await fetch(`${t}/v1/${o?`preview/${o}?key=`:`config/`}${e.appKey}`).then(e=>e.json()))}catch{return}try{o&&sessionStorage[s.guides?`setItem`:`removeItem`](c,o)}catch{}if(s?.capture)return void n?.().then(t=>t.start(s.capture,e.appKey)).catch(S);if(s?.guides&&!s.flags?.disabled&&(d=s,e.eventsUrl=s.ingest_url??`${t}/v1/events`,u=i({config:s,platform:r,progress:e.preview?void 0:a.get(y())??void 0,traits:g}),T({type:`init`,path:location.pathname}),_.splice(0).forEach(T),O&&k(),A(s),e.autoPageViews!==!1)){let e=location.pathname,t=C(()=>location.pathname!==e&&T({type:`page_view`,path:e=location.pathname}));for(let e of[`pushState`,`replaceState`]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener(`popstate`,t)}}return{version:s,init:C(e=>{!l&&e?.appKey&&(l={...e,version:s},o(()=>j().catch(S)))}),identify:C((e,t)=>{h=e||void 0,g={...g,...t},T({type:`identify`,traits:g})}),track:w(`event`,`name`),start:w(`start`,`guide`),complete:w(`complete`,`step`),page:C(e=>T({type:`page_view`,path:e??location.pathname})),openLauncher:k,resetProgress:w(`reset_progress`,`guide`),reset:C(()=>{T({type:`dismiss`}),h=void 0,g={},u&&(Object.assign(u.progress,{seen:!1,guides:{}}),b(),f?.update()),l?.preview||a.set(`d`,null)})}}let u=document.currentScript;function d(e,t){return new Promise((n,r)=>{document.head.append(Object.assign(document.createElement(`script`),{src:new URL(`${e}.js`,u?.src||location.href).href,integrity:t,crossOrigin:`anonymous`,onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))})}let f=()=>d(`launcher`,`sha256-4XR4T57+g5J9t2/fEwpDaT2xgq/z3iXoSHoq28M9BuY=`),p=l(()=>d(`ui`,`sha256-9LpXsG1GSgPUo/1jY9D2o/UNUETxI1ZALNTvQjpTm3Y=`),f,()=>f().then(e=>d(`capture`,e.captureIntegrity)));if(!window.playstep){window.playstep=p;let e=u?.dataset;e?.appKey&&p.init({appKey:e.appKey,apiBase:e.api,locale:e.locale})}})();
|
package/dist/cdn/ui.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __playstep_ui=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=Math.min,n=Math.max,r=Math.round,i=e=>({x:e,y:e}),a={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function o(e,r,i){return n(e,t(r,i))}function s(e,t){return typeof e==`function`?e(t):e}function c(e){return e.split(`-`)[0]}function l(e){return e.split(`-`)[1]}function u(e){return e===`x`?`y`:`x`}function d(e){return e===`y`?`height`:`width`}function f(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function p(e){return u(f(e))}function m(e,t,n){n===void 0&&(n=!1);let r=l(e),i=p(e),a=d(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=C(o)),[o,C(o)]}function h(e){let t=C(e);return[g(e),t,g(t)]}function g(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}let _=[`left`,`right`],v=[`right`,`left`],y=[`top`,`bottom`],b=[`bottom`,`top`];function x(e,t,n){switch(e){case`top`:case`bottom`:return n?t?v:_:t?_:v;case`left`:case`right`:return t?y:b;default:return[]}}function S(e,t,n,r){let i=l(e),a=x(c(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(g)))),a}function C(e){let t=c(e);return a[t]+e.slice(t.length)}function w(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function T(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:w(e)}function E(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function D(e,t,n){let{reference:r,floating:i}=e,a=f(t),o=p(t),s=d(o),u=c(t),m=a===`y`,h=r.x+r.width/2-i.width/2,g=r.y+r.height/2-i.height/2,_=r[s]/2-i[s]/2,v;switch(u){case`top`:v={x:h,y:r.y-i.height};break;case`bottom`:v={x:h,y:r.y+r.height};break;case`right`:v={x:r.x+r.width,y:g};break;case`left`:v={x:r.x-i.width,y:g};break;default:v={x:r.x,y:r.y}}let y=l(t);return y&&(v[o]+=_*(y===`end`?1:-1)*(n&&m?-1:1)),v}async function O(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=s(t,e),m=T(p),h=o[f?d===`floating`?`reference`:`floating`:d],g=E(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(h))??!0?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(v))&&await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1},b=E(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}let k=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:O},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=D(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<50&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=D(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},A=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:_=`bestFit`,fallbackAxisSideDirection:v=`none`,flipAlignment:y=!0,...b}=s(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let x=c(r),w=f(o),T=c(o)===o,E=await(l.isRTL==null?void 0:l.isRTL(u.floating)),D=g||(T||!y?[C(o)]:h(o)),O=v!==`none`;!g&&O&&D.push(...S(o,y,v,E));let k=[o,...D],A=await l.detectOverflow(t,b),ee=[],j=i.flip?.overflows||[];if(d&&ee.push(A[x]),p){let e=m(r,a,E);ee.push(A[e[0]],A[e[1]])}if(j=[...j,{placement:r,overflows:ee}],!ee.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=k[e];if(t&&(p!==`alignment`||w===f(t)||j.every(e=>f(e.placement)!==w||e.overflows[0]>0)))return{data:{index:e,overflows:j},reset:{placement:t}};let n=j.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(_){case`bestFit`:{let e=j.filter(e=>{if(O){let t=f(e.placement);return t===w||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},ee=new Set([`left`,`top`]);async function j(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=c(n),u=l(n),d=f(n)===`y`,p=ee.has(o)?-1:1,m=a&&d?-1:1,h=s(t,e),{mainAxis:g,crossAxis:_,alignmentAxis:v}=typeof h==`number`?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return u&&typeof v==`number`&&(_=u===`end`?v*-1:v),d?{x:_*m,y:g*p}:{x:g*p,y:_*m}}let te=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await j(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ne=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:c=!0,crossAxis:l=!1,limiter:d={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...p}=s(e,t),m={x:n,y:r},h=await a.detectOverflow(t,p),g=f(i),_=u(g),v=m[_],y=m[g],b=(e,t)=>o(t+h[e===`y`?`top`:`left`],t,t-h[e===`y`?`bottom`:`right`]);c&&(v=b(_,v)),l&&(y=b(g,y));let x=d.fn({...t,[_]:v,[g]:y});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[_]:c,[g]:l}}}}}};function re(){return typeof window<`u`}function ie(e){return ae(e)?(e.nodeName||``).toLowerCase():`#document`}function M(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function N(e){return((ae(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ae(e){return re()?e instanceof Node||e instanceof M(e).Node:!1}function P(e){return re()?e instanceof Element||e instanceof M(e).Element:!1}function F(e){return re()?e instanceof HTMLElement||e instanceof M(e).HTMLElement:!1}function oe(e){return!re()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof M(e).ShadowRoot}function se(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=L(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ce(e){return/^(table|td|th)$/.test(ie(e))}function le(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}let ue=/transform|translate|scale|rotate|perspective|filter/,de=/paint|layout|strict|content/,I=e=>!!e&&e!==`none`,fe;function pe(e){let t=P(e)?L(e):e;return I(t.transform)||I(t.translate)||I(t.scale)||I(t.rotate)||I(t.perspective)||!he()&&(I(t.backdropFilter)||I(t.filter))||ue.test(t.willChange||``)||de.test(t.contain||``)}function me(e){let t=R(e);for(;F(t)&&!ge(t);){if(pe(t))return t;if(le(t))return null;t=R(t)}return null}function he(){return fe??(fe=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`)),fe}function ge(e){return/^(html|body|#document)$/.test(ie(e))}function L(e){return M(e).getComputedStyle(e)}function _e(e){return P(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function R(e){if(ie(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||oe(e)&&e.host||N(e);return oe(t)?t.host:t}function ve(e){let t=R(e);return ge(t)?(e.ownerDocument||e).body:F(t)&&se(t)?t:ve(t)}function ye(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ve(e),i=r===e.ownerDocument?.body,a=M(r);if(i){let e=be(a);return t.concat(a,a.visualViewport||[],se(r)?r:[],e&&n?ye(e):[])}return t.concat(r,ye(r,[],n))}function be(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xe(e){let t=L(e),n=parseFloat(t.width)||0,i=parseFloat(t.height)||0,a=F(e),o=a?e.offsetWidth:n,s=a?e.offsetHeight:i,c=r(n)!==o||r(i)!==s;return c&&(n=o,i=s),{width:n,height:i,$:c}}function Se(e){return P(e)?e:e.contextElement}function z(e){let t=Se(e);if(!F(t))return i(1);let n=t.getBoundingClientRect(),{width:a,height:o,$:s}=xe(t),c=(s?r(n.width):n.width)/a,l=(s?r(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!l||!Number.isFinite(l))&&(l=1),{x:c,y:l}}let Ce=i(0);function we(e){let t=M(e);return!he()||!t.visualViewport?Ce:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Te(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===M(e)}function Ee(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let a=e.getBoundingClientRect(),o=Se(e),s=i(1);t&&(r?P(r)&&(s=z(r)):s=z(e));let c=Te(o,n,r)?we(o):i(0),l=(a.left+c.x)/s.x,u=(a.top+c.y)/s.y,d=a.width/s.x,f=a.height/s.y;if(o&&r){let e=M(o),t=P(r)?M(r):r,n=e,i=be(n);for(;i&&t!==n;){let e=z(i),t=i.getBoundingClientRect(),r=L(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,d*=e.x,f*=e.y,l+=a,u+=o,n=M(i),i=be(n)}}return E({width:d,height:f,x:l,y:u})}function De(e,t){let n=_e(e).scrollLeft;return t?t.left+n:Ee(N(e)).left+n}function Oe(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-De(e,n),y:n.top+t.scrollTop}}function ke(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e,o=a===`fixed`,s=N(r),c=t?le(t.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=i(1),d=i(0),f=F(r);if((f||!o)&&((ie(r)!==`body`||se(s))&&(l=_e(r)),f)){let e=Ee(r);u=z(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let p=s&&!f&&!o?Oe(s,l):i(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function Ae(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function je(e){let t=_e(e),r=e.ownerDocument.body,i=n(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=n(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),o=-t.scrollLeft+De(e),s=-t.scrollTop;return L(r).direction===`rtl`&&(o+=n(e.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function Me(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=M(e),a=N(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!he()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(De(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=25&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ne(e,t){let n=Ee(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=z(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Pe(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Me(e,n,t);else if(t===`document`)r=je(N(e));else if(P(t))r=Ne(t,n);else{let n=we(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return E(r)}function Fe(e,t){let n=t.get(e);if(n)return n;let r=ye(e,[],!1).filter(e=>P(e)&&ie(e)!==`body`),i=null,a=L(e).position===`fixed`,o=a?R(e):e;for(;P(o)&&!ge(o);){let e=L(o),t=pe(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=R(o)}return t.set(e,r),r}function Ie(e){let{element:r,boundary:i,rootBoundary:a,strategy:o}=e,s=[...i===`clippingAncestors`?le(r)?[]:Fe(r,this._c):[].concat(i),a],c=Pe(r,s[0],o),l=c.top,u=c.right,d=c.bottom,f=c.left;for(let e=1;e<s.length;e++){let i=Pe(r,s[e],o);l=n(i.top,l),u=t(i.right,u),d=t(i.bottom,d),f=n(i.left,f)}return{width:u-f,height:d-l,x:f,y:l}}function Le(e){let{width:t,height:n}=xe(e);return{width:t,height:n}}function Re(e,t,n){let r=F(t),a=N(t),o=n===`fixed`,s=Ee(e,!0,o,t),c={scrollLeft:0,scrollTop:0},l=i(0);if((r||!o)&&((ie(t)!==`body`||se(a))&&(c=_e(t)),r)){let e=Ee(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!r&&a&&(l.x=De(a));let u=a&&!r&&!o?Oe(a,c):i(0);return{x:s.left+c.scrollLeft-l.x-u.x,y:s.top+c.scrollTop-l.y-u.y,width:s.width,height:s.height}}function ze(e){return L(e).position===`static`}function Be(e,t){if(!F(e)||L(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return N(e)===n&&(n=n.ownerDocument.body),n}function Ve(e,t){let n=M(e);if(le(e))return n;if(!F(e)){let t=R(e);for(;t&&!ge(t);){if(P(t)&&!ze(t))return t;t=R(t)}return n}let r=Be(e,t);for(;r&&ce(r)&&ze(r);)r=Be(r,t);return r&&ge(r)&&ze(r)&&!pe(r)?n:r||me(e)||n}let He=async function(e){let t=this.getOffsetParent||Ve,n=this.getDimensions,r=await n(e.floating);return{reference:Re(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ue(e){return L(e).direction===`rtl`}let We={convertOffsetParentRelativeRectToViewportRelativeRect:ke,getDocumentElement:N,getClippingRect:Ie,getOffsetParent:Ve,getElementRects:He,getClientRects:Ae,getDimensions:Le,getScale:z,isElement:P,isRTL:Ue},Ge=te,Ke=ne,qe=A,Je=(e,t,n)=>{let r=new Map,i=n??{},a={...We,...i.platform,_c:r};return k(e,t,{...i,platform:a})};var B,Ye,V,Xe,Ze,Qe,$e,et,tt,nt,rt={},it=[],at=/^m(i|n|o|s|text|space)$/,ot=Array.isArray,st=it.slice,H=Object.assign;function ct(e){e&&e.parentNode&&e.remove()}function lt(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:void 0,__v:i||++Ye,__i:-1,__u:0};return!i&&B.vnode&&B.vnode(a),a}function U(e){return e.children}function ut(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):null;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 dt(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),dt(e)}function ft(e){(8&e.__g||!(e.__g|=8)||!V.push(e)||Ze++)&&Xe==B.debounceRendering||((Xe=B.debounceRendering)||queueMicrotask)(pt)}function pt(){var e,t,n,r,i,a,o,s,c;try{for(t=1;V.length;)V.length>t&&V.sort(Qe),e=V.shift(),t=V.length,8&e.__g&&(r=void 0,i=void 0,a=(i=(n=e).__v).__e,o=[],s=[],(c=n.__P)&&((r=H({constructor:void 0},i)).__v=i.__v+1,B.vnode&&B.vnode(r),xt(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,Ct(o,r,s),i.__=i.__e=null,r.__e!=a&&dt(r)))}finally{V.length=Ze=0}}function mt(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r.__k||it,v=t.length;for(c=ht(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=~p.__i&&_[p.__i]||rt,p.__i=d,g=xt(e,p,f,i,a,o,s,c,l,u),m=p.__e,(f.ref!=p.ref||8&f.__u)&&(f.ref&&Tt(f.ref,null,p,f),p.ref&&u.push(p.ref,p.__c||m,p)),h=h||m,4&p.__u?(c=gt(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&=-7);return n.__e=h,c}function ht(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m,h=n.length,g=h,_=0,v=!1,y=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=y[a]=lt(null,o):ot(o)?o=y[a]=lt(U,{children:o}):o.constructor===void 0&&o.__b?o=y[a]=lt(o.type,o.props,o.key,o.ref,o.__v):y[a]=o,c=a+_,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=_t(o,n,c,g))&&(g--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=2,l==c-1?_--:l==c+1?_++:l!=c&&(l>c?_--:_++,v=!0)):(~l||(i>h?_--:i<h&&_++),typeof o.type!=`function`&&(o.__u|=4))):y[a]=null;if(v){for(u=[],d=[],a=0;a<i;a++)if((o=y[a])&&2&o.__u){for(f=0,p=u.length;f<p;)u[m=f+p>>1]<o.__i?f=m+1:p=m;u[f]=o.__i,d[a]=f+1}for(_=u.length;a--;)d[a]&&(d[a]==_?_--:y[a].__u|=4)}if(g)for(a=0;a<h;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=W(s)),Et(s,s));return r}function gt(e,t,n,r){var i,a,o;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=gt(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=W(e))&&!t.parentNode&&(t=null),o=t;o&&o.nodeType==8;)o=o.nextSibling;for(e.__e!=o&&(!r&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t=t&&t.nextSibling)&&t.nodeType==8;);return t}function _t(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function vt(e,t,n){n??(n=``),t[0]==`-`?e.setProperty(t,n):e[t]=n}function yt(e,t,n,r,i){var a,o;n: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||vt(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||vt(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)(e.__e||(e.__e={}))[t]=n,n&&r||(o=nt[t]||(nt[t]=bt(t)),(e.__a||(e.__a={}))[t]=tt,a=t!=(t=t.replace(et,`$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??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function bt(e){return function(t){if(this.__e){var n=this.__e[e];if(t[$e]==null)t[$e]=tt++;else if(t[$e]<this.__a[e])return;return n(B.event?B.event(t):t)}}}function xt(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,k,A=t.type;if(t.constructor!==void 0)return null;if(128&n.__u&&(c=32&n.__u,u=n.__c.__z)){if(t.__u|=c,d=a=[],u.nodeType==8)for(f=1,p=u.nextSibling;p;p=p.nextSibling){if(p.nodeType==8){if(p.data.startsWith(`$s`))f++;else if(p.data.startsWith(`/$s`)&&!--f)break}a.push(p)}else a.push(u);s=a[0]}(u=B.__b)&&u(t);n:if(typeof A==`function`){m=o.length;try{if(y=t.props,b=(u=A.prototype)&&u.render,x=(u=A.contextType)&&r[u.__c],S=u?x?x.props.value:u.__:r,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1):(b?t.__c=h=new A(y,S):(t.__c=h=new ut(y,S),h.constructor=A,h.render=Dt),x&&x.sub(h),h.state||(h.state={}),h.__n=r,h.__g|=8,h.__h=[],h.__k=[]),b&&(h.__s||(h.__s=h.state),A.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=H({},h.__s)),H(h.__s,A.getDerivedStateFromProps(y,h.__s)))),g=h.props,_=h.state,h.__v=t,n.__c){if(b&&!A.getDerivedStateFromProps&&y!==g&&h.componentWillReceiveProps&&h.componentWillReceiveProps(y,S),t.__v==n.__v&&!(8&h.__g)||!(4&h.__g)&&h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(y,h.__s,S)){t.__v!=n.__v&&(h.props=y,h.state=h.__s,h.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),it.push.apply(h.__h,h.__k),h.__k=[],h.__h.length&&o.push(h),s=W(n);break n}h.componentWillUpdate&&h.componentWillUpdate(y,h.__s,S),b&&h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(g,_,v)})}else b&&!A.getDerivedStateFromProps&&h.componentWillMount&&h.componentWillMount(),b&&h.componentDidMount&&h.__h.push(h.componentDidMount);if(h.context=S,h.props=y,h.__P=e,h.__g&=-5,C=B.__r,w=0,b)h.state=h.__s,h.__g&=-9,C&&C(t),u=h.render(h.props,h.state,h.context),it.push.apply(h.__h,h.__k),h.__k=[];else do h.__g&=-9,C&&C(t),u=h.render(h.props,h.state,h.context),h.state=h.__s;while(8&h.__g&&++w<25);h.state=h.__s,h.getChildContext&&(r=H({},r,h.getChildContext())),b&&n.__c&&h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(g,_)),T=u&&u.type===U&&u.key==null?u.props.children:u,y.__P&&(u=s,i=(e=y.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&Et(e,e)}),n.__k=null),s=n.__k?W(n,0):null),s=mt(e,ot(T)?T:[T],t,n,r,i,a,o,s,c,l),y.__P&&(t.__e=null,s=u),t.__u&=-161,128&n.__u&&(h.__z=null),d&&d.some(ct),h.__h.length&&o.push(h),1&h.__g&&(h.__g&=-4)}catch(e){if(o.length=m,t.__v=null,c||a){if(e.then){if(E=0,t.__u|=c?160:128,a){for(~(O=a.indexOf(s||void 0))||(O=a.length);(k=a[O-1])&&k.nodeType==8;)O--;for(;O<a.length;O++)if(k=a[O]){if(a[O]=null,k.nodeType==8){if(k.data.startsWith(`$s`))E++||(D=k);else if(E&&k.data.startsWith(`/$s`)&&!--E){s=k;break}}else if(!E)break}}if(!D){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;D=s}t.__c.__z||(t.__c.__z=D),t.__e=s}else a&&a.some(ct)}else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),e.then||St(t),B.__e(e,t,n)}}else s=t.__e=wt(n.__e,t,n,r,i,a,o,c,l,e);return(u=B.diffed)&&u(t),128&t.__u?void 0:s}function St(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(St))}function Ct(e,t,n){for(var r=0;r<n.length;)Tt(n[r++],n[r++],n[r++]);B.__c&&B.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){B.__e(e,t.__v)}})}function wt(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y=n.props||rt,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&&(B.__m&&B.__m(t,a),s=!1),a=null}if(x){if(l=x==`template`?e.content:e,a=x==`textarea`&&b.defaultValue!=null?null:a&&st.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||yt(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)||yt(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`&&at.test(x))&&(i=`http://www.w3.org/1999/xhtml`),mt(l,ot(p)?p:[p],t,n,r,i,a,o,a?a[0]:n.__k&&W(n,0),s,c),a&&a.some(ct)),s&&x!=`textarea`||(u=`value`,x==`progress`&&h==null?e.removeAttribute(u):h==null||h===e[u]&&(x!=`progress`||h)||yt(e,u,h,y[u],i),u=`checked`,g!=null&&g!=e[u]&&yt(e,u,g,y[u],i))}else y===b||s&&e.data==b||(e.data=b);return e}function Tt(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){B.__e(e,n)}}function Et(e,t,n){var r,i;if(B.unmount&&B.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Tt(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){B.__e(e,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Et(r[i],t,typeof e.type!=`function`||n&&!e.props.__P);(r=e.__e)&&(n||ct(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function Dt(e,t,n){return this.constructor(e,n)}function Ot(e,t){var n,r,i,a;B.__&&B.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=lt(U,{children:[e]}),i=[],a=[],xt(t,t.__k,r||rt,rt,t.namespaceURI,r?null:t.firstChild?st.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a),Ct(i,t.__k,a),t.__k.props.children=null}B={__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((a=i.constructor)&&a.getDerivedStateFromError&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t,o=0}}throw Ze=0,e}},Ye=0,ut.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=H({},this.state)),typeof e==`function`&&(e=e(H({},n),this.props)),e&&(H(n,e),this.__v&&(t&&this.__k.push(t),ft(this)))},ut.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),ft(this))},ut.prototype.render=U,V=[],Ze=0,Qe=function(e,t){return e.__v.__b-t.__v.__b},$e=Symbol(),et=/(PointerCapture)$|Capture$/i,tt=0,nt={};var G,K,kt,At,jt=Object.is,Mt=0,Nt=[],Pt=[],q=B,Ft=q.__b,It=q.__r,Lt=q.diffed,Rt=q.__c,zt=q.unmount,Bt=q.__;function Vt(e,t){q.__h&&q.__h(K,e,Mt||t),Mt=0;var n=K.__H||(K.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function J(e){return Mt=1,Ht($t,e)}function Ht(e,t,n){var r=Vt(G++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):$t(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);jt(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,jt(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=Vt(G++,3);!q.__s&&Qt(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,K.__H.__h.push(n))}function Ut(e,t){var n=Vt(G++,4);!q.__s&&Qt(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,K.__h.push(n))}function Wt(e){return Mt=5,Gt(function(){return{current:e}},[])}function Gt(e,t){var n=Vt(G++,7);return Qt(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function Kt(){var e;do{for(;e=Pt.shift();)try{Xt(e)}catch(t){q.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Nt.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xt),t.__h.some(Zt),t.__h=[]}catch(n){t.__h=[],q.__e(n,e.__v)}}}while(Pt.length)}q.__b=function(e){K=null,Ft&&Ft(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Bt&&Bt(e,t)},q.__r=function(e){It&&It(e),G=0;var t=(K=e.__c).__H;t&&(kt==K?K.__h=[]:(t.__h.some(Xt),t.__h.some(Zt),G=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),kt=K},q.diffed=function(e){Lt&&Lt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Yt(Nt.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),kt=K=null},q.__c=function(e,t){t.some(function(e){try{e.__h.some(Xt),e.__h=e.__h.filter(function(e){return!e.__||Zt(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],q.__e(n,e.__v)}}),Rt&&Rt(e,t)},q.unmount=function(e){zt&&zt(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,Yt(Pt.push(r))}else Xt(r)}catch(e){t=e}}),r.__H=void 0,t&&q.__e(t,r.__v))};var qt=typeof requestAnimationFrame==`function`;function Jt(e){var t,n=function(){clearTimeout(r),qt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);qt&&(t=requestAnimationFrame(n))}function Yt(e){e!=1&&At==q.requestAnimationFrame||((At=q.requestAnimationFrame)||Jt)(Kt)}function Xt(e){var t=K,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),K=t}function Zt(e){var t=K;e.__c=e.__(),K=t}function Qt(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!jt(t,e[n])})}function $t(e,t){return typeof t==`function`?t(e):t}function X(e,t,n=`en`){return e?e[t]??e[t.split(`-`)[0]]??e[n]??Object.values(e)[0]??``:``}function en(e){try{let t=new URL(e),n=t.hostname.replace(/^(www|m)\./,``),r;if(n===`youtu.be`?r=t.pathname.slice(1):n===`youtube.com`&&(r=t.searchParams.get(`v`)??t.pathname.match(/^\/(?:embed|shorts)\/([\w-]+)/)?.[1]),r)return{src:`https://www.youtube-nocookie.com/embed/${r}?autoplay=1&rel=0`,thumb:`https://i.ytimg.com/vi/${r}/hqdefault.jpg`};if(r=n===`vimeo.com`||n===`player.vimeo.com`?t.pathname.match(/(\d{5,})/)?.[1]:null,r)return{src:`https://player.vimeo.com/video/${r}?autoplay=1`}}catch{}return null}let tn=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`};function nn(e){let t=Number.parseInt(e.slice(1),16),n=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,r=.2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(t&255);return 1.05/(r+.05)>=(r+.05)/.0595?`#ffffff`:`#151823`}function rn(e){let t=[],n,r=e.send??((e,t)=>{navigator.sendBeacon&&navigator.sendBeacon(e,t)||fetch(e,{method:`POST`,body:t,keepalive:!0,headers:{"content-type":`text/plain`}}).catch(()=>{})});function i(){clearTimeout(n),n=void 0;let i=e.envelope();if(t.length&&i)for(;t.length;)r(e.url,JSON.stringify({...i,events:t.splice(0,20)}))}return addEventListener(`visibilitychange`,()=>document.visibilityState===`hidden`&&i()),addEventListener(`pagehide`,i),{push(r){t.push(r),t.length>=20?i():n??(n=setTimeout(i,e.delayMs??2e3))},flush:i,get size(){return t.length}}}let an={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{return null}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},on=()=>matchMedia(`(prefers-reduced-motion: reduce)`).matches,sn=e=>e+(crypto.randomUUID?crypto.randomUUID().replace(/-/g,``):Math.random().toString(36).slice(2)+Date.now().toString(36));function cn(){try{let e=sessionStorage.getItem(`playstep:s`);return e||sessionStorage.setItem(`playstep:s`,e=sn(`s_`)),e}catch{return sn(`s_`)}}async function ln(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function un(e){let t=cn(),n=an.get(`d`);n||an.set(`d`,n=sn(`d_`));let r,i=n,a=!1,o=rn({url:e.url,send:e.send,envelope:()=>{let s=e.userId();return s&&s!==r?(a||(a=!0,ln(`${e.appKey}:${s}`).then(e=>{r=s,i=`u_${e.slice(0,40)}`,a=!1,o.flush()})),null):(s||(i=n),{key:e.appKey,sdk:{name:e.sdk,version:e.version},platform:`web`,session_id:t,user_key:i,preview:e.preview})}});return{session:t,push:e=>o.push(e.message?{...e,message:e.message.slice(0,300)}:e),flush:o.flush}}let dn={x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,play:`<path d="M5 5a2 2 0 0 1 3-1.7l12 7a2 2 0 0 1 0 3.5l-12 7A2 2 0 0 1 5 19z"/>`,"volume-2":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.4 18.4a9 9 0 0 0 0-12.7"/>`,"volume-x":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="m16.5 14.5 5-5"/><path d="m16.5 9.5 5 5"/>`,check:`<path d="M20 6 9 17l-5-5"/>`,"maximize-2":`<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>`,"arrow-right":`<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>`,"rotate-ccw":`<path d="M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"/><path d="M3 3v5h5"/>`,"external-link":`<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>`,"ps-launcher":`<path d="M12 21a9 9 0 1 0-8-5L3 21l5-.9A9 9 0 0 0 12 21z"/><path d="M10 9v6l5-3z"/>`,"ps-level-up":`<path d="M3 21h5v-4h5v-4h5V9"/><path d="M18 9V3l4 2.5L18 8"/>`,"ps-guide":`<rect x="4" y="3" width="4" height="18" rx="2"/><path d="M12 5.5v10l7.5-5z"/>`};var fn=0;Array.isArray;function Z(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:void 0,__v:--fn,__i:-1,__u:0};return(i||a)&&(l.__source=i,l.__self=a),B.vnode&&B.vnode(l),l}function Q({name:e}){return Z(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:dn[e]}})}function pn(e){try{let t=JSON.parse(sessionStorage.getItem(`playstep:clips`)??`[]`);if(t.includes(e))return!1;sessionStorage.setItem(`playstep:clips`,JSON.stringify([...t,e].slice(-200)))}catch{}return!0}let $=e=>e.options.locale??navigator.language??`en`,mn=(e,t)=>X(t.name,$(e),t.locale_default)||t.id;function hn({ctx:e,guide:t,index:n,reduced:r,clip:i,big:a,onExpand:o,onDuration:s}){let c=t.steps[n],l=Wt(null),[u,d]=J(!0),[f,p]=J(!r&&i.source!==`embed`),[m,h]=J(i.duration_ms??0),g=r=>e.emit({type:r,guide_id:t.id,guide_version:t.version,step_id:c.id,step_index:n,clip_id:i.source===`hosted`?i.clip_id:void 0,clip_source:i.source}),_=e=>pn(`${e}|${i.url}`)&&g(e);if(Y(()=>{let e=l.current;e&&f&&(e.muted=u,e.play()?.catch(()=>{}))},[f,i.url]),Y(()=>s(f&&i.source!==`embed`?m:0),[m,f]),i.source===`embed`){let t=en(i.url),n=new URL(i.url).hostname.replace(/^www\./,``);return Z(`div`,{class:`clip embed`,children:f&&t?Z(`iframe`,{src:t.src,title:`Video: ${X(c.title,$(e))}`,allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowFullScreen:!0}):Z(U,{children:[(i.poster??t?.thumb)&&Z(`img`,{src:i.poster??t?.thumb,alt:``}),Z(`button`,{class:`play`,"aria-label":`Play video`,onClick:()=>(p(!0),g(`clip_played`)),children:Z(Q,{name:`play`})}),Z(`div`,{class:`bar`,children:Z(`span`,{class:`pill`,children:[Z(Q,{name:`external-link`}),n,m?` · ${tn(m)}`:``]})})]})})}return Z(`div`,{class:`clip`,children:[f?Z(`video`,{ref:l,src:i.url,poster:i.poster,muted:u,loop:!0,autoplay:!0,playsInline:!0,preload:`auto`,"aria-label":`Clip: ${X(c.title,$(e))}`,onLoadedData:()=>_(`clip_loaded`),onPlaying:()=>_(`clip_played`),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&h(t*1e3)}}):Z(U,{children:[i.poster&&Z(`img`,{src:i.poster,alt:``}),Z(`button`,{class:`play`,"aria-label":`Play clip`,onClick:()=>p(!0),children:Z(Q,{name:`play`})})]}),f&&Z(`div`,{class:`bar`,children:[Z(`span`,{class:`pill`,children:[Z(Q,{name:`play`}),m?`${tn(m)} loop`:`Loop`]}),Z(`button`,{class:`round`,"aria-label":u?`Unmute clip`:`Mute clip`,onClick:()=>{d(!u),l.current&&(l.current.muted=!u),u&&g(`clip_unmuted`)},children:Z(Q,{name:u?`volume-x`:`volume-2`})}),Z(`button`,{class:`round`,"aria-label":a?`Shrink clip`:`Expand clip`,"aria-pressed":a,onClick:o,children:Z(Q,{name:`maximize-2`})})]})]})}function gn({ctx:e,guide:t,index:n,reduced:r,cardRef:i,style:a}){let o=t.steps[n],s=t.steps.length,[c,l]=J(!1),[u,d]=J(0),f=n=>X(n,$(e),t.locale_default),p=o.complete_on.type===`next_button`;return Y(()=>{l(!1);let e=t.steps[n+1]?.clip;if(e&&e.source!==`embed`&&!r&&!navigator.connection?.saveData){let t=document.createElement(`video`);t.preload=`auto`,t.muted=!0,t.src=e.url}},[t.id,n]),Z(`div`,{ref:i,class:`card${c?` big`:``}`,style:a,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabIndex:-1,"data-step":o.id,children:[o.clip&&Z(hn,{ctx:e,guide:t,index:n,reduced:r,clip:o.clip,big:c,onExpand:()=>l(!c),onDuration:d},o.id),Z(`div`,{class:`body`,children:[Z(`div`,{class:`meta`,children:[Z(`span`,{children:[`Step `,n+1,` of `,s,` · `,mn(e,t)]}),Z(`button`,{class:`x`,"aria-label":`Close guide`,onClick:()=>e.dispatch({type:`dismiss`}),children:Z(Q,{name:`x`})})]}),Z(`div`,{class:`steps`,role:`img`,"aria-label":`Step ${n+1} of ${s}`,children:t.steps.map((e,t)=>Z(`span`,{class:`seg${t<n?` done`:t===n?` cur${u&&!r?` anim`:``}`:``}`,style:t===n&&u?{"--d":`${u}ms`}:void 0},t))}),Z(`h2`,{class:`title`,id:`ps-title`,children:f(o.title)}),Z(`p`,{class:`text`,id:`ps-text`,children:f(o.body)})]}),Z(`div`,{class:`foot`,children:[p?Z(`span`,{class:`sp`}):Z(`span`,{class:`wait`,children:[Z(`span`,{class:`pulse`,"aria-hidden":`true`}),`Waiting for you`]}),n>0&&Z(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`}),children:`Back`}),p&&Z(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`}),children:[n+1===s?`Done`:`Next`,Z(Q,{name:`arrow-right`})]})]})]})}let _n=[`width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)`,`width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)`,`width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)`,`width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)`,`width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)`,`width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)`];function vn({ctx:e,guide:t}){let n=e.engine.launcherGuides().find(n=>n.id!==t.id&&e.engine.progress.guides[n.id]?.status!==`done`),r=Wt(null);return Y(()=>r.current?.focus(),[]),Z(U,{children:[Z(`div`,{class:`scrim`,onClick:()=>e.dispatch({type:`close`})}),Z(`div`,{class:`cel`,ref:r,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabIndex:-1,children:[Z(`div`,{class:`art`,"aria-hidden":`true`,children:[_n.map((e,t)=>Z(`span`,{class:`bit`,style:e},t)),Z(`span`,{class:`tile`,children:Z(Q,{name:`ps-level-up`})})]}),Z(`h2`,{id:`ps-cel`,children:`Level cleared`}),Z(`p`,{children:[`You finished `,mn(e,t),`.`,n?` Next up: ${mn(e,n)}.`:``]}),Z(`div`,{class:`acts`,children:[Z(`button`,{class:`btn sec`,onClick:()=>e.dispatch({type:`start`,guide:t.id}),children:[Z(Q,{name:`rotate-ccw`}),`Replay`]}),n?Z(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`start`,guide:n.id}),children:[`Next guide`,Z(Q,{name:`arrow-right`})]}):Z(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`close`}),children:`Done`})]})]})]})}function yn({ctx:e,open:t,setOpen:n}){let r=Wt(null),i=Wt(null);Y(()=>{t?(i.current=e.root.activeElement??document.activeElement,r.current?.focus()):i.current?.focus()},[t]);let a=e.config.launcher,o=e.engine.launcherGuides();if(!o.length)return null;let s=e.engine.progress.guides,c=o.filter(e=>!s[e.id]).length,l=a?.position===`bottom-left`?` left`:``;return Z(U,{children:[t&&Z(`div`,{class:`panel${l}${a?.enabled?``:` solo`}`,ref:r,tabIndex:-1,role:`dialog`,"aria-label":`Guides`,children:[Z(`button`,{class:`x`,"aria-label":`Close guides`,onClick:()=>n(!1),children:Z(Q,{name:`x`})}),Z(`h2`,{children:X(a?.title,$(e))||`Need a hand?`}),Z(`p`,{children:X(a?.description,$(e))||`Pick a guide and play it step by step.`}),Z(`ul`,{class:`rows`,children:o.map(t=>{let r=s[t.id],i=t.steps.length,a=r?.status===`done`,o=r?.status===`running`;return Z(`li`,{children:Z(`button`,{class:`row`,onClick:()=>{n(!1),r&&e.dispatch({type:`reset_progress`,guide:t.id}),e.dispatch({type:`start`,guide:t.id})},children:[Z(`span`,{class:`ti${a?` mint`:r?``:` spark`}`,children:Z(Q,{name:a?`check`:`ps-guide`})}),Z(`span`,{class:`rb`,children:[Z(`span`,{class:`rt`,children:mn(e,t)}),Z(`span`,{class:`rm`,children:a?`Completed`:o?`Step ${r.step+1} of ${i}`:`${i} steps`}),o&&Z(`span`,{class:`prog`,"aria-hidden":`true`,children:Z(`i`,{style:{width:`${r.step/i*100}%`}})})]}),r?Z(`span`,{class:`rp`,children:[Z(Q,{name:`rotate-ccw`}),`Replay`]}):Z(`span`,{class:`new`,children:`New`})]})},t.id)})}),o.some(e=>s[e.id])&&Z(`div`,{class:`acts so`,children:Z(`button`,{class:`btn gho`,onClick:()=>{e.dispatch({type:`reset_progress`}),e.engine.active?n(!1):r.current?.focus()},children:`Start over`})}),e.config.flags?.show_badge!==!1&&Z(`a`,{class:`pb`,href:`https://playstep.app/?ref=badge`,target:`_blank`,rel:`noopener`,children:[Z(`span`,{dangerouslySetInnerHTML:{__html:`<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>`},style:`display:inline-flex;width:16px;height:16px`}),`Powered by PlayStep`]})]}),a?.enabled&&Z(`button`,{class:`lb${l}`,"aria-label":t?`Close guides`:`Open guides`,"aria-expanded":t,onClick:()=>n(!t),children:[Z(Q,{name:`ps-launcher`}),c>0&&!t&&Z(`span`,{class:`cnt`,children:c})]})]})}let bn=e=>!!e?.getClientRects().length;function xn(e,t){let n=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{n||(n=t?[...document.querySelectorAll(t.css)].find(e=>bn(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return bn(n)?n:null}function Sn(e,t,n){let[r,i]=J(()=>e?xn(e,t):null);return Y(()=>{if(!e)return i(null);let r=xn(e,t);i(r);let a=0,o=()=>{a=0;let n=xn(e,t);n!==r&&i(r=n)},s=new MutationObserver(()=>a||(a=requestAnimationFrame(o)));s.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-guide`,`hidden`,`style`,`class`]});let c=setTimeout(()=>!r&&n(e),3e3);return()=>{s.disconnect(),clearTimeout(c),cancelAnimationFrame(a)}},[e,t]),r}function Cn(e,t,n,r,i){let[a,o]=J(null);return Ut(()=>{let i=t.current;if(!i)return;if(!e){let e=()=>o({x:(innerWidth-i.offsetWidth)/2,y:r===`center`?(innerHeight-i.offsetHeight)/2:innerHeight-i.offsetHeight-24});e();let t=new ResizeObserver(e);return t.observe(i),addEventListener(`resize`,e),()=>{t.disconnect(),removeEventListener(`resize`,e)}}let a=e.getBoundingClientRect();(a.bottom<0||a.top>innerHeight)&&e.scrollIntoView({block:`center`,behavior:on()?`auto`:`smooth`});let s=()=>{let t=e.getBoundingClientRect(),r=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;Je(e,i,{strategy:`fixed`,placement:n===`auto`?`bottom`:n,middleware:[Ge(18),qe({fallbackPlacements:[`top`,`left`,`right`],padding:12}),Ke({padding:12})]}).then(({x:e,y:n})=>o({x:e,y:n,spot:{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(r+6,(t.height+12)/2)}}))};s();let c=new ResizeObserver(s);c.observe(e),c.observe(i),addEventListener(`scroll`,s,{capture:!0,passive:!0}),addEventListener(`resize`,s);let l=setInterval(s,400);return()=>{c.disconnect(),clearInterval(l),removeEventListener(`scroll`,s,{capture:!0}),removeEventListener(`resize`,s)}},[e,r,n,...i]),a}function wn({ctx:e,guide:t,index:n,reduced:r}){let i=t.steps[n],a=Sn(i.anchor,i.find?.web,t=>e.dispatch({type:`anchor_missing`,anchor:t})),o=Wt(null);Y(()=>{if(!a)return;let t=t=>t.composedPath().includes(a)&&e.dispatch({type:`tap`,anchor:i.anchor});return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[a]);let s=t.theme?.position??`bottom`,c=Cn(a,o,i.placement??`auto`,s,[i.id]),l=Wt(``);Y(()=>{c&&l.current!==i.id&&(l.current=i.id,document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)||o.current?.focus({preventScroll:!0}))},[i.id,c]);let[u,d]=J(!1);Y(()=>{c&&!u&&requestAnimationFrame(()=>d(!0))},[c]),Y(()=>{let t=t=>{if(t.key!==`Tab`||!o.current)return;let n=[...o.current.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],r=t.composedPath().includes(o.current),i=n[0],s=n.at(-1),c=e.root.activeElement;r&&!t.shiftKey&&c===s?(t.preventDefault(),(a??i)?.focus()):r&&t.shiftKey&&c===i?(t.preventDefault(),(a??s)?.focus()):a&&document.activeElement===a&&(t.preventDefault(),(t.shiftKey?s:i)?.focus())};return document.addEventListener(`keydown`,t,!0),()=>document.removeEventListener(`keydown`,t,!0)},[a]);let f=c?.spot;return Z(U,{children:[a&&f?Z(`div`,{class:`spot`,"aria-hidden":`true`,style:{width:`${f.w}px`,height:`${f.h}px`,transform:`translate(${f.x}px,${f.y}px)`,borderRadius:`${f.r}px`}}):!a&&s===`center`&&Z(`div`,{class:`scrim`,"aria-hidden":`true`}),Z(gn,{ctx:e,guide:t,index:n,reduced:r,cardRef:o,style:c?{transform:`translate(${Math.round(c.x)}px,${Math.round(c.y)}px)`,transition:u?void 0:`none`}:{visibility:`hidden`}})]})}function Tn({ctx:e,handle:t}){let[,n]=J(0),r=()=>n(e=>e+1),[i,a]=J(!1),o=on();t.update=r,t.openLauncher=()=>a(!0),Y(()=>{let t=t=>{t.key===`Escape`&&(i?a(!1):e.engine.active&&e.dispatch({type:e.engine.active.status===`completed`?`close`:`dismiss`}))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[i]);let s=e.engine.active,c=s?.guide??e.engine.launcherGuides()[0],l=c?.theme?.mode??`auto`,u=l===`dark`||l===`auto`&&matchMedia(`(prefers-color-scheme: dark)`).matches;e.root.host.setAttribute(`data-mode`,u?`dark`:`light`);let d=c?.theme?.accent,f=d?{"--ps-accent":d,"--ps-accent-hover":d,"--ps-on-accent":nn(d)}:void 0,p=s?.status===`running`?s.guide.steps[s.index]:void 0;return Z(`div`,{class:`l`,style:f,children:[Z(yn,{ctx:e,open:i&&!p,setOpen:a}),s?.status===`running`&&Z(wn,{ctx:e,guide:s.guide,index:s.index,reduced:o},s.guide.id),s?.status===`completed`&&Z(vn,{ctx:e,guide:s.guide}),Z(`div`,{class:`sr`,"aria-live":`polite`,children:p?`Step ${s.index+1} of ${s.guide.steps.length}: ${X(p.title,$(e))}`:s?`Level cleared`:``})]})}function En(e){let t=e.options,n=un({appKey:t.appKey,url:t.eventsUrl,sdk:t.sdkName??`web`,version:t.version,preview:t.preview,userId:e.userId,send:t.transport});e.outbox.splice(0).forEach(n.push);let r=document.createElement(`style`);r.textContent=`:host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-left:auto}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:99px;border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.bit{position:absolute;border-radius:99px}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.left{right:auto;left:24px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.panel{right:18px;bottom:86px}.solo{bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}`,e.root.appendChild(r);let i=document.createElement(`div`);e.root.appendChild(i);let a={update:()=>{},openLauncher:()=>{},send:n.push};return Ot(Z(Tn,{ctx:e,handle:a}),i),a}return e.findAnchor=xn,e.mount=En,e})({});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
//#region ../spec/src/types.d.ts
|
|
2
|
+
type Platform = 'web' | 'flutter' | 'react-native';
|
|
3
|
+
type LocalizedText = Record<string, string>;
|
|
4
|
+
interface ClipBase {
|
|
5
|
+
poster?: string;
|
|
6
|
+
duration_ms?: number;
|
|
7
|
+
}
|
|
8
|
+
type Clip = (ClipBase & {
|
|
9
|
+
source: 'hosted';
|
|
10
|
+
clip_id?: string;
|
|
11
|
+
url: string;
|
|
12
|
+
bytes?: number;
|
|
13
|
+
}) | (ClipBase & {
|
|
14
|
+
source: 'external';
|
|
15
|
+
url: string;
|
|
16
|
+
}) | (ClipBase & {
|
|
17
|
+
source: 'embed';
|
|
18
|
+
provider: 'youtube' | 'vimeo';
|
|
19
|
+
url: string;
|
|
20
|
+
});
|
|
21
|
+
type ClipSource = Clip['source'];
|
|
22
|
+
type CompleteOn = {
|
|
23
|
+
type: 'tap_anchor';
|
|
24
|
+
} | {
|
|
25
|
+
type: 'event';
|
|
26
|
+
name: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'manual';
|
|
29
|
+
} | {
|
|
30
|
+
type: 'next_button';
|
|
31
|
+
};
|
|
32
|
+
/** Where an anchor is when the app has no data-guide / GuideAnchor for it (see findSchema). */
|
|
33
|
+
interface Find {
|
|
34
|
+
web?: {
|
|
35
|
+
css: string;
|
|
36
|
+
text?: string;
|
|
37
|
+
};
|
|
38
|
+
flutter?: {
|
|
39
|
+
by: 'key' | 'text' | 'semantics' | 'tooltip';
|
|
40
|
+
value: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
interface Step {
|
|
44
|
+
id: string;
|
|
45
|
+
anchor?: string;
|
|
46
|
+
find?: Find;
|
|
47
|
+
title: LocalizedText;
|
|
48
|
+
body: LocalizedText;
|
|
49
|
+
clip?: Clip;
|
|
50
|
+
complete_on: CompleteOn;
|
|
51
|
+
placement: 'auto' | 'top' | 'bottom' | 'left' | 'right';
|
|
52
|
+
}
|
|
53
|
+
type Trigger = {
|
|
54
|
+
type: 'first_visit';
|
|
55
|
+
once: boolean;
|
|
56
|
+
} | {
|
|
57
|
+
type: 'page_view';
|
|
58
|
+
path: string;
|
|
59
|
+
once: boolean;
|
|
60
|
+
} | {
|
|
61
|
+
type: 'event';
|
|
62
|
+
name: string;
|
|
63
|
+
once: boolean;
|
|
64
|
+
} | {
|
|
65
|
+
type: 'manual';
|
|
66
|
+
};
|
|
67
|
+
interface SegmentRule {
|
|
68
|
+
trait: string;
|
|
69
|
+
op: 'eq' | 'neq' | 'in' | 'exists';
|
|
70
|
+
value?: string | number | boolean | (string | number)[];
|
|
71
|
+
}
|
|
72
|
+
interface Guide {
|
|
73
|
+
spec_version: 1 | 2;
|
|
74
|
+
id: string;
|
|
75
|
+
version: number;
|
|
76
|
+
name?: LocalizedText;
|
|
77
|
+
locale_default: string;
|
|
78
|
+
trigger: Trigger;
|
|
79
|
+
targeting: {
|
|
80
|
+
platforms: Platform[];
|
|
81
|
+
segments: SegmentRule[];
|
|
82
|
+
};
|
|
83
|
+
theme: {
|
|
84
|
+
accent?: string;
|
|
85
|
+
position: 'bottom' | 'center';
|
|
86
|
+
mode: 'auto' | 'light' | 'dark';
|
|
87
|
+
};
|
|
88
|
+
launcher: boolean;
|
|
89
|
+
steps: Step[];
|
|
90
|
+
}
|
|
91
|
+
interface ConfigFlags {
|
|
92
|
+
disabled: boolean;
|
|
93
|
+
paused_for_new_users: boolean;
|
|
94
|
+
show_badge: boolean;
|
|
95
|
+
}
|
|
96
|
+
interface LauncherConfig {
|
|
97
|
+
enabled: boolean;
|
|
98
|
+
position: 'bottom-right' | 'bottom-left';
|
|
99
|
+
title?: LocalizedText;
|
|
100
|
+
description?: LocalizedText;
|
|
101
|
+
}
|
|
102
|
+
/** Capture links (Generate with AI): where the capture panel sends screens. */
|
|
103
|
+
interface CaptureConfig {
|
|
104
|
+
endpoint: string;
|
|
105
|
+
expires_at: string;
|
|
106
|
+
max_screens: number;
|
|
107
|
+
}
|
|
108
|
+
interface AppConfig {
|
|
109
|
+
spec_version: 1;
|
|
110
|
+
app_id: string;
|
|
111
|
+
env: 'dev' | 'prod';
|
|
112
|
+
generated_at: string;
|
|
113
|
+
ingest_url?: string;
|
|
114
|
+
flags: ConfigFlags;
|
|
115
|
+
launcher: LauncherConfig;
|
|
116
|
+
guides: Guide[];
|
|
117
|
+
capture?: CaptureConfig;
|
|
118
|
+
}
|
|
119
|
+
type EventType = 'guide_shown' | 'step_shown' | 'step_completed' | 'clip_loaded' | 'clip_played' | 'clip_unmuted' | 'guide_completed' | 'guide_dismissed' | 'anchor_missing' | 'sdk_error' | 'progress_reset';
|
|
120
|
+
interface AnalyticsEvent {
|
|
121
|
+
type: EventType;
|
|
122
|
+
ts: number;
|
|
123
|
+
guide_id?: string;
|
|
124
|
+
guide_version?: number;
|
|
125
|
+
step_id?: string;
|
|
126
|
+
step_index?: number;
|
|
127
|
+
anchor?: string;
|
|
128
|
+
clip_id?: string;
|
|
129
|
+
clip_source?: ClipSource;
|
|
130
|
+
message?: string;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/core/engine.d.ts
|
|
134
|
+
type Traits = Record<string, unknown>;
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/core/sdk.d.ts
|
|
137
|
+
interface InitOptions {
|
|
138
|
+
/** Your publishable key, `ps_pub_…`. */
|
|
139
|
+
appKey: string;
|
|
140
|
+
/** Where configs and events live. Defaults to https://cdn.playstep.app. */
|
|
141
|
+
apiBase?: string;
|
|
142
|
+
/** Defaults to the browser language. */
|
|
143
|
+
locale?: string;
|
|
144
|
+
/** Send page views for client-side navigation automatically. Default true. */
|
|
145
|
+
autoPageViews?: boolean;
|
|
146
|
+
/** Use this config instead of fetching one (dashboard previews and tests). Nothing is metered. */
|
|
147
|
+
config?: AppConfig;
|
|
148
|
+
/** Preview mode: nothing is metered. Set automatically by `?playstep_preview=` links. */
|
|
149
|
+
preview?: boolean;
|
|
150
|
+
/** Called for every analytics event, so you can pipe guide events into your own analytics. */
|
|
151
|
+
onEvent?: (event: AnalyticsEvent) => void;
|
|
152
|
+
/** @internal Set by @axceera/playstep-react. */
|
|
153
|
+
sdkName?: 'web' | 'react';
|
|
154
|
+
/** @internal Tests: replaces navigator.sendBeacon. */
|
|
155
|
+
transport?: (url: string, body: string) => void;
|
|
156
|
+
}
|
|
157
|
+
interface PlayStep {
|
|
158
|
+
readonly version: string;
|
|
159
|
+
/** Starts the SDK. Safe to call once; later calls are ignored. */
|
|
160
|
+
init: (options: InitOptions) => void;
|
|
161
|
+
/** Tells PlayStep who the user is. The id is hashed before it leaves the browser; traits drive segments. */
|
|
162
|
+
identify: (userId: string, traits?: Traits) => void;
|
|
163
|
+
/** Reports one of your events: it can start a guide or complete an `event` step. */
|
|
164
|
+
track: (event: string) => void;
|
|
165
|
+
/** Starts a guide now, even if it has been completed before (a replay). */
|
|
166
|
+
start: (guideId: string) => void;
|
|
167
|
+
/** Completes the current step if its id matches (for `manual` steps). */
|
|
168
|
+
complete: (stepId: string) => void;
|
|
169
|
+
/** Reports a page or screen view (automatic for client-side navigation unless autoPageViews is false). */
|
|
170
|
+
page: (path?: string) => void;
|
|
171
|
+
/**
|
|
172
|
+
* Opens the list of guides this user can replay, whether or not the floating launcher button is on: call it from
|
|
173
|
+
* your own help menu. Does nothing when there are no guides to list; before the SDK has loaded, it opens once loaded.
|
|
174
|
+
*/
|
|
175
|
+
openLauncher: () => void;
|
|
176
|
+
/**
|
|
177
|
+
* Clears guide progress on this device so guides can start again: every guide, or only `guideId`. The user, their
|
|
178
|
+
* traits and the device id stay. A guide it clears closes, and first-visit and page triggers are checked again for
|
|
179
|
+
* the current page straight away. Emits `progress_reset`.
|
|
180
|
+
*/
|
|
181
|
+
resetProgress: (guideId?: string) => void;
|
|
182
|
+
/** Forgets the user and their guide progress on this device (call on sign-out). */
|
|
183
|
+
reset: () => void;
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/index.d.ts
|
|
187
|
+
export declare const playstep: PlayStep;
|
|
188
|
+
//#endregion
|
|
189
|
+
export { type AnalyticsEvent, type AppConfig, type Guide, type InitOptions, type PlayStep, playstep as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./util-D4Lqh5GT.js";const n=e=>RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`)}$`),r=e=>e.length>1?e.replace(/\/+$/,``):e;function i(e,t){return n(r(e)).test(r(t))}function a(e,t){return(e??[]).every(e=>{let n=t[e.trait];return e.op===`exists`?n!=null:e.op===`in`?Array.isArray(e.value)&&e.value.includes(n):e.op===`eq`?n===e.value:n!==e.value})}function o(e){let{config:t,platform:n}=e,r=e.progress??{seen:!1,guides:{}},o=e.traits??{},s=null,c,l=t.flags||{},u=(t.guides??[]).filter(e=>e.spec_version<=2&&(e.targeting?.platforms??[`web`]).includes(n)),d=e=>u.find(t=>t.id===e),f=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n===void 0?{}:{step_id:t.steps[n].id,step_index:n}}),p=e=>!l.disabled&&(!l.paused_for_new_users||r.seen)&&a(e.targeting?.segments,o),m=e=>{let t=r.guides[e.id];return!s&&p(e)&&(!t||t.status!==`done`&&(t.status===`running`||!e.trigger.once))},h=(e,t,n)=>{r.guides[e.id]={version:e.version,step:n,status:t}},g=(e,t)=>(s={guide:e,index:t,status:`running`},c=void 0,r.seen=!0,h(e,`running`,t),[f(`guide_shown`,e),f(`step_shown`,e,t)]),_=()=>{let e=s,t=[f(`step_completed`,e.guide,e.index)];return e.index+1>=e.guide.steps.length?(s={...e,status:`completed`},h(e.guide,`done`,e.index),t.push(f(`guide_completed`,e.guide))):(s={...e,index:e.index+1},c=void 0,h(e.guide,`running`,e.index+1),t.push(f(`step_shown`,e.guide,e.index+1))),t},v=e=>{let t=u.find(t=>m(t)&&e(t));return t?g(t,0):[]},y,b=()=>v(e=>e.trigger.type===`first_visit`||e.trigger.type===`page_view`&&y!==void 0&&i(e.trigger.path,y));function x(e){let t=s?.status===`running`?s.guide.steps[s.index]:null;switch(e.type){case`init`:{y=e.path;let t=u.find(e=>r.guides[e.id]?.status===`running`&&p(e));if(t){let e=r.guides[t.id];return g(t,e.version===t.version?Math.min(e.step,t.steps.length-1):0)}return b()}case`page_view`:return y=e.path,v(t=>t.trigger.type===`page_view`&&i(t.trigger.path,e.path));case`reset_progress`:{let t=typeof e.guide==`string`?e.guide:void 0,n=t===void 0?void 0:d(t);return t!==void 0&&!n?[]:((!n||s?.guide===n)&&(s=null),n?delete r.guides[n.id]:r.guides={},[{type:`progress_reset`,guide_id:t},...b()])}case`event`:return t?.complete_on.type===`event`&&t.complete_on.name===e.name?_():v(t=>t.trigger.type===`event`&&t.trigger.name===e.name);case`tap`:return t?.complete_on.type===`tap_anchor`&&t.anchor===e.anchor?_():[];case`complete`:return t?.id===e.step?_():[];case`next`:return t?.complete_on.type===`next_button`?_():[];case`back`:return!t||s.index===0?[]:(s={...s,index:s.index-1},h(s.guide,`running`,s.index),[f(`step_shown`,s.guide,s.index)]);case`close`:if(s?.status!==`completed`)return[];case`dismiss`:{if(!s)return[];let e=s;return s=null,e.status===`completed`?[]:(h(e.guide,`dismissed`,e.index),[f(`guide_dismissed`,e.guide,e.index)])}case`start`:{let n=d(e.guide);if(!n||!p(n)||t===n.steps[0])return[];let r=[];return s?.status===`running`&&(h(s.guide,`dismissed`,s.index),r.push(f(`guide_dismissed`,s.guide,s.index))),s=null,r.concat(g(n,0))}case`anchor_missing`:return!t||t.anchor!==e.anchor||c===e.anchor?[]:(c=e.anchor,[{...f(`anchor_missing`,s.guide,s.index),anchor:e.anchor}]);case`identify`:return o={...o,...e.traits},[]}}return{get active(){return s},progress:r,dispatch:x,launcherGuides:()=>u.filter(e=>e.launcher!==!1&&p(e))}}const s=`0.2.0`,c=`playstep_preview`;function l(n,r,i,a=`web`){let l,u,d,f,p,m,h,g={},_=[],v=[],y=()=>`p:${l.appKey}`,b=()=>l.preview||e.set(y(),u.progress),x=e=>{let t={...e,ts:Date.now()};l?.onEvent?.(t),l&&!l.preview&&(f?f.send(t):v.push(t))},S=e=>{try{u&&x({type:`sdk_error`,message:String(e)})}catch{}},C=e=>(...t)=>{try{e(...t)}catch(e){S(e)}},w=(e,t)=>C(n=>T({type:e,[t]:n}));function T(e){if(!u)return void _.push(e);let t=u.dispatch(e);b(),t.forEach(x),u.active&&D(),f?.update()}function E(){return m??(m=document.body.appendChild(document.createElement(`playstep-root`)).attachShadow({mode:`open`}))}function D(){return p??(p=n().then(e=>{let t=E();return t.innerHTML=``,f=e.mount({engine:u,config:d,options:l,root:t,outbox:v,userId:()=>h,dispatch:C(T),emit:C(x)})}).catch(e=>void S(e)))}let O,k=C(()=>{u?u.launcherGuides().length&&D().then(e=>e?.openLauncher()):O=!0});function A(e){e.launcher?.enabled&&u.launcherGuides().length&&!p&&r&&r().then(t=>{p||t.drawLauncher(E(),u,e.launcher.position,k)}).catch(S)}async function j(){let t=l,n=(t.apiBase??`https://cdn.playstep.app`).replace(/\/$/,``),r=null;try{r=new URLSearchParams(location.search).get(c)||(t.config?null:sessionStorage.getItem(c))}catch{}t.preview||(t.preview=!!(t.config||r));let s=t.config;try{s??(s=await fetch(`${n}/v1/${r?`preview/${r}?key=`:`config/`}${t.appKey}`).then(e=>e.json()))}catch{return}try{r&&sessionStorage[s.guides?`setItem`:`removeItem`](c,r)}catch{}if(s?.capture)return void i?.().then(e=>e.start(s.capture,t.appKey)).catch(S);if(s?.guides&&!s.flags?.disabled&&(d=s,t.eventsUrl=s.ingest_url??`${n}/v1/events`,u=o({config:s,platform:a,progress:t.preview?void 0:e.get(y())??void 0,traits:g}),T({type:`init`,path:location.pathname}),_.splice(0).forEach(T),O&&k(),A(s),t.autoPageViews!==!1)){let e=location.pathname,t=C(()=>location.pathname!==e&&T({type:`page_view`,path:e=location.pathname}));for(let e of[`pushState`,`replaceState`]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener(`popstate`,t)}}return{version:s,init:C(e=>{!l&&e?.appKey&&(l={...e,version:s},t(()=>j().catch(S)))}),identify:C((e,t)=>{h=e||void 0,g={...g,...t},T({type:`identify`,traits:g})}),track:w(`event`,`name`),start:w(`start`,`guide`),complete:w(`complete`,`step`),page:C(e=>T({type:`page_view`,path:e??location.pathname})),openLauncher:k,resetProgress:w(`reset_progress`,`guide`),reset:C(()=>{T({type:`dismiss`}),h=void 0,g={},u&&(Object.assign(u.progress,{seen:!1,guides:{}}),b(),f?.update()),l?.preview||e.set(`d`,null)})}}const u=l(()=>import(`./ui-DrNa6Tw8.js`),()=>import(`./launcher-button-CbdJMLHL.js`),()=>import(`./capture-Cg3cKBI_.js`));export{u as default,u as playstep};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./text-rFw_ND9o.js";const t=``;function n(t,n,r,i){let a=n.launcherGuides();if(!a.length)return;let o=a[0].theme?.accent??`#2e5bff`,s=a.filter(e=>!n.progress.guides[e.id]).length;t.innerHTML=`<button aria-label="Open guides" style="position:fixed;${r.slice(7)}:24px;bottom:24px;z-index:2147483000;padding:15px;border:0;border-radius:50%;cursor:pointer;background:${o};color:${e(o)};box-shadow:0 8px 24px #0004"><svg width=26 height=26 viewBox="0 0 24 24" fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 21a9 9 0 1 0-8.05-4.98L3 21l4.98-.95A8.96 8.96 0 0 0 12 21zM10 9v6l5-3z"/></svg>${s?`<b style="position:absolute;top:-2px;right:-2px;padding:0 6px;border-radius:9px;background:#ffc933;color:#151823;font:800 11px/20px sans-serif">${s}</b>`:``}</button>`,t.querySelector(`button`).onclick=i}export{t as captureIntegrity,n as drawLauncher};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t,n=`en`){return e?e[t]??e[t.split(`-`)[0]]??e[n]??Object.values(e)[0]??``:``}function t(e){try{let t=new URL(e),n=t.hostname.replace(/^(www|m)\./,``),r;if(n===`youtu.be`?r=t.pathname.slice(1):n===`youtube.com`&&(r=t.searchParams.get(`v`)??t.pathname.match(/^\/(?:embed|shorts)\/([\w-]+)/)?.[1]),r)return{src:`https://www.youtube-nocookie.com/embed/${r}?autoplay=1&rel=0`,thumb:`https://i.ytimg.com/vi/${r}/hqdefault.jpg`};if(r=n===`vimeo.com`||n===`player.vimeo.com`?t.pathname.match(/(\d{5,})/)?.[1]:null,r)return{src:`https://player.vimeo.com/video/${r}?autoplay=1`}}catch{}return null}const n=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`};function r(e){let t=Number.parseInt(e.slice(1),16),n=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,r=.2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(t&255);return 1.05/(r+.05)>=(r+.05)/.0595?`#ffffff`:`#151823`}export{r as i,t as n,e as r,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./util-D4Lqh5GT.js";import{i as n,n as r,r as i,t as a}from"./text-rFw_ND9o.js";import{computePosition as o,flip as s,offset as c,shift as l}from"@floating-ui/dom";import{render as u}from"preact";import{useEffect as d,useLayoutEffect as f,useRef as p,useState as m}from"preact/hooks";import{Fragment as h,jsx as g,jsxs as _}from"preact/jsx-runtime";function v(e){let t=[],n,r=e.send??((e,t)=>{navigator.sendBeacon&&navigator.sendBeacon(e,t)||fetch(e,{method:`POST`,body:t,keepalive:!0,headers:{"content-type":`text/plain`}}).catch(()=>{})});function i(){clearTimeout(n),n=void 0;let i=e.envelope();if(t.length&&i)for(;t.length;)r(e.url,JSON.stringify({...i,events:t.splice(0,20)}))}return addEventListener(`visibilitychange`,()=>document.visibilityState===`hidden`&&i()),addEventListener(`pagehide`,i),{push(r){t.push(r),t.length>=20?i():n??(n=setTimeout(i,e.delayMs??2e3))},flush:i,get size(){return t.length}}}const y=e=>e+(crypto.randomUUID?crypto.randomUUID().replace(/-/g,``):Math.random().toString(36).slice(2)+Date.now().toString(36));function b(){try{let e=sessionStorage.getItem(`playstep:s`);return e||sessionStorage.setItem(`playstep:s`,e=y(`s_`)),e}catch{return y(`s_`)}}async function x(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function S(t){let n=b(),r=e.get(`d`);r||e.set(`d`,r=y(`d_`));let i,a=r,o=!1,s=v({url:t.url,send:t.send,envelope:()=>{let e=t.userId();return e&&e!==i?(o||(o=!0,x(`${t.appKey}:${e}`).then(t=>{i=e,a=`u_${t.slice(0,40)}`,o=!1,s.flush()})),null):(e||(a=r),{key:t.appKey,sdk:{name:t.sdk,version:t.version},platform:`web`,session_id:n,user_key:a,preview:t.preview})}});return{session:n,push:e=>s.push(e.message?{...e,message:e.message.slice(0,300)}:e),flush:s.flush}}const C={x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,play:`<path d="M5 5a2 2 0 0 1 3-1.7l12 7a2 2 0 0 1 0 3.5l-12 7A2 2 0 0 1 5 19z"/>`,"volume-2":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.4 18.4a9 9 0 0 0 0-12.7"/>`,"volume-x":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="m16.5 14.5 5-5"/><path d="m16.5 9.5 5 5"/>`,check:`<path d="M20 6 9 17l-5-5"/>`,"maximize-2":`<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>`,"arrow-right":`<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>`,"rotate-ccw":`<path d="M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"/><path d="M3 3v5h5"/>`,"external-link":`<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>`,"ps-launcher":`<path d="M12 21a9 9 0 1 0-8-5L3 21l5-.9A9 9 0 0 0 12 21z"/><path d="M10 9v6l5-3z"/>`,"ps-level-up":`<path d="M3 21h5v-4h5v-4h5V9"/><path d="M18 9V3l4 2.5L18 8"/>`,"ps-guide":`<rect x="4" y="3" width="4" height="18" rx="2"/><path d="M12 5.5v10l7.5-5z"/>`};function w({name:e}){return/* @__PURE__ */ g(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:C[e]}})}function T(e){try{let t=JSON.parse(sessionStorage.getItem(`playstep:clips`)??`[]`);if(t.includes(e))return!1;sessionStorage.setItem(`playstep:clips`,JSON.stringify([...t,e].slice(-200)))}catch{}return!0}const E=e=>e.options.locale??navigator.language??`en`,D=(e,t)=>i(t.name,E(e),t.locale_default)||t.id;function O({ctx:e,guide:t,index:n,reduced:o,clip:s,big:c,onExpand:l,onDuration:u}){let f=t.steps[n],v=p(null),[y,b]=m(!0),[x,S]=m(!o&&s.source!==`embed`),[C,D]=m(s.duration_ms??0),O=r=>e.emit({type:r,guide_id:t.id,guide_version:t.version,step_id:f.id,step_index:n,clip_id:s.source===`hosted`?s.clip_id:void 0,clip_source:s.source}),k=e=>T(`${e}|${s.url}`)&&O(e);if(d(()=>{let e=v.current;e&&x&&(e.muted=y,e.play()?.catch(()=>{}))},[x,s.url]),d(()=>u(x&&s.source!==`embed`?C:0),[C,x]),s.source===`embed`){let t=r(s.url),n=new URL(s.url).hostname.replace(/^www\./,``);return/* @__PURE__ */ g(`div`,{class:`clip embed`,children:x&&t?/* @__PURE__ */ g(`iframe`,{src:t.src,title:`Video: ${i(f.title,E(e))}`,allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowFullScreen:!0}):/* @__PURE__ */ _(h,{children:[(s.poster??t?.thumb)&&/* @__PURE__ */ g(`img`,{src:s.poster??t?.thumb,alt:``}),/* @__PURE__ */ g(`button`,{class:`play`,"aria-label":`Play video`,onClick:()=>(S(!0),O(`clip_played`)),children:/* @__PURE__ */ g(w,{name:`play`})}),/* @__PURE__ */ g(`div`,{class:`bar`,children:/* @__PURE__ */ _(`span`,{class:`pill`,children:[/* @__PURE__ */ g(w,{name:`external-link`}),n,C?` · ${a(C)}`:``]})})]})})}return/* @__PURE__ */ _(`div`,{class:`clip`,children:[x?/* @__PURE__ */ g(`video`,{ref:v,src:s.url,poster:s.poster,muted:y,loop:!0,autoplay:!0,playsInline:!0,preload:`auto`,"aria-label":`Clip: ${i(f.title,E(e))}`,onLoadedData:()=>k(`clip_loaded`),onPlaying:()=>k(`clip_played`),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&D(t*1e3)}}):/* @__PURE__ */ _(h,{children:[s.poster&&/* @__PURE__ */ g(`img`,{src:s.poster,alt:``}),/* @__PURE__ */ g(`button`,{class:`play`,"aria-label":`Play clip`,onClick:()=>S(!0),children:/* @__PURE__ */ g(w,{name:`play`})})]}),x&&/* @__PURE__ */ _(`div`,{class:`bar`,children:[/* @__PURE__ */ _(`span`,{class:`pill`,children:[/* @__PURE__ */ g(w,{name:`play`}),C?`${a(C)} loop`:`Loop`]}),/* @__PURE__ */ g(`button`,{class:`round`,"aria-label":y?`Unmute clip`:`Mute clip`,onClick:()=>{b(!y),v.current&&(v.current.muted=!y),y&&O(`clip_unmuted`)},children:/* @__PURE__ */ g(w,{name:y?`volume-x`:`volume-2`})}),/* @__PURE__ */ g(`button`,{class:`round`,"aria-label":c?`Shrink clip`:`Expand clip`,"aria-pressed":c,onClick:l,children:/* @__PURE__ */ g(w,{name:`maximize-2`})})]})]})}function k({ctx:e,guide:t,index:n,reduced:r,cardRef:a,style:o}){let s=t.steps[n],c=t.steps.length,[l,u]=m(!1),[f,p]=m(0),h=n=>i(n,E(e),t.locale_default),v=s.complete_on.type===`next_button`;return d(()=>{u(!1);let e=t.steps[n+1]?.clip;if(e&&e.source!==`embed`&&!r&&!navigator.connection?.saveData){let t=document.createElement(`video`);t.preload=`auto`,t.muted=!0,t.src=e.url}},[t.id,n]),/* @__PURE__ */ _(`div`,{ref:a,class:`card${l?` big`:``}`,style:o,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabIndex:-1,"data-step":s.id,children:[s.clip&&/* @__PURE__ */ g(O,{ctx:e,guide:t,index:n,reduced:r,clip:s.clip,big:l,onExpand:()=>u(!l),onDuration:p},s.id),/* @__PURE__ */ _(`div`,{class:`body`,children:[/* @__PURE__ */ _(`div`,{class:`meta`,children:[/* @__PURE__ */ _(`span`,{children:[`Step `,n+1,` of `,c,` · `,D(e,t)]}),/* @__PURE__ */ g(`button`,{class:`x`,"aria-label":`Close guide`,onClick:()=>e.dispatch({type:`dismiss`}),children:/* @__PURE__ */ g(w,{name:`x`})})]}),/* @__PURE__ */ g(`div`,{class:`steps`,role:`img`,"aria-label":`Step ${n+1} of ${c}`,children:t.steps.map((e,t)=>/* @__PURE__ */ g(`span`,{class:`seg${t<n?` done`:t===n?` cur${f&&!r?` anim`:``}`:``}`,style:t===n&&f?{"--d":`${f}ms`}:void 0},t))}),/* @__PURE__ */ g(`h2`,{class:`title`,id:`ps-title`,children:h(s.title)}),/* @__PURE__ */ g(`p`,{class:`text`,id:`ps-text`,children:h(s.body)})]}),/* @__PURE__ */ _(`div`,{class:`foot`,children:[v?/* @__PURE__ */ g(`span`,{class:`sp`}):/* @__PURE__ */ _(`span`,{class:`wait`,children:[/* @__PURE__ */ g(`span`,{class:`pulse`,"aria-hidden":`true`}),`Waiting for you`]}),n>0&&/* @__PURE__ */ g(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`}),children:`Back`}),v&&/* @__PURE__ */ _(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`}),children:[n+1===c?`Done`:`Next`,/* @__PURE__ */ g(w,{name:`arrow-right`})]})]})]})}const A=[`width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)`,`width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)`,`width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)`,`width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)`,`width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)`,`width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)`];function j({ctx:e,guide:t}){let n=e.engine.launcherGuides().find(n=>n.id!==t.id&&e.engine.progress.guides[n.id]?.status!==`done`),r=p(null);return d(()=>r.current?.focus(),[]),/* @__PURE__ */ _(h,{children:[/* @__PURE__ */ g(`div`,{class:`scrim`,onClick:()=>e.dispatch({type:`close`})}),/* @__PURE__ */ _(`div`,{class:`cel`,ref:r,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabIndex:-1,children:[/* @__PURE__ */ _(`div`,{class:`art`,"aria-hidden":`true`,children:[A.map((e,t)=>/* @__PURE__ */ g(`span`,{class:`bit`,style:e},t)),/* @__PURE__ */ g(`span`,{class:`tile`,children:/* @__PURE__ */ g(w,{name:`ps-level-up`})})]}),/* @__PURE__ */ g(`h2`,{id:`ps-cel`,children:`Level cleared`}),/* @__PURE__ */ _(`p`,{children:[`You finished `,D(e,t),`.`,n?` Next up: ${D(e,n)}.`:``]}),/* @__PURE__ */ _(`div`,{class:`acts`,children:[/* @__PURE__ */ _(`button`,{class:`btn sec`,onClick:()=>e.dispatch({type:`start`,guide:t.id}),children:[/* @__PURE__ */ g(w,{name:`rotate-ccw`}),`Replay`]}),n?/* @__PURE__ */ _(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`start`,guide:n.id}),children:[`Next guide`,/* @__PURE__ */ g(w,{name:`arrow-right`})]}):/* @__PURE__ */ g(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`close`}),children:`Done`})]})]})]})}function M({ctx:e,open:t,setOpen:n}){let r=p(null),a=p(null);d(()=>{t?(a.current=e.root.activeElement??document.activeElement,r.current?.focus()):a.current?.focus()},[t]);let o=e.config.launcher,s=e.engine.launcherGuides();if(!s.length)return null;let c=e.engine.progress.guides,l=s.filter(e=>!c[e.id]).length,u=o?.position===`bottom-left`?` left`:``;return/* @__PURE__ */ _(h,{children:[t&&/* @__PURE__ */ _(`div`,{class:`panel${u}${o?.enabled?``:` solo`}`,ref:r,tabIndex:-1,role:`dialog`,"aria-label":`Guides`,children:[/* @__PURE__ */ g(`button`,{class:`x`,"aria-label":`Close guides`,onClick:()=>n(!1),children:/* @__PURE__ */ g(w,{name:`x`})}),/* @__PURE__ */ g(`h2`,{children:i(o?.title,E(e))||`Need a hand?`}),/* @__PURE__ */ g(`p`,{children:i(o?.description,E(e))||`Pick a guide and play it step by step.`}),/* @__PURE__ */ g(`ul`,{class:`rows`,children:s.map(t=>{let r=c[t.id],i=t.steps.length,a=r?.status===`done`,o=r?.status===`running`;return/* @__PURE__ */ g(`li`,{children:/* @__PURE__ */ _(`button`,{class:`row`,onClick:()=>{n(!1),r&&e.dispatch({type:`reset_progress`,guide:t.id}),e.dispatch({type:`start`,guide:t.id})},children:[/* @__PURE__ */ g(`span`,{class:`ti${a?` mint`:r?``:` spark`}`,children:/* @__PURE__ */ g(w,{name:a?`check`:`ps-guide`})}),/* @__PURE__ */ _(`span`,{class:`rb`,children:[/* @__PURE__ */ g(`span`,{class:`rt`,children:D(e,t)}),/* @__PURE__ */ g(`span`,{class:`rm`,children:a?`Completed`:o?`Step ${r.step+1} of ${i}`:`${i} steps`}),o&&/* @__PURE__ */ g(`span`,{class:`prog`,"aria-hidden":`true`,children:/* @__PURE__ */ g(`i`,{style:{width:`${r.step/i*100}%`}})})]}),r?/* @__PURE__ */ _(`span`,{class:`rp`,children:[/* @__PURE__ */ g(w,{name:`rotate-ccw`}),`Replay`]}):/* @__PURE__ */ g(`span`,{class:`new`,children:`New`})]})},t.id)})}),s.some(e=>c[e.id])&&/* @__PURE__ */ g(`div`,{class:`acts so`,children:/* @__PURE__ */ g(`button`,{class:`btn gho`,onClick:()=>{e.dispatch({type:`reset_progress`}),e.engine.active?n(!1):r.current?.focus()},children:`Start over`})}),e.config.flags?.show_badge!==!1&&/* @__PURE__ */ _(`a`,{class:`pb`,href:`https://playstep.app/?ref=badge`,target:`_blank`,rel:`noopener`,children:[/* @__PURE__ */ g(`span`,{dangerouslySetInnerHTML:{__html:`<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>`},style:`display:inline-flex;width:16px;height:16px`}),`Powered by PlayStep`]})]}),o?.enabled&&/* @__PURE__ */ _(`button`,{class:`lb${u}`,"aria-label":t?`Close guides`:`Open guides`,"aria-expanded":t,onClick:()=>n(!t),children:[/* @__PURE__ */ g(w,{name:`ps-launcher`}),l>0&&!t&&/* @__PURE__ */ g(`span`,{class:`cnt`,children:l})]})]})}const N=e=>!!e?.getClientRects().length;function P(e,t){let n=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{n||(n=t?[...document.querySelectorAll(t.css)].find(e=>N(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return N(n)?n:null}function F(e,t,n){let[r,i]=m(()=>e?P(e,t):null);return d(()=>{if(!e)return i(null);let r=P(e,t);i(r);let a=0,o=()=>{a=0;let n=P(e,t);n!==r&&i(r=n)},s=new MutationObserver(()=>a||(a=requestAnimationFrame(o)));s.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-guide`,`hidden`,`style`,`class`]});let c=setTimeout(()=>!r&&n(e),3e3);return()=>{s.disconnect(),clearTimeout(c),cancelAnimationFrame(a)}},[e,t]),r}function I(e,n,r,i,a){let[u,d]=m(null);return f(()=>{let a=n.current;if(!a)return;if(!e){let e=()=>d({x:(innerWidth-a.offsetWidth)/2,y:i===`center`?(innerHeight-a.offsetHeight)/2:innerHeight-a.offsetHeight-24});e();let t=new ResizeObserver(e);return t.observe(a),addEventListener(`resize`,e),()=>{t.disconnect(),removeEventListener(`resize`,e)}}let u=e.getBoundingClientRect();(u.bottom<0||u.top>innerHeight)&&e.scrollIntoView({block:`center`,behavior:t()?`auto`:`smooth`});let f=()=>{let t=e.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;o(e,a,{strategy:`fixed`,placement:r===`auto`?`bottom`:r,middleware:[c(18),s({fallbackPlacements:[`top`,`left`,`right`],padding:12}),l({padding:12})]}).then(({x:e,y:r})=>d({x:e,y:r,spot:{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(n+6,(t.height+12)/2)}}))};f();let p=new ResizeObserver(f);p.observe(e),p.observe(a),addEventListener(`scroll`,f,{capture:!0,passive:!0}),addEventListener(`resize`,f);let m=setInterval(f,400);return()=>{p.disconnect(),clearInterval(m),removeEventListener(`scroll`,f,{capture:!0}),removeEventListener(`resize`,f)}},[e,i,r,...a]),u}function L({ctx:e,guide:t,index:n,reduced:r}){let i=t.steps[n],a=F(i.anchor,i.find?.web,t=>e.dispatch({type:`anchor_missing`,anchor:t})),o=p(null);d(()=>{if(!a)return;let t=t=>t.composedPath().includes(a)&&e.dispatch({type:`tap`,anchor:i.anchor});return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[a]);let s=t.theme?.position??`bottom`,c=I(a,o,i.placement??`auto`,s,[i.id]),l=p(``);d(()=>{c&&l.current!==i.id&&(l.current=i.id,document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)||o.current?.focus({preventScroll:!0}))},[i.id,c]);let[u,f]=m(!1);d(()=>{c&&!u&&requestAnimationFrame(()=>f(!0))},[c]),d(()=>{let t=t=>{if(t.key!==`Tab`||!o.current)return;let n=[...o.current.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],r=t.composedPath().includes(o.current),i=n[0],s=n.at(-1),c=e.root.activeElement;r&&!t.shiftKey&&c===s?(t.preventDefault(),(a??i)?.focus()):r&&t.shiftKey&&c===i?(t.preventDefault(),(a??s)?.focus()):a&&document.activeElement===a&&(t.preventDefault(),(t.shiftKey?s:i)?.focus())};return document.addEventListener(`keydown`,t,!0),()=>document.removeEventListener(`keydown`,t,!0)},[a]);let v=c?.spot;return/* @__PURE__ */ _(h,{children:[a&&v?/* @__PURE__ */ g(`div`,{class:`spot`,"aria-hidden":`true`,style:{width:`${v.w}px`,height:`${v.h}px`,transform:`translate(${v.x}px,${v.y}px)`,borderRadius:`${v.r}px`}}):!a&&s===`center`&&/* @__PURE__ */ g(`div`,{class:`scrim`,"aria-hidden":`true`}),/* @__PURE__ */ g(k,{ctx:e,guide:t,index:n,reduced:r,cardRef:o,style:c?{transform:`translate(${Math.round(c.x)}px,${Math.round(c.y)}px)`,transition:u?void 0:`none`}:{visibility:`hidden`}})]})}function R({ctx:e,handle:r}){let[,a]=m(0),o=()=>a(e=>e+1),[s,c]=m(!1),l=t();r.update=o,r.openLauncher=()=>c(!0),d(()=>{let t=t=>{t.key===`Escape`&&(s?c(!1):e.engine.active&&e.dispatch({type:e.engine.active.status===`completed`?`close`:`dismiss`}))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[s]);let u=e.engine.active,f=u?.guide??e.engine.launcherGuides()[0],p=f?.theme?.mode??`auto`,h=p===`dark`||p===`auto`&&matchMedia(`(prefers-color-scheme: dark)`).matches;e.root.host.setAttribute(`data-mode`,h?`dark`:`light`);let v=f?.theme?.accent,y=v?{"--ps-accent":v,"--ps-accent-hover":v,"--ps-on-accent":n(v)}:void 0,b=u?.status===`running`?u.guide.steps[u.index]:void 0;return/* @__PURE__ */ _(`div`,{class:`l`,style:y,children:[/* @__PURE__ */ g(M,{ctx:e,open:s&&!b,setOpen:c}),u?.status===`running`&&/* @__PURE__ */ g(L,{ctx:e,guide:u.guide,index:u.index,reduced:l},u.guide.id),u?.status===`completed`&&/* @__PURE__ */ g(j,{ctx:e,guide:u.guide}),/* @__PURE__ */ g(`div`,{class:`sr`,"aria-live":`polite`,children:b?`Step ${u.index+1} of ${u.guide.steps.length}: ${i(b.title,E(e))}`:u?`Level cleared`:``})]})}function z(e){let t=e.options,n=S({appKey:t.appKey,url:t.eventsUrl,sdk:t.sdkName??`web`,version:t.version,preview:t.preview,userId:e.userId,send:t.transport});e.outbox.splice(0).forEach(n.push);let r=document.createElement(`style`);r.textContent=`:host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-left:auto}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:99px;border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.bit{position:absolute;border-radius:99px}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.left{right:auto;left:24px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.panel{right:18px;bottom:86px}.solo{bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}`,e.root.appendChild(r);let i=document.createElement(`div`);e.root.appendChild(i);let a={update:()=>{},openLauncher:()=>{},send:n.push};return u(/* @__PURE__ */ g(R,{ctx:e,handle:a}),i),a}export{P as findAnchor,z as mount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{return null}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},t=()=>matchMedia(`(prefers-reduced-motion: reduce)`).matches;function n(e){let t=()=>setTimeout(e);document.readyState===`complete`?t():addEventListener(`load`,t)}export{e as n,n as r,t};
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axceera/playstep",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "PlayStep web SDK: playable, video-first guides for any web app. A 3 KB loader; the guide UI loads only when a guide shows.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"homepage": "https://playstep.app/docs/sdk/web",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"onboarding",
|
|
10
|
+
"product tour",
|
|
11
|
+
"guides",
|
|
12
|
+
"walkthrough",
|
|
13
|
+
"video"
|
|
14
|
+
],
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/*.js",
|
|
27
|
+
"dist/*.d.ts",
|
|
28
|
+
"dist/cdn"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@floating-ui/dom": "^1.8.0",
|
|
32
|
+
"preact": "^11.0.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@playwright/test": "^1.64.0",
|
|
36
|
+
"@size-limit/file": "^14.2.0",
|
|
37
|
+
"@types/node": "^24.19.1",
|
|
38
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
39
|
+
"happy-dom": "^20.14.6",
|
|
40
|
+
"size-limit": "^14.2.0",
|
|
41
|
+
"tsdown": "^0.23.0",
|
|
42
|
+
"typescript": "~6.0.3",
|
|
43
|
+
"vite": "^8.3.4",
|
|
44
|
+
"vitest": "^4.1.11",
|
|
45
|
+
"@playstep/design-system": "0.1.0",
|
|
46
|
+
"@playstep/spec": "0.1.0"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsdown && node scripts/cdn.ts",
|
|
50
|
+
"dev": "vite --config e2e/vite.config.ts",
|
|
51
|
+
"test": "vitest run --coverage",
|
|
52
|
+
"typecheck": "tsc --noEmit",
|
|
53
|
+
"lint": "eslint .",
|
|
54
|
+
"size": "size-limit",
|
|
55
|
+
"e2e": "playwright test"
|
|
56
|
+
}
|
|
6
57
|
}
|