@axceera/playstep 0.9.0 → 0.11.2

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/README.md CHANGED
@@ -13,6 +13,7 @@ import { playstep } from '@axceera/playstep'
13
13
  playstep.init({ appKey: 'ps_pub_xxx' })
14
14
  playstep.identify(user.id, { plan: user.plan }) // the id is hashed before it leaves the browser
15
15
  playstep.track('invoice_page_opened') // starts guides and completes `event` steps
16
+ playstep.track('invoice_sent', { amount: 49 }) // properties go to add-ons such as Insights; guides use the name
16
17
  ```
17
18
 
18
19
  Mark the elements your guides point at with `data-guide`:
@@ -23,8 +24,23 @@ Mark the elements your guides point at with `data-guide`:
23
24
 
24
25
  Other calls: `playstep.start(guideId)`, `playstep.complete(stepId)`, `playstep.page(path)`,
25
26
  `playstep.openLauncher({ anchor })` (the list of guides people can replay, next to your own menu button), `playstep.resetProgress(guideId?)`
26
- (let guides start again, keeping the user), `playstep.reset()` (on sign-out) and `playstep.pause()` / `playstep.resume()`
27
- (no guides for now, for a user who should not see them, keeping their progress).
27
+ (let guides start again, keeping the user), `playstep.identify('')` (on sign-out, keeping the user's guide progress
28
+ here for their return; add-ons stop recording them), `playstep.reset()` (on sign-out, forgetting the user, their traits
29
+ and their progress) and `playstep.pause()` / `playstep.resume()` (no guides for now, for a user who should not see
30
+ them, keeping their progress). Another user signing in without a page load gets their own progress from PlayStep, not
31
+ the last user's.
32
+
33
+ Add-ons attach with `playstep.use(plugin)`: a function that hears the config once it loads, then each `identify`,
34
+ `track` (with its properties), `page` and `reset`. Insights, PlayStep's analytics add-on, attaches this way; the script
35
+ tag loads it by itself only for an app with analytics on, and an app without it loads nothing more.
36
+ `@axceera/playstep/plugin` exports the event queue add-ons share with the SDK.
37
+
38
+ Traits passed to `identify` merge with earlier ones; pass one as `null` to remove it. For a signed-in user, guide
39
+ progress follows them across devices and browsers (on https): the SDK sends a hash of their id with the config request
40
+ and takes PlayStep's record of their guides. Call `identify` before PlayStep loads to have it on the first page; when
41
+ another user signs in after it has loaded, the SDK asks for the config once more, since some guides go only to some
42
+ groups of users (Insights cohorts). A user held out of a guide (a holdout, which measures what the guide changes) never
43
+ sees it: the SDK sends `guide_held_out` once, which loads the event delivery chunk for that one event.
28
44
 
29
45
  Pass your router as `init({ navigate: (path) => router.push(path) })` and a guide started from the guide list, the
30
46
  finish screen or `start()` on another page begins on step 1 on its start page, set in the dashboard (`/app/*/projects`:
@@ -47,8 +63,9 @@ carries the hashes of the chunks it loads, so pinning it covers everything that
47
63
  data-app-key="ps_pub_xxx"></script>
48
64
  ```
49
65
 
50
- - About 3.3 KB gzipped until a guide shows; the guide card (about 8.6 KB) and event delivery (about 2 KB) load only
51
- then, the guide list and the finish screen only when they show. No dependencies.
66
+ - About 3.8 KB gzipped until a guide shows; the guide card (about 8.6 KB) and event delivery (about 2 KB) load only
67
+ then, the guide list and the finish screen only when they show. Insights (`insights.js`, about 4 KB) loads only for
68
+ an app with analytics on. No dependencies.
52
69
  - Feather-light by design: PlayStep's API sends each user a config already made for their language and platform, so
53
70
  the SDK only draws, and new features arrive as data rather than code.
54
71
  - Never loses usage: batches that cannot be sent are retried with backoff and kept in local storage until they go
@@ -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){return i.replace(e,`[email]`).replace(r,`[id]`).replace(t,e=>e.replace(/\D/g,``).length>=7?`[number]`:e).replace(n,`[number]`)}function o(e){if(!e)return``;let t=a(e.replace(/\s+/g,` `).trim());return t.length>80?`${t.slice(0,79)}…`:t}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}}function c(){let e=document.createElement(`canvas`);e.width=e.height=1;let t=e.getContext(`2d`,{willReadFrequently:!0}),n=e=>{if(!t||!e||e===`transparent`||e===`none`||(t.fillStyle=`#010203`,t.fillStyle=e,t.fillStyle===`#010203`&&!/^#010203$/i.test(e)))return null;t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let n=t.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]/255]},r=e=>`#${e.slice(0,3).map(e=>e.toString(16).padStart(2,`0`)).join(``)}`,i=e=>(Math.max(e[0],e[1],e[2])-Math.min(e[0],e[1],e[2]))/255,a=e=>{let[t,n,r]=e.slice(0,3).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},o=(e,t)=>{let r=n(e),i=n(t);return Math.hypot(r[0]-i[0],r[1]-i[1],r[2]-i[2])<30},s=e=>{let t=e.getBoundingClientRect();if(t.width<4||t.height<4||t.bottom<0||t.top>innerHeight*3)return null;let n=getComputedStyle(e);return n.visibility===`hidden`||n.display===`none`||Number(n.opacity||1)<.3?null:{r:t,s:n}},c=e=>{let t=n(e);return t&&t[3]>=.9?t:null},l=e=>e.length?e.sort((e,t)=>e-t)[Math.floor(e.length/2)]:void 0,u=null;for(let e of[document.querySelector(`#root,#app,#__next,[data-reactroot],main`),document.body,document.documentElement])if(u=e?c(getComputedStyle(e).backgroundColor):null,u)break;for(let e=document.elementFromPoint(innerWidth/2,innerHeight/2);!u&&e;e=e.parentElement)u=c(getComputedStyle(e).backgroundColor);u??(u=getComputedStyle(document.documentElement).colorScheme.trim()===`dark`?[18,18,18,1]:[255,255,255,1]);let d=a(u)<.2,f=n(getComputedStyle(document.querySelector(`main`)??document.body).color),p=[],m=(e,t,n)=>{let r=p.find(t=>t.from===n&&o(t.color,e));r?r.weight+=t:p.push({color:e,weight:t,from:n})},h=[],g=document.querySelectorAll(`button,[role=button],input[type=submit],input[type=button],a,[class*=btn],[class*=Btn],[class*=button],[class*=Button]`);for(let e of[...g].slice(0,400)){let t=s(e);if(!t)continue;let o=c(t.s.backgroundColor);if(o&&i(o)>.18&&a(o)>.02&&a(o)<.9){m(r(o),Math.min(t.r.width*t.r.height,3e4),`button`);let e=Number.parseFloat(t.s.borderTopLeftRadius)||0;h.push(e>=t.r.height/2-1?999:e)}else if(e.tagName===`A`){let e=n(t.s.color);e&&i(e)>.25&&m(r(e),400,`link`)}}let _=getComputedStyle(document.documentElement),v=/* @__PURE__ */ new Set,y=0;for(let e of[...document.styleSheets]){let t;try{t=e.cssRules}catch{continue}for(let e of[...t]){if(++y>3e3)break;let t=e.style;if(t&&/:root|html|body|\.light|\[data-theme/.test(e.selectorText??``))for(let e of[...t]){if(!e.startsWith(`--`)||v.has(e)||!/primary|accent|brand/i.test(e)||/foreground|fg|text|contrast|muted|soft|subtle|hover|active|border|ring|shadow|sidebar|chart|50\b|100\b|900\b/i.test(e))continue;v.add(e);let t=_.getPropertyValue(e).trim(),a=n(t)??n(`hsl(${t})`)??n(`rgb(${t})`)??n(`oklch(${t})`);a&&a[3]>=.9&&i(a)>.18&&m(r(a),/^--(color-)?(primary|brand)$/i.test(e)?8e4:4e4,`variable`)}}}let b=n(document.querySelector(`meta[name=theme-color]`)?.getAttribute(`content`));b&&i(b)>.18&&m(r(b),2e4,`theme-color`);let x=[],S=[],C=document.querySelectorAll(`section,article,aside,dialog,[role=dialog],[class*=card],[class*=Card],[class*=panel],[class*=Panel],div`);for(let e of[...C].slice(0,800)){let t=s(e);if(!t||t.r.width*t.r.height<2e4||t.r.width>innerWidth*.95)continue;let n=c(t.s.backgroundColor);if(!n||i(n)>.2||o(r(n),r(u))||a(n)<.2!==d)continue;let l=t.s.boxShadow!==`none`||Number.parseFloat(t.s.borderTopWidth)>0,f=r(n),p=x.find(e=>o(e.color,f)),m=Math.min(t.r.width*t.r.height,2e5)*(l?2:1);p?p.weight+=m:x.push({color:f,weight:m}),l&&S.push(Number.parseFloat(t.s.borderTopLeftRadius)||0)}let w=getComputedStyle(document.body).fontFamily,T=document.querySelector(`h1,h2`),E=T?getComputedStyle(T).fontFamily:void 0;return{scheme:d?`dark`:`light`,background:r(u),...f?{text:r(f)}:{},accents:p.sort((e,t)=>t.weight-e.weight).slice(0,8),surfaces:x.sort((e,t)=>t.weight-e.weight).slice(0,4).map(e=>e.color),...w?{font:w.slice(0,300)}:{},...E&&E!==w?{displayFont:E.slice(0,300)}:{},...h.length?{radius:l(h)}:{},...S.length?{cardRadius:l(S)}:{}}}function l(){try{return c()}catch{return}}const u=`playstep_preview`,d=`playstep_capture_on`,f={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 p(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&&!i(e.href)?e.href:void 0,css:e.css&&!i(e.css)?e.css:void 0})).filter(e=>e.anchor||e.css)}}function m(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=``,c,m=!1,h=(n=``)=>`${e.endpoint}${n}?key=${encodeURIComponent(t)}`,g=(e,t,n=!1)=>{let r=document.createElement(`button`);return r.textContent=e,n&&(r.className=`go`),r.onclick=t,r},_=(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)},v=()=>{m=!0,clearTimeout(c),f.set(u,null),f.set(d,null),n.remove()},y=()=>{m=!0,f.set(u,null),f.set(d,null),_(`Capture link expired`,`Get a new link from Generate with AI in PlayStep.`,[g(`Close`,v,!0)])},b=e=>_(`Capturing · ${a} ${a===1?`page`:`pages`}`,`Open the pages your users need help with. Each one is added as you go.`,[g(`Capture this page`,()=>void x()),g(`Finish`,()=>void S(),!0)],{live:!0,note:e});async function x(){if(m)return;clearTimeout(c);let e={...p(s()),style:l()};try{let t=await fetch(h(`/screens`),{method:`POST`,headers:{"content-type":`text/plain`},body:JSON.stringify(e)});if(t.status===404||t.status===410)return y();let n=await t.json().catch(()=>({}));if(!t.ok)return b(n.message??`That page could not be added.`);a=n.screens??a+1,o=location.pathname,b(`Added ${e.title||o}`)}catch{b(`PlayStep could not be reached. It will try again on the next page.`)}}async function S(){m=!0,await fetch(h(`/finish`),{method:`POST`}).catch(()=>void 0),f.set(u,null),f.set(d,null),_(`Capture finished`,`${a} ${a===1?`page`:`pages`} captured. Go back to PlayStep to generate tours.`,[g(`Close`,()=>n.remove(),!0)])}let C=()=>{m||f.get(d)!==`1`||location.pathname===o||(clearTimeout(c),c=setTimeout(()=>void x(),1200))};for(let e of[`pushState`,`replaceState`]){let t=history[e];history[e]=function(...e){t.apply(this,e),C()}}addEventListener(`popstate`,C);let w=()=>{f.set(d,`1`),b(),C()};return f.get(d)===`1`?fetch(h()).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{a=e.screens,w()}).catch(e=>e===404?y():w()):_(`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.`,[g(`Start capturing`,w,!0),g(`Not now`,v)]),{captureNow:x,stop:v}}export{p as redactScreen,s as snapshotPage,m as start};
@@ -1 +1 @@
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,o=/\d{6,}/g,r=/\b(?=[\w-]*\d)[\w-]{24,}\b/g;function l(e){return[t,r,o].some(t=>new RegExp(t.source).test(e))||[...e.matchAll(n)].some(e=>e[0].replace(/\D/g,"").length>=7)}function a(e){if(!e)return"";let l=e.replace(/\s+/g," ").trim().replace(t,"[email]").replace(r,"[id]").replace(n,e=>e.replace(/\D/g,"").length>=7?"[number]":e).replace(o,"[number]");return l.length>80?`${l.slice(0,79)}…`:l}function i(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,o=e=>(e??"").replace(/\s+/g," ").trim().slice(0,80),r=e=>`"${e.replace(/["\\]/g,"\\$&")}"`,l=e=>CSS.escape(e),a=e=>{try{return 1===document.querySelectorAll(e).length}catch{return!1}},i=e=>{let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return"hidden"!==n.visibility&&"none"!==n.display&&Number(n.opacity||1)>.05},s=e=>{let t=e.getAttribute("role"),n=e.tagName,o=(e.getAttribute("type")??"").toLowerCase();return"tab"===t||"menuitem"===t||"link"===t||"button"===t?t:"checkbox"===t||"switch"===t||"INPUT"===n&&("checkbox"===o||"radio"===o)?"checkbox":"A"===n?"link":"BUTTON"===n||"SUMMARY"===n||"INPUT"===n&&/^(submit|button|reset|image)$/.test(o)?"button":"SELECT"===n?"select":"INPUT"===n||"TEXTAREA"===n?"input":"other"},c=e=>{let o=e.tagName.toLowerCase(),i=[];e.id&&!t.test(e.id)&&i.push(`#${l(e.id)}`);for(let t of["data-testid","data-test","data-cy","data-qa"]){let n=e.getAttribute(t);n&&i.push(`[${t}=${r(n)}]`)}for(let t of["aria-label","name","title","placeholder"]){let n=e.getAttribute(t);n&&n.length<=80&&i.push(`${o}[${t}=${r(n)}]`)}let s=e.getAttribute("href");"a"===o&&s&&!/^javascript:/i.test(s)&&s.length<=200&&i.push(`a[href=${r(s)}]`);let c=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!t.test(e)&&!n.test(e));c.length&&i.push(`${o}.${c.slice(0,3).map(l).join(".")}`);for(let e of i)if(a(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(`#${l(d.id)}`);break}let n=d.tagName.toLowerCase(),o=d.parentElement?[...d.parentElement.children].filter(e=>e.tagName===d.tagName):[];u.unshift(o.length>1?`${n}:nth-of-type(${o.indexOf(d)+1})`:n),d=d.parentElement}let p=u.join(">");return a(p)?p: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 o=e.labels;return o?.length?o[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]")&&i(e)&&!e.parentElement?.closest("a[href],button,[role=button],[role=link]")).map((e,t)=>{let n=e.getBoundingClientRect(),o=n.bottom>0&&n.top<innerHeight;return{e:e,i:t,score:(e.hasAttribute("data-guide")?0:2)+ +!o}}).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,e).sort((e,t)=>e.i-t.i),p=[];for(let{e:e}of d){let t,n=s(e),r=e.getAttribute("data-guide"),l="input"===n||"select"===n?"":o(e.innerText||e.textContent),a=o(u(e))||("INPUT"===e.tagName&&"button"===n?o(e.value):""),i=o(e.getAttribute("placeholder")),d=e.getAttribute("href");if("A"===e.tagName&&d)try{let e=new URL(d,location.href);e.origin===location.origin&&(t=e.pathname)}catch{}let h=r?void 0:c(e);if(!r&&!h)continue;let m=e.getBoundingClientRect();p.push({ref:`e${p.length+1}`,role:n,...l?{text:l}:{},...a&&a!==l?{label:a}:{},...i?{placeholder:i}:{},...t?{href:t}:{},...r?{anchor:r.slice(0,64)}:{css:h.slice(0,300)},clickable:"input"!==n&&"select"!==n&&"other"!==n,rect:[m.left+scrollX,m.top+scrollY,m.width,m.height].map(Math.round)})}let h=[...document.querySelectorAll("h1,h2,h3,[role=heading]")].filter(e=>!e.closest("[data-private]")&&i(e)).map(e=>o(e.innerText)).filter(Boolean).slice(0,10);return{platform:"web",path:location.pathname||"/",...document.title?{title:o(document.title)}:{},headings:h,viewport:[innerWidth,innerHeight],elements:p}}function s(){try{return function(){let e=document.createElement("canvas");e.width=e.height=1;let t=e.getContext("2d",{willReadFrequently:!0}),n=e=>{if(!t||!e||"transparent"===e||"none"===e||(t.fillStyle="#010203",t.fillStyle=e,"#010203"===t.fillStyle&&!/^#010203$/i.test(e)))return null;t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let n=t.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]/255]},o=e=>`#${e.slice(0,3).map(e=>e.toString(16).padStart(2,"0")).join("")}`,r=e=>(Math.max(e[0],e[1],e[2])-Math.min(e[0],e[1],e[2]))/255,l=e=>{let[t,n,o]=e.slice(0,3).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*o},a=(e,t)=>{let o=n(e),r=n(t);return Math.hypot(o[0]-r[0],o[1]-r[1],o[2]-r[2])<30},i=e=>{let t=e.getBoundingClientRect();if(t.width<4||t.height<4||t.bottom<0||t.top>3*innerHeight)return null;let n=getComputedStyle(e);return"hidden"===n.visibility||"none"===n.display||Number(n.opacity||1)<.3?null:{r:t,s:n}},s=e=>{let t=n(e);return t&&t[3]>=.9?t:null},c=e=>e.length?e.sort((e,t)=>e-t)[Math.floor(e.length/2)]:void 0,u=null;for(let e of[document.querySelector("#root,#app,#__next,[data-reactroot],main"),document.body,document.documentElement])if(u=e?s(getComputedStyle(e).backgroundColor):null,u)break;for(let e=document.elementFromPoint(innerWidth/2,innerHeight/2);!u&&e;e=e.parentElement)u=s(getComputedStyle(e).backgroundColor);u??(u="dark"===getComputedStyle(document.documentElement).colorScheme.trim()?[18,18,18,1]:[255,255,255,1]);let d=l(u)<.2,p=n(getComputedStyle(document.querySelector("main")??document.body).color),h=[],m=(e,t,n)=>{let o=h.find(t=>t.from===n&&a(t.color,e));o?o.weight+=t:h.push({color:e,weight:t,from:n})},g=[],f=document.querySelectorAll("button,[role=button],input[type=submit],input[type=button],a,[class*=btn],[class*=Btn],[class*=button],[class*=Button]");for(let e of[...f].slice(0,400)){let t=i(e);if(!t)continue;let a=s(t.s.backgroundColor);if(a&&r(a)>.18&&l(a)>.02&&l(a)<.9){m(o(a),Math.min(t.r.width*t.r.height,3e4),"button");let e=Number.parseFloat(t.s.borderTopLeftRadius)||0;g.push(e>=t.r.height/2-1?999:e)}else if("A"===e.tagName){let e=n(t.s.color);e&&r(e)>.25&&m(o(e),400,"link")}}let b=getComputedStyle(document.documentElement),y=new Set,x=0;for(let e of[...document.styleSheets]){let t;try{t=e.cssRules}catch{continue}for(let e of[...t]){if(++x>3e3)break;let t=e.style;if(t&&/:root|html|body|\.light|\[data-theme/.test(e.selectorText??""))for(let e of[...t]){if(!e.startsWith("--")||y.has(e)||!/primary|accent|brand/i.test(e)||/foreground|fg|text|contrast|muted|soft|subtle|hover|active|border|ring|shadow|sidebar|chart|50\b|100\b|900\b/i.test(e))continue;y.add(e);let t=b.getPropertyValue(e).trim(),l=n(t)??n(`hsl(${t})`)??n(`rgb(${t})`)??n(`oklch(${t})`);l&&l[3]>=.9&&r(l)>.18&&m(o(l),/^--(color-)?(primary|brand)$/i.test(e)?8e4:4e4,"variable")}}}let w=n(document.querySelector("meta[name=theme-color]")?.getAttribute("content"));w&&r(w)>.18&&m(o(w),2e4,"theme-color");let S=[],v=[],k=document.querySelectorAll("section,article,aside,dialog,[role=dialog],[class*=card],[class*=Card],[class*=panel],[class*=Panel],div");for(let e of[...k].slice(0,800)){let t=i(e);if(!t||t.r.width*t.r.height<2e4||t.r.width>.95*innerWidth)continue;let n=s(t.s.backgroundColor);if(!n||r(n)>.2||a(o(n),o(u))||l(n)<.2!==d)continue;let c="none"!==t.s.boxShadow||Number.parseFloat(t.s.borderTopWidth)>0,p=o(n),h=S.find(e=>a(e.color,p)),m=Math.min(t.r.width*t.r.height,2e5)*(c?2:1);h?h.weight+=m:S.push({color:p,weight:m}),c&&v.push(Number.parseFloat(t.s.borderTopLeftRadius)||0)}let C=getComputedStyle(document.body).fontFamily,$=document.querySelector("h1,h2"),A=$?getComputedStyle($).fontFamily:void 0;return{scheme:d?"dark":"light",background:o(u),...p?{text:o(p)}:{},accents:h.sort((e,t)=>t.weight-e.weight).slice(0,8),surfaces:S.sort((e,t)=>t.weight-e.weight).slice(0,4).map(e=>e.color),...C?{font:C.slice(0,300)}:{},...A&&A!==C?{displayFont:A.slice(0,300)}:{},...g.length?{radius:c(g)}:{},...v.length?{cardRadius:c(v)}:{}}}()}catch{return}}let c="playstep_preview",u="playstep_capture_on",d=e=>{try{return sessionStorage.getItem(e)}catch{return null}},p=(e,t)=>{try{null===t?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}catch{}};function h(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&&!l(e.href)?e.href:void 0,css:e.css&&!l(e.css)?e.css:void 0})).filter(e=>e.anchor||e.css)}}return e.redactScreen=h,e.snapshotPage=i,e.start=function(e,t){let n=document.createElement("playstep-capture"),o=n.attachShadow({mode:"open"});document.body.appendChild(n);let r=document.createElement("div");r.className="p",r.setAttribute("role","region"),r.setAttribute("aria-label","PlayStep capture"),o.innerHTML='<style>:host{all:initial}\n.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}\nh2{margin:0 0 4px;font-size:15px;line-height:22px;font-weight:700;display:flex;align-items:center;gap:8px}\np{margin:0 0 12px;color:#4a5163}\n.dot{width:8px;height:8px;border-radius:50%;background:#e5484d;animation:b 1.6s ease-in-out infinite}\n@keyframes b{50%{opacity:.35}}\n.row{display:flex;gap:8px;flex-wrap:wrap}\nbutton{font:600 14px/20px inherit;font-family:inherit;border:0;border-radius:999px;padding:8px 14px;cursor:pointer;background:#eef0f5;color:#151823}\nbutton.go{background:#2e5bff;color:#fff}\nbutton:focus-visible{outline:2px solid #2e5bff;outline-offset:2px}\n.last{margin:-6px 0 12px;font-size:12px;color:#4a5163;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n@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}}\n@media (prefers-reduced-motion:reduce){.dot{animation:none}}</style>',o.appendChild(r);let l,a=0,m="",g=!1,f=(n="")=>`${e.endpoint}${n}?key=${encodeURIComponent(t)}`,b=(e,t,n=!1)=>{let o=document.createElement("button");return o.textContent=e,n&&(o.className="go"),o.onclick=t,o},y=(e,t,n,o={})=>{r.innerHTML="";let l=document.createElement("h2");o.live&&(l.innerHTML='<span class="dot" aria-hidden="true"></span>'),l.append(e);let a=document.createElement("p");if(a.textContent=t,a.setAttribute("aria-live","polite"),r.append(l,a),o.note){let e=document.createElement("div");e.className="last",e.textContent=o.note,r.append(e)}let i=document.createElement("div");i.className="row",i.append(...n),r.append(i)},x=()=>{g=!0,clearTimeout(l),p(c,null),p(u,null),n.remove()},w=()=>{g=!0,p(c,null),p(u,null),y("Capture link expired","Get a new link from Generate with AI in PlayStep.",[b("Close",x,!0)])},S=e=>y(`Capturing · ${a} ${1===a?"page":"pages"}`,"Open the pages your users need help with. Each one is added as you go.",[b("Capture this page",()=>{v()}),b("Finish",()=>{!async function(){g=!0,await fetch(f("/finish"),{method:"POST"}).catch(()=>{}),p(c,null),p(u,null),y("Capture finished",`${a} ${1===a?"page":"pages"} captured. Go back to PlayStep to generate tours.`,[b("Close",()=>n.remove(),!0)])}()},!0)],{live:!0,note:e});async function v(){if(g)return;clearTimeout(l);let e={...h(i()),style:s()};try{let t=await fetch(f("/screens"),{method:"POST",headers:{"content-type":"text/plain"},body:JSON.stringify(e)});if(404===t.status||410===t.status)return w();let n=await t.json().catch(()=>({}));if(!t.ok)return S(n.message??"That page could not be added.");a=n.screens??a+1,m=location.pathname,S(`Added ${e.title||m}`)}catch{S("PlayStep could not be reached. It will try again on the next page.")}}let k=()=>{g||"1"!==d(u)||location.pathname===m||(clearTimeout(l),l=setTimeout(()=>{v()},1200))};for(let e of["pushState","replaceState"]){let t=history[e];history[e]=function(...e){t.apply(this,e),k()}}addEventListener("popstate",k);let C=()=>{p(u,"1"),S(),k()};return"1"===d(u)?fetch(f()).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{a=e.screens,C()}).catch(e=>404===e?w():C()):y("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.",[b("Start capturing",C,!0),b("Not now",x)]),{captureNow:v,stop:x}},e}({});
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,o=/\d{6,}/g,r=/\b(?=[\w-]*\d)[\w-]{24,}\b/g;function l(e){return[t,r,o].some(t=>new RegExp(t.source).test(e))||[...e.matchAll(n)].some(e=>e[0].replace(/\D/g,"").length>=7)}function a(e){return e.replace(t,"[email]").replace(r,"[id]").replace(n,e=>e.replace(/\D/g,"").length>=7?"[number]":e).replace(o,"[number]")}function i(e){if(!e)return"";let t=a(e.replace(/\s+/g," ").trim());return t.length>80?`${t.slice(0,79)}…`:t}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,o=e=>(e??"").replace(/\s+/g," ").trim().slice(0,80),r=e=>`"${e.replace(/["\\]/g,"\\$&")}"`,l=e=>CSS.escape(e),a=e=>{try{return 1===document.querySelectorAll(e).length}catch{return!1}},i=e=>{let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return"hidden"!==n.visibility&&"none"!==n.display&&Number(n.opacity||1)>.05},s=e=>{let t=e.getAttribute("role"),n=e.tagName,o=(e.getAttribute("type")??"").toLowerCase();return"tab"===t||"menuitem"===t||"link"===t||"button"===t?t:"checkbox"===t||"switch"===t||"INPUT"===n&&("checkbox"===o||"radio"===o)?"checkbox":"A"===n?"link":"BUTTON"===n||"SUMMARY"===n||"INPUT"===n&&/^(submit|button|reset|image)$/.test(o)?"button":"SELECT"===n?"select":"INPUT"===n||"TEXTAREA"===n?"input":"other"},c=e=>{let o=e.tagName.toLowerCase(),i=[];e.id&&!t.test(e.id)&&i.push(`#${l(e.id)}`);for(let t of["data-testid","data-test","data-cy","data-qa"]){let n=e.getAttribute(t);n&&i.push(`[${t}=${r(n)}]`)}for(let t of["aria-label","name","title","placeholder"]){let n=e.getAttribute(t);n&&n.length<=80&&i.push(`${o}[${t}=${r(n)}]`)}let s=e.getAttribute("href");"a"===o&&s&&!/^javascript:/i.test(s)&&s.length<=200&&i.push(`a[href=${r(s)}]`);let c=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!t.test(e)&&!n.test(e));c.length&&i.push(`${o}.${c.slice(0,3).map(l).join(".")}`);for(let e of i)if(a(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(`#${l(d.id)}`);break}let n=d.tagName.toLowerCase(),o=d.parentElement?[...d.parentElement.children].filter(e=>e.tagName===d.tagName):[];u.unshift(o.length>1?`${n}:nth-of-type(${o.indexOf(d)+1})`:n),d=d.parentElement}let p=u.join(">");return a(p)?p: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 o=e.labels;return o?.length?o[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]")&&i(e)&&!e.parentElement?.closest("a[href],button,[role=button],[role=link]")).map((e,t)=>{let n=e.getBoundingClientRect(),o=n.bottom>0&&n.top<innerHeight;return{e:e,i:t,score:(e.hasAttribute("data-guide")?0:2)+ +!o}}).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,e).sort((e,t)=>e.i-t.i),p=[];for(let{e:e}of d){let t,n=s(e),r=e.getAttribute("data-guide"),l="input"===n||"select"===n?"":o(e.innerText||e.textContent),a=o(u(e))||("INPUT"===e.tagName&&"button"===n?o(e.value):""),i=o(e.getAttribute("placeholder")),d=e.getAttribute("href");if("A"===e.tagName&&d)try{let e=new URL(d,location.href);e.origin===location.origin&&(t=e.pathname)}catch{}let h=r?void 0:c(e);if(!r&&!h)continue;let m=e.getBoundingClientRect();p.push({ref:`e${p.length+1}`,role:n,...l?{text:l}:{},...a&&a!==l?{label:a}:{},...i?{placeholder:i}:{},...t?{href:t}:{},...r?{anchor:r.slice(0,64)}:{css:h.slice(0,300)},clickable:"input"!==n&&"select"!==n&&"other"!==n,rect:[m.left+scrollX,m.top+scrollY,m.width,m.height].map(Math.round)})}let h=[...document.querySelectorAll("h1,h2,h3,[role=heading]")].filter(e=>!e.closest("[data-private]")&&i(e)).map(e=>o(e.innerText)).filter(Boolean).slice(0,10);return{platform:"web",path:location.pathname||"/",...document.title?{title:o(document.title)}:{},headings:h,viewport:[innerWidth,innerHeight],elements:p}}function c(){try{return function(){let e=document.createElement("canvas");e.width=e.height=1;let t=e.getContext("2d",{willReadFrequently:!0}),n=e=>{if(!t||!e||"transparent"===e||"none"===e||(t.fillStyle="#010203",t.fillStyle=e,"#010203"===t.fillStyle&&!/^#010203$/i.test(e)))return null;t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let n=t.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]/255]},o=e=>`#${e.slice(0,3).map(e=>e.toString(16).padStart(2,"0")).join("")}`,r=e=>(Math.max(e[0],e[1],e[2])-Math.min(e[0],e[1],e[2]))/255,l=e=>{let[t,n,o]=e.slice(0,3).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*o},a=(e,t)=>{let o=n(e),r=n(t);return Math.hypot(o[0]-r[0],o[1]-r[1],o[2]-r[2])<30},i=e=>{let t=e.getBoundingClientRect();if(t.width<4||t.height<4||t.bottom<0||t.top>3*innerHeight)return null;let n=getComputedStyle(e);return"hidden"===n.visibility||"none"===n.display||Number(n.opacity||1)<.3?null:{r:t,s:n}},s=e=>{let t=n(e);return t&&t[3]>=.9?t:null},c=e=>e.length?e.sort((e,t)=>e-t)[Math.floor(e.length/2)]:void 0,u=null;for(let e of[document.querySelector("#root,#app,#__next,[data-reactroot],main"),document.body,document.documentElement])if(u=e?s(getComputedStyle(e).backgroundColor):null,u)break;for(let e=document.elementFromPoint(innerWidth/2,innerHeight/2);!u&&e;e=e.parentElement)u=s(getComputedStyle(e).backgroundColor);u??(u="dark"===getComputedStyle(document.documentElement).colorScheme.trim()?[18,18,18,1]:[255,255,255,1]);let d=l(u)<.2,p=n(getComputedStyle(document.querySelector("main")??document.body).color),h=[],m=(e,t,n)=>{let o=h.find(t=>t.from===n&&a(t.color,e));o?o.weight+=t:h.push({color:e,weight:t,from:n})},g=[],f=document.querySelectorAll("button,[role=button],input[type=submit],input[type=button],a,[class*=btn],[class*=Btn],[class*=button],[class*=Button]");for(let e of[...f].slice(0,400)){let t=i(e);if(!t)continue;let a=s(t.s.backgroundColor);if(a&&r(a)>.18&&l(a)>.02&&l(a)<.9){m(o(a),Math.min(t.r.width*t.r.height,3e4),"button");let e=Number.parseFloat(t.s.borderTopLeftRadius)||0;g.push(e>=t.r.height/2-1?999:e)}else if("A"===e.tagName){let e=n(t.s.color);e&&r(e)>.25&&m(o(e),400,"link")}}let b=getComputedStyle(document.documentElement),y=new Set,x=0;for(let e of[...document.styleSheets]){let t;try{t=e.cssRules}catch{continue}for(let e of[...t]){if(++x>3e3)break;let t=e.style;if(t&&/:root|html|body|\.light|\[data-theme/.test(e.selectorText??""))for(let e of[...t]){if(!e.startsWith("--")||y.has(e)||!/primary|accent|brand/i.test(e)||/foreground|fg|text|contrast|muted|soft|subtle|hover|active|border|ring|shadow|sidebar|chart|50\b|100\b|900\b/i.test(e))continue;y.add(e);let t=b.getPropertyValue(e).trim(),l=n(t)??n(`hsl(${t})`)??n(`rgb(${t})`)??n(`oklch(${t})`);l&&l[3]>=.9&&r(l)>.18&&m(o(l),/^--(color-)?(primary|brand)$/i.test(e)?8e4:4e4,"variable")}}}let w=n(document.querySelector("meta[name=theme-color]")?.getAttribute("content"));w&&r(w)>.18&&m(o(w),2e4,"theme-color");let S=[],v=[],k=document.querySelectorAll("section,article,aside,dialog,[role=dialog],[class*=card],[class*=Card],[class*=panel],[class*=Panel],div");for(let e of[...k].slice(0,800)){let t=i(e);if(!t||t.r.width*t.r.height<2e4||t.r.width>.95*innerWidth)continue;let n=s(t.s.backgroundColor);if(!n||r(n)>.2||a(o(n),o(u))||l(n)<.2!==d)continue;let c="none"!==t.s.boxShadow||Number.parseFloat(t.s.borderTopWidth)>0,p=o(n),h=S.find(e=>a(e.color,p)),m=Math.min(t.r.width*t.r.height,2e5)*(c?2:1);h?h.weight+=m:S.push({color:p,weight:m}),c&&v.push(Number.parseFloat(t.s.borderTopLeftRadius)||0)}let C=getComputedStyle(document.body).fontFamily,$=document.querySelector("h1,h2"),A=$?getComputedStyle($).fontFamily:void 0;return{scheme:d?"dark":"light",background:o(u),...p?{text:o(p)}:{},accents:h.sort((e,t)=>t.weight-e.weight).slice(0,8),surfaces:S.sort((e,t)=>t.weight-e.weight).slice(0,4).map(e=>e.color),...C?{font:C.slice(0,300)}:{},...A&&A!==C?{displayFont:A.slice(0,300)}:{},...g.length?{radius:c(g)}:{},...v.length?{cardRadius:c(v)}:{}}}()}catch{return}}let u="playstep_preview",d="playstep_capture_on",p=e=>{try{return sessionStorage.getItem(e)}catch{return null}},h=(e,t)=>{try{null===t?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}catch{}};function m(e){let t=e=>e&&i(e)||void 0;return{...e,title:t(e.title),headings:(e.headings??[]).map(e=>i(e)).filter(Boolean),elements:e.elements.map(e=>({...e,text:t(e.text),label:t(e.label),placeholder:t(e.placeholder),href:e.href&&!l(e.href)?e.href:void 0,css:e.css&&!l(e.css)?e.css:void 0})).filter(e=>e.anchor||e.css)}}return e.redactScreen=m,e.snapshotPage=s,e.start=function(e,t){let n=document.createElement("playstep-capture"),o=n.attachShadow({mode:"open"});document.body.appendChild(n);let r=document.createElement("div");r.className="p",r.setAttribute("role","region"),r.setAttribute("aria-label","PlayStep capture"),o.innerHTML='<style>:host{all:initial}\n.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}\nh2{margin:0 0 4px;font-size:15px;line-height:22px;font-weight:700;display:flex;align-items:center;gap:8px}\np{margin:0 0 12px;color:#4a5163}\n.dot{width:8px;height:8px;border-radius:50%;background:#e5484d;animation:b 1.6s ease-in-out infinite}\n@keyframes b{50%{opacity:.35}}\n.row{display:flex;gap:8px;flex-wrap:wrap}\nbutton{font:600 14px/20px inherit;font-family:inherit;border:0;border-radius:999px;padding:8px 14px;cursor:pointer;background:#eef0f5;color:#151823}\nbutton.go{background:#2e5bff;color:#fff}\nbutton:focus-visible{outline:2px solid #2e5bff;outline-offset:2px}\n.last{margin:-6px 0 12px;font-size:12px;color:#4a5163;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n@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}}\n@media (prefers-reduced-motion:reduce){.dot{animation:none}}</style>',o.appendChild(r);let l,a=0,i="",g=!1,f=(n="")=>`${e.endpoint}${n}?key=${encodeURIComponent(t)}`,b=(e,t,n=!1)=>{let o=document.createElement("button");return o.textContent=e,n&&(o.className="go"),o.onclick=t,o},y=(e,t,n,o={})=>{r.innerHTML="";let l=document.createElement("h2");o.live&&(l.innerHTML='<span class="dot" aria-hidden="true"></span>'),l.append(e);let a=document.createElement("p");if(a.textContent=t,a.setAttribute("aria-live","polite"),r.append(l,a),o.note){let e=document.createElement("div");e.className="last",e.textContent=o.note,r.append(e)}let i=document.createElement("div");i.className="row",i.append(...n),r.append(i)},x=()=>{g=!0,clearTimeout(l),h(u,null),h(d,null),n.remove()},w=()=>{g=!0,h(u,null),h(d,null),y("Capture link expired","Get a new link from Generate with AI in PlayStep.",[b("Close",x,!0)])},S=e=>y(`Capturing · ${a} ${1===a?"page":"pages"}`,"Open the pages your users need help with. Each one is added as you go.",[b("Capture this page",()=>{v()}),b("Finish",()=>{!async function(){g=!0,await fetch(f("/finish"),{method:"POST"}).catch(()=>{}),h(u,null),h(d,null),y("Capture finished",`${a} ${1===a?"page":"pages"} captured. Go back to PlayStep to generate tours.`,[b("Close",()=>n.remove(),!0)])}()},!0)],{live:!0,note:e});async function v(){if(g)return;clearTimeout(l);let e={...m(s()),style:c()};try{let t=await fetch(f("/screens"),{method:"POST",headers:{"content-type":"text/plain"},body:JSON.stringify(e)});if(404===t.status||410===t.status)return w();let n=await t.json().catch(()=>({}));if(!t.ok)return S(n.message??"That page could not be added.");a=n.screens??a+1,i=location.pathname,S(`Added ${e.title||i}`)}catch{S("PlayStep could not be reached. It will try again on the next page.")}}let k=()=>{g||"1"!==p(d)||location.pathname===i||(clearTimeout(l),l=setTimeout(()=>{v()},1200))};for(let e of["pushState","replaceState"]){let t=history[e];history[e]=function(...e){t.apply(this,e),k()}}addEventListener("popstate",k);let C=()=>{h(d,"1"),S(),k()};return"1"===p(d)?fetch(f()).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{a=e.screens,C()}).catch(e=>404===e?w():C()):y("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.",[b("Start capturing",C,!0),b("Not now",x)]),{captureNow:v,stop:x}},e}({});
@@ -1 +1 @@
1
- var __playstep_events=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t="playstep:q",r=(e,t)=>fetch(e,{method:"POST",body:t,keepalive:!0,headers:{"content-type":"text/plain"}}).then(e=>({status:e.status,retryAfter:Number(e.headers.get("retry-after"))||void 0}),()=>({status:0})),s={read(e){try{return JSON.parse(localStorage.getItem(e))??[]}catch{return[]}},write(e,r){try{r.length?localStorage.setItem(e,JSON.stringify(r)):localStorage.removeItem(e);let s=!1;for(let e=0;e<localStorage.length;e++)s||(s=!!localStorage.key(e)?.startsWith("playstep:q:"));s?localStorage.setItem(t,"1"):localStorage.removeItem(t)}catch{}}};function l(e){let t,l,a=[],n=[],o=[],i=0,c=!1,g=`${e.storageKey}:${Math.random().toString(36).slice(2,10)}`,u=()=>s.write(g,[...o,...n]),h=async t=>await(e.send?.(e.url,t))??(e.send?{status:204}:r(e.url,t));try{for(let t=localStorage.length-1;t>=0;t--){let r=localStorage.key(t);r?.startsWith(`${e.storageKey}:`)&&(n.push(...s.read(r).filter(e=>Date.now()-e.t<6048e5)),localStorage.removeItem(r))}}catch{}async function p(){if(!c&&!l){c=!0;try{for(;n.length;){let e=await h(n[0].b);if(0===e.status||408===e.status||429===e.status||e.status>=500){i=Math.min(6e4,2*i||2e3),l=setTimeout(()=>{l=void 0,p()},Math.max(i,1e3*(e.retryAfter??0)));break}i=0,n.shift(),u()}}finally{c=!1}}}function d(s=!1){clearTimeout(t),t=void 0;let l=a.length?e.envelope():null;if(l){for(;a.length;)n.push({b:JSON.stringify({...l,events:a.splice(0,20)}),t:Date.now()});n=n.slice(-25),u()}if(s){for(let t of n.splice(0))e.send?h(t.b):navigator.sendBeacon?.(e.url,t.b)||r(e.url,t.b),o.push(t);o=o.slice(-25),u()}else p()}return n=n.sort((e,t)=>e.t-t.t).slice(-25),u(),addEventListener("visibilitychange",()=>"hidden"===document.visibilityState&&d(!0)),addEventListener("pagehide",()=>d(!0)),n.length&&p(),{push(r){a.push(r),a.length>=20?d():t??(t=setTimeout(d,e.delayMs??2e3))},flush:()=>d(),get size(){return a.length},get pending(){return n.length}}}let a=[];for(let e=2;a.length<64;e++){let t=!0;for(let r=2;r*r<=e;r++)e%r===0&&(t=!1);t&&a.push(Math.cbrt(e)%1*2**32|0)}let n=(e,t)=>e>>>t|e<<32-t;function o(e){let t=(new TextEncoder).encode(e),r=t.length,s=new Uint32Array(16*(r+8>>6)+16);for(let e=0;e<r;e++)s[e>>2]|=t[e]<<24-e%4*8;s[r>>2]|=128<<24-r%4*8,s[s.length-1]=8*r,s[s.length-2]=Math.floor(r/536870912);let l=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],o=new Uint32Array(64);for(let e=0;e<s.length;e+=16){for(let t=0;t<64;t++)if(t<16)o[t]=s[e+t];else{let e=o[t-15],r=o[t-2];o[t]=o[t-16]+(n(e,7)^n(e,18)^e>>>3)+o[t-7]+(n(r,17)^n(r,19)^r>>>10)}let[t,r,i,c,g,u,h,p]=l;for(let e=0;e<64;e++){let s=p+(n(g,6)^n(g,11)^n(g,25))+(g&u^~g&h)+a[e]+o[e]|0,l=(n(t,2)^n(t,13)^n(t,22))+(t&r^t&i^r&i)|0;p=h,h=u,u=g,g=c+s|0,c=i,i=r,r=t,t=s+l|0}[t,r,i,c,g,u,h,p].forEach((e,t)=>l[t]=l[t]+e|0)}return l.map(e=>(e>>>0).toString(16).padStart(8,"0")).join("")}let i={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},c=e=>e+(crypto.randomUUID?crypto.randomUUID().replace(/-/g,""):Math.random().toString(36).slice(2)+Date.now().toString(36));function g(){try{let e=sessionStorage.getItem("playstep:s");return e||sessionStorage.setItem("playstep:s",e=c("s_")),e}catch{return c("s_")}}return e.createTransport=function(e){let t=g(),r=i.get("d");r||i.set("d",r=c("d_"));let s,a=r,n=l({url:e.url,send:e.send,storageKey:`playstep:q:${e.appKey}`,envelope:()=>{let l=e.userId()||void 0;return l!==s&&(s=l,a=l?`u_${o(`${e.appKey}:${l}`).slice(0,40)}`:r),{key:e.appKey,sdk:{name:e.sdk,version:e.version},session_id:t,user_key:a,preview:e.preview,locale:e.locale()}}});return{session:t,push:e=>n.push({...e,id:e.id??c("e").slice(0,25),...e.message?{message:e.message.slice(0,300)}:{}}),flush:n.flush}},e.randomId=c,e.sessionId=g,e}({});
1
+ var __playstep_events=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t="playstep:q",r=(e,t)=>fetch(e,{method:"POST",body:t,keepalive:!0,headers:{"content-type":"text/plain"}}).then(e=>({status:e.status,retryAfter:Number(e.headers.get("retry-after"))||void 0}),()=>({status:0})),s={read(e){try{return JSON.parse(localStorage.getItem(e))??[]}catch{return[]}},write(e,r){try{r.length?localStorage.setItem(e,JSON.stringify(r)):localStorage.removeItem(e);let s=!1;for(let e=0;e<localStorage.length;e++)s||(s=!!localStorage.key(e)?.startsWith("playstep:q:"));s?localStorage.setItem(t,"1"):localStorage.removeItem(t)}catch{}}};function l(e){let t,l,a=[],n=[],o=[],i=0,c=!1,g=`${e.storageKey}:${Math.random().toString(36).slice(2,10)}`,u=()=>s.write(g,[...o,...n]),h=async t=>await(e.send?.(e.url,t))??(e.send?{status:204}:r(e.url,t));try{for(let t=localStorage.length-1;t>=0;t--){let r=localStorage.key(t);r?.startsWith(`${e.storageKey}:`)&&(n.push(...s.read(r).filter(e=>Date.now()-e.t<6048e5)),localStorage.removeItem(r))}}catch{}async function p(){if(!c&&!l){c=!0;try{for(;n.length;){let e=await h(n[0].b);if(0===e.status||408===e.status||429===e.status||e.status>=500){i=Math.min(6e4,2*i||2e3),l=setTimeout(()=>{l=void 0,p()},Math.max(i,1e3*(e.retryAfter??0)));break}i=0,n.shift(),u()}}finally{c=!1}}}function d(s=!1){clearTimeout(t),t=void 0;let l=a.length?e.envelope():null;if(l){for(;a.length;)n.push({b:JSON.stringify({...l,events:a.splice(0,20)}),t:Date.now()});n=n.slice(-25),u()}if(s){for(let t of n.splice(0))e.send?h(t.b):navigator.sendBeacon?.(e.url,t.b)||r(e.url,t.b),o.push(t);o=o.slice(-25),u()}else p()}return n=n.sort((e,t)=>e.t-t.t).slice(-25),u(),addEventListener("visibilitychange",()=>"hidden"===document.visibilityState&&d(!0)),addEventListener("pagehide",()=>d(!0)),n.length&&p(),{push(r){a.push(r),a.length>=20?d():t??(t=setTimeout(d,e.delayMs??2e3))},flush:()=>d(),get size(){return a.length},get pending(){return n.length}}}let a=[];for(let e=2;a.length<64;e++){let t=!0;for(let r=2;r*r<=e;r++)e%r===0&&(t=!1);t&&a.push(Math.cbrt(e)%1*2**32|0)}let n=(e,t)=>e>>>t|e<<32-t;function o(e){let t=(new TextEncoder).encode(e),r=t.length,s=new Uint32Array(16*(r+8>>6)+16);for(let e=0;e<r;e++)s[e>>2]|=t[e]<<24-e%4*8;s[r>>2]|=128<<24-r%4*8,s[s.length-1]=8*r,s[s.length-2]=Math.floor(r/536870912);let l=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],o=new Uint32Array(64);for(let e=0;e<s.length;e+=16){for(let t=0;t<64;t++)if(t<16)o[t]=s[e+t];else{let e=o[t-15],r=o[t-2];o[t]=o[t-16]+(n(e,7)^n(e,18)^e>>>3)+o[t-7]+(n(r,17)^n(r,19)^r>>>10)}let[t,r,i,c,g,u,h,p]=l;for(let e=0;e<64;e++){let s=p+(n(g,6)^n(g,11)^n(g,25))+(g&u^~g&h)+a[e]+o[e]|0,l=(n(t,2)^n(t,13)^n(t,22))+(t&r^t&i^r&i)|0;p=h,h=u,u=g,g=c+s|0,c=i,i=r,r=t,t=s+l|0}[t,r,i,c,g,u,h,p].forEach((e,t)=>l[t]=l[t]+e|0)}return l.map(e=>(e>>>0).toString(16).padStart(8,"0")).join("")}let i={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},c=e=>e+(crypto.randomUUID?crypto.randomUUID().replace(/-/g,""):Math.random().toString(36).slice(2)+Date.now().toString(36));function g(){try{let e=sessionStorage.getItem("playstep:s");return e||sessionStorage.setItem("playstep:s",e=c("s_")),e}catch{return c("s_")}}return e.createTransport=function(e){let t,r=g(),s="",a=l({url:e.url,send:e.send,storageKey:`playstep:q:${e.appKey}`,envelope:()=>{let l=e.userId()||void 0;return l?l!==t&&(s=`u_${o(`${e.appKey}:${l}`).slice(0,40)}`):s=(()=>{let e=i.get("d");return e||i.set("d",e=c("d_")),e})(),t=l,{key:e.appKey,sdk:{name:e.sdk,version:e.version},session_id:r,user_key:s,preview:e.preview,locale:e.locale()}}});return{session:r,push:e=>a.push({...e,id:e.id??c("e").slice(0,25),...e.message?{message:e.message.slice(0,300)}:{}}),flush:a.flush}},e.randomId=c,e.sessionId=g,e}({});
@@ -0,0 +1 @@
1
+ !function(){let e="playstep:q",t=(e,t)=>fetch(e,{method:"POST",body:t,keepalive:!0,headers:{"content-type":"text/plain"}}).then(e=>({status:e.status,retryAfter:Number(e.headers.get("retry-after"))||void 0}),()=>({status:0})),r={read(e){try{return JSON.parse(localStorage.getItem(e))??[]}catch{return[]}},write(t,r){try{r.length?localStorage.setItem(t,JSON.stringify(r)):localStorage.removeItem(t);let a=!1;for(let e=0;e<localStorage.length;e++)a||(a=!!localStorage.key(e)?.startsWith("playstep:q:"));a?localStorage.setItem(e,"1"):localStorage.removeItem(e)}catch{}}};function a(e){let a,i,n=[],l=[],s=[],o=0,u=!1,c=`${e.storageKey}:${Math.random().toString(36).slice(2,10)}`,d=()=>r.write(c,[...s,...l]),g=async r=>await(e.send?.(e.url,r))??(e.send?{status:204}:t(e.url,r));try{for(let t=localStorage.length-1;t>=0;t--){let a=localStorage.key(t);a?.startsWith(`${e.storageKey}:`)&&(l.push(...r.read(a).filter(e=>Date.now()-e.t<6048e5)),localStorage.removeItem(a))}}catch{}async function p(){if(!u&&!i){u=!0;try{for(;l.length;){let e=await g(l[0].b);if(0===e.status||408===e.status||429===e.status||e.status>=500){o=Math.min(6e4,2*o||2e3),i=setTimeout(()=>{i=void 0,p()},Math.max(o,1e3*(e.retryAfter??0)));break}o=0,l.shift(),d()}}finally{u=!1}}}function h(r=!1){clearTimeout(a),a=void 0;let i=n.length?e.envelope():null;if(i){for(;n.length;)l.push({b:JSON.stringify({...i,events:n.splice(0,20)}),t:Date.now()});l=l.slice(-25),d()}if(r){for(let r of l.splice(0))e.send?g(r.b):navigator.sendBeacon?.(e.url,r.b)||t(e.url,r.b),s.push(r);s=s.slice(-25),d()}else p()}return l=l.sort((e,t)=>e.t-t.t).slice(-25),d(),addEventListener("visibilitychange",()=>"hidden"===document.visibilityState&&h(!0)),addEventListener("pagehide",()=>h(!0)),l.length&&p(),{push(t){n.push(t),n.length>=20?h():a??(a=setTimeout(h,e.delayMs??2e3))},flush:()=>h(),get size(){return n.length},get pending(){return l.length}}}let i={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},n=/^(:|radix-|headlessui-|react-|ember\d|mui-|v-|css-|sc-|jsx-)|\d{3,}|[a-f0-9]{8,}|__/i,l=/active|selected|current|open|hover|focus|disabled|hidden|show|visible|checked|loading/i,s=e=>`"${e.replace(/["\\]/g,"\\$&")}"`,o=e=>CSS.escape(e);function u(e,t){try{return 1===e.querySelectorAll(t).length}catch{return!1}}function c(e){let t=e.getAttribute("role"),r=e.tagName,a=(e.getAttribute("type")??"").toLowerCase();return"tab"===t||"menuitem"===t||"link"===t||"button"===t?t:"checkbox"===t||"switch"===t||"INPUT"===r&&("checkbox"===a||"radio"===a)?"checkbox":"A"===r?"link":"BUTTON"===r||"SUMMARY"===r||"INPUT"===r&&/^(submit|button|reset|image)$/.test(a)?"button":"SELECT"===r?"select":"INPUT"===r||"TEXTAREA"===r?"input":"other"}function d(e){let t=e.ownerDocument,r=e.tagName.toLowerCase(),a=[];e.id&&!n.test(e.id)&&a.push(`#${o(e.id)}`);for(let t of["data-testid","data-test","data-cy","data-qa"]){let r=e.getAttribute(t);r&&a.push(`[${t}=${s(r)}]`)}for(let t of["aria-label","name","title","placeholder"]){let i=e.getAttribute(t);i&&i.length<=80&&a.push(`${r}[${t}=${s(i)}]`)}let i=e.getAttribute("href");"a"===r&&i&&!/^javascript:/i.test(i)&&i.length<=200&&a.push(`a[href=${s(i)}]`);let c=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!n.test(e)&&!l.test(e));c.length&&a.push(`${r}.${c.slice(0,3).map(o).join(".")}`);for(let e of a)if(u(t,e))return e;let d=[],g=e;for(;g&&d.length<7;){if(g===t.body){d.unshift("body");break}if(g!==e&&g.id&&!n.test(g.id)){d.unshift(`#${o(g.id)}`);break}let r=g.tagName.toLowerCase(),a=g.parentElement?[...g.parentElement.children].filter(e=>e.tagName===g.tagName):[];d.unshift(a.length>1?`${r}:nth-of-type(${a.indexOf(g)+1})`:r),g=g.parentElement}let p=d.join(">");return u(t,p)?p:void 0}function g(e){let t=e.getAttribute("aria-label")||e.getAttribute("title");if(t)return t;let r=e.getAttribute("aria-labelledby");if(r)return r.split(/\s+/).map(t=>e.ownerDocument.getElementById(t)?.textContent??"").join(" ");let a=e.labels;return a?.length?a[0].innerText:""}function p(e,t=[]){if(e.closest("[data-private],[aria-hidden=true],[inert],[data-ps-no-capture],playstep-root,playstep-capture"))return!0;for(let r of t)try{if(e.closest(r))return!0}catch{}return!1}let h=()=>crypto.randomUUID(),f=async e=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)))].map(e=>e.toString(16).padStart(2,"0")).join(""),m=e=>/^(string|number|boolean)$/.test(typeof e),y=e=>Object.keys(e).length,b=e=>(e??"").replace(/\s+/g," ").trim().slice(0,80);function v(e,t=!0){let r={};for(let a in e){let i=e[a];y(r)<50&&/^[A-Za-z_$][\w.:-]{0,63}$/.test(a)&&(null===i||m(i)||t&&Array.isArray(i)&&i.every(m))&&(r[a]=Array.isArray(i)?i.slice(0,25):i)}return r}function $(){let e,t={};for(let[e,r]of new URLSearchParams(location.search))e.startsWith("utm_")&&(t[e.slice(4)]=r);try{e=new URL(document.referrer)}catch{}return{r:e&&e.host!=location.host?e.origin:void 0,u:y(t)?t:void 0}}function w(e,t,r){let a=r&&b(/^(INPUT|SELECT|TEXTAREA)$/.test(e.tagName)?g(e):e.innerText||g(e)),i=e.href;return{selector:d(e),text:a||void 0,role:c(e),href:"string"==typeof i&&i||void 0,x:0|t.pageX,y:0|t.pageY,vw:innerWidth,vh:innerHeight}}let S=function(e={}){let t,r,n,l,s,o,u,c,m,S="",k=[],A={},T={},x={},E=[],N=e=>{let t=i.get("a:d");return!t&&e&&i.set("a:d",t=`d_${h()}`),t||void 0},I=()=>t&&(u??(!o&&t.anonymous?N(!0):void 0)),L=()=>{let e=I();if(!e)return null;let a=i.get("a:s"),n=e=>"string"==typeof e?e:void 0;return{v:1,key:S,sdk:r,actor:e,device:u&&N()||void 0,guide_key:c,traits:y(A)?A:void 0,user:t.identities&&o?{id:o,email:n(A.email),name:n(A.name)}:void 0,groups:y(T)?T:void 0,context:{platform:"web",locale:navigator.language,referrer:a?.r,utm:a?.u}}};function _(e){let t=Date.now(),r=i.get("a:s");(!r||t-r.t>18e5)&&(r={id:h(),t:t,...$()},s.push({id:h(),name:"$session_start",ts:e.ts,session:r.id})),r.t=t,i.set("a:s",r),s.push({...e,session:r.id})}let U=()=>"granted"==l&&I()&&E.splice(0).forEach(_);function M(e,r={}){if(!t||"denied"==l)return;let a={...x,...r.props},i={id:h(),name:e,ts:Date.now(),page:r.el&&m,...r,props:y(a)?a:void 0};"granted"==l&&I()?_(i):E.length<100&&E.push(i)}function O(e,r){A=v(r,!1),e==o&&e?u&&M("$identify"):(s.flush(),o=e,u=c=void 0,e?Promise.all([f(`${t.hash_key}:${e}`),f(`${S}:${e}`)]).then(([t,r])=>{o==e&&(u=`u_${t.slice(0,40)}`,c=`u_${r.slice(0,40)}`,M("$identify"),U())}):T={})}function C(){let e=[];addEventListener("click",t=>{let r=t.target;if(!(r instanceof Element))return;let a=r.closest("a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],[data-guide]");if(p(a??r,k)||(n.rage&&(e=e.filter(e=>t.timeStamp-e.t<700&&Math.abs(e.x-t.clientX)<30&&Math.abs(e.y-t.clientY)<30),3==e.push({t:t.timeStamp,x:t.clientX,y:t.clientY})&&M("$rage_click",{el:w(a??r,t,!!a)})),!a))return;let i=w(a,t,!0);if(n.clicks&&M("$click",{el:i}),n.dead){let e=!1,t=location.href,r=new MutationObserver(()=>e=!0);r.observe(document,{subtree:!0,childList:!0,attributes:!0}),setTimeout(()=>{r.disconnect(),!e&&t==location.href&&M("$dead_click",{el:i})},1e3)}},!0),n.forms&&addEventListener("submit",e=>{let t=e.target;t instanceof HTMLFormElement&&!p(t,k)&&M("$submit",{el:{selector:d(t),role:"form",text:b(g(t)||t.getAttribute("name"))}})},!0)}function j(o,u){!t&&o&&!u.preview&&crypto.subtle&&(t=o,S=u.appKey,r={name:u.sdkName||"web",version:"0.11.2"},n={...o.autocapture,...e.autocapture},k=[...o.mask,...e.mask??[]],l=i.get("a:c")??o.consent,s=a({url:o.url,storageKey:`playstep:a:q:${S}`,envelope:L,send:e.send}),C())}return{plugin:(...e)=>{"config"==e[0]?j(e[1].analytics,e[2]):t&&("identify"==e[0]?O(e[1],e[2]):"track"==e[0]?M(e[1],{props:v(e[2])}):"page"==e[0]?(m={path:e[1]},n.pages&&M("$pageview",{page:{path:e[1],title:document.title}})):(O("",{}),x={},E=[],i.set("a:d",null),i.set("a:s",null)))},setConsent:e=>{l=e?"granted":"denied",i.set("a:c",l),e?U():(E=[],i.set("a:d",null))},register:e=>{x={...x,...v(e)}},unregister:e=>{delete x[e]},group:(e,t,r)=>{(e in T||y(T)<5)&&(T[e]=t),M("$group",{props:{...v(r),group_type:e,group_id:t}})},flush:()=>s?.flush()}}(),k=window.playstepInsights;if(window.playstepInsights=S,Array.isArray(k))for(let[e,...t]of k)S[e](...t);window.playstep?.use(S.plugin)}();
@@ -1 +1 @@
1
- var __playstep_launcher=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=e=>"dark"==e||"light"==e?e:void 0;function o(e,o,r){let n=t(r)??t(e.theme?.mode)??t(o);return n?"dark"==n:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,o=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(o)return"dark"==o[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}return e.captureIntegrity="sha256-AR4Ja7XvDHIrqdPWqvaPm8oOKBI6VDVtoVXn5bZEVVk=",e.drawLauncher=function(e,t,r,n,i){let a=t.launcherGuides();if(!a.length)return;let d=o(r,i.colorMode),l=r.theme?.[d?"dark":"light"]??{},c=a.filter(e=>!t.progress.guides[e.id]).length;e.innerHTML=`<button aria-label="${r.words[r.lang].open_guides}" style="position:fixed;${r.launcher.position.slice(7)}:24px;bottom:24px;z-index:2147483000;padding:15px;border:0;border-radius:50%;cursor:pointer;background:${l.accent??(d?"#7091ff":"#2e5bff")};color:${l["on-accent"]??(d?"#0c0e13":"#fff")};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>${c?`<b style="position:absolute;top:-2px;right:-2px;padding:0 6px;border-radius:9px;background:#ffc933;color:#151823;font:800 11px/20px sans-serif">${c}</b>`:""}</button>`,e.firstChild.onclick=n},e}({});
1
+ var __playstep_launcher=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=e=>"dark"==e||"light"==e?e:void 0;function o(e,o,r){let n=t(r)??t(e.theme?.mode)??t(o);return n?"dark"==n:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,o=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(o)return"dark"==o[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}return e.captureIntegrity="sha256-xYb6IwwD6GJoL/XyK5zw9pL4DDS0Z6+RXcBG6mP6Tig=",e.drawLauncher=function(e,t,r,n,i){let l=t.launcherGuides();if(!l.length)return;let d=o(r,i.colorMode),a=r.theme?.[d?"dark":"light"]??{},c=l.filter(e=>!t.progress.guides[e.id]).length;e.innerHTML=`<button style="position:fixed;${r.launcher.position.slice(7)}:24px;bottom:24px;z-index:2147483000;padding:15px;border:0;border-radius:50%;cursor:pointer;background:${a.accent??(d?"#7091ff":"#2e5bff")};color:${a["on-accent"]??(d?"#0c0e13":"#fff")};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>${c?`<b style="position:absolute;top:-2px;right:-2px;padding:0 6px;border-radius:9px;background:#ffc933;color:#151823;font:800 11px/20px sans-serif">${c}</b>`:""}</button>`;let s=e.firstChild;s.setAttribute("aria-label",r.words[r.lang].open_guides),s.onclick=n},e}({});
@@ -1 +1 @@
1
- !function(){let e=e=>e.length>1?e.replace(/\/+$/,""):e;function t(t,n){return!!t&&void 0!==n&&(r=e(t),RegExp(`^${r.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`)).test(e(n));var r}function n(e){let n,r,i=e.progress??{seen:!1,guides:{}},s=e.traits??{},a=null,u=new Set,o=new Set,p=!1,c=e.config.flags,d=e.config.guides,l=e=>d.find(t=>t.id===e),g=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),h=e=>!p&&!c.disabled&&(!c.paused_for_new_users||i.seen)&&function(e,t){return(e??[]).every(e=>{let n=t[e.trait];return"exists"===e.op?null!=n:"in"===e.op?Array.isArray(e.value)&&e.value.includes(n):n===e.value==("eq"===e.op)})}(e.segments,s),y=e=>{let t=i.guides[e.id];return!a&&!u.has(e.id)&&h(e)&&(!t||"done"!==t.status&&("running"===t.status||!e.trigger.once))},m=(e,t,n)=>{i.guides[e.id]={...i.guides[e.id],version:e.version,step:n,status:t}},f=e=>t(e.path,r),v=e=>t(e.skip_if_on,r)||f(e.complete_on),_=e=>!r||t(e.page??"*",r),w=(e,t,r)=>{for(;t<e.steps.length;){if(a={guide:e,index:t,status:"running"},n=void 0,m(e,"running",t),r.push(g("step_shown",e,t)),!v(e.steps[t]))return r;r.push(g("step_completed",e,t++))}return a={guide:e,index:--t,status:"completed"},m(e,"done",t),r.push(g("guide_completed",e)),r},x=(e,t,n="trigger")=>(i.seen=!0,o.add(e.id),i.guides[e.id]={source:n},w(e,t,[{...g("guide_shown",e),source:n}])),$=()=>{let e=a;return w(e.guide,e.index+1,[g("step_completed",e.guide,e.index)])},S=e=>{let t=d.find(t=>y(t)&&e(t));return t?x(t,0):[]},L=e=>"first_visit"===e.trigger.type||f(e.trigger),b=(e=L)=>{let t=0,n=d.find(e=>{let n=i.guides[e.id];return t=n?.version===e.version?n.step:0,!a&&"running"===n?.status&&!u.has(e.id)&&h(e)&&_(e.steps[t])});return n?o.has(n.id)?w(n,t,[]):x(n,t,i.guides[n.id].source):S(e)};return{get active(){return p?null:a},progress:i,dispatch:function(e){let c="running"===a?.status?a.guide.steps[a.index]:null,d=p?null:c;switch(e.type){case"init":return r=e.path,u.clear(),o.clear(),b();case"pause":return p=!0,[];case"resume":return p?(p=!1,b()):[];case"page_view":return r=e.path,p||"waiting"!==a?.status?d&&v(d)?$():(c&&!_(c)&&(a=null),b(e=>f(e.trigger))):x(a.guide,0,a.source);case"reset_progress":{let t="string"==typeof e.guide&&l(e.guide);return void 0===t?[]:((!t||a?.guide===t)&&(a=null),t?delete i.guides[t.id]:i.guides={},[{type:"progress_reset",...t&&{guide_id:t.id}},...(u.clear(),S(L))])}case"event":return"event"===d?.complete_on.type&&d.complete_on.name===e.name?$():S(t=>"event"===t.trigger.type&&t.trigger.name===e.name);case"tap":return"tap_anchor"===d?.complete_on.type&&d.anchor===e.anchor?$():[];case"complete":return d?.id===e.step?$():[];case"next":return"next_button"===d?.complete_on.type?$():[];case"back":return d&&0!==a.index?(a={...a,index:a.index-1},m(a.guide,"running",a.index),[g("step_shown",a.guide,a.index)]):[];case"hide":return d&&(u.add(a.guide.id),a=null),[];case"close":if("completed"!==a?.status)return[];case"dismiss":{let e=a;return a=null,c?(m(e.guide,"dismissed",e.index),[g("guide_dismissed",e.guide,e.index)]):[]}case"start":{let n=l(e.guide);if(!n||!h(n)||d&&a.guide===n&&n.steps.slice(0,a.index).every(v))return[];let i=e.source??"api";return e.to&&!t(n.start_path,r)?(a={guide:n,index:0,status:"waiting",source:i},[]):x(n,0,i)}case"anchor_missing":return d&&d.anchor===e.anchor&&n!==e.anchor?(n=e.anchor,[{...g("anchor_missing",a.guide,a.index),anchor:e.anchor}]):[];case"identify":return s={...s,...e.traits},[]}},launcherGuides:()=>d.filter(e=>e.launcher&&h(e)),use(e){d=e.guides,a&&(a={...a,guide:l(a.guide.id)??a.guide})}}}let r={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},i="playstep_preview",s=document.currentScript;function a(e,t){return new Promise((n,r)=>{document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,s?.src||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))})}let u=()=>a("launcher","sha256-MXzjgrJQkFDwhR3H7iqT1z+XgjeCMVo9/FUXfvSvTaM="),o=function(e,t,s){let a,u,o,p,c,d,l,g,h,y={},m=!1,f=[],v=[],_=()=>`p:${a.appKey}`,w=()=>a.preview||r.set(_(),u.progress),x=e=>{let t={...e,ts:Date.now()};a?.preview||(c?c.send(t):v.push(t)),a?.onEvent?.(t)},$=e=>{try{x({type:"sdk_error",message:String(e)})}catch{}},S=e=>(...t)=>{try{e(...t)}catch(e){$(e)}},L=(e,t)=>S(n=>b({type:e,[t]:n}));function b(e){if(!u)return void f.push(e);if("start"==e.type&&void 0===e.to&&a.navigate)return void I().then(t=>t?.start(e));let t=u.dispatch(e);w(),t.forEach(S(x)),(u.active||r.get("q"))&&I(),c?.update()}function E(){return l??(l=document.body.appendChild(document.createElement("playstep-root")).attachShadow({mode:"open"}))}function I(){return d??(d=e().then(e=>{let t=E();return t.innerHTML="",c=e.mount({engine:u,get config(){return o},options:a,root:t,outbox:v,userId:()=>g,dispatch:S(b),emit:S(x)})}).catch($))}let K,j=S((e={})=>{u?u.launcherGuides().length&&I().then(t=>t?.openLauncher(e.anchor)):K=e});function M(e){e.launcher?.enabled&&u.launcherGuides().length&&!d&&t&&t().then(t=>{d||t.drawLauncher(E(),u,e,j,a)}).catch($)}let O=e=>S(()=>{m!==e&&(m=e,u&&(b({type:e?"pause":"resume"}),!d&&(e?l&&(l.innerHTML=""):M(o))))});return{version:"0.9.0",init:S(e=>{if(a||!e?.appKey)return;a={...e},h&&(a.locale=h);let t=()=>setTimeout(()=>async function(){let e=a,t=(e.apiBase??"https://cdn.playstep.app").replace(/\/$/,""),c=null;try{c=new URLSearchParams(location.search).get(i)||(e.config?null:sessionStorage.getItem(i))}catch{}e.preview||(e.preview=!(!e.config&&!c)),p=n=>fetch(`${t}/v2/${c?`preview/${c}?key=${e.appKey}&`:`config/${e.appKey}?`}l=${n}`).then(e=>e.json());let d=e.config;try{d??(d=await p(e.locale??navigator.language??""))}catch{return}try{c&&sessionStorage[d.guides?"setItem":"removeItem"](i,c)}catch{}if(d?.capture)s?.().then(t=>t.start(d.capture,e.appKey)).catch($);else if(d?.guides&&!d.flags?.disabled&&(o=d,e.eventsUrl=d.ingest_url??`${t}/v1/events`,u=n({config:d,progress:e.preview?void 0:r.get(_()),traits:y}),m&&u.dispatch({type:"pause"}),b({type:"init",path:location.pathname}),f.splice(0).forEach(b),K&&j(K),M(d),!1!==e.autoPageViews)){let e=location.pathname,t=S(()=>location.pathname!==e&&b({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)}}().catch($));"complete"===document.readyState?t():addEventListener("load",t)}),identify:S((e,t)=>{g=e,y={...y,...t},b({type:"identify",traits:y})}),track:L("event","name"),start:L("start","guide"),complete:L("complete","step"),page:S(e=>b({type:"page_view",path:e??location.pathname})),openLauncher:j,resetProgress:L("reset_progress","guide"),reset:S(()=>{b({type:"dismiss"}),g=void 0,y={},u&&(Object.assign(u.progress,{seen:!1,guides:{}}),w(),c?.update()),a?.preview||r.set("d",null)}),pause:O(!0),resume:O(!1),isPaused:()=>m,setLocale:S(e=>{h=e,a&&(a.locale=e),p?.(e).then(t=>{t.guides&&a?.locale==e&&(u.use(o=t),c?.update())}).catch($)})}}(()=>a("ui","sha256-qIW50mLaSmfqRUWrjNOMrD2O94w9R5WV1iRaeMBggC0="),u,()=>u().then(e=>a("capture",e.captureIntegrity)));if(!window.playstep){window.playstep=o;let e=s?.dataset;e?.appKey&&o.init({appKey:e.appKey,apiBase:e.api,locale:e.locale})}}();
1
+ !function(){let e=e=>e.length>1?e.replace(/\/+$/,""):e;function t(t,n){return!!t&&void 0!==n&&(i=e(t),RegExp(`^${i.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`)).test(e(n));var i}function n(e){let n,i,r=e.progress??{seen:!1,guides:{}},s=e.traits??{},a=null,u=new Set,o=new Set,c=!1,d=e.config.flags,p=e.config.guides,l=e=>p.find(t=>t.id===e),g=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),h=(e,t)=>(t||!e.held_out)&&!c&&!d.disabled&&(!d.paused_for_new_users||r.seen)&&function(e,t){return(e??[]).every(e=>{let n=t[e.trait];return"exists"==e.op?null!=n:"in"==e.op?Array.isArray(e.value)&&e.value.includes(n):"eq"==e.op?n===e.value:"neq"==e.op&&n!==e.value})}(e.segments,s),y=e=>{let t=r.guides[e.id];return!a&&!u.has(e.id)&&h(e,1)&&(!t||("held_out"==t.status?!e.held_out:"done"!=t.status&&("running"==t.status||!e.trigger.once)))},f=(e,t,n)=>{r.guides[e.id]={...r.guides[e.id],version:e.version,step:n,status:t}},m=e=>t(e.path,i),v=e=>t(e.skip_if_on,i)||m(e.complete_on),_=e=>!i||t(e.page??"*",i),w=(e,t,i)=>{for(;t<e.steps.length;){if(a={guide:e,index:t,status:"running"},n=void 0,f(e,"running",t),i.push(g("step_shown",e,t)),!v(e.steps[t]))return i;i.push(g("step_completed",e,t++))}return a={guide:e,index:--t,status:"completed"},f(e,"done",t),i.push(g("guide_completed",e)),i},x=(e,t,n="trigger")=>(r.seen=!0,o.add(e.id),r.guides[e.id]={source:n},w(e,t,[{...g("guide_shown",e),source:n}])),$=()=>{let e=a;return w(e.guide,e.index+1,[g("step_completed",e.guide,e.index)])},S=e=>{let t=p.find(t=>y(t)&&e(t));return t?t.held_out?(f(t,"held_out",0),[g("guide_held_out",t)]):x(t,0):[]},E=e=>"first_visit"==e.trigger.type||m(e.trigger),b=(e=E)=>{let t=0,n=p.find(e=>{let n=r.guides[e.id];return t=n?.version===e.version?n.step:0,!a&&"running"==n?.status&&!u.has(e.id)&&h(e)&&_(e.steps[t])});return n?o.has(n.id)?w(n,t,[]):x(n,t,r.guides[n.id].source):S(e)};return{get active(){return c?null:a},progress:r,dispatch:function(e){let d="running"==a?.status?a.guide.steps[a.index]:null,p=c?null:d;switch(e.type){case"init":return i=e.path,u.clear(),o.clear(),b();case"pause":return c=!0,[];case"arrived":return S(t=>e.guides.includes(t)&&E(t));case"resume":return c?(c=!1,b()):[];case"page_view":return i=e.path,c||"waiting"!=a?.status?p&&v(p)?$():(d&&!_(d)&&(a=null),b(e=>m(e.trigger))):x(a.guide,0,a.source);case"reset_progress":{let t="string"==typeof e.guide&&l(e.guide);return void 0===t?[]:((!t||a?.guide===t)&&(a=null),t?delete r.guides[t.id]:r.guides={},[{type:"progress_reset",...t&&{guide_id:t.id}},...(u.clear(),S(E))])}case"event":return"event"==p?.complete_on.type&&p.complete_on.name===e.name?$():S(t=>"event"==t.trigger.type&&t.trigger.name===e.name);case"tap":return"tap_anchor"==p?.complete_on.type&&p.anchor===e.anchor?$():[];case"complete":return p?.id===e.step?$():[];case"next":return"next_button"==p?.complete_on.type?$():[];case"back":return p&&0!==a.index?(a={...a,index:a.index-1},f(a.guide,"running",a.index),[g("step_shown",a.guide,a.index)]):[];case"hide":return p&&(u.add(a.guide.id),a=null),[];case"close":if("completed"!=a?.status)return[];case"dismiss":{let e=a;return a=null,d?(f(e.guide,"dismissed",e.index),[g("guide_dismissed",e.guide,e.index)]):"completed"==e?.status?b(t=>m(t.trigger)||t.trigger.guide==e.guide.id):[]}case"start":{let n=l(e.guide);if(!n||!h(n)||p&&a.guide===n&&n.steps.slice(0,a.index).every(v))return[];let r=e.source??"api";return e.to&&!t(n.start_path,i)?(a={guide:n,index:0,status:"waiting",source:r},[]):x(n,0,r)}case"anchor_missing":return p&&p.anchor===e.anchor&&n!==e.anchor?(n=e.anchor,[{...g("anchor_missing",a.guide,a.index),anchor:e.anchor}]):[];case"identify":return s={...s,...e.traits},[]}},launcherGuides:()=>p.filter(e=>e.launcher&&h(e)),use(e){let t=e.guides.filter(e=>!l(e.id));return p=e.guides,a&&(a={...a,guide:l(a.guide.id)??a.guide}),t}}}let i={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},r="playstep_preview",s=document.currentScript;function a(e,t){return new Promise((n,i)=>{document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,s?.src||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>n(window[`__playstep_${e}`]),onerror:()=>i(Error(e))}))})}let u=()=>a("launcher","sha256-9tsCv75S3cus4vUFhh/YRYoBnNHADIrpN7L5CDavv0s="),o=function(e,t,s,a){let u,o,c,d,p,l,g,h,y,f,m,v={},_=!1,w=[],x=[],$=[],S=[],E=()=>`p:${u.appKey}`,b=e=>{let t=e.progress,n=o.progress;if(t&&p!=m){m&&Object.assign(n,{seen:!1,guides:{}}),t.seen&&(n.seen=!0),Object.assign(n.guides,t.guides);for(let e of t.reset)delete n.guides[e];m=p}},L=()=>u.preview||i.set(E(),o.progress),K=e=>{let t={...e,ts:Date.now()};u?.preview||(l?l.send(t):x.push(t)),u?.onEvent?.(t)},I=e=>{try{K({type:"sdk_error",message:String(e)})}catch{}},U=e=>(...t)=>{try{e(...t)}catch(e){I(e)}},j=(...e)=>S?S.length<50&&S.push(e):$.forEach(t=>U(t)(...e)),O=(e,t)=>U(n=>k({type:e,[t]:n}));function k(e){if(!o)return void w.push(e);if("start"==e.type&&void 0===e.to&&u.navigate)return void P().then(t=>t?.start(e));let t=o.dispatch(e);L(),t.forEach(U(K)),(o.active||i.get("q")||x.length)&&P(),l?.update()}function A(){return h??(h=document.body.appendChild(document.createElement("playstep-root")).attachShadow({mode:"open"}))}function P(){return g??(g=e().then(e=>{let t=A();return t.innerHTML="",l=e.mount({engine:o,get config(){return c},options:u,root:t,outbox:x,userId:()=>y,dispatch:U(k),emit:U(K)})}).catch(I))}let T,C=()=>{let e=u?.locale??navigator.language??"",t=y;d?.(e).then(n=>{n.guides&&(u.locale??navigator.language??"")==e&&t==y&&(b(n),k({type:"arrived",guides:o.use(c=n)}))}).catch(I)},H=U((e={})=>{o?o.launcherGuides().length&&P().then(t=>t?.openLauncher(e.anchor)):T=e});function R(e){e.launcher?.enabled&&o.launcherGuides().length&&!g&&t&&t().then(t=>{g||t.drawLauncher(A(),o,e,H,u)}).catch(I)}let Y=e=>U(()=>{_!==e&&(_=e,o&&(k({type:e?"pause":"resume"}),!g&&(e?h&&(h.innerHTML=""):R(c))))}),D={version:"0.11.2",init:U(e=>{if(u||!e?.appKey)return;u={...e},f&&(u.locale=f);let t=()=>setTimeout(()=>async function(){let e=u,t=(e.apiBase??"https://cdn.playstep.app").replace(/\/$/,""),l=null;try{l=new URLSearchParams(location.search).get(r)||(e.config?null:sessionStorage.getItem(r))}catch{}e.preview||(e.preview=!(!e.config&&!l)),d=async n=>{let i="";p=y;try{y&&!l&&(i="&u="+btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(`${e.appKey}:${y}`))))))}catch{}return(await fetch(`${t}/v2/${l?`preview/${l}?key=${e.appKey}&`:`config/${e.appKey}?`}v=2&l=${n}${i}`)).json()};let g=e.config;try{g??(g=await d(u?.locale??navigator.language??""))}catch{return}try{l&&sessionStorage[g.guides?"setItem":"removeItem"](r,l)}catch{}if(g?.capture)s?.().then(t=>t.start(g.capture,e.appKey)).catch(I);else if(g?.guides&&!g.flags?.disabled&&(c=g,e.eventsUrl=g.ingest_url??`${t}/v1/events`,g.analytics||(S=void 0),$.splice(0).forEach(D.use),S&&a?.().catch(I),o=n({config:g,progress:e.preview?void 0:i.get(E()),traits:v}),b(g),_&&o.dispatch({type:"pause"}),k({type:"init",path:location.pathname}),w.splice(0).forEach(k),T&&H(T),R(g),!e.config&&p!=y&&C(),!1!==e.autoPageViews)){let e=location.pathname;j("page",e);let t=U(()=>location.pathname!==e&&D.page(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)}}().catch(I));"complete"==document.readyState?t():addEventListener("load",t)}),identify:U((e,t)=>{y=e,v={...v,...t},k({type:"identify",traits:v}),j("identify",e,v),c&&e!=p&&!u.config&&C()}),track:U((e,t)=>{k({type:"event",name:e}),j("track",e,t)}),start:O("start","guide"),complete:O("complete","step"),page:U((e=location.pathname)=>{k({type:"page_view",path:e}),j("page",e)}),openLauncher:H,resetProgress:O("reset_progress","guide"),reset:U(()=>{k({type:"dismiss"}),y=void 0,v={},o&&(Object.assign(o.progress,{seen:!1,guides:{}}),L(),l?.update()),u?.preview||i.set("d",null),j("reset")}),pause:Y(!0),resume:Y(!1),isPaused:()=>_,setLocale:U(e=>{f=e,u&&(u.locale=e),C()}),use:U(e=>{$.push(e),c&&(U(e)("config",c,u),S&&(()=>{let e=S;S=void 0,e.forEach(e=>j(...e))})())})};return D}(()=>a("ui","sha256-uHYzIstISah3JFX8/T7+YtdJoaUzftsK/h2pEoVjy/w="),u,()=>u().then(e=>a("capture",e.captureIntegrity)),()=>a("insights","sha256-++PAfmiuuL4Dws2GxlRUFTerimnKYUWgsslLtE7bViU="));if(!window.playstep){window.playstep=o;let e=s?.dataset;e?.appKey&&o.init({appKey:e.appKey,apiBase:e.api,locale:e.locale})}}();
package/dist/cdn/ui.js CHANGED
@@ -1 +1 @@
1
- var __playstep_ui=function(e){function t(e,t){let i=e=>!!e?.getClientRects().length,a=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{a||(a=t?[...document.querySelectorAll(t.css)].find(e=>i(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return i(a)?a:null}Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let i=e=>"dark"==e||"light"==e?e:void 0;function a(e,t,a){let s=i(a)??i(e.theme?.mode)??i(t);return s?"dark"==s:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,i=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(i)return"dark"==i[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}let s=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},n={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 r(e,t,...i){let a=document.createElement(e);for(let e in t){let i=t[e];if(null!=i&&!1!==i)if("o"==e[0]&&"n"==e[1])a.addEventListener(e.slice(2).toLowerCase(),i);else if("ref"==e)i(a);else if("style"==e)for(let e in i)a.style.setProperty(e,i[e]);else a.setAttribute(e,!0===i?"":String(i))}return o(a,i),a}function o(e,t){for(let i of t)Array.isArray(i)?o(e,i):null!=i&&!1!==i&&e.appendChild("object"==typeof i?i:document.createTextNode(String(i)))}let l=document.createElement("template");function p(e){return l.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n[e]}</svg>`,l.content.firstChild}let d=(e,...t)=>{e.textContent="",o(e,t)},c=(e,t=e.config.lang)=>(i,a)=>((e,t={})=>e.replace(/\{(\w+)\}/g,(e,i)=>i in t?String(t[i]):e))(e.config.words[t]?.[i]??i,a);function u(e,t,i,a,s,n){(!n||function(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}(`${s}|${a.url}`))&&e.emit({type:s,guide_id:t.id,guide_version:t.version,step_id:t.steps[i].id,step_index:i,clip_id:a.clip_id,clip_source:a.source})}function h(e,t,i,a,n,o,l){let h=c(e,t.lang),f=t.steps[i].title,g=r("div",{class:"clip"}),m=!0,b=a.duration_ms??0;if("embed"==a.kind)return g.className="clip embed",d(g,a.poster&&r("img",{src:a.poster,alt:""}),r("button",{class:"play","aria-label":h("play_video"),onClick:()=>{d(g,r("iframe",{src:a.url,title:h("video",{title:f}),allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowfullscreen:!0})),u(e,t,i,a,"clip_played")}},p("play")),r("div",{class:"bar"},r("span",{class:"pill"},p("external-link"),a.label,b?` · ${s(b)}`:""))),l(0),g;let x=()=>{let n=r("video",{src:a.url,poster:a.poster,loop:!0,autoplay:!0,playsinline:!0,preload:"auto","aria-label":h("clip",{title:f}),onLoadeddata:()=>u(e,t,i,a,"clip_loaded",!0),onPlaying:()=>u(e,t,i,a,"clip_played",!0),onLoadedmetadata:()=>{Number.isFinite(n.duration)&&(b=1e3*n.duration,c.textContent=`${s(b)} `,l(b))}});n.muted=!0;let c=r("span",null,b?`${s(b)} `:""),x=r("button",{class:"round","aria-label":h("unmute_clip"),onClick:()=>{m=!m,n.muted=m,x.setAttribute("aria-label",h(m?"unmute_clip":"mute_clip")),d(x,p(m?"volume-x":"volume-2")),m||u(e,t,i,a,"clip_unmuted")}},p("volume-x")),v=r("button",{class:"round","aria-label":h("expand_clip"),"aria-pressed":"false",onClick:()=>{let e=o.classList.toggle("big");v.setAttribute("aria-label",h(e?"shrink_clip":"expand_clip")),v.setAttribute("aria-pressed",String(e))}},p("maximize-2"));d(g,n,r("div",{class:"bar"},r("span",{class:"pill"},p("play"),c,h("loop")),x,v)),n.play()?.catch(()=>{}),l(b)};return n?d(g,a.poster&&r("img",{src:a.poster,alt:""}),r("button",{class:"play","aria-label":h("play_clip"),onClick:x},p("play"))):x(),g}function f(e,t,i,a,s){let n=t.steps[i],o=t.steps.length,l=c(e,t.lang),f="next_button"==n.complete_on.type,g=n.media,m=l("step_of",{n:i+1,total:o}),b=t.steps.map((e,t)=>r("span",{class:"seg"+(t<i?" done":t==i?" cur":"")}));s.classList.remove("big"),s.dataset.step=n.id,s.lang=t.lang,t.rtl?s.dir="rtl":s.removeAttribute("dir"),d(s,"image"==g?.kind?r("div",{class:"clip img"},r("img",{src:g.url,alt:g.label??"",width:g.width,height:g.height})):g&&h(e,t,i,g,a,s,e=>{let t=b[i];t.className="seg cur"+(e&&!a?" anim":""),e?t.style.setProperty("--d",`${e}ms`):t.style.removeProperty("--d")}),r("div",{class:"body"},r("div",{class:"meta"},r("span",null,`${m} · ${t.name}`),r("button",{class:"x","aria-label":l("close_guide"),onClick:()=>e.dispatch({type:"dismiss"})},p("x"))),r("div",{class:"steps",role:"img","aria-label":m},b),r("h2",{class:"title",id:"ps-title"},n.title),r("p",{class:"text",id:"ps-text"},n.body)),r("div",{class:"foot"},f?r("span",{class:"sp"}):r("span",{class:"wait"},r("span",{class:"pulse","aria-hidden":"true"}),l("waiting")),n.back&&r("button",{class:"btn gho",onClick:()=>e.dispatch({type:"back"})},l("back")),f&&r("button",{class:"btn pri",onClick:()=>e.dispatch({type:"next"})},l(i+1==o?"done":"next"),p("arrow-right"))));let x=t.steps[i+1]?.media;if(x&&"embed"!=x.kind&&!a&&!navigator.connection?.saveData)if("image"==x.kind)(new Image).src=x.url;else{let a=document.createElement("video");a.preload="auto",a.muted=!0,a.src=x.url,"hosted"==x.source&&u(e,t,i+1,x,"clip_loaded",!0)}}function g(e,t,i,a,s,n=!1,r=12){let o={bottom:e.bottom+s+i<=innerHeight-r,top:e.top-s-i>=r,left:e.left-s-t>=r,right:e.right+s+t<=innerWidth-r},l=a.find(e=>o[e])??a[0],p=(e,t)=>Math.max(r,Math.min(e,t-r));return"top"==l||"bottom"==l?{x:p(n?e.left:e.left+(e.width-t)/2,innerWidth-t),y:"top"==l?e.top-s-i:e.bottom+s}:{x:"left"==l?e.left-s-t:e.right+s,y:p(e.top+(e.height-i)/2,innerHeight-i)}}let m=document.currentScript?.src,b=(e,t,i)=>t?new Promise((i,a)=>document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,m||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>i(window[`__playstep_${e}`]),onerror:()=>a(Error(e))}))):i(),x=()=>b("events","sha256-K6rptBMfhdH1iZVQrIhV2rB8e2GRZQLFGKtbWkX30xE=",()=>import("../core/transport")),v=()=>b("list","sha256-28L8SfXyI2tnqGcN1BhJvRjS6lhEYeXgyl9SH/E2Npk=",()=>import("./list")),y=()=>b("done","sha256-NQjGrSn5EuVz6RfEcLwXPj+spBN6kWyQkMIO8c3LAg8=",()=>import("./done"));function k(e,t,i){let a=c(e),s=e.engine.launcherGuides().filter(t=>!e.engine.progress.guides[t.id]).length;t.className="lb"+("bottom-left"==e.config.launcher.position?" left":""),t.setAttribute("aria-label",a(i?"close_guides":"open_guides")),t.setAttribute("aria-expanded",String(i)),d(t,p("ps-launcher"),s>0&&!i&&r("span",{class:"cnt"},s))}function w(e){let t=location.pathname.split("/"),i=!0,a=e.split("/").map((e,a)=>"*"==e?t[a]||(i=!1,""):e).join("/");return i?a:""}let _=(e,t,i,a)=>(e.addEventListener(t,i,a),()=>e.removeEventListener(t,i,a));function M(e,i,a){let s,n,o=r("div",{class:"card",role:"dialog","aria-modal":"false","aria-labelledby":"ps-title","aria-describedby":"ps-text",tabindex:"-1",style:{visibility:"hidden"}}),l=r("div",{class:"spot","aria-hidden":"true"}),p=r("div",{class:"scrim","aria-hidden":"true"}),d=!1,c=!1,u=-1,h=null,m=[],b=[],x=[],v=!1,y="",k="",w=e=>e.splice(0).forEach(e=>e()),M=()=>s.steps[u];function S(e,t,i){o.style.transform=`translate(${Math.round(e)}px,${Math.round(t)}px)`,o.style.visibility="",v||(o.style.transition="none",requestAnimationFrame(()=>(v=!0,o.style.transition=""))),d!=!(!h||!i)&&(d=!d,a()),h&&i&&Object.assign(l.style,{width:`${i.w}px`,height:`${i.h}px`,transform:`translate(${i.x}px,${i.y}px)`,borderRadius:`${i.r}px`}),y!=M().id&&(y=M().id,document.hasFocus()&&!document.activeElement?.matches("input,textarea,select,[contenteditable]:not([contenteditable=false])")&&o.focus({preventScroll:!0}))}function $(){w(x);let e=o;if(c!=(!h&&"center"==s.position)&&(c=!c,a()),!h){let t=()=>S((innerWidth-e.offsetWidth)/2,"center"==s.position?(innerHeight-e.offsetHeight)/2:innerHeight-e.offsetHeight-24);t();let i=new ResizeObserver(t);return i.observe(e),void x.push(()=>i.disconnect(),_(window,"resize",t))}let t=h,n=t.getBoundingClientRect();(n.bottom<0||n.top>innerHeight)&&t.scrollIntoView({block:"center",behavior:i?"auto":"smooth"});let r=()=>{let i=t.getBoundingClientRect(),a=Number.parseFloat(getComputedStyle(t).borderTopLeftRadius)||8,s=M().placement,{x:n,y:r}=g(i,e.offsetWidth,e.offsetHeight,["auto"==s?"bottom":s,"top","left","right"],18);S(n,r,{x:i.left-6,y:i.top-6,w:i.width+12,h:i.height+12,r:Math.min(a+6,(i.height+12)/2)})};r();let l=new ResizeObserver(r);l.observe(t),l.observe(e);let p=setInterval(r,400);x.push(()=>l.disconnect(),()=>clearInterval(p),_(window,"scroll",r,{capture:!0,passive:!0}),_(window,"resize",r))}function C(i){h=i,w(b),clearTimeout(n);let a=M();if(i)b.push(_(document,"click",t=>{t.composedPath().includes(i)&&(k="",e.dispatch({type:"tap",anchor:a.anchor}))},!0)),i==t(a.anchor,a.find?.web)&&(k=a.id);else if(k==a.id){let i=u;n=setTimeout(()=>{for(let a=i;a--;){let n=s.steps[a];if(!n.anchor||"page"==n.complete_on.type)return;if(t(n.anchor,n.find?.web)){for(let t=i;t-- >a;)e.dispatch({type:"back"});return}}},400)}b.push(_(document,"keydown",t=>{if("Tab"!=t.key)return;let a=[...o.querySelectorAll('button,a,iframe,[tabindex="0"]')],s=t.composedPath().includes(o),n=a[0],r=a.at(-1),l=e.root.activeElement;s&&!t.shiftKey&&l==r?(t.preventDefault(),(i??n)?.focus()):s&&t.shiftKey&&l==n?(t.preventDefault(),(i??r)?.focus()):i&&document.activeElement==i&&(t.preventDefault(),(t.shiftKey?r:n)?.focus())},!0)),$()}function E(){w(m);let i=M(),a=i.anchor?t(i.anchor,i.find?.web):null;if(C(a),!i.anchor)return;let s=0,n=()=>{s=0;let e=t(i.anchor,i.find?.web);e!=a&&C(a=e)},r=new MutationObserver(()=>s||(s=requestAnimationFrame(n)));r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-guide","hidden","style","class"]});let o=setTimeout(()=>!a&&e.dispatch({type:"anchor_missing",anchor:i.anchor}),3e3);m.push(()=>r.disconnect(),()=>clearTimeout(o),()=>cancelAnimationFrame(s))}return{nodes:()=>[d&&l,c&&p,o],get guide(){return s},update(t,a){if(t==s&&a==u)return;let n=!s||a!=u||t.steps[a]?.id!=M().id;s=t,u=a,f(e,t,a,i,o),n?E():$()},stop(){w(m),w(b),w(x),clearTimeout(n)}}}return e.fillEl=d,e.h=r,e.icon=p,e.mount=function(e){let i=e.options,s=t=>{e.outbox.push(t)};x().then(({createTransport:t})=>{let a=t({appKey:i.appKey,url:i.eventsUrl,sdk:i.sdkName??"web",version:"0.9.0",preview:i.preview,userId:e.userId,locale:()=>(e=>e.options.locale??navigator.language??"en")(e),send:i.transport});e.outbox.splice(0).forEach(a.push),s=a.push}).catch(t=>e.emit({type:"sdk_error",message:String(t)}));let n=e.root;n.appendChild(r("style",null,':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-inline-start:auto}[dir=rtl] .btn svg{transform:scaleX(-1)}.img>img{object-fit:contain}.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:var(--ps-radius-btn,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)}.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)}.left{right:auto;left:24px}.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%}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}'));let o,l,p,d,u,h,f,m,b=n.appendChild(r("div",{class:"l"})),S=r("div",{class:"sr","aria-live":"polite"}),$=!1,C=null,E=r("button",{onClick:()=>H(!$)}),A=t=>e.emit({type:"sdk_error",message:String(t)}),L=()=>u??(u=v().then(e=>(p=e,n.appendChild(r("style",null,e.css)),O())).catch(A)),z=()=>h??(h=y().then(e=>(d=e,n.appendChild(r("style",null,e.css)),O())).catch(A)),j=[],N=()=>[S],H=e=>{$=e,O()};function P(e){let t=e.filter(Boolean);for(t.forEach((e,t)=>b.childNodes[t]!=e&&b.insertBefore(e,b.childNodes[t]??null));b.childNodes.length>t.length;)b.lastChild.remove()}function O(){let t=e.engine.active,s=t?.guide,u=a(e.config,i.colorMode,s?.mode)?"dark":"light";n.host.setAttribute("data-mode",u),b.removeAttribute("style");for(let[t,i]of Object.entries({...e.config.theme?.[u],...s?.tokens?.[u]}))b.style.setProperty(`--ps-${t}`,i);let h=e.engine.launcherGuides().length>0,x=!!l;$&&h&&p?(l??(l=r("div",{tabindex:"-1",role:"dialog"})),p.drawList(e,l,()=>H(!1))):(l=void 0,$&&h&&L()),h&&k(e,E,$),$||"running"!=t?.status?(f?.stop(),f=void 0):f?.guide?.id!=s.id&&(f?.stop(),f=M(e,matchMedia("(prefers-reduced-motion: reduce)").matches,()=>P(N()))),"running"==t?.status&&t.index==s.steps.length-1&&z();let v=!$&&"completed"==t?.status&&!!d;!$&&"completed"==t?.status&&!d&&z();let y=v&&(m!=s||!j.length);if(v?y&&(j=d.drawDone(e,s)):j=[],m=v?s:void 0,S.textContent="running"==t?.status?`${c(e,s.lang)("step_of",{n:t.index+1,total:s.steps.length})}: ${s.steps[t.index].title}`:"completed"==t?.status?c(e,s.lang)("level_cleared"):"",N=()=>[l,h&&e.config.launcher.enabled&&E,...f?.nodes()??[],...j,S],P(N()),f?.update(s,t.index),l&&!x){if(C=n.activeElement??document.activeElement,o){let{x:e,y:t}=g(o.getBoundingClientRect(),l.offsetWidth,l.offsetHeight,["top","bottom"],8,!0);l.style.cssText=`left:${e}px;top:${t}px;right:auto;bottom:auto`}l.focus()}else!l&&x&&C?.focus();y&&j[1]?.focus()}_(window,"keydown",i=>{if("Escape"!=i.key||i.defaultPrevented||!i.composedPath().includes(n.host))return;let a=e.engine.active;if($)H(!1);else if("completed"==a?.status)e.dispatch({type:"close"});else{if("running"!=a?.status)return;{let i=a.guide.steps[a.index],s=i.anchor?t(i.anchor,i.find?.web):null;e.dispatch({type:"hide"}),s?.focus({preventScroll:!0})}}i.preventDefault(),i.stopPropagation()},!0);let T=new MutationObserver(()=>O());for(let e of[document.documentElement,document.body])T.observe(e,{attributes:!0});return _(matchMedia("(prefers-color-scheme: dark)"),"change",()=>O()),O(),{update:()=>{e.engine.launcherGuides().length||($=!1),O()},openLauncher:e=>{let t=document.activeElement;o=e??(t!=document.body&&t!=n.host?t??void 0:void 0),H(!0)},send:e=>s(e),start:t=>{let a=e.config.guides.find(e=>e.id==t.guide)?.start_path;try{let s=a&&(i.startPage??w)(a,t.guide)||"";e.dispatch({...t,to:s});let n=e.engine.active;"waiting"==n?.status&&n.guide.id==t.guide&&i.navigate(s)}catch(a){A(a),e.dispatch({...t,to:""})}}}},e.words=c,e}({});
1
+ var __playstep_ui=function(e){function t(e,t){let i=e=>!!e?.getClientRects().length,a=[...document.querySelectorAll(`[data-guide="${CSS.escape(e)}"]`)].find(i)??null;try{a||(a=t?[...document.querySelectorAll(t.css)].find(e=>i(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return i(a)?a:null}Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let i=e=>"dark"==e||"light"==e?e:void 0;function a(e,t,a){let s=i(a)??i(e.theme?.mode)??i(t);return s?"dark"==s:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,i=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(i)return"dark"==i[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}let s=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},n={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 r(e,t,...i){let a=document.createElement(e);for(let e in t){let i=t[e];if(null!=i&&!1!==i)if("o"==e[0]&&"n"==e[1])a.addEventListener(e.slice(2).toLowerCase(),i);else if("ref"==e)i(a);else if("style"==e)for(let e in i)a.style.setProperty(e,i[e]);else a.setAttribute(e,!0===i?"":String(i))}return o(a,i),a}function o(e,t){for(let i of t)Array.isArray(i)?o(e,i):null!=i&&!1!==i&&e.appendChild("object"==typeof i?i:document.createTextNode(String(i)))}let l=document.createElement("template");function p(e){return l.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n[e]}</svg>`,l.content.firstChild}let d=(e,...t)=>{e.textContent="",o(e,t)},c=(e,t=e.config.lang)=>(i,a)=>((e,t={})=>e.replace(/\{(\w+)\}/g,(e,i)=>i in t?String(t[i]):e))(e.config.words[t]?.[i]??i,a);function u(e,t,i,a,s,n){(!n||function(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}(`${s}|${a.url}`))&&e.emit({type:s,guide_id:t.id,guide_version:t.version,step_id:t.steps[i].id,step_index:i,clip_id:a.clip_id,clip_source:a.source})}function h(e,t,i,a,n,o,l){let h=c(e,t.lang),f=t.steps[i].title,g=r("div",{class:"clip"}),m=!0,b=a.duration_ms??0;if("embed"==a.kind)return g.className="clip embed",d(g,a.poster&&r("img",{src:a.poster,alt:""}),r("button",{class:"play","aria-label":h("play_video"),onClick:()=>{d(g,r("iframe",{src:a.url,title:h("video",{title:f}),allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowfullscreen:!0})),u(e,t,i,a,"clip_played")}},p("play")),r("div",{class:"bar"},r("span",{class:"pill"},p("external-link"),a.label,b?` · ${s(b)}`:""))),l(0),g;let x=()=>{let n=r("video",{src:a.url,poster:a.poster,loop:!0,autoplay:!0,playsinline:!0,preload:"auto","aria-label":h("clip",{title:f}),onLoadeddata:()=>u(e,t,i,a,"clip_loaded",!0),onPlaying:()=>u(e,t,i,a,"clip_played",!0),onLoadedmetadata:()=>{Number.isFinite(n.duration)&&(b=1e3*n.duration,c.textContent=`${s(b)} `,l(b))}});n.muted=!0;let c=r("span",null,b?`${s(b)} `:""),x=r("button",{class:"round","aria-label":h("unmute_clip"),onClick:()=>{m=!m,n.muted=m,x.setAttribute("aria-label",h(m?"unmute_clip":"mute_clip")),d(x,p(m?"volume-x":"volume-2")),m||u(e,t,i,a,"clip_unmuted")}},p("volume-x")),v=r("button",{class:"round","aria-label":h("expand_clip"),"aria-pressed":"false",onClick:()=>{let e=o.classList.toggle("big");v.setAttribute("aria-label",h(e?"shrink_clip":"expand_clip")),v.setAttribute("aria-pressed",String(e))}},p("maximize-2"));d(g,n,r("div",{class:"bar"},r("span",{class:"pill"},p("play"),c,h("loop")),x,v)),n.play()?.catch(()=>{}),l(b)};return n?d(g,a.poster&&r("img",{src:a.poster,alt:""}),r("button",{class:"play","aria-label":h("play_clip"),onClick:x},p("play"))):x(),g}function f(e,t,i,a,s){let n=t.steps[i],o=t.steps.length,l=c(e,t.lang),f="next_button"==n.complete_on.type,g=n.media,m=l("step_of",{n:i+1,total:o}),b=t.steps.map((e,t)=>r("span",{class:"seg"+(t<i?" done":t==i?" cur":"")}));s.classList.remove("big"),s.dataset.step=n.id,s.lang=t.lang,t.rtl?s.dir="rtl":s.removeAttribute("dir"),d(s,"image"==g?.kind?r("div",{class:"clip img"},r("img",{src:g.url,alt:g.label??"",width:g.width,height:g.height})):g&&h(e,t,i,g,a,s,e=>{let t=b[i];t.className="seg cur"+(e&&!a?" anim":""),e?t.style.setProperty("--d",`${e}ms`):t.style.removeProperty("--d")}),r("div",{class:"body"},r("div",{class:"meta"},r("span",null,`${m} · ${t.name}`),r("button",{class:"x","aria-label":l("close_guide"),onClick:()=>e.dispatch({type:"dismiss"})},p("x"))),r("div",{class:"steps",role:"img","aria-label":m},b),r("h2",{class:"title",id:"ps-title"},n.title),r("p",{class:"text",id:"ps-text"},n.body)),r("div",{class:"foot"},f?r("span",{class:"sp"}):r("span",{class:"wait"},r("span",{class:"pulse","aria-hidden":"true"}),l("waiting")),n.back&&r("button",{class:"btn gho",onClick:()=>e.dispatch({type:"back"})},l("back")),f&&r("button",{class:"btn pri",onClick:()=>e.dispatch({type:"next"})},l(i+1==o?"done":"next"),p("arrow-right"))));let x=t.steps[i+1]?.media;if(x&&"embed"!=x.kind&&!a&&!navigator.connection?.saveData)if("image"==x.kind)(new Image).src=x.url;else{let a=document.createElement("video");a.preload="auto",a.muted=!0,a.src=x.url,"hosted"==x.source&&u(e,t,i+1,x,"clip_loaded",!0)}}function g(e,t,i,a,s,n=!1,r=12){let o={bottom:e.bottom+s+i<=innerHeight-r,top:e.top-s-i>=r,left:e.left-s-t>=r,right:e.right+s+t<=innerWidth-r},l=a.find(e=>o[e])??a[0],p=(e,t)=>Math.max(r,Math.min(e,t-r));return"top"==l||"bottom"==l?{x:p(n?e.left:e.left+(e.width-t)/2,innerWidth-t),y:"top"==l?e.top-s-i:e.bottom+s}:{x:"left"==l?e.left-s-t:e.right+s,y:p(e.top+(e.height-i)/2,innerHeight-i)}}let m=document.currentScript?.src,b=(e,t,i)=>t?new Promise((i,a)=>document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,m||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>i(window[`__playstep_${e}`]),onerror:()=>a(Error(e))}))):i(),x=()=>b("events","sha256-4vyjrnK5rttEM/kZCgUVyDOH2+Q28gM+5u/1U5TZHWw=",()=>import("../core/transport")),v=()=>b("list","sha256-28L8SfXyI2tnqGcN1BhJvRjS6lhEYeXgyl9SH/E2Npk=",()=>import("./list")),y=()=>b("done","sha256-NQjGrSn5EuVz6RfEcLwXPj+spBN6kWyQkMIO8c3LAg8=",()=>import("./done"));function k(e,t,i){let a=c(e),s=e.engine.launcherGuides().filter(t=>!e.engine.progress.guides[t.id]).length;t.className="lb"+("bottom-left"==e.config.launcher.position?" left":""),t.setAttribute("aria-label",a(i?"close_guides":"open_guides")),t.setAttribute("aria-expanded",String(i)),d(t,p("ps-launcher"),s>0&&!i&&r("span",{class:"cnt"},s))}function w(e){let t=location.pathname.split("/"),i=!0,a=e.split("/").map((e,a)=>"*"==e?t[a]||(i=!1,""):e).join("/");return i?a:""}let _=(e,t,i,a)=>(e.addEventListener(t,i,a),()=>e.removeEventListener(t,i,a));function M(e,i,a){let s,n,o=r("div",{class:"card",role:"dialog","aria-modal":"false","aria-labelledby":"ps-title","aria-describedby":"ps-text",tabindex:"-1",style:{visibility:"hidden"}}),l=r("div",{class:"spot","aria-hidden":"true"}),p=r("div",{class:"scrim","aria-hidden":"true"}),d=!1,c=!1,u=-1,h=null,m=[],b=[],x=[],v=!1,y="",k="",w=e=>e.splice(0).forEach(e=>e()),M=()=>s.steps[u];function S(e,t,i){o.style.transform=`translate(${Math.round(e)}px,${Math.round(t)}px)`,o.style.visibility="",v||(o.style.transition="none",requestAnimationFrame(()=>(v=!0,o.style.transition=""))),d!=!(!h||!i)&&(d=!d,a()),h&&i&&Object.assign(l.style,{width:`${i.w}px`,height:`${i.h}px`,transform:`translate(${i.x}px,${i.y}px)`,borderRadius:`${i.r}px`}),y!=M().id&&(y=M().id,document.hasFocus()&&!document.activeElement?.matches("input,textarea,select,[contenteditable]:not([contenteditable=false])")&&o.focus({preventScroll:!0}))}function $(){w(x);let e=o;if(c!=(!h&&"center"==s.position)&&(c=!c,a()),!h){let t=()=>S((innerWidth-e.offsetWidth)/2,"center"==s.position?(innerHeight-e.offsetHeight)/2:innerHeight-e.offsetHeight-24);t();let i=new ResizeObserver(t);return i.observe(e),void x.push(()=>i.disconnect(),_(window,"resize",t))}let t=h,n=t.getBoundingClientRect();(n.bottom<0||n.top>innerHeight)&&t.scrollIntoView({block:"center",behavior:i?"auto":"smooth"});let r=()=>{let i=t.getBoundingClientRect(),a=Number.parseFloat(getComputedStyle(t).borderTopLeftRadius)||8,s=M().placement,{x:n,y:r}=g(i,e.offsetWidth,e.offsetHeight,["auto"==s?"bottom":s,"top","left","right"],18);S(n,r,{x:i.left-6,y:i.top-6,w:i.width+12,h:i.height+12,r:Math.min(a+6,(i.height+12)/2)})};r();let l=new ResizeObserver(r);l.observe(t),l.observe(e);let p=setInterval(r,400);x.push(()=>l.disconnect(),()=>clearInterval(p),_(window,"scroll",r,{capture:!0,passive:!0}),_(window,"resize",r))}function C(i){h=i,w(b),clearTimeout(n);let a=M();if(i)b.push(_(document,"click",t=>{t.composedPath().includes(i)&&(k="",e.dispatch({type:"tap",anchor:a.anchor}))},!0)),i==t(a.anchor,a.find?.web)&&(k=a.id);else if(k==a.id){let i=u;n=setTimeout(()=>{for(let a=i;a--;){let n=s.steps[a];if(!n.anchor||"page"==n.complete_on.type)return;if(t(n.anchor,n.find?.web)){for(let t=i;t-- >a;)e.dispatch({type:"back"});return}}},400)}b.push(_(document,"keydown",t=>{if("Tab"!=t.key)return;let a=[...o.querySelectorAll('button,a,iframe,[tabindex="0"]')],s=t.composedPath().includes(o),n=a[0],r=a.at(-1),l=e.root.activeElement;s&&!t.shiftKey&&l==r?(t.preventDefault(),(i??n)?.focus()):s&&t.shiftKey&&l==n?(t.preventDefault(),(i??r)?.focus()):i&&document.activeElement==i&&(t.preventDefault(),(t.shiftKey?r:n)?.focus())},!0)),$()}function E(){w(m);let i=M(),a=i.anchor?t(i.anchor,i.find?.web):null;if(C(a),!i.anchor)return;let s=0,n=()=>{s=0;let e=t(i.anchor,i.find?.web);e!=a&&C(a=e)},r=new MutationObserver(()=>s||(s=requestAnimationFrame(n)));r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-guide","hidden","style","class"]});let o=setTimeout(()=>!a&&e.dispatch({type:"anchor_missing",anchor:i.anchor}),3e3);m.push(()=>r.disconnect(),()=>clearTimeout(o),()=>cancelAnimationFrame(s))}return{nodes:()=>[d&&l,c&&p,o],get guide(){return s},update(t,a){if(t==s&&a==u)return;let n=!s||a!=u||t.steps[a]?.id!=M().id;s=t,u=a,f(e,t,a,i,o),n?E():$()},stop(){w(m),w(b),w(x),clearTimeout(n)}}}return e.fillEl=d,e.h=r,e.icon=p,e.mount=function(e){let i=e.options,s=t=>{e.outbox.push(t)};x().then(({createTransport:t})=>{let a=t({appKey:i.appKey,url:i.eventsUrl,sdk:i.sdkName??"web",version:"0.11.2",preview:i.preview,userId:e.userId,locale:()=>(e=>e.options.locale??navigator.language??"en")(e),send:i.transport});e.outbox.splice(0).forEach(a.push),s=a.push}).catch(t=>e.emit({type:"sdk_error",message:String(t)}));let n=e.root;n.appendChild(r("style",null,':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-inline-start:auto}[dir=rtl] .btn svg{transform:scaleX(-1)}.img>img{object-fit:contain}.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:var(--ps-radius-btn,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)}.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)}.left{right:auto;left:24px}.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%}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}'));let o,l,p,d,u,h,f,m,b=n.appendChild(r("div",{class:"l"})),S=r("div",{class:"sr","aria-live":"polite"}),$=!1,C=null,E=r("button",{onClick:()=>N(!$)}),A=t=>e.emit({type:"sdk_error",message:String(t)}),L=()=>u??(u=v().then(e=>(p=e,n.appendChild(r("style",null,e.css)),P())).catch(A)),z=()=>h??(h=y().then(e=>(d=e,n.appendChild(r("style",null,e.css)),P())).catch(A)),j=[],H=()=>[S],N=e=>{$=e,P()};function O(e){let t=e.filter(Boolean);for(t.forEach((e,t)=>b.childNodes[t]!=e&&b.insertBefore(e,b.childNodes[t]??null));b.childNodes.length>t.length;)b.lastChild.remove()}function P(){let t=e.engine.active,s=t?.guide,u=a(e.config,i.colorMode,s?.mode)?"dark":"light";n.host.setAttribute("data-mode",u),b.removeAttribute("style");for(let[t,i]of Object.entries({...e.config.theme?.[u],...s?.tokens?.[u]}))b.style.setProperty(`--ps-${t}`,i);let h=e.engine.launcherGuides().length>0,x=!!l;$&&h&&p?(l??(l=r("div",{tabindex:"-1",role:"dialog"})),p.drawList(e,l,()=>N(!1))):(l=void 0,$&&h&&L()),h&&k(e,E,$),$||"running"!=t?.status?(f?.stop(),f=void 0):f?.guide?.id!=s.id&&(f?.stop(),f=M(e,matchMedia("(prefers-reduced-motion: reduce)").matches,()=>O(H()))),"running"==t?.status&&t.index==s.steps.length-1&&z();let v=!$&&"completed"==t?.status&&!!d;!$&&"completed"==t?.status&&!d&&z();let y=v&&(m!=s||!j.length);if(v?y&&(j=d.drawDone(e,s)):j=[],m=v?s:void 0,S.textContent="running"==t?.status?`${c(e,s.lang)("step_of",{n:t.index+1,total:s.steps.length})}: ${s.steps[t.index].title}`:"completed"==t?.status?c(e,s.lang)("level_cleared"):"",H=()=>[l,h&&e.config.launcher.enabled&&E,...f?.nodes()??[],...j,S],O(H()),f?.update(s,t.index),l&&!x){if(C=n.activeElement??document.activeElement,o){let{x:e,y:t}=g(o.getBoundingClientRect(),l.offsetWidth,l.offsetHeight,["top","bottom"],8,!0);l.style.cssText=`left:${e}px;top:${t}px;right:auto;bottom:auto`}l.focus()}else!l&&x&&C?.focus();y&&j[1]?.focus()}_(window,"keydown",i=>{if("Escape"!=i.key||i.defaultPrevented||!i.composedPath().includes(n.host))return;let a=e.engine.active;if($)N(!1);else if("completed"==a?.status)e.dispatch({type:"close"});else{if("running"!=a?.status)return;{let i=a.guide.steps[a.index],s=i.anchor?t(i.anchor,i.find?.web):null;e.dispatch({type:"hide"}),s?.focus({preventScroll:!0})}}i.preventDefault(),i.stopPropagation()},!0);let T=new MutationObserver(()=>P());for(let e of[document.documentElement,document.body])T.observe(e,{attributes:!0});return _(matchMedia("(prefers-color-scheme: dark)"),"change",()=>P()),P(),{update:()=>{e.engine.launcherGuides().length||($=!1),P()},openLauncher:e=>{let t=document.activeElement;o=e??(t!=document.body&&t!=n.host?t??void 0:void 0),N(!0)},send:e=>s(e),start:t=>{let a=e.config.guides.find(e=>e.id==t.guide)?.start_path;try{let s=a&&(i.startPage??w)(a,t.guide)||"";e.dispatch({...t,to:s});let n=e.engine.active;"waiting"==n?.status&&n.guide.id==t.guide&&i.navigate(s)}catch(a){A(a),e.dispatch({...t,to:""})}}}},e.words=c,e}({});
@@ -1 +1 @@
1
- import{h as e,icon as t,words as n}from"./ui-Wx3i3XXx.js";const r=`.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}.art i{position:absolute;border-radius:99px}.art i:nth-child(1){width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)}.art i:nth-child(2){width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)}.art i:nth-child(3){width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)}.art i:nth-child(4){width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)}.art i:nth-child(5){width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)}.art i:nth-child(6){width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}`;function i(r,i){let a=r.engine.launcherGuides().find(e=>e.id!=i.id&&r.engine.progress.guides[e.id]?.status!=`done`),o=n(r,i.lang),s=e(`div`,{class:`cel`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabindex:`-1`,lang:i.lang,dir:i.rtl&&`rtl`},e(`div`,{class:`art`,"aria-hidden":`true`},[1,2,3,4,5,6].map(()=>e(`i`)),e(`span`,{class:`tile`},t(`ps-level-up`))),e(`h2`,{id:`ps-cel`},o(`level_cleared`)),e(`p`,null,o(`finished`,{guide:i.name}),a?` ${o(`next_up`,{guide:a.name})}`:``),e(`div`,{class:`acts`},e(`button`,{class:`btn sec`,onClick:()=>r.dispatch({type:`start`,guide:i.id,source:`launcher`})},t(`rotate-ccw`),o(`replay`)),a?e(`button`,{class:`btn pri`,onClick:()=>r.dispatch({type:`start`,guide:a.id,source:`launcher`})},o(`next_guide`),t(`arrow-right`)):e(`button`,{class:`btn pri`,onClick:()=>r.dispatch({type:`close`})},o(`done`))));return[e(`div`,{class:`scrim`,onClick:()=>r.dispatch({type:`close`})}),s]}export{r as css,i as drawDone};
1
+ import{h as e,icon as t,words as n}from"./ui-BXeMvUwo.js";const r=`.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}.art i{position:absolute;border-radius:99px}.art i:nth-child(1){width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)}.art i:nth-child(2){width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)}.art i:nth-child(3){width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)}.art i:nth-child(4){width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)}.art i:nth-child(5){width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)}.art i:nth-child(6){width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}`;function i(r,i){let a=r.engine.launcherGuides().find(e=>e.id!=i.id&&r.engine.progress.guides[e.id]?.status!=`done`),o=n(r,i.lang),s=e(`div`,{class:`cel`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabindex:`-1`,lang:i.lang,dir:i.rtl&&`rtl`},e(`div`,{class:`art`,"aria-hidden":`true`},[1,2,3,4,5,6].map(()=>e(`i`)),e(`span`,{class:`tile`},t(`ps-level-up`))),e(`h2`,{id:`ps-cel`},o(`level_cleared`)),e(`p`,null,o(`finished`,{guide:i.name}),a?` ${o(`next_up`,{guide:a.name})}`:``),e(`div`,{class:`acts`},e(`button`,{class:`btn sec`,onClick:()=>r.dispatch({type:`start`,guide:i.id,source:`launcher`})},t(`rotate-ccw`),o(`replay`)),a?e(`button`,{class:`btn pri`,onClick:()=>r.dispatch({type:`start`,guide:a.id,source:`launcher`})},o(`next_guide`),t(`arrow-right`)):e(`button`,{class:`btn pri`,onClick:()=>r.dispatch({type:`close`})},o(`done`))));return[e(`div`,{class:`scrim`,onClick:()=>r.dispatch({type:`close`})}),s]}export{r as css,i as drawDone};