@axceera/playstep 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/cdn/done.js +1 -1
- package/dist/cdn/events.js +1 -1
- package/dist/cdn/list.js +1 -1
- package/dist/cdn/loader.js +1 -1
- package/dist/cdn/ui.js +1 -1
- package/dist/{done-BwXakUjv.js → done-CIjuDrGz.js} +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/index.js +1 -1
- package/dist/{list-Dqrzp4FD.js → list-BL3FY9X7.js} +1 -1
- package/dist/sdk-wO7F4vdJ.js +1 -0
- package/dist/{transport-BbOItkab.js → transport-DZeLw3bE.js} +1 -1
- package/dist/ui-WHd-CNG8.js +1 -0
- package/dist/util-X5IoDowG.js +1 -0
- package/package.json +2 -2
- package/dist/sdk-Ba_W5Ehd.js +0 -1
- package/dist/ui-uhppJh4o.js +0 -1
- package/dist/util-oI8xpB8k.js +0 -1
package/README.md
CHANGED
|
@@ -26,6 +26,11 @@ Other calls: `playstep.start(guideId)`, `playstep.complete(stepId)`, `playstep.p
|
|
|
26
26
|
(let guides start again, keeping the user), `playstep.reset()` (on sign-out) and `playstep.pause()` / `playstep.resume()`
|
|
27
27
|
(no guides for now, for a user who should not see them, keeping their progress).
|
|
28
28
|
|
|
29
|
+
Pass your router as `init({ navigate: (path) => router.push(path) })` and a guide started from the guide list, the
|
|
30
|
+
finish screen or `start()` on another page begins on step 1 on its start page, set in the dashboard (`/app/*/projects`:
|
|
31
|
+
each `*` filled in from the current path). Triggers never navigate. `guide_shown` events carry `source` (`trigger`,
|
|
32
|
+
`launcher` or `api`) for apps that want to react themselves.
|
|
33
|
+
|
|
29
34
|
## Script tag
|
|
30
35
|
|
|
31
36
|
```html
|
|
@@ -40,7 +45,7 @@ carries the hashes of the chunks it loads, so pinning it covers everything that
|
|
|
40
45
|
data-app-key="ps_pub_xxx"></script>
|
|
41
46
|
```
|
|
42
47
|
|
|
43
|
-
- About 3 KB gzipped until a guide shows; the guide card (about 8.
|
|
48
|
+
- About 3.3 KB gzipped until a guide shows; the guide card (about 8.6 KB) and event delivery (about 2 KB) load only
|
|
44
49
|
then, the guide list and the finish screen only when they show. No dependencies.
|
|
45
50
|
- Feather-light by design: PlayStep's API sends each user a config already made for their language and platform, so
|
|
46
51
|
the SDK only draws, and new features arrive as data rather than code.
|
package/dist/cdn/done.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __playstep_done=function(t,i){return Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t.css=".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)}}",t.drawDone=function(t,e){let a=t.engine.launcherGuides().find(i=>i.id!=e.id&&"done"!=t.engine.progress.guides[i.id]?.status),r=(0,i.words)(t,e.lang),p=(0,i.h)("div",{class:"cel",role:"dialog","aria-modal":"true","aria-labelledby":"ps-cel",tabindex:"-1",lang:e.lang,dir:e.rtl&&"rtl"},(0,i.h)("div",{class:"art","aria-hidden":"true"},[1,2,3,4,5,6].map(()=>(0,i.h)("i")),(0,i.h)("span",{class:"tile"},(0,i.icon)("ps-level-up"))),(0,i.h)("h2",{id:"ps-cel"},r("level_cleared")),(0,i.h)("p",null,r("finished",{guide:e.name}),a?` ${r("next_up",{guide:a.name})}`:""),(0,i.h)("div",{class:"acts"},(0,i.h)("button",{class:"btn sec",onClick:()=>t.dispatch({type:"start",guide:e.id})},(0,i.icon)("rotate-ccw"),r("replay")),a?(0,i.h)("button",{class:"btn pri",onClick:()=>t.dispatch({type:"start",guide:a.id})},r("next_guide"),(0,i.icon)("arrow-right")):(0,i.h)("button",{class:"btn pri",onClick:()=>t.dispatch({type:"close"})},r("done"))));return[(0,i.h)("div",{class:"scrim",onClick:()=>t.dispatch({type:"close"})}),p]},t}({},__playstep_ui);
|
|
1
|
+
var __playstep_done=function(t,i){return Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t.css=".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)}}",t.drawDone=function(t,e){let a=t.engine.launcherGuides().find(i=>i.id!=e.id&&"done"!=t.engine.progress.guides[i.id]?.status),r=(0,i.words)(t,e.lang),p=(0,i.h)("div",{class:"cel",role:"dialog","aria-modal":"true","aria-labelledby":"ps-cel",tabindex:"-1",lang:e.lang,dir:e.rtl&&"rtl"},(0,i.h)("div",{class:"art","aria-hidden":"true"},[1,2,3,4,5,6].map(()=>(0,i.h)("i")),(0,i.h)("span",{class:"tile"},(0,i.icon)("ps-level-up"))),(0,i.h)("h2",{id:"ps-cel"},r("level_cleared")),(0,i.h)("p",null,r("finished",{guide:e.name}),a?` ${r("next_up",{guide:a.name})}`:""),(0,i.h)("div",{class:"acts"},(0,i.h)("button",{class:"btn sec",onClick:()=>t.dispatch({type:"start",guide:e.id,source:"launcher"})},(0,i.icon)("rotate-ccw"),r("replay")),a?(0,i.h)("button",{class:"btn pri",onClick:()=>t.dispatch({type:"start",guide:a.id,source:"launcher"})},r("next_guide"),(0,i.icon)("arrow-right")):(0,i.h)("button",{class:"btn pri",onClick:()=>t.dispatch({type:"close"})},r("done"))));return[(0,i.h)("div",{class:"scrim",onClick:()=>t.dispatch({type:"close"})}),p]},t}({},__playstep_ui);
|
package/dist/cdn/events.js
CHANGED
|
@@ -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})),
|
|
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}({});
|
package/dist/cdn/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __playstep_list=function(t
|
|
1
|
+
var __playstep_list=function(e,t){return Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.css=".panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.panel.left{right:auto;left:24px}@media (max-width:480px){.panel{right:18px;bottom:86px}.solo{bottom:18px}.panel.left{left:18px}}",e.drawList=function(e,i,s){let a=e.config.launcher,p=(0,t.words)(e),r=e.engine.launcherGuides(),n=e.engine.progress.guides;i.className=`panel${"bottom-left"==a.position?" left":""}${a.enabled?"":" solo"}`,i.setAttribute("aria-label",p("guides")),i.lang=e.config.lang,e.config.rtl&&(i.dir="rtl"),(0,t.fillEl)(i,(0,t.h)("button",{class:"x","aria-label":p("close_guides"),onClick:s},(0,t.icon)("x")),(0,t.h)("h2",null,a.title),(0,t.h)("p",null,a.description),(0,t.h)("ul",{class:"rows"},r.map(i=>{let a=n[i.id],r=i.steps.length,o="done"==a?.status,l="running"==a?.status;return(0,t.h)("li",null,(0,t.h)("button",{class:"row",onClick:()=>{s(),a&&e.dispatch({type:"reset_progress",guide:i.id}),e.dispatch({type:"start",guide:i.id,source:"launcher"})}},(0,t.h)("span",{class:"ti"+(o?" mint":a?"":" spark")},(0,t.icon)(o?"check":"ps-guide")),(0,t.h)("span",{class:"rb"},(0,t.h)("span",{class:"rt"},i.name),(0,t.h)("span",{class:"rm"},o?p("completed"):l?p("step_of",{n:a.step+1,total:r}):p("n_steps",{n:r})),l&&(0,t.h)("span",{class:"prog","aria-hidden":"true"},(0,t.h)("i",{style:{width:a.step/r*100+"%"}}))),a?(0,t.h)("span",{class:"rp"},(0,t.icon)("rotate-ccw"),p("replay")):(0,t.h)("span",{class:"new"},p("new"))))})),r.some(e=>n[e.id])&&(0,t.h)("div",{class:"acts so"},(0,t.h)("button",{class:"btn gho",onClick:()=>{e.dispatch({type:"reset_progress"}),e.engine.active?s():i.focus()}},p("start_over"))),!1!==e.config.flags?.show_badge&&(0,t.h)("a",{class:"pb",href:"https://playstep.app/?ref=badge",target:"_blank",rel:"noopener"},(0,t.h)("span",{style:{display:"inline-flex",width:"16px",height:"16px"},ref:e=>e.innerHTML='<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>'}),"Powered by PlayStep"))},e}({},__playstep_ui);
|
package/dist/cdn/loader.js
CHANGED
|
@@ -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,
|
|
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=!1,p=e.config.flags,c=e.config.guides,d=e=>c.find(t=>t.id===e),l=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),g=e=>!o&&!p.disabled&&(!p.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),h=e=>{let t=i.guides[e.id];return!a&&!u.has(e.id)&&g(e)&&(!t||"done"!==t.status&&("running"===t.status||!e.trigger.once))},y=(e,t,n)=>{i.guides[e.id]={version:e.version,step:n,status:t}},m=e=>t(e.path,r),f=e=>t(e.skip_if_on,r)||m(e.complete_on),v=e=>!r||t(e.page??"*",r),_=(e,t,r)=>{for(;t<e.steps.length;){if(a={guide:e,index:t,status:"running"},n=void 0,y(e,"running",t),r.push(l("step_shown",e,t)),!f(e.steps[t]))return r;r.push(l("step_completed",e,t++))}return a={guide:e,index:--t,status:"completed"},y(e,"done",t),r.push(l("guide_completed",e)),r},w=(e,t,n="trigger")=>(i.seen=!0,_(e,t,[{...l("guide_shown",e),source:n}])),x=()=>{let e=a;return a=null,"running"===e?.status?(y(e.guide,"dismissed",e.index),[l("guide_dismissed",e.guide,e.index)]):[]},$=()=>{let e=a;return _(e.guide,e.index+1,[l("step_completed",e.guide,e.index)])},S=e=>{let t=c.find(t=>h(t)&&e(t));return t?w(t,0):[]},b=e=>"first_visit"===e.trigger.type||m(e.trigger),L=(e=b)=>{let t=0,n=c.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)&&g(e)&&v(e.steps[t])});return n?w(n,t):S(e)};return{get active(){return o?null:a},progress:i,dispatch:function(e){let p="running"===a?.status?a.guide.steps[a.index]:null,c=o?null:p;switch(e.type){case"init":return r=e.path,u.clear(),L();case"pause":return o=!0,[];case"resume":return o?(o=!1,L()):[];case"page_view":return r=e.path,o||"waiting"!==a?.status?c&&f(c)?$():(p&&!v(p)&&(a=null),L(e=>m(e.trigger))):w(a.guide,0,a.source);case"reset_progress":{let t="string"==typeof e.guide&&d(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(b))])}case"event":return"event"===c?.complete_on.type&&c.complete_on.name===e.name?$():S(t=>"event"===t.trigger.type&&t.trigger.name===e.name);case"tap":return"tap_anchor"===c?.complete_on.type&&c.anchor===e.anchor?$():[];case"complete":return c?.id===e.step?$():[];case"next":return"next_button"===c?.complete_on.type?$():[];case"back":return c&&0!==a.index?(a={...a,index:a.index-1},y(a.guide,"running",a.index),[l("step_shown",a.guide,a.index)]):[];case"hide":return c&&(u.add(a.guide.id),a=null),[];case"close":if("completed"!==a?.status)return[];case"dismiss":return x();case"start":{let n=d(e.guide);if(!n||!g(n)||c&&a.guide===n&&n.steps.slice(0,a.index).every(f))return[];let i=x(),s=e.source??"api";return e.to&&!t(n.start_path,r)?(a={guide:n,index:0,status:"waiting",source:s},i):i.concat(w(n,0,s))}case"anchor_missing":return c&&c.anchor===e.anchor&&n!==e.anchor?(n=e.anchor,[{...l("anchor_missing",a.guide,a.index),anchor:e.anchor}]):[];case"identify":return s={...s,...e.traits},[]}},launcherGuides:()=>c.filter(e=>e.launcher&&g(e)),use(e){c=e.guides,a&&(a={...a,guide:d(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)}},b=(e,t)=>S(n=>L({type:e,[t]:n}));function L(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(L),emit:S(x)})}).catch($))}let K,P=S((e={})=>{u?u.launcherGuides().length&&I().then(t=>t?.openLauncher(e.anchor)):K=e});function j(e){e.launcher?.enabled&&u.launcherGuides().length&&!d&&t&&t().then(t=>{d||t.drawLauncher(E(),u,e,P,a)}).catch($)}let k=e=>S(()=>{m!==e&&(m=e,u&&(L({type:e?"pause":"resume"}),!d&&(e?l&&(l.innerHTML=""):j(o))))});return{version:"0.8.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"}),L({type:"init",path:location.pathname}),f.splice(0).forEach(L),K&&P(K),j(d),!1!==e.autoPageViews)){let e=location.pathname,t=S(()=>location.pathname!==e&&L({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},L({type:"identify",traits:y})}),track:b("event","name"),start:b("start","guide"),complete:b("complete","step"),page:S(e=>L({type:"page_view",path:e??location.pathname})),openLauncher:P,resetProgress:b("reset_progress","guide"),reset:S(()=>{L({type:"dismiss"}),g=void 0,y={},u&&(Object.assign(u.progress,{seen:!1,guides:{}}),w(),c?.update()),a?.preview||r.set("d",null)}),pause:k(!0),resume:k(!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-VmAPlPiuiCx6pewONQ9f7hnbIWIWxBf7FmTVtYlvaWc="),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})}}();
|
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")}`},r={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 n(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">${r[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,r){(!r||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,r,o,l){let h=c(e,t.lang),f=t.steps[i].title,g=n("div",{class:"clip"}),m=!0,b=a.duration_ms??0;if("embed"==a.kind)return g.className="clip embed",d(g,a.poster&&n("img",{src:a.poster,alt:""}),n("button",{class:"play","aria-label":h("play_video"),onClick:()=>{d(g,n("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")),n("div",{class:"bar"},n("span",{class:"pill"},p("external-link"),a.label,b?` · ${s(b)}`:""))),l(0),g;let x=()=>{let r=n("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(r.duration)&&(b=1e3*r.duration,c.textContent=`${s(b)} `,l(b))}});r.muted=!0;let c=n("span",null,b?`${s(b)} `:""),x=n("button",{class:"round","aria-label":h("unmute_clip"),onClick:()=>{m=!m,r.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=n("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,r,n("div",{class:"bar"},n("span",{class:"pill"},p("play"),c,h("loop")),x,v)),r.play()?.catch(()=>{}),l(b)};return r?d(g,a.poster&&n("img",{src:a.poster,alt:""}),n("button",{class:"play","aria-label":h("play_clip"),onClick:x},p("play"))):x(),g}function f(e,t,i,a,s){let r=t.steps[i],o=t.steps.length,l=c(e,t.lang),f="next_button"==r.complete_on.type,g=r.media,m=l("step_of",{n:i+1,total:o}),b=t.steps.map((e,t)=>n("span",{class:"seg"+(t<i?" done":t==i?" cur":"")}));s.classList.remove("big"),s.dataset.step=r.id,s.lang=t.lang,t.rtl?s.dir="rtl":s.removeAttribute("dir"),d(s,"image"==g?.kind?n("div",{class:"clip img"},n("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")}),n("div",{class:"body"},n("div",{class:"meta"},n("span",null,`${m} · ${t.name}`),n("button",{class:"x","aria-label":l("close_guide"),onClick:()=>e.dispatch({type:"dismiss"})},p("x"))),n("div",{class:"steps",role:"img","aria-label":m},b),n("h2",{class:"title",id:"ps-title"},r.title),n("p",{class:"text",id:"ps-text"},r.body)),n("div",{class:"foot"},f?n("span",{class:"sp"}):n("span",{class:"wait"},n("span",{class:"pulse","aria-hidden":"true"}),l("waiting")),r.back&&n("button",{class:"btn gho",onClick:()=>e.dispatch({type:"back"})},l("back")),f&&n("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,r=!1,n=12){let o={bottom:e.bottom+s+i<=innerHeight-n,top:e.top-s-i>=n,left:e.left-s-t>=n,right:e.right+s+t<=innerWidth-n},l=a.find(e=>o[e])??a[0],p=(e,t)=>Math.max(n,Math.min(e,t-n));return"top"==l||"bottom"==l?{x:p(r?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-CerIJEpuL4cLDqI43o7a5jOuy0Z8DXYl/ONzSKtoLTo=",()=>import("../core/transport")),v=()=>b("list","sha256-S/G0OwvlP9HcGlohdg39i6K/864ro2QmO7EeWbR6nFQ=",()=>import("./list")),y=()=>b("done","sha256-55mQSPuf9FqiGIbmh9a92hpRupfaw34ACX1xtueSU30=",()=>import("./done"));function w(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&&n("span",{class:"cnt"},s))}let k=(e,t,i,a)=>(e.addEventListener(t,i,a),()=>e.removeEventListener(t,i,a));function _(e,i,a){let s,r,o=n("div",{class:"card",role:"dialog","aria-modal":"false","aria-labelledby":"ps-title","aria-describedby":"ps-text",tabindex:"-1",style:{visibility:"hidden"}}),l=n("div",{class:"spot","aria-hidden":"true"}),p=n("div",{class:"scrim","aria-hidden":"true"}),d=!1,c=!1,u=-1,h=null,m=[],b=[],x=[],v=!1,y="",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.activeElement?.matches("input,textarea,select,[contenteditable]:not([contenteditable=false])")||o.focus({preventScroll:!0}))}function $(){_(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(),k(window,"resize",t))}let t=h,r=t.getBoundingClientRect();(r.bottom<0||r.top>innerHeight)&&t.scrollIntoView({block:"center",behavior:i?"auto":"smooth"});let n=()=>{let i=t.getBoundingClientRect(),a=Number.parseFloat(getComputedStyle(t).borderTopLeftRadius)||8,s=M().placement,{x:r,y:n}=g(i,e.offsetWidth,e.offsetHeight,["auto"==s?"bottom":s,"top","left","right"],18);S(r,n,{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)})};n();let l=new ResizeObserver(n);l.observe(t),l.observe(e);let p=setInterval(n,400);x.push(()=>l.disconnect(),()=>clearInterval(p),k(window,"scroll",n,{capture:!0,passive:!0}),k(window,"resize",n))}function C(i){h=i,_(b),clearTimeout(r);let a=M();if(i)b.push(k(document,"click",t=>{t.composedPath().includes(i)&&(w="",e.dispatch({type:"tap",anchor:a.anchor}))},!0)),i==t(a.anchor,a.find?.web)&&(w=a.id);else if(w==a.id){let i=u;r=setTimeout(()=>{for(let a=i;a--;){let r=s.steps[a];if(!r.anchor||"page"==r.complete_on.type)return;if(t(r.anchor,r.find?.web)){for(let t=i;t-- >a;)e.dispatch({type:"back"});return}}},400)}b.push(k(document,"keydown",t=>{if("Tab"!=t.key)return;let a=[...o.querySelectorAll('button,a,iframe,[tabindex="0"]')],s=t.composedPath().includes(o),r=a[0],n=a.at(-1),l=e.root.activeElement;s&&!t.shiftKey&&l==n?(t.preventDefault(),(i??r)?.focus()):s&&t.shiftKey&&l==r?(t.preventDefault(),(i??n)?.focus()):i&&document.activeElement==i&&(t.preventDefault(),(t.shiftKey?n:r)?.focus())},!0)),$()}function A(){_(m);let i=M(),a=i.anchor?t(i.anchor,i.find?.web):null;if(C(a),!i.anchor)return;let s=0,r=()=>{s=0;let e=t(i.anchor,i.find?.web);e!=a&&C(a=e)},n=new MutationObserver(()=>s||(s=requestAnimationFrame(r)));n.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(()=>n.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 r=!s||a!=u||t.steps[a]?.id!=M().id;s=t,u=a,f(e,t,a,i,o),r?A():$()},stop(){_(m),_(b),_(x),clearTimeout(r)}}}return e.fillEl=d,e.h=n,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.7.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 r=e.root;r.appendChild(n("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=r.appendChild(n("div",{class:"l"})),M=n("div",{class:"sr","aria-live":"polite"}),S=!1,$=null,C=n("button",{onClick:()=>H(!S)}),A=t=>e.emit({type:"sdk_error",message:String(t)}),E=()=>u??(u=v().then(e=>(p=e,r.appendChild(n("style",null,e.css)),N())).catch(A)),L=()=>h??(h=y().then(e=>(d=e,r.appendChild(n("style",null,e.css)),N())).catch(A)),z=[],O=()=>[M],H=e=>{S=e,N()};function j(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 N(){let t=e.engine.active,s=t?.guide,u=a(e.config,i.colorMode,s?.mode)?"dark":"light";r.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;S&&h&&p?(l??(l=n("div",{tabindex:"-1",role:"dialog"})),p.drawList(e,l,()=>H(!1))):(l=void 0,S&&h&&E()),h&&w(e,C,S),S||"running"!=t?.status?(f?.stop(),f=void 0):f?.guide?.id!=s.id&&(f?.stop(),f=_(e,matchMedia("(prefers-reduced-motion: reduce)").matches,()=>j(O()))),"running"==t?.status&&t.index==s.steps.length-1&&L();let v=!S&&"completed"==t?.status&&!!d;!S&&"completed"==t?.status&&!d&&L();let y=v&&(m!=s||!z.length);if(v?y&&(z=d.drawDone(e,s)):z=[],m=v?s:void 0,M.textContent=t?"running"==t.status?`${c(e,s.lang)("step_of",{n:t.index+1,total:s.steps.length})}: ${s.steps[t.index].title}`:c(e,s.lang)("level_cleared"):"",O=()=>[l,h&&e.config.launcher.enabled&&C,...f?.nodes()??[],...z,M],j(O()),f?.update(s,t.index),l&&!x){if($=r.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&&$?.focus();y&&z[1]?.focus()}k(window,"keydown",i=>{if("Escape"!=i.key||i.defaultPrevented||!i.composedPath().includes(r.host))return;let a=e.engine.active;if(S)H(!1);else if("completed"==a?.status)e.dispatch({type:"close"});else{if(!a)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 P=new MutationObserver(()=>N());for(let e of[document.documentElement,document.body])P.observe(e,{attributes:!0});return k(matchMedia("(prefers-color-scheme: dark)"),"change",()=>N()),N(),{update:()=>{e.engine.launcherGuides().length||(S=!1),N()},openLauncher:e=>{let t=document.activeElement;o=e??(t!=document.body&&t!=r.host?t??void 0:void 0),H(!0)},send:e=>s(e)}},e.words=c,e}({});
|
|
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))}let w=(e,t,i,a)=>(e.addEventListener(t,i,a),()=>e.removeEventListener(t,i,a));function _(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="",_=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 $(){_(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(),w(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),w(window,"scroll",r,{capture:!0,passive:!0}),w(window,"resize",r))}function C(i){h=i,_(b),clearTimeout(n);let a=M();if(i)b.push(w(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(w(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(){_(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(){_(m),_(b),_(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.8.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"})),M=r("div",{class:"sr","aria-live":"polite"}),S=!1,$=null,C=r("button",{onClick:()=>N(!S)}),E=t=>e.emit({type:"sdk_error",message:String(t)}),A=()=>u??(u=v().then(e=>(p=e,n.appendChild(r("style",null,e.css)),O())).catch(E)),L=()=>h??(h=y().then(e=>(d=e,n.appendChild(r("style",null,e.css)),O())).catch(E)),z=[],j=()=>[M],N=e=>{S=e,O()};function H(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;S&&h&&p?(l??(l=r("div",{tabindex:"-1",role:"dialog"})),p.drawList(e,l,()=>N(!1))):(l=void 0,S&&h&&A()),h&&k(e,C,S),S||"running"!=t?.status?(f?.stop(),f=void 0):f?.guide?.id!=s.id&&(f?.stop(),f=_(e,matchMedia("(prefers-reduced-motion: reduce)").matches,()=>H(j()))),"running"==t?.status&&t.index==s.steps.length-1&&L();let v=!S&&"completed"==t?.status&&!!d;!S&&"completed"==t?.status&&!d&&L();let y=v&&(m!=s||!z.length);if(v?y&&(z=d.drawDone(e,s)):z=[],m=v?s:void 0,M.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"):"",j=()=>[l,h&&e.config.launcher.enabled&&C,...f?.nodes()??[],...z,M],H(j()),f?.update(s,t.index),l&&!x){if($=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&&$?.focus();y&&z[1]?.focus()}w(window,"keydown",i=>{if("Escape"!=i.key||i.defaultPrevented||!i.composedPath().includes(n.host))return;let a=e.engine.active;if(S)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 P=new MutationObserver(()=>O());for(let e of[document.documentElement,document.body])P.observe(e,{attributes:!0});return w(matchMedia("(prefers-color-scheme: dark)"),"change",()=>O()),O(),{update:()=>{e.engine.launcherGuides().length||(S=!1),O()},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=function(e=""){let t=location.pathname.split("/"),i=!!e,a=e.split("/").map((e,a)=>"*"==e?t[a]||(i=!1,""):e).join("/");return i?a:""}(e.config.guides.find(e=>e.id==t.guide)?.start_path);e.dispatch({...t,to:a});let s=e.engine.active;if("waiting"==s?.status&&s.guide.id==t.guide)try{i.navigate(a)}catch(a){E(a),e.dispatch({...t,to:""})}}}},e.words=c,e}({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,icon as t,words as n}from"./ui-
|
|
1
|
+
import{h as e,icon as t,words as n}from"./ui-WHd-CNG8.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};
|
package/dist/index.d.ts
CHANGED
|
@@ -126,8 +126,12 @@ interface AnalyticsEvent {
|
|
|
126
126
|
anchor?: string;
|
|
127
127
|
clip_id?: string;
|
|
128
128
|
clip_source?: ClipSource;
|
|
129
|
+
/** guide_shown: what started the guide. */
|
|
130
|
+
source?: GuideSource;
|
|
129
131
|
message?: string;
|
|
130
132
|
}
|
|
133
|
+
/** What started a guide (see GUIDE_SOURCES). */
|
|
134
|
+
type GuideSource = 'trigger' | 'launcher' | 'api';
|
|
131
135
|
/** A step's clip or image, ready to draw. */
|
|
132
136
|
interface RenderedMedia {
|
|
133
137
|
/** `video`: a muted looping <video>; `embed`: a click-to-load player (`url` is the player); `image`. */
|
|
@@ -152,6 +156,12 @@ interface RenderedStep {
|
|
|
152
156
|
media?: RenderedMedia;
|
|
153
157
|
complete_on: CompleteOn;
|
|
154
158
|
skip_if_on?: string;
|
|
159
|
+
/**
|
|
160
|
+
* The page (path or route pattern) this step belongs on: the page trigger's or a page step's, kept through Next
|
|
161
|
+
* steps only; none: any page. Elsewhere a running guide waits, its progress kept, so it neither follows the user
|
|
162
|
+
* around nor blocks that page's own guide.
|
|
163
|
+
*/
|
|
164
|
+
page?: string;
|
|
155
165
|
placement: 'auto' | 'top' | 'bottom' | 'left' | 'right';
|
|
156
166
|
/** Show Back on this step. */
|
|
157
167
|
back?: true;
|
|
@@ -166,6 +176,11 @@ interface RenderedGuide {
|
|
|
166
176
|
trigger: Trigger;
|
|
167
177
|
segments?: SegmentRule[];
|
|
168
178
|
launcher: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* The page it begins on, `*` parts to fill in from the current path. Started from the guide list, the finish screen
|
|
181
|
+
* or start(id) elsewhere, an SDK with the app's router takes the user there first.
|
|
182
|
+
*/
|
|
183
|
+
start_path?: string;
|
|
169
184
|
/** Where the card sits for steps without an anchor. */
|
|
170
185
|
position: 'bottom' | 'center';
|
|
171
186
|
/** Always this mode, whatever the app does. */
|
|
@@ -239,6 +254,13 @@ interface InitOptions {
|
|
|
239
254
|
* setting. A guide or brand kit set to always light or dark wins over this.
|
|
240
255
|
*/
|
|
241
256
|
colorMode?: ColorMode;
|
|
257
|
+
/**
|
|
258
|
+
* Your router, so a guide can begin where it starts (its start page, set in the dashboard): `(path) =>
|
|
259
|
+
* router.push(path)`. When someone starts a guide from the guide list, replays it from the finish screen, or your code
|
|
260
|
+
* calls start(id) on another page, PlayStep calls this with that page and shows step 1 once the page view is reported.
|
|
261
|
+
* Triggers never navigate. Without it, guides start wherever the user is.
|
|
262
|
+
*/
|
|
263
|
+
navigate?: (path: string) => void;
|
|
242
264
|
/** @internal Set by @axceera/playstep-react. */
|
|
243
265
|
sdkName?: 'web' | 'react';
|
|
244
266
|
/** @internal Tests: replaces fetch and navigator.sendBeacon. Returning nothing counts as delivered. */
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./sdk-
|
|
1
|
+
import{n as e}from"./sdk-wO7F4vdJ.js";const t=e(()=>import(`./ui-WHd-CNG8.js`).then(e=>e.t),()=>import(`./launcher-button-BFeH6G4k.js`),()=>import(`./capture-NeIia2Wg.js`));export{t as default,t as playstep};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fillEl as e,h as t,icon as n,words as r}from"./ui-
|
|
1
|
+
import{fillEl as e,h as t,icon as n,words as r}from"./ui-WHd-CNG8.js";const i=`.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.panel.left{right:auto;left:24px}@media (max-width:480px){.panel{right:18px;bottom:86px}.solo{bottom:18px}.panel.left{left:18px}}`;function a(i,a,o){let s=i.config.launcher,c=r(i),l=i.engine.launcherGuides(),u=i.engine.progress.guides;a.className=`panel${s.position==`bottom-left`?` left`:``}${s.enabled?``:` solo`}`,a.setAttribute(`aria-label`,c(`guides`)),a.lang=i.config.lang,i.config.rtl&&(a.dir=`rtl`),e(a,t(`button`,{class:`x`,"aria-label":c(`close_guides`),onClick:o},n(`x`)),t(`h2`,null,s.title),t(`p`,null,s.description),t(`ul`,{class:`rows`},l.map(e=>{let r=u[e.id],a=e.steps.length,s=r?.status==`done`,l=r?.status==`running`;return t(`li`,null,t(`button`,{class:`row`,onClick:()=>{o(),r&&i.dispatch({type:`reset_progress`,guide:e.id}),i.dispatch({type:`start`,guide:e.id,source:`launcher`})}},t(`span`,{class:`ti${s?` mint`:r?``:` spark`}`},n(s?`check`:`ps-guide`)),t(`span`,{class:`rb`},t(`span`,{class:`rt`},e.name),t(`span`,{class:`rm`},s?c(`completed`):l?c(`step_of`,{n:r.step+1,total:a}):c(`n_steps`,{n:a})),l&&t(`span`,{class:`prog`,"aria-hidden":`true`},t(`i`,{style:{width:`${r.step/a*100}%`}}))),r?t(`span`,{class:`rp`},n(`rotate-ccw`),c(`replay`)):t(`span`,{class:`new`},c(`new`))))})),l.some(e=>u[e.id])&&t(`div`,{class:`acts so`},t(`button`,{class:`btn gho`,onClick:()=>{i.dispatch({type:`reset_progress`}),i.engine.active?o():a.focus()}},c(`start_over`))),i.config.flags?.show_badge!==!1&&t(`a`,{class:`pb`,href:`https://playstep.app/?ref=badge`,target:`_blank`,rel:`noopener`},t(`span`,{style:{display:`inline-flex`,width:`16px`,height:`16px`},ref:e=>e.innerHTML=`<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>`}),`Powered by PlayStep`))}export{i as css,a as drawList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./util-X5IoDowG.js";const t=e=>RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`)}$`),n=e=>e.length>1?e.replace(/\/+$/,``):e;function r(e,r){return!!e&&r!==void 0&&t(n(e)).test(n(r))}function i(e,t){return(e??[]).every(e=>{let n=t[e.trait];return e.op===`exists`?n!=null:e.op===`in`?Array.isArray(e.value)&&e.value.includes(n):n===e.value==(e.op===`eq`)})}function a(e){let t=e.progress??{seen:!1,guides:{}},n=e.traits??{},a=null,o,s=/* @__PURE__ */ new Set,c=!1,l=e.config.flags,u=e.config.guides,d=e=>u.find(t=>t.id===e),f=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),p=e=>!c&&!l.disabled&&(!l.paused_for_new_users||t.seen)&&i(e.segments,n),m=e=>{let n=t.guides[e.id];return!a&&!s.has(e.id)&&p(e)&&(!n||n.status!==`done`&&(n.status===`running`||!e.trigger.once))},h=(e,n,r)=>{t.guides[e.id]={version:e.version,step:r,status:n}},g,_=e=>r(e.path,g),v=e=>r(e.skip_if_on,g)||_(e.complete_on),y=e=>!g||r(e.page??`*`,g),b=(e,t,n)=>{for(;t<e.steps.length;){if(a={guide:e,index:t,status:`running`},o=void 0,h(e,`running`,t),n.push(f(`step_shown`,e,t)),!v(e.steps[t]))return n;n.push(f(`step_completed`,e,t++))}return a={guide:e,index:--t,status:`completed`},h(e,`done`,t),n.push(f(`guide_completed`,e)),n},x=(e,n,r=`trigger`)=>(t.seen=!0,b(e,n,[{...f(`guide_shown`,e),source:r}])),S=()=>{let e=a;return a=null,e?.status===`running`?(h(e.guide,`dismissed`,e.index),[f(`guide_dismissed`,e.guide,e.index)]):[]},C=()=>{let e=a;return b(e.guide,e.index+1,[f(`step_completed`,e.guide,e.index)])},w=e=>{let t=u.find(t=>m(t)&&e(t));return t?x(t,0):[]},T=e=>e.trigger.type===`first_visit`||_(e.trigger),E=()=>(s.clear(),w(T)),D=(e=T)=>{let n=0,r=u.find(e=>{let r=t.guides[e.id];return n=r?.version===e.version?r.step:0,!a&&r?.status===`running`&&!s.has(e.id)&&p(e)&&y(e.steps[n])});return r?x(r,n):w(e)};function O(e){let i=a?.status===`running`?a.guide.steps[a.index]:null,l=c?null:i;switch(e.type){case`init`:return g=e.path,s.clear(),D();case`pause`:return c=!0,[];case`resume`:return c?(c=!1,D()):[];case`page_view`:return g=e.path,!c&&a?.status===`waiting`?x(a.guide,0,a.source):l&&v(l)?C():(i&&!y(i)&&(a=null),D(e=>_(e.trigger)));case`reset_progress`:{let n=typeof e.guide==`string`&&d(e.guide);return n===void 0?[]:((!n||a?.guide===n)&&(a=null),n?delete t.guides[n.id]:t.guides={},[{type:`progress_reset`,...n&&{guide_id:n.id}},...E()])}case`event`:return l?.complete_on.type===`event`&&l.complete_on.name===e.name?C():w(t=>t.trigger.type===`event`&&t.trigger.name===e.name);case`tap`:return l?.complete_on.type===`tap_anchor`&&l.anchor===e.anchor?C():[];case`complete`:return l?.id===e.step?C():[];case`next`:return l?.complete_on.type===`next_button`?C():[];case`back`:return!l||a.index===0?[]:(a={...a,index:a.index-1},h(a.guide,`running`,a.index),[f(`step_shown`,a.guide,a.index)]);case`hide`:return l&&(s.add(a.guide.id),a=null),[];case`close`:if(a?.status!==`completed`)return[];case`dismiss`:return S();case`start`:{let t=d(e.guide);if(!t||!p(t)||l&&a.guide===t&&t.steps.slice(0,a.index).every(v))return[];let n=S(),i=e.source??`api`;return e.to&&!r(t.start_path,g)?(a={guide:t,index:0,status:`waiting`,source:i},n):n.concat(x(t,0,i))}case`anchor_missing`:return!l||l.anchor!==e.anchor||o===e.anchor?[]:(o=e.anchor,[{...f(`anchor_missing`,a.guide,a.index),anchor:e.anchor}]);case`identify`:return n={...n,...e.traits},[]}}return{get active(){return c?null:a},progress:t,dispatch:O,launcherGuides:()=>u.filter(e=>e.launcher&&p(e)),use(e){u=e.guides,a&&(a={...a,guide:d(a.guide.id)??a.guide})}}}const o=`0.8.0`,s=`playstep_preview`;function c(t,n,r){let i,c,l,u,d,f,p,m,h={},g=!1,_,v=[],y=[],b=()=>`p:${i.appKey}`,x=()=>i.preview||e.set(b(),c.progress),S=e=>{let t={...e,ts:Date.now()};i?.preview||(d?d.send(t):y.push(t)),i?.onEvent?.(t)},C=e=>{try{S({type:`sdk_error`,message:String(e)})}catch{}},w=e=>(...t)=>{try{e(...t)}catch(e){C(e)}},T=(e,t)=>w(n=>E({type:e,[t]:n}));function E(t){if(!c)return void v.push(t);if(t.type==`start`&&t.to===void 0&&i.navigate)return void O().then(e=>e?.start(t));let n=c.dispatch(t);x(),n.forEach(w(S)),(c.active||e.get(`q`))&&O(),d?.update()}function D(){return p??(p=document.body.appendChild(document.createElement(`playstep-root`)).attachShadow({mode:`open`}))}function O(){return f??(f=t().then(e=>{let t=D();return t.innerHTML=``,d=e.mount({engine:c,get config(){return l},options:i,root:t,outbox:y,userId:()=>m,dispatch:w(E),emit:w(S)})}).catch(C))}let k,A=w((e={})=>{c?c.launcherGuides().length&&O().then(t=>t?.openLauncher(e.anchor)):k=e});function j(e){e.launcher?.enabled&&c.launcherGuides().length&&!f&&n&&n().then(t=>{f||t.drawLauncher(D(),c,e,A,i)}).catch(C)}let M=e=>w(()=>{g!==e&&(g=e,c&&(E({type:e?`pause`:`resume`}),!f&&(e?p&&(p.innerHTML=``):j(l))))});async function N(){let t=i,n=(t.apiBase??`https://cdn.playstep.app`).replace(/\/$/,``),o=null;try{o=new URLSearchParams(location.search).get(s)||(t.config?null:sessionStorage.getItem(s))}catch{}t.preview||(t.preview=!!(t.config||o)),u=e=>fetch(`${n}/v2/${o?`preview/${o}?key=${t.appKey}&`:`config/${t.appKey}?`}l=${e}`).then(e=>e.json());let d=t.config;try{d??(d=await u(t.locale??navigator.language??``))}catch{return}try{o&&sessionStorage[d.guides?`setItem`:`removeItem`](s,o)}catch{}if(d?.capture)return void r?.().then(e=>e.start(d.capture,t.appKey)).catch(C);if(d?.guides&&!d.flags?.disabled&&(l=d,t.eventsUrl=d.ingest_url??`${n}/v1/events`,c=a({config:d,progress:t.preview?void 0:e.get(b()),traits:h}),g&&c.dispatch({type:`pause`}),E({type:`init`,path:location.pathname}),v.splice(0).forEach(E),k&&A(k),j(d),t.autoPageViews!==!1)){let e=location.pathname,t=w(()=>location.pathname!==e&&E({type:`page_view`,path:e=location.pathname}));for(let e of[`pushState`,`replaceState`]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener(`popstate`,t)}}return{version:o,init:w(e=>{if(i||!e?.appKey)return;i={...e},_&&(i.locale=_);let t=()=>setTimeout(()=>N().catch(C));document.readyState===`complete`?t():addEventListener(`load`,t)}),identify:w((e,t)=>{m=e,h={...h,...t},E({type:`identify`,traits:h})}),track:T(`event`,`name`),start:T(`start`,`guide`),complete:T(`complete`,`step`),page:w(e=>E({type:`page_view`,path:e??location.pathname})),openLauncher:A,resetProgress:T(`reset_progress`,`guide`),reset:w(()=>{E({type:`dismiss`}),m=void 0,h={},c&&(Object.assign(c.progress,{seen:!1,guides:{}}),x(),d?.update()),i?.preview||e.set(`d`,null)}),pause:M(!0),resume:M(!1),isPaused:()=>g,setLocale:w(e=>{_=e,i&&(i.locale=e),u?.(e).then(t=>{t.guides&&i?.locale==e&&(c.use(l=t),d?.update())}).catch(C)})}}export{c as n,o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./util-
|
|
1
|
+
import{n as e}from"./util-X5IoDowG.js";const t=`playstep:q`,n=(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(e,n){try{n.length?localStorage.setItem(e,JSON.stringify(n)):localStorage.removeItem(e);let r=!1;for(let e=0;e<localStorage.length;e++)r||(r=!!localStorage.key(e)?.startsWith(`playstep:q:`));r?localStorage.setItem(t,`1`):localStorage.removeItem(t)}catch{}}};function i(e){let t=[],i=[],a=[],o,s,c=0,l=!1,u=`${e.storageKey}:${Math.random().toString(36).slice(2,10)}`,d=()=>r.write(u,[...a,...i]),f=async t=>await e.send?.(e.url,t)??(e.send?{status:204}:n(e.url,t));try{for(let t=localStorage.length-1;t>=0;t--){let n=localStorage.key(t);n?.startsWith(`${e.storageKey}:`)&&(i.push(...r.read(n).filter(e=>Date.now()-e.t<6048e5)),localStorage.removeItem(n))}}catch{}i=i.sort((e,t)=>e.t-t.t).slice(-25),d();async function p(){if(!(l||s)){l=!0;try{for(;i.length;){let e=await f(i[0].b);if(e.status===0||e.status===408||e.status===429||e.status>=500){c=Math.min(6e4,c*2||2e3),s=setTimeout(()=>{s=void 0,p()},Math.max(c,(e.retryAfter??0)*1e3));break}c=0,i.shift(),d()}}finally{l=!1}}}function m(r=!1){clearTimeout(o),o=void 0;let s=t.length?e.envelope():null;if(s){for(;t.length;)i.push({b:JSON.stringify({...s,events:t.splice(0,20)}),t:Date.now()});i=i.slice(-25),d()}if(!r)return void p();for(let t of i.splice(0))e.send?f(t.b):navigator.sendBeacon?.(e.url,t.b)||n(e.url,t.b),a.push(t);a=a.slice(-25),d()}return addEventListener(`visibilitychange`,()=>document.visibilityState===`hidden`&&m(!0)),addEventListener(`pagehide`,()=>m(!0)),i.length&&p(),{push(n){t.push(n),t.length>=20?m():o??(o=setTimeout(m,e.delayMs??2e3))},flush:()=>m(),get size(){return t.length},get pending(){return i.length}}}const a=[];for(let e=2;a.length<64;e++){let t=!0;for(let n=2;n*n<=e;n++)e%n===0&&(t=!1);t&&a.push(Math.cbrt(e)%1*2**32|0)}const o=(e,t)=>e>>>t|e<<32-t;function s(e){let t=new TextEncoder().encode(e),n=t.length,r=new Uint32Array((n+8>>6)*16+16);for(let e=0;e<n;e++)r[e>>2]|=t[e]<<24-e%4*8;r[n>>2]|=128<<24-n%4*8,r[r.length-1]=n*8,r[r.length-2]=Math.floor(n/536870912);let i=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],s=/* @__PURE__ */ new Uint32Array(64);for(let e=0;e<r.length;e+=16){for(let t=0;t<64;t++)if(t<16)s[t]=r[e+t];else{let e=s[t-15],n=s[t-2];s[t]=s[t-16]+(o(e,7)^o(e,18)^e>>>3)+s[t-7]+(o(n,17)^o(n,19)^n>>>10)}let[t,n,c,l,u,d,f,p]=i;for(let e=0;e<64;e++){let r=p+(o(u,6)^o(u,11)^o(u,25))+(u&d^~u&f)+a[e]+s[e]|0,i=(o(t,2)^o(t,13)^o(t,22))+(t&n^t&c^n&c)|0;p=f,f=d,d=u,u=l+r|0,l=c,c=n,n=t,t=r+i|0}[t,n,c,l,u,d,f,p].forEach((e,t)=>i[t]=i[t]+e|0)}return i.map(e=>(e>>>0).toString(16).padStart(8,`0`)).join(``)}const c=e=>e+(crypto.randomUUID?crypto.randomUUID().replace(/-/g,``):Math.random().toString(36).slice(2)+Date.now().toString(36));function l(){try{let e=sessionStorage.getItem(`playstep:s`);return e||sessionStorage.setItem(`playstep:s`,e=c(`s_`)),e}catch{return c(`s_`)}}function u(t){let n=l(),r=e.get(`d`);r||e.set(`d`,r=c(`d_`));let a,o=r,u=i({url:t.url,send:t.send,storageKey:`playstep:q:${t.appKey}`,envelope:()=>{let e=t.userId()||void 0;return e!==a&&(a=e,o=e?`u_${s(`${t.appKey}:${e}`).slice(0,40)}`:r),{key:t.appKey,sdk:{name:t.sdk,version:t.version},session_id:n,user_key:o,preview:t.preview,locale:t.locale()}}});return{session:n,push:e=>u.push({...e,id:e.id??c(`e`).slice(0,25),...e.message?{message:e.message.slice(0,300)}:{}}),flush:u.flush}}export{u as createTransport,c as randomId,l as sessionId};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./sdk-wO7F4vdJ.js";import{t}from"./util-X5IoDowG.js";import{t as n}from"./mode-CPlpg1Yl.js";var r=Object.defineProperty,i=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n};const a={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 o(e,t,...n){let r=document.createElement(e);for(let e in t){let n=t[e];if(n!=null&&n!==!1){if(e[0]==`o`&&e[1]==`n`)r.addEventListener(e.slice(2).toLowerCase(),n);else if(e==`ref`)n(r);else if(e==`style`)for(let e in n)r.style.setProperty(e,n[e]);else r.setAttribute(e,n===!0?``:String(n))}}return s(r,n),r}function s(e,t){for(let n of t)Array.isArray(n)?s(e,n):n!=null&&n!==!1&&e.appendChild(typeof n==`object`?n:document.createTextNode(String(n)))}const c=document.createElement(`template`);function l(e){return c.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${a[e]}</svg>`,c.content.firstChild}const u=(e,...t)=>{e.textContent=``,s(e,t)},d=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e),f=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},p=e=>e.options.locale??navigator.language??`en`,m=(e,t=e.config.lang)=>(n,r)=>d(e.config.words[t]?.[n]??n,r);function h(e,t){let n=e=>!!e?.getClientRects().length,r=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{r||(r=t?[...document.querySelectorAll(t.css)].find(e=>n(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return n(r)?r:null}function g(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}function _(e,t,n,r,i,a){(!a||g(`${i}|${r.url}`))&&e.emit({type:i,guide_id:t.id,guide_version:t.version,step_id:t.steps[n].id,step_index:n,clip_id:r.clip_id,clip_source:r.source})}function v(e,t,n,r,i,a,s){let c=m(e,t.lang),d=t.steps[n].title,p=o(`div`,{class:`clip`}),h=!0,g=r.duration_ms??0;if(r.kind==`embed`)return p.className=`clip embed`,u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_video`),onClick:()=>{u(p,o(`iframe`,{src:r.url,title:c(`video`,{title:d}),allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowfullscreen:!0})),_(e,t,n,r,`clip_played`)}},l(`play`)),o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`external-link`),r.label,g?` · ${f(g)}`:``))),s(0),p;let v=()=>{let i=o(`video`,{src:r.url,poster:r.poster,loop:!0,autoplay:!0,playsinline:!0,preload:`auto`,"aria-label":c(`clip`,{title:d}),onLoadeddata:()=>_(e,t,n,r,`clip_loaded`,!0),onPlaying:()=>_(e,t,n,r,`clip_played`,!0),onLoadedmetadata:()=>{Number.isFinite(i.duration)&&(g=i.duration*1e3,m.textContent=`${f(g)} `,s(g))}});i.muted=!0;let m=o(`span`,null,g?`${f(g)} `:``),v=o(`button`,{class:`round`,"aria-label":c(`unmute_clip`),onClick:()=>{h=!h,i.muted=h,v.setAttribute(`aria-label`,c(h?`unmute_clip`:`mute_clip`)),u(v,l(h?`volume-x`:`volume-2`)),h||_(e,t,n,r,`clip_unmuted`)}},l(`volume-x`)),y=o(`button`,{class:`round`,"aria-label":c(`expand_clip`),"aria-pressed":`false`,onClick:()=>{let e=a.classList.toggle(`big`);y.setAttribute(`aria-label`,c(e?`shrink_clip`:`expand_clip`)),y.setAttribute(`aria-pressed`,String(e))}},l(`maximize-2`));u(p,i,o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`play`),m,c(`loop`)),v,y)),i.play()?.catch(()=>{}),s(g)};return i?u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_clip`),onClick:v},l(`play`))):v(),p}function y(e,t,n,r,i){let a=t.steps[n],s=t.steps.length,c=m(e,t.lang),d=a.complete_on.type==`next_button`,f=a.media,p=c(`step_of`,{n:n+1,total:s}),h=t.steps.map((e,t)=>o(`span`,{class:`seg${t<n?` done`:t==n?` cur`:``}`})),g=e=>{let t=h[n];t.className=`seg cur${e&&!r?` anim`:``}`,e?t.style.setProperty(`--d`,`${e}ms`):t.style.removeProperty(`--d`)};i.classList.remove(`big`),i.dataset.step=a.id,i.lang=t.lang,t.rtl?i.dir=`rtl`:i.removeAttribute(`dir`),u(i,f?.kind==`image`?o(`div`,{class:`clip img`},o(`img`,{src:f.url,alt:f.label??``,width:f.width,height:f.height})):f&&v(e,t,n,f,r,i,g),o(`div`,{class:`body`},o(`div`,{class:`meta`},o(`span`,null,`${p} · ${t.name}`),o(`button`,{class:`x`,"aria-label":c(`close_guide`),onClick:()=>e.dispatch({type:`dismiss`})},l(`x`))),o(`div`,{class:`steps`,role:`img`,"aria-label":p},h),o(`h2`,{class:`title`,id:`ps-title`},a.title),o(`p`,{class:`text`,id:`ps-text`},a.body)),o(`div`,{class:`foot`},d?o(`span`,{class:`sp`}):o(`span`,{class:`wait`},o(`span`,{class:`pulse`,"aria-hidden":`true`}),c(`waiting`)),a.back&&o(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`})},c(`back`)),d&&o(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`})},c(n+1==s?`done`:`next`),l(`arrow-right`))));let y=t.steps[n+1]?.media;if(y&&y.kind!=`embed`&&!r&&!navigator.connection?.saveData){if(y.kind==`image`)new Image().src=y.url;else{let r=document.createElement(`video`);r.preload=`auto`,r.muted=!0,r.src=y.url,y.source==`hosted`&&_(e,t,n+1,y,`clip_loaded`,!0)}}}function b(e,t,n,r,i,a=!1,o=12){let s={bottom:e.bottom+i+n<=innerHeight-o,top:e.top-i-n>=o,left:e.left-i-t>=o,right:e.right+i+t<=innerWidth-o},c=r.find(e=>s[e])??r[0],l=(e,t)=>Math.max(o,Math.min(e,t-o));return c==`top`||c==`bottom`?{x:l(a?e.left:e.left+(e.width-t)/2,innerWidth-t),y:c==`top`?e.top-i-n:e.bottom+i}:{x:c==`left`?e.left-i-t:e.right+i,y:l(e.top+(e.height-n)/2,innerHeight-n)}}var x=/* @__PURE__ */ i({fillEl:()=>u,h:()=>o,icon:()=>l,mount:()=>j,words:()=>m});const S=document.currentScript?.src,C=(e,t,n)=>t?new Promise((n,r)=>document.head.append(Object.assign(document.createElement(`script`),{src:new URL(`${e}.js`,S||location.href).href,integrity:t,crossOrigin:`anonymous`,onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))):n(),w=()=>C(`events`,``,()=>import(`./transport-DZeLw3bE.js`)),T=()=>C(`list`,typeof __PLAYSTEP_LIST_INTEGRITY__==`string`?__PLAYSTEP_LIST_INTEGRITY__:``,()=>import(`./list-BL3FY9X7.js`)),E=()=>C(`done`,typeof __PLAYSTEP_DONE_INTEGRITY__==`string`?__PLAYSTEP_DONE_INTEGRITY__:``,()=>import(`./done-CIjuDrGz.js`));function D(e,t,n){let r=m(e),i=e.engine.launcherGuides().filter(t=>!e.engine.progress.guides[t.id]).length;t.className=`lb${e.config.launcher.position==`bottom-left`?` left`:``}`,t.setAttribute(`aria-label`,r(n?`close_guides`:`open_guides`)),t.setAttribute(`aria-expanded`,String(n)),u(t,l(`ps-launcher`),i>0&&!n&&o(`span`,{class:`cnt`},i))}function O(e=``){let t=location.pathname.split(`/`),n=!!e,r=e.split(`/`).map((e,r)=>e==`*`?t[r]||(n=!1,``):e).join(`/`);return n?r:``}const k=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r));function A(e,t,n){let r=o(`div`,{class:`card`,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabindex:`-1`,style:{visibility:`hidden`}}),i=o(`div`,{class:`spot`,"aria-hidden":`true`}),a=o(`div`,{class:`scrim`,"aria-hidden":`true`}),s=!1,c=!1,l,u=-1,d=null,f=[],p=[],m=[],g=!1,_=``,v=``,x,S=e=>e.splice(0).forEach(e=>e()),C=()=>l.steps[u];function w(e,t,a){r.style.transform=`translate(${Math.round(e)}px,${Math.round(t)}px)`,r.style.visibility=``,g||(r.style.transition=`none`,requestAnimationFrame(()=>(g=!0,r.style.transition=``))),s!=!!(d&&a)&&(s=!s,n()),d&&a&&Object.assign(i.style,{width:`${a.w}px`,height:`${a.h}px`,transform:`translate(${a.x}px,${a.y}px)`,borderRadius:`${a.r}px`}),_!=C().id&&(_=C().id,document.hasFocus()&&!document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)&&r.focus({preventScroll:!0}))}function T(){S(m);let e=r;if(c!=(!d&&l.position==`center`)&&(c=!c,n()),!d){let t=()=>w((innerWidth-e.offsetWidth)/2,l.position==`center`?(innerHeight-e.offsetHeight)/2:innerHeight-e.offsetHeight-24);t();let n=new ResizeObserver(t);n.observe(e),m.push(()=>n.disconnect(),k(window,`resize`,t));return}let i=d,a=i.getBoundingClientRect();(a.bottom<0||a.top>innerHeight)&&i.scrollIntoView({block:`center`,behavior:t?`auto`:`smooth`});let o=()=>{let t=i.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(i).borderTopLeftRadius)||8,r=C().placement,{x:a,y:o}=b(t,e.offsetWidth,e.offsetHeight,[r==`auto`?`bottom`:r,`top`,`left`,`right`],18);w(a,o,{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(n+6,(t.height+12)/2)})};o();let s=new ResizeObserver(o);s.observe(i),s.observe(e);let u=setInterval(o,400);m.push(()=>s.disconnect(),()=>clearInterval(u),k(window,`scroll`,o,{capture:!0,passive:!0}),k(window,`resize`,o))}function E(t){d=t,S(p),clearTimeout(x);let n=C();if(t)p.push(k(document,`click`,(r=>{r.composedPath().includes(t)&&(v=``,e.dispatch({type:`tap`,anchor:n.anchor}))}),!0)),t==h(n.anchor,n.find?.web)&&(v=n.id);else if(v==n.id){let t=u;x=setTimeout(()=>{for(let n=t;n--;){let r=l.steps[n];if(!r.anchor||r.complete_on.type==`page`)return;if(h(r.anchor,r.find?.web)){for(let r=t;r-->n;)e.dispatch({type:`back`});return}}},400)}p.push(k(document,`keydown`,(n=>{if(n.key!=`Tab`)return;let i=[...r.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],a=n.composedPath().includes(r),o=i[0],s=i.at(-1),c=e.root.activeElement;a&&!n.shiftKey&&c==s?(n.preventDefault(),(t??o)?.focus()):a&&n.shiftKey&&c==o?(n.preventDefault(),(t??s)?.focus()):t&&document.activeElement==t&&(n.preventDefault(),(n.shiftKey?s:o)?.focus())}),!0)),T()}function D(){S(f);let t=C(),n=t.anchor?h(t.anchor,t.find?.web):null;if(E(n),!t.anchor)return;let r=0,i=()=>{r=0;let e=h(t.anchor,t.find?.web);e!=n&&E(n=e)},a=new MutationObserver(()=>r||(r=requestAnimationFrame(i)));a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-guide`,`hidden`,`style`,`class`]});let o=setTimeout(()=>!n&&e.dispatch({type:`anchor_missing`,anchor:t.anchor}),3e3);f.push(()=>a.disconnect(),()=>clearTimeout(o),()=>cancelAnimationFrame(r))}return{nodes:()=>[s&&i,c&&a,r],get guide(){return l},update(n,i){if(n==l&&i==u)return;let a=!l||i!=u||n.steps[i]?.id!=C().id;l=n,u=i,y(e,n,i,t,r),a?D():T()},stop(){S(f),S(p),S(m),clearTimeout(x)}}}function j(r){let i=r.options,a=e=>void r.outbox.push(e);w().then(({createTransport:t})=>{let n=t({appKey:i.appKey,url:i.eventsUrl,sdk:i.sdkName??`web`,version:e,preview:i.preview,userId:r.userId,locale:()=>p(r),send:i.transport});r.outbox.splice(0).forEach(n.push),a=n.push}).catch(e=>r.emit({type:`sdk_error`,message:String(e)}));let s=r.root;s.appendChild(o(`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 c=s.appendChild(o(`div`,{class:`l`})),l=o(`div`,{class:`sr`,"aria-live":`polite`}),u=!1,d,f,g=null,_=o(`button`,{onClick:()=>L(!u)}),v,y,x,S,C=e=>r.emit({type:`sdk_error`,message:String(e)}),j=()=>x??(x=T().then(e=>(v=e,s.appendChild(o(`style`,null,e.css)),z())).catch(C)),M=()=>S??(S=E().then(e=>(y=e,s.appendChild(o(`style`,null,e.css)),z())).catch(C)),N,P=[],F=()=>[l],I,L=e=>{u=e,z()};function R(e){let t=e.filter(Boolean);for(t.forEach((e,t)=>c.childNodes[t]!=e&&c.insertBefore(e,c.childNodes[t]??null));c.childNodes.length>t.length;)c.lastChild.remove()}function z(){let e=r.engine.active,a=e?.guide,p=n(r.config,i.colorMode,a?.mode)?`dark`:`light`;s.host.setAttribute(`data-mode`,p),c.removeAttribute(`style`);for(let[e,t]of Object.entries({...r.config.theme?.[p],...a?.tokens?.[p]}))c.style.setProperty(`--ps-${e}`,t);let h=r.engine.launcherGuides().length>0,x=!!f;u&&h&&v?(f??(f=o(`div`,{tabindex:`-1`,role:`dialog`})),v.drawList(r,f,()=>L(!1))):(f=void 0,u&&h&&j()),h&&D(r,_,u),!u&&e?.status==`running`?N?.guide?.id!=a.id&&(N?.stop(),N=A(r,t(),()=>R(F()))):(N?.stop(),N=void 0),e?.status==`running`&&e.index==a.steps.length-1&&M();let S=!u&&e?.status==`completed`&&!!y;!u&&e?.status==`completed`&&!y&&M();let C=S&&(I!=a||!P.length);if(S?C&&(P=y.drawDone(r,a)):P=[],I=S?a:void 0,l.textContent=e?.status==`running`?`${m(r,a.lang)(`step_of`,{n:e.index+1,total:a.steps.length})}: ${a.steps[e.index].title}`:e?.status==`completed`?m(r,a.lang)(`level_cleared`):``,F=()=>[f,h&&r.config.launcher.enabled&&_,...N?.nodes()??[],...P,l],R(F()),N?.update(a,e.index),f&&!x){if(g=s.activeElement??document.activeElement,d){let{x:e,y:t}=b(d.getBoundingClientRect(),f.offsetWidth,f.offsetHeight,[`top`,`bottom`],8,!0);f.style.cssText=`left:${e}px;top:${t}px;right:auto;bottom:auto`}f.focus()}else!f&&x&&g?.focus();C&&P[1]?.focus()}k(window,`keydown`,(e=>{if(e.key!=`Escape`||e.defaultPrevented||!e.composedPath().includes(s.host))return;let t=r.engine.active;if(u)L(!1);else if(t?.status==`completed`)r.dispatch({type:`close`});else if(t?.status==`running`){let e=t.guide.steps[t.index],n=e.anchor?h(e.anchor,e.find?.web):null;r.dispatch({type:`hide`}),n?.focus({preventScroll:!0})}else return;e.preventDefault(),e.stopPropagation()}),!0);let B=new MutationObserver(()=>z());for(let e of[document.documentElement,document.body])B.observe(e,{attributes:!0});return k(matchMedia(`(prefers-color-scheme: dark)`),`change`,()=>z()),z(),{update:()=>{r.engine.launcherGuides().length||(u=!1),z()},openLauncher:e=>{let t=document.activeElement;d=e??(t!=document.body&&t!=s.host?t??void 0:void 0),L(!0)},send:e=>a(e),start:e=>{let t=O(r.config.guides.find(t=>t.id==e.guide)?.start_path);r.dispatch({...e,to:t});let n=r.engine.active;if(n?.status==`waiting`&&n.guide.id==e.guide)try{i.navigate(t)}catch(t){C(t),r.dispatch({...e,to:``})}}}}export{u as fillEl,o as h,l as icon,j as mount,x as t,m as words};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},t=()=>matchMedia(`(prefers-reduced-motion: reduce)`).matches;export{e as n,t};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axceera/playstep",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "PlayStep web SDK: playable, video-first guides for any web app. A 3.
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "PlayStep web SDK: playable, video-first guides for any web app. A 3.3 KB loader; the guide UI loads only when a guide shows.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"homepage": "https://playstep.app/docs/sdk/web",
|
package/dist/sdk-Ba_W5Ehd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./util-oI8xpB8k.js";const t=e=>RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`)}$`),n=e=>e.length>1?e.replace(/\/+$/,``):e;function r(e,r){return!!e&&r!==void 0&&t(n(e)).test(n(r))}function i(e,t){return(e??[]).every(e=>{let n=t[e.trait];return e.op===`exists`?n!=null:e.op===`in`?Array.isArray(e.value)&&e.value.includes(n):n===e.value==(e.op===`eq`)})}function a(e){let{config:t}=e,n=e.progress??{seen:!1,guides:{}},a=e.traits??{},o=null,s,c=/* @__PURE__ */ new Set,l=!1,u=t.flags,d=t.guides,f=e=>d.find(t=>t.id===e),p=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),m=e=>!l&&!u.disabled&&(!u.paused_for_new_users||n.seen)&&i(e.segments,a),h=e=>{let t=n.guides[e.id];return!o&&!c.has(e.id)&&m(e)&&(!t||t.status!==`done`&&(t.status===`running`||!e.trigger.once))},g=(e,t,r)=>{n.guides[e.id]={version:e.version,step:r,status:t}},_,v=e=>r(e.path,_),y=e=>r(e.skip_if_on,_)||v(e.complete_on),b=(e,t,n)=>{for(;t<e.steps.length;){if(o={guide:e,index:t,status:`running`},s=void 0,g(e,`running`,t),n.push(p(`step_shown`,e,t)),!y(e.steps[t]))return n;n.push(p(`step_completed`,e,t++))}return o={guide:e,index:--t,status:`completed`},g(e,`done`,t),n.push(p(`guide_completed`,e)),n},x=(e,t)=>(n.seen=!0,b(e,t,[p(`guide_shown`,e)])),S=()=>{let e=o;return o=null,e?.status===`running`?(g(e.guide,`dismissed`,e.index),[p(`guide_dismissed`,e.guide,e.index)]):[]},C=()=>{let e=o;return b(e.guide,e.index+1,[p(`step_completed`,e.guide,e.index)])},w=e=>{let t=d.find(t=>h(t)&&e(t));return t?x(t,0):[]},T=()=>(c.clear(),E()),E=()=>w(e=>e.trigger.type===`first_visit`||v(e.trigger)),D=()=>{let e=d.find(e=>n.guides[e.id]?.status===`running`&&!c.has(e.id)&&m(e));if(!e)return E();let t=n.guides[e.id];return x(e,t.version===e.version?t.step:0)};function O(e){let t=!l&&o?.status===`running`?o.guide.steps[o.index]:null;switch(e.type){case`init`:return _=e.path,c.clear(),D();case`pause`:return l=!0,[];case`resume`:return l?(l=!1,o?[]:D()):[];case`page_view`:return _=e.path,t&&y(t)?C():w(e=>v(e.trigger));case`reset_progress`:{let t=typeof e.guide==`string`&&f(e.guide);return t===void 0?[]:((!t||o?.guide===t)&&(o=null),t?delete n.guides[t.id]:n.guides={},[{type:`progress_reset`,guide_id:t?t.id:void 0},...T()])}case`event`:return t?.complete_on.type===`event`&&t.complete_on.name===e.name?C():w(t=>t.trigger.type===`event`&&t.trigger.name===e.name);case`tap`:return t?.complete_on.type===`tap_anchor`&&t.anchor===e.anchor?C():[];case`complete`:return t?.id===e.step?C():[];case`next`:return t?.complete_on.type===`next_button`?C():[];case`back`:return!t||o.index===0?[]:(o={...o,index:o.index-1},g(o.guide,`running`,o.index),[p(`step_shown`,o.guide,o.index)]);case`hide`:return t&&(c.add(o.guide.id),o=null),[];case`close`:if(o?.status!==`completed`)return[];case`dismiss`:return S();case`start`:{let n=f(e.guide);return!n||!m(n)||t&&o.guide===n&&n.steps.slice(0,o.index).every(y)?[]:S().concat(x(n,0))}case`anchor_missing`:return!t||t.anchor!==e.anchor||s===e.anchor?[]:(s=e.anchor,[{...p(`anchor_missing`,o.guide,o.index),anchor:e.anchor}]);case`identify`:return a={...a,...e.traits},[]}}return{get active(){return l?null:o},progress:n,dispatch:O,launcherGuides:()=>d.filter(e=>e.launcher&&m(e)),use(e){t=e,d=e.guides,o&&(o={...o,guide:f(o.guide.id)??o.guide})}}}const o=`0.7.0`,s=`playstep_preview`;function c(t,n,r){let i,c,l,u,d,f,p,m,h={},g=!1,_,v=[],y=[],b=()=>`p:${i.appKey}`,x=()=>i.preview||e.set(b(),c.progress),S=e=>{let t={...e,ts:Date.now()};i?.preview||(d?d.send(t):y.push(t)),i?.onEvent?.(t)},C=e=>{try{S({type:`sdk_error`,message:String(e)})}catch{}},w=e=>(...t)=>{try{e(...t)}catch(e){C(e)}},T=(e,t)=>w(n=>E({type:e,[t]:n}));function E(t){if(!c)return void v.push(t);let n=c.dispatch(t);x(),n.forEach(w(S)),(c.active||e.get(`q`))&&O(),d?.update()}function D(){return p??(p=document.body.appendChild(document.createElement(`playstep-root`)).attachShadow({mode:`open`}))}function O(){return f??(f=t().then(e=>{let t=D();return t.innerHTML=``,d=e.mount({engine:c,get config(){return l},options:i,root:t,outbox:y,userId:()=>m,dispatch:w(E),emit:w(S)})}).catch(C))}let k,A=w((e={})=>{c?c.launcherGuides().length&&O().then(t=>t?.openLauncher(e.anchor)):k=e});function j(e){e.launcher?.enabled&&c.launcherGuides().length&&!f&&n&&n().then(t=>{f||t.drawLauncher(D(),c,e,A,i)}).catch(C)}let M=e=>w(()=>{g!==e&&(g=e,c&&(E({type:e?`pause`:`resume`}),!f&&(e?p&&(p.innerHTML=``):j(l))))});async function N(){let t=i,n=(t.apiBase??`https://cdn.playstep.app`).replace(/\/$/,``),o=null;try{o=new URLSearchParams(location.search).get(s)||(t.config?null:sessionStorage.getItem(s))}catch{}t.preview||(t.preview=!!(t.config||o)),u=e=>fetch(`${n}/v2/${o?`preview/${o}?key=${t.appKey}&`:`config/${t.appKey}?`}l=${e}`).then(e=>e.json());let d=t.config;try{d??(d=await u(t.locale??navigator.language??``))}catch{return}try{o&&sessionStorage[d.guides?`setItem`:`removeItem`](s,o)}catch{}if(d?.capture)return void r?.().then(e=>e.start(d.capture,t.appKey)).catch(C);if(d?.guides&&!d.flags?.disabled&&(l=d,t.eventsUrl=d.ingest_url??`${n}/v1/events`,c=a({config:d,progress:t.preview?void 0:e.get(b())??void 0,traits:h}),g&&c.dispatch({type:`pause`}),E({type:`init`,path:location.pathname}),v.splice(0).forEach(E),k&&A(k),j(d),t.autoPageViews!==!1)){let e=location.pathname,t=w(()=>location.pathname!==e&&E({type:`page_view`,path:e=location.pathname}));for(let e of[`pushState`,`replaceState`]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener(`popstate`,t)}}return{version:o,init:w(e=>{if(i||!e?.appKey)return;i={...e},_&&(i.locale=_);let t=()=>setTimeout(()=>N().catch(C));document.readyState===`complete`?t():addEventListener(`load`,t)}),identify:w((e,t)=>{m=e,h={...h,...t},E({type:`identify`,traits:h})}),track:T(`event`,`name`),start:T(`start`,`guide`),complete:T(`complete`,`step`),page:w(e=>E({type:`page_view`,path:e??location.pathname})),openLauncher:A,resetProgress:T(`reset_progress`,`guide`),reset:w(()=>{E({type:`dismiss`}),m=void 0,h={},c&&(Object.assign(c.progress,{seen:!1,guides:{}}),x(),d?.update()),i?.preview||e.set(`d`,null)}),pause:M(!0),resume:M(!1),isPaused:()=>g,setLocale:w(e=>{_=e,i&&(i.locale=e),u?.(e).then(t=>{t.guides&&i?.locale==e&&(c.use(l=t),d?.update())}).catch(C)})}}export{c as n,o as t};
|
package/dist/ui-uhppJh4o.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./sdk-Ba_W5Ehd.js";import{t}from"./util-oI8xpB8k.js";import{t as n}from"./mode-CPlpg1Yl.js";var r=Object.defineProperty,i=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n};const a={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 o(e,t,...n){let r=document.createElement(e);for(let e in t){let n=t[e];if(n!=null&&n!==!1){if(e[0]==`o`&&e[1]==`n`)r.addEventListener(e.slice(2).toLowerCase(),n);else if(e==`ref`)n(r);else if(e==`style`)for(let e in n)r.style.setProperty(e,n[e]);else r.setAttribute(e,n===!0?``:String(n))}}return s(r,n),r}function s(e,t){for(let n of t)Array.isArray(n)?s(e,n):n!=null&&n!==!1&&e.appendChild(typeof n==`object`?n:document.createTextNode(String(n)))}const c=document.createElement(`template`);function l(e){return c.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${a[e]}</svg>`,c.content.firstChild}const u=(e,...t)=>{e.textContent=``,s(e,t)},d=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e),f=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},p=e=>e.options.locale??navigator.language??`en`,m=(e,t=e.config.lang)=>(n,r)=>d(e.config.words[t]?.[n]??n,r);function h(e,t){let n=e=>!!e?.getClientRects().length,r=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{r||(r=t?[...document.querySelectorAll(t.css)].find(e=>n(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return n(r)?r:null}function g(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}function _(e,t,n,r,i,a){(!a||g(`${i}|${r.url}`))&&e.emit({type:i,guide_id:t.id,guide_version:t.version,step_id:t.steps[n].id,step_index:n,clip_id:r.clip_id,clip_source:r.source})}function v(e,t,n,r,i,a,s){let c=m(e,t.lang),d=t.steps[n].title,p=o(`div`,{class:`clip`}),h=!0,g=r.duration_ms??0;if(r.kind==`embed`)return p.className=`clip embed`,u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_video`),onClick:()=>{u(p,o(`iframe`,{src:r.url,title:c(`video`,{title:d}),allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowfullscreen:!0})),_(e,t,n,r,`clip_played`)}},l(`play`)),o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`external-link`),r.label,g?` · ${f(g)}`:``))),s(0),p;let v=()=>{let i=o(`video`,{src:r.url,poster:r.poster,loop:!0,autoplay:!0,playsinline:!0,preload:`auto`,"aria-label":c(`clip`,{title:d}),onLoadeddata:()=>_(e,t,n,r,`clip_loaded`,!0),onPlaying:()=>_(e,t,n,r,`clip_played`,!0),onLoadedmetadata:()=>{Number.isFinite(i.duration)&&(g=i.duration*1e3,m.textContent=`${f(g)} `,s(g))}});i.muted=!0;let m=o(`span`,null,g?`${f(g)} `:``),v=o(`button`,{class:`round`,"aria-label":c(`unmute_clip`),onClick:()=>{h=!h,i.muted=h,v.setAttribute(`aria-label`,c(h?`unmute_clip`:`mute_clip`)),u(v,l(h?`volume-x`:`volume-2`)),h||_(e,t,n,r,`clip_unmuted`)}},l(`volume-x`)),y=o(`button`,{class:`round`,"aria-label":c(`expand_clip`),"aria-pressed":`false`,onClick:()=>{let e=a.classList.toggle(`big`);y.setAttribute(`aria-label`,c(e?`shrink_clip`:`expand_clip`)),y.setAttribute(`aria-pressed`,String(e))}},l(`maximize-2`));u(p,i,o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`play`),m,c(`loop`)),v,y)),i.play()?.catch(()=>{}),s(g)};return i?u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_clip`),onClick:v},l(`play`))):v(),p}function y(e,t,n,r,i){let a=t.steps[n],s=t.steps.length,c=m(e,t.lang),d=a.complete_on.type==`next_button`,f=a.media,p=c(`step_of`,{n:n+1,total:s}),h=t.steps.map((e,t)=>o(`span`,{class:`seg${t<n?` done`:t==n?` cur`:``}`})),g=e=>{let t=h[n];t.className=`seg cur${e&&!r?` anim`:``}`,e?t.style.setProperty(`--d`,`${e}ms`):t.style.removeProperty(`--d`)};i.classList.remove(`big`),i.dataset.step=a.id,i.lang=t.lang,t.rtl?i.dir=`rtl`:i.removeAttribute(`dir`),u(i,f?.kind==`image`?o(`div`,{class:`clip img`},o(`img`,{src:f.url,alt:f.label??``,width:f.width,height:f.height})):f&&v(e,t,n,f,r,i,g),o(`div`,{class:`body`},o(`div`,{class:`meta`},o(`span`,null,`${p} · ${t.name}`),o(`button`,{class:`x`,"aria-label":c(`close_guide`),onClick:()=>e.dispatch({type:`dismiss`})},l(`x`))),o(`div`,{class:`steps`,role:`img`,"aria-label":p},h),o(`h2`,{class:`title`,id:`ps-title`},a.title),o(`p`,{class:`text`,id:`ps-text`},a.body)),o(`div`,{class:`foot`},d?o(`span`,{class:`sp`}):o(`span`,{class:`wait`},o(`span`,{class:`pulse`,"aria-hidden":`true`}),c(`waiting`)),a.back&&o(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`})},c(`back`)),d&&o(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`})},c(n+1==s?`done`:`next`),l(`arrow-right`))));let y=t.steps[n+1]?.media;if(y&&y.kind!=`embed`&&!r&&!navigator.connection?.saveData){if(y.kind==`image`)new Image().src=y.url;else{let r=document.createElement(`video`);r.preload=`auto`,r.muted=!0,r.src=y.url,y.source==`hosted`&&_(e,t,n+1,y,`clip_loaded`,!0)}}}function b(e,t,n,r,i,a=!1,o=12){let s={bottom:e.bottom+i+n<=innerHeight-o,top:e.top-i-n>=o,left:e.left-i-t>=o,right:e.right+i+t<=innerWidth-o},c=r.find(e=>s[e])??r[0],l=(e,t)=>Math.max(o,Math.min(e,t-o));return c==`top`||c==`bottom`?{x:l(a?e.left:e.left+(e.width-t)/2,innerWidth-t),y:c==`top`?e.top-i-n:e.bottom+i}:{x:c==`left`?e.left-i-t:e.right+i,y:l(e.top+(e.height-n)/2,innerHeight-n)}}var x=/* @__PURE__ */ i({fillEl:()=>u,h:()=>o,icon:()=>l,mount:()=>A,words:()=>m});const S=document.currentScript?.src,C=(e,t,n)=>t?new Promise((n,r)=>document.head.append(Object.assign(document.createElement(`script`),{src:new URL(`${e}.js`,S||location.href).href,integrity:t,crossOrigin:`anonymous`,onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))):n(),w=()=>C(`events`,``,()=>import(`./transport-BbOItkab.js`)),T=()=>C(`list`,typeof __PLAYSTEP_LIST_INTEGRITY__==`string`?__PLAYSTEP_LIST_INTEGRITY__:``,()=>import(`./list-Dqrzp4FD.js`)),E=()=>C(`done`,typeof __PLAYSTEP_DONE_INTEGRITY__==`string`?__PLAYSTEP_DONE_INTEGRITY__:``,()=>import(`./done-BwXakUjv.js`));function D(e,t,n){let r=m(e),i=e.engine.launcherGuides().filter(t=>!e.engine.progress.guides[t.id]).length;t.className=`lb${e.config.launcher.position==`bottom-left`?` left`:``}`,t.setAttribute(`aria-label`,r(n?`close_guides`:`open_guides`)),t.setAttribute(`aria-expanded`,String(n)),u(t,l(`ps-launcher`),i>0&&!n&&o(`span`,{class:`cnt`},i))}const O=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r));function k(e,t,n){let r=o(`div`,{class:`card`,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabindex:`-1`,style:{visibility:`hidden`}}),i=o(`div`,{class:`spot`,"aria-hidden":`true`}),a=o(`div`,{class:`scrim`,"aria-hidden":`true`}),s=!1,c=!1,l,u=-1,d=null,f=[],p=[],m=[],g=!1,_=``,v=``,x,S=e=>e.splice(0).forEach(e=>e()),C=()=>l.steps[u];function w(e,t,a){r.style.transform=`translate(${Math.round(e)}px,${Math.round(t)}px)`,r.style.visibility=``,g||(r.style.transition=`none`,requestAnimationFrame(()=>(g=!0,r.style.transition=``))),s!=!!(d&&a)&&(s=!s,n()),d&&a&&Object.assign(i.style,{width:`${a.w}px`,height:`${a.h}px`,transform:`translate(${a.x}px,${a.y}px)`,borderRadius:`${a.r}px`}),_!=C().id&&(_=C().id,document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)||r.focus({preventScroll:!0}))}function T(){S(m);let e=r;if(c!=(!d&&l.position==`center`)&&(c=!c,n()),!d){let t=()=>w((innerWidth-e.offsetWidth)/2,l.position==`center`?(innerHeight-e.offsetHeight)/2:innerHeight-e.offsetHeight-24);t();let n=new ResizeObserver(t);n.observe(e),m.push(()=>n.disconnect(),O(window,`resize`,t));return}let i=d,a=i.getBoundingClientRect();(a.bottom<0||a.top>innerHeight)&&i.scrollIntoView({block:`center`,behavior:t?`auto`:`smooth`});let o=()=>{let t=i.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(i).borderTopLeftRadius)||8,r=C().placement,{x:a,y:o}=b(t,e.offsetWidth,e.offsetHeight,[r==`auto`?`bottom`:r,`top`,`left`,`right`],18);w(a,o,{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(n+6,(t.height+12)/2)})};o();let s=new ResizeObserver(o);s.observe(i),s.observe(e);let u=setInterval(o,400);m.push(()=>s.disconnect(),()=>clearInterval(u),O(window,`scroll`,o,{capture:!0,passive:!0}),O(window,`resize`,o))}function E(t){d=t,S(p),clearTimeout(x);let n=C();if(t)p.push(O(document,`click`,(r=>{r.composedPath().includes(t)&&(v=``,e.dispatch({type:`tap`,anchor:n.anchor}))}),!0)),t==h(n.anchor,n.find?.web)&&(v=n.id);else if(v==n.id){let t=u;x=setTimeout(()=>{for(let n=t;n--;){let r=l.steps[n];if(!r.anchor||r.complete_on.type==`page`)return;if(h(r.anchor,r.find?.web)){for(let r=t;r-->n;)e.dispatch({type:`back`});return}}},400)}p.push(O(document,`keydown`,(n=>{if(n.key!=`Tab`)return;let i=[...r.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],a=n.composedPath().includes(r),o=i[0],s=i.at(-1),c=e.root.activeElement;a&&!n.shiftKey&&c==s?(n.preventDefault(),(t??o)?.focus()):a&&n.shiftKey&&c==o?(n.preventDefault(),(t??s)?.focus()):t&&document.activeElement==t&&(n.preventDefault(),(n.shiftKey?s:o)?.focus())}),!0)),T()}function D(){S(f);let t=C(),n=t.anchor?h(t.anchor,t.find?.web):null;if(E(n),!t.anchor)return;let r=0,i=()=>{r=0;let e=h(t.anchor,t.find?.web);e!=n&&E(n=e)},a=new MutationObserver(()=>r||(r=requestAnimationFrame(i)));a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-guide`,`hidden`,`style`,`class`]});let o=setTimeout(()=>!n&&e.dispatch({type:`anchor_missing`,anchor:t.anchor}),3e3);f.push(()=>a.disconnect(),()=>clearTimeout(o),()=>cancelAnimationFrame(r))}return{nodes:()=>[s&&i,c&&a,r],get guide(){return l},update(n,i){if(n==l&&i==u)return;let a=!l||i!=u||n.steps[i]?.id!=C().id;l=n,u=i,y(e,n,i,t,r),a?D():T()},stop(){S(f),S(p),S(m),clearTimeout(x)}}}function A(r){let i=r.options,a=e=>void r.outbox.push(e);w().then(({createTransport:t})=>{let n=t({appKey:i.appKey,url:i.eventsUrl,sdk:i.sdkName??`web`,version:e,preview:i.preview,userId:r.userId,locale:()=>p(r),send:i.transport});r.outbox.splice(0).forEach(n.push),a=n.push}).catch(e=>r.emit({type:`sdk_error`,message:String(e)}));let s=r.root;s.appendChild(o(`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 c=s.appendChild(o(`div`,{class:`l`})),l=o(`div`,{class:`sr`,"aria-live":`polite`}),u=!1,d,f,g=null,_=o(`button`,{onClick:()=>I(!u)}),v,y,x,S,C=e=>r.emit({type:`sdk_error`,message:String(e)}),A=()=>x??(x=T().then(e=>(v=e,s.appendChild(o(`style`,null,e.css)),R())).catch(C)),j=()=>S??(S=E().then(e=>(y=e,s.appendChild(o(`style`,null,e.css)),R())).catch(C)),M,N=[],P=()=>[l],F,I=e=>{u=e,R()};function L(e){let t=e.filter(Boolean);for(t.forEach((e,t)=>c.childNodes[t]!=e&&c.insertBefore(e,c.childNodes[t]??null));c.childNodes.length>t.length;)c.lastChild.remove()}function R(){let e=r.engine.active,a=e?.guide,p=n(r.config,i.colorMode,a?.mode)?`dark`:`light`;s.host.setAttribute(`data-mode`,p),c.removeAttribute(`style`);for(let[e,t]of Object.entries({...r.config.theme?.[p],...a?.tokens?.[p]}))c.style.setProperty(`--ps-${e}`,t);let h=r.engine.launcherGuides().length>0,x=!!f;u&&h&&v?(f??(f=o(`div`,{tabindex:`-1`,role:`dialog`})),v.drawList(r,f,()=>I(!1))):(f=void 0,u&&h&&A()),h&&D(r,_,u),!u&&e?.status==`running`?M?.guide?.id!=a.id&&(M?.stop(),M=k(r,t(),()=>L(P()))):(M?.stop(),M=void 0),e?.status==`running`&&e.index==a.steps.length-1&&j();let S=!u&&e?.status==`completed`&&!!y;!u&&e?.status==`completed`&&!y&&j();let C=S&&(F!=a||!N.length);if(S?C&&(N=y.drawDone(r,a)):N=[],F=S?a:void 0,l.textContent=e?e.status==`running`?`${m(r,a.lang)(`step_of`,{n:e.index+1,total:a.steps.length})}: ${a.steps[e.index].title}`:m(r,a.lang)(`level_cleared`):``,P=()=>[f,h&&r.config.launcher.enabled&&_,...M?.nodes()??[],...N,l],L(P()),M?.update(a,e.index),f&&!x){if(g=s.activeElement??document.activeElement,d){let{x:e,y:t}=b(d.getBoundingClientRect(),f.offsetWidth,f.offsetHeight,[`top`,`bottom`],8,!0);f.style.cssText=`left:${e}px;top:${t}px;right:auto;bottom:auto`}f.focus()}else!f&&x&&g?.focus();C&&N[1]?.focus()}O(window,`keydown`,(e=>{if(e.key!=`Escape`||e.defaultPrevented||!e.composedPath().includes(s.host))return;let t=r.engine.active;if(u)I(!1);else if(t?.status==`completed`)r.dispatch({type:`close`});else if(t){let e=t.guide.steps[t.index],n=e.anchor?h(e.anchor,e.find?.web):null;r.dispatch({type:`hide`}),n?.focus({preventScroll:!0})}else return;e.preventDefault(),e.stopPropagation()}),!0);let z=new MutationObserver(()=>R());for(let e of[document.documentElement,document.body])z.observe(e,{attributes:!0});return O(matchMedia(`(prefers-color-scheme: dark)`),`change`,()=>R()),R(),{update:()=>{r.engine.launcherGuides().length||(u=!1),R()},openLauncher:e=>{let t=document.activeElement;d=e??(t!=document.body&&t!=s.host?t??void 0:void 0),I(!0)},send:e=>a(e)}}export{u as fillEl,o as h,l as icon,A as mount,x as t,m as words};
|
package/dist/util-oI8xpB8k.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{return null}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},t=()=>matchMedia(`(prefers-reduced-motion: reduce)`).matches;export{e as n,t};
|