@axceera/playstep 0.3.0 → 0.4.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 +4 -1
- package/dist/cdn/events.js +1 -0
- package/dist/cdn/loader.js +1 -1
- package/dist/cdn/ui.js +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +1 -1
- package/dist/sdk-PxS4dzh1.js +1 -0
- package/dist/transport-Cu51h2G6.js +1 -0
- package/dist/ui-DiF80WLc.js +1 -0
- package/dist/util-oI8xpB8k.js +1 -0
- package/package.json +1 -1
- package/dist/sdk-BupMWbuV.js +0 -1
- package/dist/ui-DkqtUF5u.js +0 -1
package/README.md
CHANGED
|
@@ -39,7 +39,10 @@ carries the hashes of the chunks it loads, so pinning it covers everything that
|
|
|
39
39
|
data-app-key="ps_pub_xxx"></script>
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
- About 3 KB gzipped until a guide shows; the guide UI (under 20 KB)
|
|
42
|
+
- About 3 KB gzipped until a guide shows; the guide UI (under 20 KB) and event delivery (about 2 KB) load only then.
|
|
43
|
+
- Never loses usage: batches that cannot be sent are retried with backoff and kept in local storage until they go
|
|
44
|
+
(on a later page if need be), every event carries an id so a retried one counts once, and `identify` ids are hashed
|
|
45
|
+
synchronously, so a page that closes right away still sends under the right person.
|
|
43
46
|
- Renders in its own Shadow DOM: no CSS leaks in or out, and it never shifts your layout.
|
|
44
47
|
- Fails silent: if PlayStep cannot load, your app behaves as if it were not installed.
|
|
45
48
|
- No `eval`, no inline scripts: works under a strict Content Security Policy.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __playstep_events=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t="playstep:q",r=(e,t)=>fetch(e,{method:"POST",body:t,keepalive:!0,headers:{"content-type":"text/plain"}}).then(e=>({status:e.status,retryAfter:Number(e.headers.get("retry-after"))||void 0}),()=>({status:0})),s={read(e){try{return JSON.parse(localStorage.getItem(e))??[]}catch{return[]}},write(e,r){try{r.length?localStorage.setItem(e,JSON.stringify(r)):localStorage.removeItem(e);let s=!1;for(let e=0;e<localStorage.length;e++)s||(s=!!localStorage.key(e)?.startsWith("playstep:q:"));s?localStorage.setItem(t,"1"):localStorage.removeItem(t)}catch{}}};function l(e){let t,l,a=[],n=[],o=[],i=0,c=!1,g=`${e.storageKey}:${Math.random().toString(36).slice(2,10)}`,u=()=>s.write(g,[...o,...n]),p=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 h(){if(!c&&!l){c=!0;try{for(;n.length;){let e=await p(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,h()},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?p(t.b):navigator.sendBeacon?.(e.url,t.b)||r(e.url,t.b),o.push(t);o=o.slice(-25),u()}else h()}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&&h(),{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,p,h]=l;for(let e=0;e<64;e++){let s=h+(n(g,6)^n(g,11)^n(g,25))+(g&u^~g&p)+a[e]+o[e]|0,l=(n(t,2)^n(t,13)^n(t,22))+(t&r^t&i^r&i)|0;h=p,p=u,u=g,g=c+s|0,c=i,i=r,r=t,t=s+l|0}[t,r,i,c,g,u,p,h].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{return null}},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},platform:"web",session_id:t,user_key:a,preview:e.preview}}});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/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&&(i=e(t),RegExp(`^${i.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`)).test(e(n));var i}function n(e){let n,i,{config:r,platform:s}=e,a=e.progress??{seen:!1,guides:{}},o=e.traits??{},p=null,u=r.flags||{},c=(r.guides??[]).filter(e=>e.spec_version<=3&&(e.targeting?.platforms??["web"]).includes(s)),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=>!u.disabled&&(!u.paused_for_new_users||a.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.targeting?.segments,o),h=(e,t,n)=>{a.guides[e.id]={version:e.version,step:n,status:t}},m=e=>t(e.path,i),f=e=>t(e.skip_if_on,i)||m(e.complete_on),y=(e,t,i)=>{for(;t<e.steps.length;){if(p={guide:e,index:t,status:"running"},n=void 0,h(e,"running",t),i.push(l("step_shown",e,t)),!f(e.steps[t]))return i;i.push(l("step_completed",e,t++))}return p={guide:e,index:--t,status:"completed"},h(e,"done",t),i.push(l("guide_completed",e)),i},v=(e,t)=>(a.seen=!0,y(e,t,[l("guide_shown",e)])),_=()=>{let e=p;return y(e.guide,e.index+1,[l("step_completed",e.guide,e.index)])},w=e=>{let t=c.find(t=>(e=>{let t=a.guides[e.id];return!p&&g(e)&&(!t||"done"!==t.status&&("running"===t.status||!e.trigger.once))})(t)&&e(t));return t?v(t,0):[]},x=()=>w(e=>"first_visit"===e.trigger.type||m(e.trigger));return{get active(){return p},progress:a,dispatch:function(e){let t="running"===p?.status?p.guide.steps[p.index]:null;switch(e.type){case"init":{i=e.path;let t=c.find(e=>"running"===a.guides[e.id]?.status&&g(e));if(t){let e=a.guides[t.id];return v(t,e.version===t.version?e.step:0)}return x()}case"page_view":return i=e.path,t&&f(t)?_():w(e=>m(e.trigger));case"reset_progress":{let t="string"==typeof e.guide&&d(e.guide);return void 0===t?[]:((!t||p?.guide===t)&&(p=null),t?delete a.guides[t.id]:a.guides={},[{type:"progress_reset",guide_id:t?t.id:void 0},...x()])}case"event":return"event"===t?.complete_on.type&&t.complete_on.name===e.name?_():w(t=>"event"===t.trigger.type&&t.trigger.name===e.name);case"tap":return"tap_anchor"===t?.complete_on.type&&t.anchor===e.anchor?_():[];case"complete":return t?.id===e.step?_():[];case"next":return"next_button"===t?.complete_on.type?_():[];case"back":return t&&0!==p.index?(p={...p,index:p.index-1},h(p.guide,"running",p.index),[l("step_shown",p.guide,p.index)]):[];case"close":if("completed"!==p?.status)return[];case"dismiss":{if(!p)return[];let e=p;return p=null,"completed"===e.status?[]:(h(e.guide,"dismissed",e.index),[l("guide_dismissed",e.guide,e.index)])}case"start":{let n=d(e.guide);if(!n||!g(n)||t&&p.guide===n&&n.steps.slice(0,p.index).every(f))return[];let i=[];return"running"===p?.status&&(h(p.guide,"dismissed",p.index),i.push(l("guide_dismissed",p.guide,p.index))),p=null,i.concat(v(n,0))}case"anchor_missing":return t&&t.anchor===e.anchor&&n!==e.anchor?(n=e.anchor,[{...l("anchor_missing",p.guide,p.index),anchor:e.anchor}]):[];case"identify":return o={...o,...e.traits},[]}},launcherGuides:()=>c.filter(e=>!1!==e.launcher&&g(e))}}let i={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{}}},r="playstep_preview",s=document.currentScript;function a(e,t){return new Promise((n,i)=>{document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,s?.src||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>n(window[`__playstep_${e}`]),onerror:()=>i(Error(e))}))})}let o=()=>a("launcher","sha256-HnBHA42PjdJ8LGOSIFqLqV+Sv/ojfkEpNcsdQ7BTJb8="),p=function(e,t,s,a="web"){let o,p,u,c,d,l,g,h={},m=[],f=[],y=()=>`p:${o.appKey}`,v=()=>o.preview||i.set(y(),p.progress),_=e=>{let t={...e,ts:Date.now()};o?.
|
|
1
|
+
!function(){let e=e=>e.length>1?e.replace(/\/+$/,""):e;function t(t,n){return!!t&&void 0!==n&&(i=e(t),RegExp(`^${i.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`)).test(e(n));var i}function n(e){let n,i,{config:r,platform:s}=e,a=e.progress??{seen:!1,guides:{}},o=e.traits??{},p=null,u=r.flags||{},c=(r.guides??[]).filter(e=>e.spec_version<=3&&(e.targeting?.platforms??["web"]).includes(s)),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=>!u.disabled&&(!u.paused_for_new_users||a.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.targeting?.segments,o),h=(e,t,n)=>{a.guides[e.id]={version:e.version,step:n,status:t}},m=e=>t(e.path,i),f=e=>t(e.skip_if_on,i)||m(e.complete_on),y=(e,t,i)=>{for(;t<e.steps.length;){if(p={guide:e,index:t,status:"running"},n=void 0,h(e,"running",t),i.push(l("step_shown",e,t)),!f(e.steps[t]))return i;i.push(l("step_completed",e,t++))}return p={guide:e,index:--t,status:"completed"},h(e,"done",t),i.push(l("guide_completed",e)),i},v=(e,t)=>(a.seen=!0,y(e,t,[l("guide_shown",e)])),_=()=>{let e=p;return y(e.guide,e.index+1,[l("step_completed",e.guide,e.index)])},w=e=>{let t=c.find(t=>(e=>{let t=a.guides[e.id];return!p&&g(e)&&(!t||"done"!==t.status&&("running"===t.status||!e.trigger.once))})(t)&&e(t));return t?v(t,0):[]},x=()=>w(e=>"first_visit"===e.trigger.type||m(e.trigger));return{get active(){return p},progress:a,dispatch:function(e){let t="running"===p?.status?p.guide.steps[p.index]:null;switch(e.type){case"init":{i=e.path;let t=c.find(e=>"running"===a.guides[e.id]?.status&&g(e));if(t){let e=a.guides[t.id];return v(t,e.version===t.version?e.step:0)}return x()}case"page_view":return i=e.path,t&&f(t)?_():w(e=>m(e.trigger));case"reset_progress":{let t="string"==typeof e.guide&&d(e.guide);return void 0===t?[]:((!t||p?.guide===t)&&(p=null),t?delete a.guides[t.id]:a.guides={},[{type:"progress_reset",guide_id:t?t.id:void 0},...x()])}case"event":return"event"===t?.complete_on.type&&t.complete_on.name===e.name?_():w(t=>"event"===t.trigger.type&&t.trigger.name===e.name);case"tap":return"tap_anchor"===t?.complete_on.type&&t.anchor===e.anchor?_():[];case"complete":return t?.id===e.step?_():[];case"next":return"next_button"===t?.complete_on.type?_():[];case"back":return t&&0!==p.index?(p={...p,index:p.index-1},h(p.guide,"running",p.index),[l("step_shown",p.guide,p.index)]):[];case"close":if("completed"!==p?.status)return[];case"dismiss":{if(!p)return[];let e=p;return p=null,"completed"===e.status?[]:(h(e.guide,"dismissed",e.index),[l("guide_dismissed",e.guide,e.index)])}case"start":{let n=d(e.guide);if(!n||!g(n)||t&&p.guide===n&&n.steps.slice(0,p.index).every(f))return[];let i=[];return"running"===p?.status&&(h(p.guide,"dismissed",p.index),i.push(l("guide_dismissed",p.guide,p.index))),p=null,i.concat(v(n,0))}case"anchor_missing":return t&&t.anchor===e.anchor&&n!==e.anchor?(n=e.anchor,[{...l("anchor_missing",p.guide,p.index),anchor:e.anchor}]):[];case"identify":return o={...o,...e.traits},[]}},launcherGuides:()=>c.filter(e=>!1!==e.launcher&&g(e))}}let i={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{}}},r="playstep_preview",s=document.currentScript;function a(e,t){return new Promise((n,i)=>{document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,s?.src||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>n(window[`__playstep_${e}`]),onerror:()=>i(Error(e))}))})}let o=()=>a("launcher","sha256-HnBHA42PjdJ8LGOSIFqLqV+Sv/ojfkEpNcsdQ7BTJb8="),p=function(e,t,s,a="web"){let o,p,u,c,d,l,g,h={},m=[],f=[],y=()=>`p:${o.appKey}`,v=()=>o.preview||i.set(y(),p.progress),_=e=>{let t={...e,ts:Date.now()};o?.preview||(c?c.send(t):f.push(t)),o?.onEvent?.(t)},w=e=>{try{_({type:"sdk_error",message:String(e)})}catch{}},x=e=>(...t)=>{try{e(...t)}catch(e){w(e)}},$=(e,t)=>x(n=>S({type:e,[t]:n}));function S(e){if(!p)return void m.push(e);let t=p.dispatch(e);v(),t.forEach(x(_)),(p.active||i.get("q"))&&E(),c?.update()}function b(){return l??(l=document.body.appendChild(document.createElement("playstep-root")).attachShadow({mode:"open"}))}function E(){return d??(d=e().then(e=>{let t=b();return t.innerHTML="",c=e.mount({engine:p,config:u,options:o,root:t,outbox:f,userId:()=>g,dispatch:x(S),emit:x(_)})}).catch(w))}let L,I=x((e={})=>{p?p.launcherGuides().length&&E().then(t=>t?.openLauncher(e.anchor)):L=e});function K(e){e.launcher?.enabled&&p.launcherGuides().length&&!d&&t&&t().then(t=>{d||t.drawLauncher(b(),p,e.launcher.position,I)}).catch(w)}return{version:"0.4.0",init:x(e=>{if(o||!e?.appKey)return;o={...e};let t=()=>setTimeout(()=>async function(){let e=o,t=(e.apiBase??"https://cdn.playstep.app").replace(/\/$/,""),c=null;try{c=new URLSearchParams(location.search).get(r)||(e.config?null:sessionStorage.getItem(r))}catch{}e.preview||(e.preview=!(!e.config&&!c));let d=e.config;try{d??(d=await fetch(`${t}/v1/${c?`preview/${c}?key=`:"config/"}${e.appKey}`).then(e=>e.json()))}catch{return}try{c&&sessionStorage[d.guides?"setItem":"removeItem"](r,c)}catch{}if(d?.capture)s?.().then(t=>t.start(d.capture,e.appKey)).catch(w);else if(d?.guides&&!d.flags?.disabled&&(u=d,e.eventsUrl=d.ingest_url??`${t}/v1/events`,p=n({config:d,platform:a,progress:e.preview?void 0:i.get(y())??void 0,traits:h}),S({type:"init",path:location.pathname}),m.splice(0).forEach(S),L&&I(L),K(d),!1!==e.autoPageViews)){let e=location.pathname,t=x(()=>location.pathname!==e&&S({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(w));"complete"===document.readyState?t():addEventListener("load",t)}),identify:x((e,t)=>{g=e,h={...h,...t},S({type:"identify",traits:h})}),track:$("event","name"),start:$("start","guide"),complete:$("complete","step"),page:x(e=>S({type:"page_view",path:e??location.pathname})),openLauncher:I,resetProgress:$("reset_progress","guide"),reset:x(()=>{S({type:"dismiss"}),g=void 0,h={},p&&(Object.assign(p.progress,{seen:!1,guides:{}}),v(),c?.update()),o?.preview||i.set("d",null)})}}(()=>a("ui","sha256-BuJ82PM06Uv/m4fsOkRl4s6hOywer7dKibGJitlb5LE="),o,()=>o().then(e=>a("capture",e.captureIntegrity)));if(!window.playstep){window.playstep=p;let e=s?.dataset;e?.appKey&&p.init({appKey:e.appKey,apiBase:e.api,locale:e.locale})}}();
|
package/dist/cdn/ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __playstep_ui=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=Math.min,n=Math.max,i=Math.round,r=e=>({x:e,y:e}),o={left:"right",right:"left",bottom:"top",top:"bottom"};function a(e,i,r){return n(e,t(i,r))}function l(e,t){return"function"==typeof e?e(t):e}function s(e){return e.split("-")[0]}function c(e){return e.split("-")[1]}function p(e){return"x"===e?"y":"x"}function u(e){return"y"===e?"height":"width"}function d(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function f(e){return p(d(e))}function _(e,t,n){void 0===n&&(n=!1);let i=c(e),r=f(e),o=u(r),a="x"===r?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=w(a)),[a,w(a)]}function h(e){let t=w(e);return[g(e),t,g(t)]}function g(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let m=["left","right"],x=["right","left"],v=["top","bottom"],y=["bottom","top"];function b(e,t,n,i){let r=c(e),o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?x:m:t?m:x;case"left":case"right":return t?v:y;default:return[]}}(s(e),"start"===n,i);return r&&(o=o.map(e=>e+"-"+r),t&&(o=o.concat(o.map(g)))),o}function w(e){let t=s(e);return o[t]+e.slice(t.length)}function k(e){let{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function S(e,t,n){let i,{reference:r,floating:o}=e,a=d(t),l=f(t),p=u(l),_=s(t),h="y"===a,g=r.x+r.width/2-o.width/2,m=r.y+r.height/2-o.height/2,x=r[p]/2-o[p]/2;switch(_){case"top":i={x:g,y:r.y-o.height};break;case"bottom":i={x:g,y:r.y+r.height};break;case"right":i={x:r.x+r.width,y:m};break;case"left":i={x:r.x-o.width,y:m};break;default:i={x:r.x,y:r.y}}let v=c(t);return v&&(i[l]+=x*("end"===v?1:-1)*(n&&h?-1:1)),i}async function L(e,t){void 0===t&&(t={});let{x:n,y:i,platform:r,rects:o,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:p="viewport",elementContext:u="floating",altBoundary:d=!1,padding:f=0}=l(t,e),_=function(e){return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:function(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}(e)}(f),h=a[d?"floating"===u?"reference":"floating":u],g=k(await r.getClippingRect({element:await(null==r.isElement?void 0:r.isElement(h))??!0?h:h.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:p,strategy:s})),m="floating"===u?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,x=await(null==r.getOffsetParent?void 0:r.getOffsetParent(a.floating)),v=await(null==r.isElement?void 0:r.isElement(x))&&await(null==r.getScale?void 0:r.getScale(x))||{x:1,y:1},y=k(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:x,strategy:s}):m);return{top:(g.top-y.top+_.top)/v.y,bottom:(y.bottom-g.bottom+_.bottom)/v.y,left:(g.left-y.left+_.left)/v.x,right:(y.right-g.right+_.right)/v.x}}let C=new Set(["left","top"]);async function T(e,t){let{placement:n,platform:i,elements:r}=e,o=await(null==i.isRTL?void 0:i.isRTL(r.floating)),a=s(n),p=c(n),u="y"===d(n),f=C.has(a)?-1:1,_=o&&u?-1:1,h=l(t,e),{mainAxis:g,crossAxis:m,alignmentAxis:x}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return p&&"number"==typeof x&&(m="end"===p?-1*x:x),u?{x:m*_,y:g*f}:{x:g*f,y:m*_}}function M(){return typeof window<"u"}function E(e){return $(e)?(e.nodeName||"").toLowerCase():"#document"}function R(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function P(e){return(($(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function $(e){return!!M()&&(e instanceof Node||e instanceof R(e).Node)}function A(e){return!!M()&&(e instanceof Element||e instanceof R(e).Element)}function H(e){return!!M()&&(e instanceof HTMLElement||e instanceof R(e).HTMLElement)}function D(e){return!(!M()||typeof ShadowRoot>"u")&&(e instanceof ShadowRoot||e instanceof R(e).ShadowRoot)}function N(e){let{overflow:t,overflowX:n,overflowY:i,display:r}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&"inline"!==r&&"contents"!==r}function F(e){return/^(table|td|th)$/.test(E(e))}function z(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}let O,I=/transform|translate|scale|rotate|perspective|filter/,U=/paint|layout|strict|content/,W=e=>!!e&&"none"!==e;function B(e){let t=A(e)?q(e):e;return W(t.transform)||W(t.translate)||W(t.scale)||W(t.rotate)||W(t.perspective)||!V()&&(W(t.backdropFilter)||W(t.filter))||I.test(t.willChange||"")||U.test(t.contain||"")}function V(){return O??(O=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),O}function j(e){return/^(html|body|#document)$/.test(E(e))}function q(e){return R(e).getComputedStyle(e)}function K(e){return A(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function G(e){if("html"===E(e))return e;let t=e.assignedSlot||e.parentNode||D(e)&&e.host||P(e);return D(t)?t.host:t}function J(e){let t=G(e);return j(t)?(e.ownerDocument||e).body:H(t)&&N(t)?t:J(t)}function Y(e,t,n){void 0===t&&(t=[]),void 0===n&&(n=!0);let i=J(e),r=i===e.ownerDocument?.body,o=R(i);if(r){let e=X(o);return t.concat(o,o.visualViewport||[],N(i)?i:[],e&&n?Y(e):[])}return t.concat(i,Y(i,[],n))}function X(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Q(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,o=H(e),a=o?e.offsetWidth:n,l=o?e.offsetHeight:r,s=i(n)!==a||i(r)!==l;return s&&(n=a,r=l),{width:n,height:r,$:s}}function Z(e){return A(e)?e:e.contextElement}function ee(e){let t=Z(e);if(!H(t))return r(1);let n=t.getBoundingClientRect(),{width:o,height:a,$:l}=Q(t),s=(l?i(n.width):n.width)/o,c=(l?i(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}let te=r(0);function ne(e){let t=R(e);return V()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:te}function ie(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),a=Z(e),l=r(1);t&&(i?A(i)&&(l=ee(i)):l=ee(e));let s=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===R(e)}(a,n,i)?ne(a):r(0),c=(o.left+s.x)/l.x,p=(o.top+s.y)/l.y,u=o.width/l.x,d=o.height/l.y;if(a&&i){let e=R(a),t=A(i)?R(i):i,n=e,r=X(n);for(;r&&t!==n;){let e=ee(r),t=r.getBoundingClientRect(),i=q(r),o=t.left+(r.clientLeft+parseFloat(i.paddingLeft))*e.x,a=t.top+(r.clientTop+parseFloat(i.paddingTop))*e.y;c*=e.x,p*=e.y,u*=e.x,d*=e.y,c+=o,p+=a,n=R(r),r=X(n)}}return k({width:u,height:d,x:c,y:p})}function re(e,t){let n=K(e).scrollLeft;return t?t.left+n:ie(P(e)).left+n}function oe(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-re(e,n),y:n.top+t.scrollTop}}function ae(e){let t=K(e),i=e.ownerDocument.body,r=n(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=n(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),a=-t.scrollLeft+re(e),l=-t.scrollTop;return"rtl"===q(i).direction&&(a+=n(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:a,y:l}}function le(e,t,n){let i;if("viewport"===t||"layoutViewport"===t)i=function(e,t,n){void 0===n&&(n="viewport");let i="layoutViewport"===n,r=R(e),o=P(e),a=r.visualViewport,l=o.clientWidth,s=o.clientHeight,c=0,p=0;if(a){let e=!V()||"fixed"===t;i?e||(c=-a.offsetLeft,p=-a.offsetTop):(l=a.width,s=a.height,e&&(c=a.offsetLeft,p=a.offsetTop))}if(re(o)<=0){let e=o.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,r=Math.abs(o.clientWidth-t.clientWidth-i),a="stable both-edges"===getComputedStyle(o).scrollbarGutter?r/2:r;a<=25&&(l-=a)}return{width:l,height:s,x:c,y:p}}(e,n,t);else if("document"===t)i=ae(P(e));else if(A(t))i=function(e,t){let n=ie(e,!0,"fixed"===t),i=n.top+e.clientTop,r=n.left+e.clientLeft,o=ee(e);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:r*o.x,y:i*o.y}}(t,n);else{let n=ne(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return k(i)}function se(e,t){let n=t.get(e);if(n)return n;let i=Y(e,[],!1).filter(e=>A(e)&&"body"!==E(e)),r=null,o="fixed"===q(e).position,a=o?G(e):e;for(;A(a)&&!j(a);){let e=q(a),t=B(a),n=r?r.position:o?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?r=e:i=i.filter(e=>e!==a),a=G(a)}return t.set(e,i),i}function ce(e,t,n){let i=H(t),o=P(t),a="fixed"===n,l=ie(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=r(0);if((i||!a)&&(("body"!==E(t)||N(o))&&(s=K(t)),i)){let e=ie(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!i&&o&&(c.x=re(o));let p=!o||i||a?r(0):oe(o,s);return{x:l.left+s.scrollLeft-c.x-p.x,y:l.top+s.scrollTop-c.y-p.y,width:l.width,height:l.height}}function pe(e){return"static"===q(e).position}function ue(e,t){if(!H(e)||"fixed"===q(e).position)return null;if(t)return t(e);let n=e.offsetParent;return P(e)===n&&(n=n.ownerDocument.body),n}function de(e,t){let n=R(e);if(z(e))return n;if(!H(e)){let t=G(e);for(;t&&!j(t);){if(A(t)&&!pe(t))return t;t=G(t)}return n}let i=ue(e,t);for(;i&&F(i)&&pe(i);)i=ue(i,t);return i&&j(i)&&pe(i)&&!B(i)?n:i||function(e){let t=G(e);for(;H(t)&&!j(t);){if(B(t))return t;if(z(t))return null;t=G(t)}return null}(e)||n}let fe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e,a="fixed"===o,l=P(i),s=!!t&&z(t.floating);if(i===l||s&&a)return n;let c={scrollLeft:0,scrollTop:0},p=r(1),u=r(0),d=H(i);if((d||!a)&&(("body"!==E(i)||N(l))&&(c=K(i)),d)){let e=ie(i);p=ee(i),u.x=e.x+i.clientLeft,u.y=e.y+i.clientTop}let f=!l||d||a?r(0):oe(l,c);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-c.scrollLeft*p.x+u.x+f.x,y:n.y*p.y-c.scrollTop*p.y+u.y+f.y}},getDocumentElement:P,getClippingRect:function(e){let{element:i,boundary:r,rootBoundary:o,strategy:a}=e,l=[..."clippingAncestors"===r?z(i)?[]:se(i,this._c):[].concat(r),o],s=le(i,l[0],a),c=s.top,p=s.right,u=s.bottom,d=s.left;for(let e=1;e<l.length;e++){let r=le(i,l[e],a);c=n(r.top,c),p=t(r.right,p),u=t(r.bottom,u),d=n(r.left,d)}return{width:p-d,height:u-c,x:d,y:c}},getOffsetParent:de,getElementRects:async function(e){let t=this.getOffsetParent||de,n=this.getDimensions,i=await n(e.floating);return{reference:ce(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){let{width:t,height:n}=Q(e);return{width:t,height:n}},getScale:ee,isElement:A,isRTL:function(e){return"rtl"===q(e).direction}},_e=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n;let{x:i,y:r,placement:o,middlewareData:a}=t,l=await T(t,e);return o===a.offset?.placement&&null!=(n=a.arrow)&&n.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:o}}}}},he=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:i,placement:r,platform:o}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:u={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=l(e,t),_={x:n,y:i},h=await o.detectOverflow(t,f),g=d(r),m=p(g),x=_[m],v=_[g],y=(e,t)=>a(t+h["y"===e?"top":"left"],t,t-h["y"===e?"bottom":"right"]);s&&(x=y(m,x)),c&&(v=y(g,v));let b=u.fn({...t,[m]:x,[g]:v});return{...b,data:{x:b.x-n,y:b.y-i,enabled:{[m]:s,[g]:c}}}}}},ge=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;let{placement:i,middlewareData:r,rects:o,initialPlacement:a,platform:c,elements:p}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...y}=l(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};let k=s(i),S=d(a),L=s(a)===a,C=await(null==c.isRTL?void 0:c.isRTL(p.floating)),T=g||(L||!v?[w(a)]:h(a)),M="none"!==x;!g&&M&&T.push(...b(a,v,x,C));let E=[a,...T],R=await c.detectOverflow(t,y),P=[],$=r.flip?.overflows||[];if(u&&P.push(R[k]),f){let e=_(i,o,C);P.push(R[e[0]],R[e[1]])}if($=[...$,{placement:i,overflows:P}],!P.every(e=>e<=0)){let e=(r.flip?.index||0)+1,t=E[e];if(t&&("alignment"!==f||S===d(t)||$.every(e=>d(e.placement)!==S||e.overflows[0]>0)))return{data:{index:e,overflows:$},reset:{placement:t}};let n=$.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(m){case"bestFit":{let e=$.filter(e=>{if(M){let t=d(e.placement);return t===S||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},me=(e,t,n)=>{let i=new Map,r=n??{},o={...fe,...r.platform,_c:i};return(async(e,t,n)=>{let{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:L},s=await(null==a.isRTL?void 0:a.isRTL(t)),c=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:p,y:u}=S(c,i,s),d=i,f=0,_={};for(let n=0;n<o.length;n++){let h=o[n];if(!h)continue;let{name:g,fn:m}=h,{x:x,y:v,data:y,reset:b}=await m({x:p,y:u,initialPlacement:i,placement:d,strategy:r,middlewareData:_,rects:c,platform:l,elements:{reference:e,floating:t}});p=x??p,u=v??u,_[g]={..._[g],...y},b&&f<50&&(f++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:r}):b.rects),({x:p,y:u}=S(c,d,s))),n=-1)}return{x:p,y:u,placement:d,strategy:r,middlewareData:_}})(e,t,{...r,platform:o})};var xe,ve,ye,be,we,ke,Se,Le,Ce,Te,Me={},Ee=[],Re=/^m(i|n|o|s|text|space)$/,Pe=Array.isArray,$e=Ee.slice,Ae=Object.assign;function He(e){e&&e.parentNode&&e.remove()}function De(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r||++ve,__i:-1,__u:0};return!r&&xe.vnode&&xe.vnode(o),o}function Ne(e){return e.children}function Fe(e,t){this.props=e,this.context=t,this.__g=0}function ze(e,t){if(null==t)return e.__?ze(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return"function"!=typeof e.type||e.props.__P?null:ze(e)}function Oe(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Oe(e)}function Ie(e){(8&e.__g||!(e.__g|=8)||!ye.push(e)||we++)&&be==xe.debounceRendering||((be=xe.debounceRendering)||queueMicrotask)(Ue)}function Ue(){var e,t,n,i,r,o,a,l,s;try{for(t=1;ye.length;)ye.length>t&&ye.sort(ke),e=ye.shift(),t=ye.length,8&e.__g&&(i=void 0,r=void 0,o=(r=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=Ae({constructor:void 0},r)).__v=r.__v+1,xe.vnode&&xe.vnode(i),Ke(s,i,r,n.__n,s.namespaceURI,32&r.__u?[o]:null,a,o||ze(r),32&r.__u,l),i.__v=r.__v,i.__.__k[i.__i]=i,Je(a,i,l),r.__=r.__e=null,i.__e!=o&&Oe(i)))}finally{ye.length=we=0}}function We(e,t,n,i,r,o,a,l,s,c,p){var u,d,f,_,h,g,m=i.__k||Ee,x=t.length;for(s=function(e,t,n,i,r){var o,a,l,s,c,p,u,d,f,_,h=n.length,g=h,m=0,x=!1,v=e.__k=Array(r);for(o=0;o<r;o++)null!=(a=t[o])&&"boolean"!=typeof a&&"function"!=typeof a?("object"!=typeof a||a.constructor==String?a=v[o]=De(null,a):Pe(a)?a=v[o]=De(Ne,{children:a}):void 0===a.constructor&&a.__b?a=v[o]=De(a.type,a.props,a.key,a.ref,a.__v):v[o]=a,s=o+m,a.__=e,a.__b=e.__b+1,l=null,~(c=a.__i=Ve(a,n,s,g))&&(g--,(l=n[c])&&(l.__u|=2)),l&&l.__v?(a.__u|=2,c==s-1?m--:c==s+1?m++:c!=s&&(c>s?m--:m++,x=!0)):(~c||(r>h?m--:r<h&&m++),"function"!=typeof a.type&&(a.__u|=4))):v[o]=null;if(x){for(p=[],u=[],o=0;o<r;o++)if((a=v[o])&&2&a.__u){for(d=0,f=p.length;d<f;)p[_=d+f>>1]<a.__i?d=_+1:f=_;p[d]=a.__i,u[o]=d+1}for(m=p.length;o--;)u[o]&&(u[o]==m?m--:v[o].__u|=4)}if(g)for(o=0;o<h;o++)!(l=n[o])||2&l.__u||(l.__e==i&&(i=ze(l)),Xe(l,l));return i}(n,t,m,s,x),u=0;u<x;u++)null!=(f=n.__k[u])&&(d=~f.__i&&m[f.__i]||Me,f.__i=u,g=Ke(e,f,d,r,o,a,l,s,c,p),_=f.__e,(d.ref!=f.ref||8&d.__u)&&(d.ref&&Ye(d.ref,null,f,d),f.ref&&p.push(f.ref,f.__c||_,f)),h=h||_,4&f.__u?(s=Be(f,s,e,!d.__v),d.__e&&(d.__e=null)):"function"==typeof f.type&&void 0!==g?s=g:_&&(s=_.nextSibling),f.__u&=-7);return n.__e=h,s}function Be(e,t,n,i){var r,o,a;if("function"==typeof e.type){if(e.props.__P)return t;if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&(r[o].__=e,t=Be(r[o],t,n,!1));return t}for(t&&!t.parentNode&&(t=ze(e))&&!t.parentNode&&(t=null),a=t;a&&8==a.nodeType;)a=a.nextSibling;for(e.__e!=a&&(!i&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t=t&&t.nextSibling)&&8==t.nodeType;);return t}function Ve(e,t,n,i){var r,o,a,l=e.key,s=e.type,c=t[n],p=c&&!(2&c.__u);if(null===c&&null==l||p&&l==c.key&&s==c.type)return n;if(i>+!!p)for(r=n-1,o=n+1;r>=0||o<t.length;)if((c=t[a=r>=0?r--:o++])&&!(2&c.__u)&&l==c.key&&s==c.type)return a;return-1}function je(e,t,n){n??(n=""),"-"==t[0]?e.setProperty(t,n):e[t]=n}function qe(e,t,n,i,r){var o,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||je(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||je(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])(e.__e||(e.__e={}))[t]=n,n&&i||(a=Te[t]||(Te[t]=function(e){return function(t){if(this.__e){var n=this.__e[e];if(null==t[Se])t[Se]=Ce++;else if(t[Se]<this.__a[e])return;return n(xe.event?xe.event(t):t)}}}(t)),(e.__a||(e.__a={}))[t]=Ce,o=t!=(t=t.replace(Le,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),n?e.addEventListener(t,a,o):e.removeEventListener(t,a,o));else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch{}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function Ke(e,t,n,i,r,o,a,l,s,c){var p,u,d,f,_,h,g,m,x,v,y,b,w,k,S,L,C,T,M,E,R=t.type;if(void 0!==t.constructor)return null;if(128&n.__u&&(s=32&n.__u,p=n.__c.__z)){if(t.__u|=s,u=o=[],8==p.nodeType)for(d=1,f=p.nextSibling;f;f=f.nextSibling){if(8==f.nodeType)if(f.data.startsWith("$s"))d++;else if(f.data.startsWith("/$s")&&! --d)break;o.push(f)}else o.push(p);l=o[0]}(p=xe.__b)&&p(t);e:if("function"==typeof R){_=a.length;try{if(v=t.props,y=(p=R.prototype)&&p.render,b=(p=R.contextType)&&i[p.__c],w=p?b?b.props.value:p.__:i,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1):(y?t.__c=h=new R(v,w):(t.__c=h=new Fe(v,w),h.constructor=R,h.render=Qe),b&&b.sub(h),h.state||(h.state={}),h.__n=i,h.__g|=8,h.__h=[],h.__k=[]),y&&(h.__s||(h.__s=h.state),R.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Ae({},h.__s)),Ae(h.__s,R.getDerivedStateFromProps(v,h.__s)))),g=h.props,m=h.state,h.__v=t,n.__c){if(y&&!R.getDerivedStateFromProps&&v!==g&&h.componentWillReceiveProps&&h.componentWillReceiveProps(v,w),t.__v==n.__v&&!(8&h.__g)||!(4&h.__g)&&h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(v,h.__s,w)){t.__v!=n.__v&&(h.props=v,h.state=h.__s,h.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),Ee.push.apply(h.__h,h.__k),h.__k=[],h.__h.length&&a.push(h),l=ze(n);break e}h.componentWillUpdate&&h.componentWillUpdate(v,h.__s,w),y&&h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(g,m,x)})}else y&&!R.getDerivedStateFromProps&&h.componentWillMount&&h.componentWillMount(),y&&h.componentDidMount&&h.__h.push(h.componentDidMount);if(h.context=w,h.props=v,h.__P=e,h.__g&=-5,k=xe.__r,S=0,y)h.state=h.__s,h.__g&=-9,k&&k(t),p=h.render(h.props,h.state,h.context),Ee.push.apply(h.__h,h.__k),h.__k=[];else do{h.__g&=-9,k&&k(t),p=h.render(h.props,h.state,h.context),h.state=h.__s}while(8&h.__g&&++S<25);h.state=h.__s,h.getChildContext&&(i=Ae({},i,h.getChildContext())),y&&n.__c&&h.getSnapshotBeforeUpdate&&(x=h.getSnapshotBeforeUpdate(g,m)),L=p&&p.type===Ne&&null==p.key?p.props.children:p,v.__P&&(p=l,r=(e=v.__P).namespaceURI,s=o=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&Xe(e,e)}),n.__k=null),l=n.__k?ze(n,0):null),l=We(e,Pe(L)?L:[L],t,n,i,r,o,a,l,s,c),v.__P&&(t.__e=null,l=p),t.__u&=-161,128&n.__u&&(h.__z=null),u&&u.some(He),h.__h.length&&a.push(h),1&h.__g&&(h.__g&=-4)}catch(e){if(a.length=_,t.__v=null,s||o)if(e.then){if(C=0,t.__u|=s?160:128,o){for(~(M=o.indexOf(l||void 0))||(M=o.length);(E=o[M-1])&&8==E.nodeType;)M--;for(;M<o.length;M++)if(E=o[M])if(o[M]=null,8==E.nodeType){if(E.data.startsWith("$s"))C++||(T=E);else if(C&&E.data.startsWith("/$s")&&! --C){l=E;break}}else if(!C)break}if(!T){for(;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;T=l}t.__c.__z||(t.__c.__z=T),t.__e=l}else o&&o.some(He);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),e.then||Ge(t),xe.__e(e,t,n)}}else l=t.__e=function(e,t,n,i,r,o,a,l,s,c){var p,u,d,f,_,h,g,m,x,v=n.props||Me,y=t.props,b=t.type;if("svg"==b?r="http://www.w3.org/2000/svg":"math"==b?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o)for(p=0;p<o.length;p++)if((_=o[p])&&(b?_.localName==b:3==_.nodeType)){e=_,o[p]=null;break}if(!e){if(m=c.ownerDocument||document,!b)return m.createTextNode(y);e=m.createElementNS(r,b,y.is&&y),l&&(xe.__m&&xe.__m(t,o),l=!1),o=null}if(b){if(c="template"==b?e.content:e,o="textarea"==b&&null!=y.defaultValue?null:o&&$e.call(c.childNodes),!l&&o)for(v={},p=0;p<e.attributes.length;p++)v[(_=e.attributes[p]).name]=_.value;for(p in v)_=v[p],"dangerouslySetInnerHTML"==p?d=_:"children"==p||p in y||"value"==p&&"defaultValue"in y||"checked"==p&&"defaultChecked"in y||qe(e,p,null,_,r);for(p in x=1&n.__u,y)_=y[p],"children"==p?f=_:"dangerouslySetInnerHTML"==p?u=_:"value"==p?h=_:"checked"==p?g=_:l&&"function"!=typeof _||!(v[p]!==_||x&&null!=_)||qe(e,p,_,v[p],r);u?(l||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[]):(d&&(e.textContent=""),("foreignObject"==b||"http://www.w3.org/1998/Math/MathML"==r&&Re.test(b))&&(r="http://www.w3.org/1999/xhtml"),We(c,Pe(f)?f:[f],t,n,i,r,o,a,o?o[0]:n.__k&&ze(n,0),l,s),o&&o.some(He)),l&&"textarea"!=b||(p="value","progress"==b&&null==h?e.removeAttribute(p):null==h||h===e[p]&&("progress"!=b||h)||qe(e,p,h,v[p],r),p="checked",null!=g&&g!=e[p]&&qe(e,p,g,v[p],r))}else v===y||l&&e.data==y||(e.data=y);return e}(n.__e,t,n,i,r,o,a,s,c,e);return(p=xe.diffed)&&p(t),128&t.__u?void 0:l}function Ge(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Ge))}function Je(e,t,n){for(var i=0;i<n.length;)Ye(n[i++],n[i++],n[i++]);xe.__c&&xe.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){xe.__e(e,t.__v)}})}function Ye(e,t,n,i){try{"function"==typeof e?t?t.__x=e(t)||1:i&&(i=i.__c||i.__e)&&(t=i.__x)&&(i.__x=null,"function"==typeof t?t():e(null)):e.current=t}catch(e){xe.__e(e,n)}}function Xe(e,t,n){var i,r;if(xe.unmount&&xe.unmount(e),!(i=e.ref)||i.current&&i.current!=e.__e||Ye(i,null,t,e),i=e.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){xe.__e(e,t)}i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Xe(i[r],t,"function"!=typeof e.type||n&&!e.props.__P);(i=e.__e)&&(n||He(i),i.__e&&(i.__e=null)),e.__e=e.__c=e.__=null}function Qe(e,t,n){return this.constructor(e,n)}xe={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!(1&r.__g)){r.__g|=4;try{if((o=r.constructor)&&o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),a=8&r.__g),r.componentDidCatch&&(r.componentDidCatch(e,i||{}),a=8&r.__g),a)return void(r.__g|=2)}catch(t){e=t,a=0}}throw we=0,e}},ve=0,Fe.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=Ae({},this.state)),"function"==typeof e&&(e=e(Ae({},n),this.props)),e&&(Ae(n,e),this.__v&&(t&&this.__k.push(t),Ie(this)))},Fe.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Ie(this))},Fe.prototype.render=Ne,ye=[],we=0,ke=function(e,t){return e.__v.__b-t.__v.__b},Se=Symbol(),Le=/(PointerCapture)$|Capture$/i,Ce=0,Te={};var Ze,et,tt,nt,it=Object.is,rt=0,ot=[],at=[],lt=xe,st=lt.__b,ct=lt.__r,pt=lt.diffed,ut=lt.__c,dt=lt.unmount,ft=lt.__;function _t(e,t){lt.__h&<.__h(et,e,rt||t),rt=0;var n=et.__H||(et.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ht(e){return rt=1,function(e,t){var n=_t(Ze++,2);if(n.t=e,!n.__c&&(n.__=[Ct(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],i=n.t(t,e);it(t,i)||(n.__N=[i,n.__[1]],n.__c.setState({}))}],n.__c=et,!et.__f)){et.__f=!0;var i=et.shouldComponentUpdate;et.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var o=!1,a=this.props!=e;if(r.__.some(function(e){e.__N&&(o=!0,it(e.__[0],e.__N[0])||(a=!0))}),i){var l=i.call(this,e,t,n);return o?l||a:l}return!o||a}}return n.__}(Ct,e)}function gt(e,t){var n=_t(Ze++,3);!lt.__s&&Lt(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,et.__H.__h.push(n))}function mt(e,t){var n=_t(Ze++,4);!lt.__s&&Lt(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,et.__h.push(n))}function xt(e){return rt=5,function(e,t){var n=_t(Ze++,7);return Lt(n.__H,t)&&(n.__=e(),n.__H=t),n.__}(function(){return{current:e}},[])}function vt(){var e;do{for(;e=at.shift();)try{kt(e)}catch(t){lt.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=ot.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(kt),t.__h.some(St),t.__h=[]}catch(n){t.__h=[],lt.__e(n,e.__v)}}}while(at.length)}lt.__b=function(e){et=null,st&&st(e)},lt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ft&&ft(e,t)},lt.__r=function(e){ct&&ct(e),Ze=0;var t=(et=e.__c).__H;t&&(tt==et?et.__h=[]:(t.__h.some(kt),t.__h.some(St),Ze=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),tt=et},lt.diffed=function(e){pt&&pt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&wt(ot.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),tt=et=null},lt.__c=function(e,t){t.some(function(e){try{e.__h.some(kt),e.__h=e.__h.filter(function(e){return!e.__||St(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],lt.__e(n,e.__v)}}),ut&&ut(e,t)},lt.unmount=function(e){dt&&dt(e);var t,n,i=e.__c;i&&i.__H&&(i.__H.__.some(function(i){try{if(i.__P&&i.__c){if(void 0===n){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}i.__P=n,wt(at.push(i))}else kt(i)}catch(e){t=e}}),i.__H=void 0,t&<.__e(t,i.__v))};var yt="function"==typeof requestAnimationFrame;function bt(e){var t,n=function(){clearTimeout(i),yt&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);yt&&(t=requestAnimationFrame(n))}function wt(e){1!=e&&nt==lt.requestAnimationFrame||((nt=lt.requestAnimationFrame)||bt)(vt)}function kt(e){var t=et,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),et=t}function St(e){var t=et;e.__c=e.__(),et=t}function Lt(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!it(t,e[n])})}function Ct(e,t){return"function"==typeof t?t(e):t}let Tt={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{}}},Mt=()=>matchMedia("(prefers-reduced-motion: reduce)").matches;function Et(e,t,n="en"){return e?e[t]??e[t.split("-")[0]]??e[n]??Object.values(e)[0]??"":""}let Rt=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`};function Pt(e){let t=Number.parseInt(e.slice(1),16),n=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,i=.2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(255&t);return 1.05/(i+.05)>=(i+.05)/.0595?"#ffffff":"#151823"}let $t=e=>e+(crypto.randomUUID?crypto.randomUUID().replace(/-/g,""):Math.random().toString(36).slice(2)+Date.now().toString(36));let At={x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',play:'<path d="M5 5a2 2 0 0 1 3-1.7l12 7a2 2 0 0 1 0 3.5l-12 7A2 2 0 0 1 5 19z"/>',"volume-2":'<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.4 18.4a9 9 0 0 0 0-12.7"/>',"volume-x":'<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="m16.5 14.5 5-5"/><path d="m16.5 9.5 5 5"/>',check:'<path d="M20 6 9 17l-5-5"/>',"maximize-2":'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',"arrow-right":'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',"rotate-ccw":'<path d="M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"/><path d="M3 3v5h5"/>',"external-link":'<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',"ps-launcher":'<path d="M12 21a9 9 0 1 0-8-5L3 21l5-.9A9 9 0 0 0 12 21z"/><path d="M10 9v6l5-3z"/>',"ps-level-up":'<path d="M3 21h5v-4h5v-4h5V9"/><path d="M18 9V3l4 2.5L18 8"/>',"ps-guide":'<rect x="4" y="3" width="4" height="18" rx="2"/><path d="M12 5.5v10l7.5-5z"/>'};var Ht=0;function Dt(e,t,n,i,r,o){t||(t={});var a,l,s=t;if("ref"in s&&"function"!=typeof e)for(l in s={},t)"ref"==l?a=t[l]:s[l]=t[l];var c={type:e,props:s,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ht,__i:-1,__u:0};return(r||o)&&(c.__source=r,c.__self=o),xe.vnode&&xe.vnode(c),c}function Nt({name:e}){return Dt("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",dangerouslySetInnerHTML:{__html:At[e]}})}Array.isArray;let Ft=e=>e.options.locale??navigator.language??"en",zt=(e,t)=>Et(t.name,Ft(e),t.locale_default)||t.id;function Ot({ctx:e,guide:t,index:n,reduced:i,clip:r,big:o,onExpand:a,onDuration:l}){let s=t.steps[n],c=xt(null),[p,u]=ht(!0),[d,f]=ht(!i&&"embed"!==r.source),[_,h]=ht(r.duration_ms??0),g=i=>e.emit({type:i,guide_id:t.id,guide_version:t.version,step_id:s.id,step_index:n,clip_id:"hosted"===r.source?r.clip_id:void 0,clip_source:r.source}),m=e=>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}(`${e}|${r.url}`)&&g(e);if(gt(()=>{let e=c.current;e&&d&&(e.muted=p,e.play()?.catch(()=>{}))},[d,r.url]),gt(()=>l(d&&"embed"!==r.source?_:0),[_,d]),"embed"===r.source){let t=function(e){try{let t,n=new URL(e),i=n.hostname.replace(/^(www|m)\./,"");if("youtu.be"===i?t=n.pathname.slice(1):"youtube.com"===i&&(t=n.searchParams.get("v")??n.pathname.match(/^\/(?:embed|shorts)\/([\w-]+)/)?.[1]),t)return{src:`https://www.youtube-nocookie.com/embed/${t}?autoplay=1&rel=0`,thumb:`https://i.ytimg.com/vi/${t}/hqdefault.jpg`};if(t="vimeo.com"===i||"player.vimeo.com"===i?n.pathname.match(/(\d{5,})/)?.[1]:null,t)return{src:`https://player.vimeo.com/video/${t}?autoplay=1`}}catch{}return null}(r.url),n=new URL(r.url).hostname.replace(/^www\./,"");return Dt("div",{class:"clip embed",children:d&&t?Dt("iframe",{src:t.src,title:`Video: ${Et(s.title,Ft(e))}`,allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowFullScreen:!0}):Dt(Ne,{children:[(r.poster??t?.thumb)&&Dt("img",{src:r.poster??t?.thumb,alt:""}),Dt("button",{class:"play","aria-label":"Play video",onClick:()=>(f(!0),g("clip_played")),children:Dt(Nt,{name:"play"})}),Dt("div",{class:"bar",children:Dt("span",{class:"pill",children:[Dt(Nt,{name:"external-link"}),n,_?` · ${Rt(_)}`:""]})})]})})}return Dt("div",{class:"clip",children:[d?Dt("video",{ref:c,src:r.url,poster:r.poster,muted:p,loop:!0,autoplay:!0,playsInline:!0,preload:"auto","aria-label":`Clip: ${Et(s.title,Ft(e))}`,onLoadedData:()=>m("clip_loaded"),onPlaying:()=>m("clip_played"),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&h(1e3*t)}}):Dt(Ne,{children:[r.poster&&Dt("img",{src:r.poster,alt:""}),Dt("button",{class:"play","aria-label":"Play clip",onClick:()=>f(!0),children:Dt(Nt,{name:"play"})})]}),d&&Dt("div",{class:"bar",children:[Dt("span",{class:"pill",children:[Dt(Nt,{name:"play"}),_?`${Rt(_)} loop`:"Loop"]}),Dt("button",{class:"round","aria-label":p?"Unmute clip":"Mute clip",onClick:()=>{u(!p),c.current&&(c.current.muted=!p),p&&g("clip_unmuted")},children:Dt(Nt,{name:p?"volume-x":"volume-2"})}),Dt("button",{class:"round","aria-label":o?"Shrink clip":"Expand clip","aria-pressed":o,onClick:a,children:Dt(Nt,{name:"maximize-2"})})]})]})}function It({ctx:e,guide:t,index:n,reduced:i,cardRef:r,style:o}){let a=t.steps[n],l=t.steps.length,[s,c]=ht(!1),[p,u]=ht(0),d=n=>Et(n,Ft(e),t.locale_default),f="next_button"===a.complete_on.type;return gt(()=>{c(!1);let e=t.steps[n+1]?.clip;if(e&&"embed"!==e.source&&!i&&!navigator.connection?.saveData){let t=document.createElement("video");t.preload="auto",t.muted=!0,t.src=e.url}},[t.id,n]),Dt("div",{ref:r,class:"card"+(s?" big":""),style:o,role:"dialog","aria-modal":"false","aria-labelledby":"ps-title","aria-describedby":"ps-text",tabIndex:-1,"data-step":a.id,children:[a.clip&&Dt(Ot,{ctx:e,guide:t,index:n,reduced:i,clip:a.clip,big:s,onExpand:()=>c(!s),onDuration:u},a.id),Dt("div",{class:"body",children:[Dt("div",{class:"meta",children:[Dt("span",{children:["Step ",n+1," of ",l," · ",zt(e,t)]}),Dt("button",{class:"x","aria-label":"Close guide",onClick:()=>e.dispatch({type:"dismiss"}),children:Dt(Nt,{name:"x"})})]}),Dt("div",{class:"steps",role:"img","aria-label":`Step ${n+1} of ${l}`,children:t.steps.map((e,t)=>Dt("span",{class:"seg"+(t<n?" done":t===n?" cur"+(p&&!i?" anim":""):""),style:t===n&&p?{"--d":`${p}ms`}:void 0},t))}),Dt("h2",{class:"title",id:"ps-title",children:d(a.title)}),Dt("p",{class:"text",id:"ps-text",children:d(a.body)})]}),Dt("div",{class:"foot",children:[Dt("span",f?{class:"sp"}:{class:"wait",children:[Dt("span",{class:"pulse","aria-hidden":"true"}),"Waiting for you"]}),n>0&&"page"!==t.steps[n-1].complete_on.type&&!t.steps[n-1].skip_if_on&&Dt("button",{class:"btn gho",onClick:()=>e.dispatch({type:"back"}),children:"Back"}),f&&Dt("button",{class:"btn pri",onClick:()=>e.dispatch({type:"next"}),children:[n+1===l?"Done":"Next",Dt(Nt,{name:"arrow-right"})]})]})]})}let Ut=["width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)","width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)","width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)","width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)","width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)","width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)"];function Wt({ctx:e,guide:t}){let n=e.engine.launcherGuides().find(n=>n.id!==t.id&&"done"!==e.engine.progress.guides[n.id]?.status),i=xt(null);return gt(()=>i.current?.focus(),[]),Dt(Ne,{children:[Dt("div",{class:"scrim",onClick:()=>e.dispatch({type:"close"})}),Dt("div",{class:"cel",ref:i,role:"dialog","aria-modal":"true","aria-labelledby":"ps-cel",tabIndex:-1,children:[Dt("div",{class:"art","aria-hidden":"true",children:[Ut.map((e,t)=>Dt("span",{class:"bit",style:e},t)),Dt("span",{class:"tile",children:Dt(Nt,{name:"ps-level-up"})})]}),Dt("h2",{id:"ps-cel",children:"Level cleared"}),Dt("p",{children:["You finished ",zt(e,t),".",n?` Next up: ${zt(e,n)}.`:""]}),Dt("div",{class:"acts",children:[Dt("button",{class:"btn sec",onClick:()=>e.dispatch({type:"start",guide:t.id}),children:[Dt(Nt,{name:"rotate-ccw"}),"Replay"]}),Dt("button",n?{class:"btn pri",onClick:()=>e.dispatch({type:"start",guide:n.id}),children:["Next guide",Dt(Nt,{name:"arrow-right"})]}:{class:"btn pri",onClick:()=>e.dispatch({type:"close"}),children:"Done"})]})]})]})}function Bt({ctx:e,open:t,setOpen:n,near:i}){let r=xt(null);mt(()=>{let e=r.current;e&&(e.style.cssText="",i&&me(i,e,{strategy:"fixed",placement:"top-start",middleware:[_e(8),ge({padding:12}),he({padding:12})]}).then(({x:t,y:n})=>e.style.cssText=`left:${t}px;top:${n}px;right:auto;bottom:auto`))},[t,i]);let o=xt(null);gt(()=>{t?(o.current=e.root.activeElement??document.activeElement,r.current?.focus()):o.current?.focus()},[t]);let a=e.config.launcher,l=e.engine.launcherGuides();if(!l.length)return null;let s=e.engine.progress.guides,c=l.filter(e=>!s[e.id]).length,p="bottom-left"===a?.position?" left":"";return Dt(Ne,{children:[t&&Dt("div",{class:`panel${p}${a?.enabled?"":" solo"}`,ref:r,tabIndex:-1,role:"dialog","aria-label":"Guides",children:[Dt("button",{class:"x","aria-label":"Close guides",onClick:()=>n(!1),children:Dt(Nt,{name:"x"})}),Dt("h2",{children:Et(a?.title,Ft(e))||"Need a hand?"}),Dt("p",{children:Et(a?.description,Ft(e))||"Pick a guide and play it step by step."}),Dt("ul",{class:"rows",children:l.map(t=>{let i=s[t.id],r=t.steps.length,o="done"===i?.status,a="running"===i?.status;return Dt("li",{children:Dt("button",{class:"row",onClick:()=>{n(!1),i&&e.dispatch({type:"reset_progress",guide:t.id}),e.dispatch({type:"start",guide:t.id})},children:[Dt("span",{class:"ti"+(o?" mint":i?"":" spark"),children:Dt(Nt,{name:o?"check":"ps-guide"})}),Dt("span",{class:"rb",children:[Dt("span",{class:"rt",children:zt(e,t)}),Dt("span",{class:"rm",children:o?"Completed":a?`Step ${i.step+1} of ${r}`:`${r} steps`}),a&&Dt("span",{class:"prog","aria-hidden":"true",children:Dt("i",{style:{width:i.step/r*100+"%"}})})]}),Dt("span",i?{class:"rp",children:[Dt(Nt,{name:"rotate-ccw"}),"Replay"]}:{class:"new",children:"New"})]})},t.id)})}),l.some(e=>s[e.id])&&Dt("div",{class:"acts so",children:Dt("button",{class:"btn gho",onClick:()=>{e.dispatch({type:"reset_progress"}),e.engine.active?n(!1):r.current?.focus()},children:"Start over"})}),!1!==e.config.flags?.show_badge&&Dt("a",{class:"pb",href:"https://playstep.app/?ref=badge",target:"_blank",rel:"noopener",children:[Dt("span",{dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>'},style:"display:inline-flex;width:16px;height:16px"}),"Powered by PlayStep"]})]}),a?.enabled&&Dt("button",{class:`lb${p}`,"aria-label":t?"Close guides":"Open guides","aria-expanded":t,onClick:()=>n(!t),children:[Dt(Nt,{name:"ps-launcher"}),c>0&&!t&&Dt("span",{class:"cnt",children:c})]})]})}let Vt=e=>!!e?.getClientRects().length;function jt(e,t){let n=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{n||(n=t?[...document.querySelectorAll(t.css)].find(e=>Vt(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return Vt(n)?n:null}function qt({ctx:e,guide:t,index:n,reduced:i}){let r=t.steps[n],o=function(e,t,n){let[i,r]=ht(()=>e?jt(e,t):null);return gt(()=>{if(!e)return r(null);let i=jt(e,t);r(i);let o=0,a=()=>{o=0;let n=jt(e,t);n!==i&&r(i=n)},l=new MutationObserver(()=>o||(o=requestAnimationFrame(a)));l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-guide","hidden","style","class"]});let s=setTimeout(()=>!i&&n(e),3e3);return()=>{l.disconnect(),clearTimeout(s),cancelAnimationFrame(o)}},[e,t]),i}(r.anchor,r.find?.web,t=>e.dispatch({type:"anchor_missing",anchor:t})),a=xt(null);gt(()=>{if(!o)return;let t=t=>t.composedPath().includes(o)&&e.dispatch({type:"tap",anchor:r.anchor});return document.addEventListener("click",t,!0),()=>document.removeEventListener("click",t,!0)},[o]);let l=t.theme?.position??"bottom",s=function(e,t,n,i,r){let[o,a]=ht(null);return mt(()=>{let r=t.current;if(!r)return;if(!e){let e=()=>a({x:(innerWidth-r.offsetWidth)/2,y:"center"===i?(innerHeight-r.offsetHeight)/2:innerHeight-r.offsetHeight-24});e();let t=new ResizeObserver(e);return t.observe(r),addEventListener("resize",e),()=>{t.disconnect(),removeEventListener("resize",e)}}let o=e.getBoundingClientRect();(o.bottom<0||o.top>innerHeight)&&e.scrollIntoView({block:"center",behavior:Mt()?"auto":"smooth"});let l=()=>{let t=e.getBoundingClientRect(),i=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;me(e,r,{strategy:"fixed",placement:"auto"===n?"bottom":n,middleware:[_e(18),ge({fallbackPlacements:["top","left","right"],padding:12}),he({padding:12})]}).then(({x:e,y:n})=>a({x:e,y:n,spot:{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(i+6,(t.height+12)/2)}}))};l();let s=new ResizeObserver(l);s.observe(e),s.observe(r),addEventListener("scroll",l,{capture:!0,passive:!0}),addEventListener("resize",l);let c=setInterval(l,400);return()=>{s.disconnect(),clearInterval(c),removeEventListener("scroll",l,{capture:!0}),removeEventListener("resize",l)}},[e,i,n,...r]),o}(o,a,r.placement??"auto",l,[r.id]),c=xt("");gt(()=>{s&&c.current!==r.id&&(c.current=r.id,document.activeElement?.matches("input,textarea,select,[contenteditable]:not([contenteditable=false])")||a.current?.focus({preventScroll:!0}))},[r.id,s]);let[p,u]=ht(!1);gt(()=>{s&&!p&&requestAnimationFrame(()=>u(!0))},[s]),gt(()=>{let t=t=>{if("Tab"!==t.key||!a.current)return;let n=[...a.current.querySelectorAll('button,a,iframe,[tabindex="0"]')],i=t.composedPath().includes(a.current),r=n[0],l=n.at(-1),s=e.root.activeElement;i&&!t.shiftKey&&s===l?(t.preventDefault(),(o??r)?.focus()):i&&t.shiftKey&&s===r?(t.preventDefault(),(o??l)?.focus()):o&&document.activeElement===o&&(t.preventDefault(),(t.shiftKey?l:r)?.focus())};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[o]);let d=s?.spot;return Dt(Ne,{children:[o&&d?Dt("div",{class:"spot","aria-hidden":"true",style:{width:`${d.w}px`,height:`${d.h}px`,transform:`translate(${d.x}px,${d.y}px)`,borderRadius:`${d.r}px`}}):!o&&"center"===l&&Dt("div",{class:"scrim","aria-hidden":"true"}),Dt(It,{ctx:e,guide:t,index:n,reduced:i,cardRef:a,style:s?{transform:`translate(${Math.round(s.x)}px,${Math.round(s.y)}px)`,transition:p?void 0:"none"}:{visibility:"hidden"}})]})}function Kt({ctx:e,handle:t}){let[,n]=ht(0),[i,r]=ht(!1),[o,a]=ht(),l=Mt();t.update=()=>n(e=>e+1),t.openLauncher=t=>{let n=document.activeElement;a(t??(n!==document.body&&n!==e.root.host?n??void 0:void 0)),r(!0)},gt(()=>{let t=t=>{"Escape"===t.key&&(i?r(!1):e.engine.active&&e.dispatch({type:"completed"===e.engine.active.status?"close":"dismiss"}))};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[i]);let s=e.engine.active,c=s?.guide??e.engine.launcherGuides()[0],p=c?.theme?.mode??"auto",u="dark"===p||"auto"===p&&matchMedia("(prefers-color-scheme: dark)").matches;e.root.host.setAttribute("data-mode",u?"dark":"light");let d=c?.theme?.accent,f=d?{"--ps-accent":d,"--ps-accent-hover":d,"--ps-on-accent":Pt(d)}:void 0,_="running"===s?.status?s.guide.steps[s.index]:void 0;return Dt("div",{class:"l",style:f,children:[Dt(Bt,{ctx:e,open:i,setOpen:r,near:o}),!i&&"running"===s?.status&&Dt(qt,{ctx:e,guide:s.guide,index:s.index,reduced:l},s.guide.id),!i&&"completed"===s?.status&&Dt(Wt,{ctx:e,guide:s.guide}),Dt("div",{class:"sr","aria-live":"polite",children:_?`Step ${s.index+1} of ${s.guide.steps.length}: ${Et(_.title,Ft(e))}`:s?"Level cleared":""})]})}return e.findAnchor=jt,e.mount=function(e){let t=e.options,n=function(e){let t=function(){try{let e=sessionStorage.getItem("playstep:s");return e||sessionStorage.setItem("playstep:s",e=$t("s_")),e}catch{return $t("s_")}}(),n=Tt.get("d");n||Tt.set("d",n=$t("d_"));let i,r=n,o=!1,a=function(e){let t,n=[],i=e.send??((e,t)=>{navigator.sendBeacon&&navigator.sendBeacon(e,t)||fetch(e,{method:"POST",body:t,keepalive:!0,headers:{"content-type":"text/plain"}}).catch(()=>{})});function r(){clearTimeout(t),t=void 0;let r=e.envelope();if(n.length&&r)for(;n.length;)i(e.url,JSON.stringify({...r,events:n.splice(0,20)}))}return addEventListener("visibilitychange",()=>"hidden"===document.visibilityState&&r()),addEventListener("pagehide",r),{push(i){n.push(i),n.length>=20?r():t??(t=setTimeout(r,e.delayMs??2e3))},flush:r,get size(){return n.length}}}({url:e.url,send:e.send,envelope:()=>{let l=e.userId();return l&&l!==i?(o||(o=!0,async function(e){let t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,"0")).join("")}(`${e.appKey}:${l}`).then(e=>{i=l,r=`u_${e.slice(0,40)}`,o=!1,a.flush()})),null):(l||(r=n),{key:e.appKey,sdk:{name:e.sdk,version:e.version},platform:"web",session_id:t,user_key:r,preview:e.preview})}});return{session:t,push:e=>a.push(e.message?{...e,message:e.message.slice(0,300)}:e),flush:a.flush}}({appKey:t.appKey,url:t.eventsUrl,sdk:t.sdkName??"web",version:"0.3.0",preview:t.preview,userId:e.userId,send:t.transport});e.outbox.splice(0).forEach(n.push);let i=document.createElement("style");i.textContent=':host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-left:auto}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:99px;border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.bit{position:absolute;border-radius:99px}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.left{right:auto;left:24px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.panel{right:18px;bottom:86px}.solo{bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}',e.root.appendChild(i);let r=document.createElement("div");e.root.appendChild(r);let o={update:()=>{},openLauncher:()=>{},send:n.push};return function(e,t){var n,i,r,o;xe.__&&xe.__(e,t),9==t.nodeType&&(t=t.documentElement),i=(n=e&&32&e.__u)?null:t.__k,t.__k=De(Ne,{children:[e]}),r=[],o=[],Ke(t,t.__k,i||Me,Me,t.namespaceURI,i?null:t.firstChild?$e.call(t.childNodes):null,r,i?i.__e:t.firstChild,n,o),Je(r,t.__k,o),t.__k.props.children=null}(Dt(Kt,{ctx:e,handle:o}),r),o},e}({});
|
|
1
|
+
var __playstep_ui=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=Math.min,n=Math.max,i=Math.round,r=e=>({x:e,y:e}),o={left:"right",right:"left",bottom:"top",top:"bottom"};function a(e,i,r){return n(e,t(i,r))}function l(e,t){return"function"==typeof e?e(t):e}function s(e){return e.split("-")[0]}function c(e){return e.split("-")[1]}function p(e){return"x"===e?"y":"x"}function d(e){return"y"===e?"height":"width"}function u(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function f(e){return p(u(e))}function _(e,t,n){void 0===n&&(n=!1);let i=c(e),r=f(e),o=d(r),a="x"===r?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=w(a)),[a,w(a)]}function h(e){let t=w(e);return[g(e),t,g(t)]}function g(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let m=["left","right"],x=["right","left"],v=["top","bottom"],y=["bottom","top"];function b(e,t,n,i){let r=c(e),o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?x:m:t?m:x;case"left":case"right":return t?v:y;default:return[]}}(s(e),"start"===n,i);return r&&(o=o.map(e=>e+"-"+r),t&&(o=o.concat(o.map(g)))),o}function w(e){let t=s(e);return o[t]+e.slice(t.length)}function k(e){let{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function S(e,t,n){let i,{reference:r,floating:o}=e,a=u(t),l=f(t),p=d(l),_=s(t),h="y"===a,g=r.x+r.width/2-o.width/2,m=r.y+r.height/2-o.height/2,x=r[p]/2-o[p]/2;switch(_){case"top":i={x:g,y:r.y-o.height};break;case"bottom":i={x:g,y:r.y+r.height};break;case"right":i={x:r.x+r.width,y:m};break;case"left":i={x:r.x-o.width,y:m};break;default:i={x:r.x,y:r.y}}let v=c(t);return v&&(i[l]+=x*("end"===v?1:-1)*(n&&h?-1:1)),i}async function C(e,t){void 0===t&&(t={});let{x:n,y:i,platform:r,rects:o,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:u=!1,padding:f=0}=l(t,e),_=function(e){return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:function(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}(e)}(f),h=a[u?"floating"===d?"reference":"floating":d],g=k(await r.getClippingRect({element:await(null==r.isElement?void 0:r.isElement(h))??!0?h:h.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:p,strategy:s})),m="floating"===d?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,x=await(null==r.getOffsetParent?void 0:r.getOffsetParent(a.floating)),v=await(null==r.isElement?void 0:r.isElement(x))&&await(null==r.getScale?void 0:r.getScale(x))||{x:1,y:1},y=k(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:x,strategy:s}):m);return{top:(g.top-y.top+_.top)/v.y,bottom:(y.bottom-g.bottom+_.bottom)/v.y,left:(g.left-y.left+_.left)/v.x,right:(y.right-g.right+_.right)/v.x}}let L=new Set(["left","top"]);async function T(e,t){let{placement:n,platform:i,elements:r}=e,o=await(null==i.isRTL?void 0:i.isRTL(r.floating)),a=s(n),p=c(n),d="y"===u(n),f=L.has(a)?-1:1,_=o&&d?-1:1,h=l(t,e),{mainAxis:g,crossAxis:m,alignmentAxis:x}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return p&&"number"==typeof x&&(m="end"===p?-1*x:x),d?{x:m*_,y:g*f}:{x:g*f,y:m*_}}function M(){return typeof window<"u"}function R(e){return A(e)?(e.nodeName||"").toLowerCase():"#document"}function E(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function P(e){return((A(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function A(e){return!!M()&&(e instanceof Node||e instanceof E(e).Node)}function $(e){return!!M()&&(e instanceof Element||e instanceof E(e).Element)}function H(e){return!!M()&&(e instanceof HTMLElement||e instanceof E(e).HTMLElement)}function D(e){return!(!M()||typeof ShadowRoot>"u")&&(e instanceof ShadowRoot||e instanceof E(e).ShadowRoot)}function F(e){let{overflow:t,overflowX:n,overflowY:i,display:r}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&"inline"!==r&&"contents"!==r}function N(e){return/^(table|td|th)$/.test(R(e))}function z(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}let O,W=/transform|translate|scale|rotate|perspective|filter/,U=/paint|layout|strict|content/,B=e=>!!e&&"none"!==e;function I(e){let t=$(e)?q(e):e;return B(t.transform)||B(t.translate)||B(t.scale)||B(t.rotate)||B(t.perspective)||!j()&&(B(t.backdropFilter)||B(t.filter))||W.test(t.willChange||"")||U.test(t.contain||"")}function j(){return O??(O=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),O}function V(e){return/^(html|body|#document)$/.test(R(e))}function q(e){return E(e).getComputedStyle(e)}function K(e){return $(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function G(e){if("html"===R(e))return e;let t=e.assignedSlot||e.parentNode||D(e)&&e.host||P(e);return D(t)?t.host:t}function X(e){let t=G(e);return V(t)?(e.ownerDocument||e).body:H(t)&&F(t)?t:X(t)}function Y(e,t,n){void 0===t&&(t=[]),void 0===n&&(n=!0);let i=X(e),r=i===e.ownerDocument?.body,o=E(i);if(r){let e=J(o);return t.concat(o,o.visualViewport||[],F(i)?i:[],e&&n?Y(e):[])}return t.concat(i,Y(i,[],n))}function J(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Q(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,o=H(e),a=o?e.offsetWidth:n,l=o?e.offsetHeight:r,s=i(n)!==a||i(r)!==l;return s&&(n=a,r=l),{width:n,height:r,$:s}}function Z(e){return $(e)?e:e.contextElement}function ee(e){let t=Z(e);if(!H(t))return r(1);let n=t.getBoundingClientRect(),{width:o,height:a,$:l}=Q(t),s=(l?i(n.width):n.width)/o,c=(l?i(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}let te=r(0);function ne(e){let t=E(e);return j()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:te}function ie(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),a=Z(e),l=r(1);t&&(i?$(i)&&(l=ee(i)):l=ee(e));let s=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===E(e)}(a,n,i)?ne(a):r(0),c=(o.left+s.x)/l.x,p=(o.top+s.y)/l.y,d=o.width/l.x,u=o.height/l.y;if(a&&i){let e=E(a),t=$(i)?E(i):i,n=e,r=J(n);for(;r&&t!==n;){let e=ee(r),t=r.getBoundingClientRect(),i=q(r),o=t.left+(r.clientLeft+parseFloat(i.paddingLeft))*e.x,a=t.top+(r.clientTop+parseFloat(i.paddingTop))*e.y;c*=e.x,p*=e.y,d*=e.x,u*=e.y,c+=o,p+=a,n=E(r),r=J(n)}}return k({width:d,height:u,x:c,y:p})}function re(e,t){let n=K(e).scrollLeft;return t?t.left+n:ie(P(e)).left+n}function oe(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-re(e,n),y:n.top+t.scrollTop}}function ae(e){let t=K(e),i=e.ownerDocument.body,r=n(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=n(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),a=-t.scrollLeft+re(e),l=-t.scrollTop;return"rtl"===q(i).direction&&(a+=n(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:a,y:l}}function le(e,t,n){let i;if("viewport"===t||"layoutViewport"===t)i=function(e,t,n){void 0===n&&(n="viewport");let i="layoutViewport"===n,r=E(e),o=P(e),a=r.visualViewport,l=o.clientWidth,s=o.clientHeight,c=0,p=0;if(a){let e=!j()||"fixed"===t;i?e||(c=-a.offsetLeft,p=-a.offsetTop):(l=a.width,s=a.height,e&&(c=a.offsetLeft,p=a.offsetTop))}if(re(o)<=0){let e=o.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,r=Math.abs(o.clientWidth-t.clientWidth-i),a="stable both-edges"===getComputedStyle(o).scrollbarGutter?r/2:r;a<=25&&(l-=a)}return{width:l,height:s,x:c,y:p}}(e,n,t);else if("document"===t)i=ae(P(e));else if($(t))i=function(e,t){let n=ie(e,!0,"fixed"===t),i=n.top+e.clientTop,r=n.left+e.clientLeft,o=ee(e);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:r*o.x,y:i*o.y}}(t,n);else{let n=ne(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return k(i)}function se(e,t){let n=t.get(e);if(n)return n;let i=Y(e,[],!1).filter(e=>$(e)&&"body"!==R(e)),r=null,o="fixed"===q(e).position,a=o?G(e):e;for(;$(a)&&!V(a);){let e=q(a),t=I(a),n=r?r.position:o?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?r=e:i=i.filter(e=>e!==a),a=G(a)}return t.set(e,i),i}function ce(e,t,n){let i=H(t),o=P(t),a="fixed"===n,l=ie(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=r(0);if((i||!a)&&(("body"!==R(t)||F(o))&&(s=K(t)),i)){let e=ie(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!i&&o&&(c.x=re(o));let p=!o||i||a?r(0):oe(o,s);return{x:l.left+s.scrollLeft-c.x-p.x,y:l.top+s.scrollTop-c.y-p.y,width:l.width,height:l.height}}function pe(e){return"static"===q(e).position}function de(e,t){if(!H(e)||"fixed"===q(e).position)return null;if(t)return t(e);let n=e.offsetParent;return P(e)===n&&(n=n.ownerDocument.body),n}function ue(e,t){let n=E(e);if(z(e))return n;if(!H(e)){let t=G(e);for(;t&&!V(t);){if($(t)&&!pe(t))return t;t=G(t)}return n}let i=de(e,t);for(;i&&N(i)&&pe(i);)i=de(i,t);return i&&V(i)&&pe(i)&&!I(i)?n:i||function(e){let t=G(e);for(;H(t)&&!V(t);){if(I(t))return t;if(z(t))return null;t=G(t)}return null}(e)||n}let fe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e,a="fixed"===o,l=P(i),s=!!t&&z(t.floating);if(i===l||s&&a)return n;let c={scrollLeft:0,scrollTop:0},p=r(1),d=r(0),u=H(i);if((u||!a)&&(("body"!==R(i)||F(l))&&(c=K(i)),u)){let e=ie(i);p=ee(i),d.x=e.x+i.clientLeft,d.y=e.y+i.clientTop}let f=!l||u||a?r(0):oe(l,c);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-c.scrollLeft*p.x+d.x+f.x,y:n.y*p.y-c.scrollTop*p.y+d.y+f.y}},getDocumentElement:P,getClippingRect:function(e){let{element:i,boundary:r,rootBoundary:o,strategy:a}=e,l=[..."clippingAncestors"===r?z(i)?[]:se(i,this._c):[].concat(r),o],s=le(i,l[0],a),c=s.top,p=s.right,d=s.bottom,u=s.left;for(let e=1;e<l.length;e++){let r=le(i,l[e],a);c=n(r.top,c),p=t(r.right,p),d=t(r.bottom,d),u=n(r.left,u)}return{width:p-u,height:d-c,x:u,y:c}},getOffsetParent:ue,getElementRects:async function(e){let t=this.getOffsetParent||ue,n=this.getDimensions,i=await n(e.floating);return{reference:ce(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){let{width:t,height:n}=Q(e);return{width:t,height:n}},getScale:ee,isElement:$,isRTL:function(e){return"rtl"===q(e).direction}},_e=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n;let{x:i,y:r,placement:o,middlewareData:a}=t,l=await T(t,e);return o===a.offset?.placement&&null!=(n=a.arrow)&&n.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:o}}}}},he=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:i,placement:r,platform:o}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:d={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=l(e,t),_={x:n,y:i},h=await o.detectOverflow(t,f),g=u(r),m=p(g),x=_[m],v=_[g],y=(e,t)=>a(t+h["y"===e?"top":"left"],t,t-h["y"===e?"bottom":"right"]);s&&(x=y(m,x)),c&&(v=y(g,v));let b=d.fn({...t,[m]:x,[g]:v});return{...b,data:{x:b.x-n,y:b.y-i,enabled:{[m]:s,[g]:c}}}}}},ge=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;let{placement:i,middlewareData:r,rects:o,initialPlacement:a,platform:c,elements:p}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...y}=l(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};let k=s(i),S=u(a),C=s(a)===a,L=await(null==c.isRTL?void 0:c.isRTL(p.floating)),T=g||(C||!v?[w(a)]:h(a)),M="none"!==x;!g&&M&&T.push(...b(a,v,x,L));let R=[a,...T],E=await c.detectOverflow(t,y),P=[],A=r.flip?.overflows||[];if(d&&P.push(E[k]),f){let e=_(i,o,L);P.push(E[e[0]],E[e[1]])}if(A=[...A,{placement:i,overflows:P}],!P.every(e=>e<=0)){let e=(r.flip?.index||0)+1,t=R[e];if(t&&("alignment"!==f||S===u(t)||A.every(e=>u(e.placement)!==S||e.overflows[0]>0)))return{data:{index:e,overflows:A},reset:{placement:t}};let n=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(m){case"bestFit":{let e=A.filter(e=>{if(M){let t=u(e.placement);return t===S||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},me=(e,t,n)=>{let i=new Map,r=n??{},o={...fe,...r.platform,_c:i};return(async(e,t,n)=>{let{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:C},s=await(null==a.isRTL?void 0:a.isRTL(t)),c=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:p,y:d}=S(c,i,s),u=i,f=0,_={};for(let n=0;n<o.length;n++){let h=o[n];if(!h)continue;let{name:g,fn:m}=h,{x:x,y:v,data:y,reset:b}=await m({x:p,y:d,initialPlacement:i,placement:u,strategy:r,middlewareData:_,rects:c,platform:l,elements:{reference:e,floating:t}});p=x??p,d=v??d,_[g]={..._[g],...y},b&&f<50&&(f++,"object"==typeof b&&(b.placement&&(u=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:r}):b.rects),({x:p,y:d}=S(c,u,s))),n=-1)}return{x:p,y:d,placement:u,strategy:r,middlewareData:_}})(e,t,{...r,platform:o})};var xe,ve,ye,be,we,ke,Se,Ce,Le,Te,Me={},Re=[],Ee=/^m(i|n|o|s|text|space)$/,Pe=Array.isArray,Ae=Re.slice,$e=Object.assign;function He(e){e&&e.parentNode&&e.remove()}function De(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r||++ve,__i:-1,__u:0};return!r&&xe.vnode&&xe.vnode(o),o}function Fe(e){return e.children}function Ne(e,t){this.props=e,this.context=t,this.__g=0}function ze(e,t){if(null==t)return e.__?ze(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return"function"!=typeof e.type||e.props.__P?null:ze(e)}function Oe(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Oe(e)}function We(e){(8&e.__g||!(e.__g|=8)||!ye.push(e)||we++)&&be==xe.debounceRendering||((be=xe.debounceRendering)||queueMicrotask)(Ue)}function Ue(){var e,t,n,i,r,o,a,l,s;try{for(t=1;ye.length;)ye.length>t&&ye.sort(ke),e=ye.shift(),t=ye.length,8&e.__g&&(i=void 0,r=void 0,o=(r=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=$e({constructor:void 0},r)).__v=r.__v+1,xe.vnode&&xe.vnode(i),Ke(s,i,r,n.__n,s.namespaceURI,32&r.__u?[o]:null,a,o||ze(r),32&r.__u,l),i.__v=r.__v,i.__.__k[i.__i]=i,Xe(a,i,l),r.__=r.__e=null,i.__e!=o&&Oe(i)))}finally{ye.length=we=0}}function Be(e,t,n,i,r,o,a,l,s,c,p){var d,u,f,_,h,g,m=i.__k||Re,x=t.length;for(s=function(e,t,n,i,r){var o,a,l,s,c,p,d,u,f,_,h=n.length,g=h,m=0,x=!1,v=e.__k=Array(r);for(o=0;o<r;o++)null!=(a=t[o])&&"boolean"!=typeof a&&"function"!=typeof a?("object"!=typeof a||a.constructor==String?a=v[o]=De(null,a):Pe(a)?a=v[o]=De(Fe,{children:a}):void 0===a.constructor&&a.__b?a=v[o]=De(a.type,a.props,a.key,a.ref,a.__v):v[o]=a,s=o+m,a.__=e,a.__b=e.__b+1,l=null,~(c=a.__i=je(a,n,s,g))&&(g--,(l=n[c])&&(l.__u|=2)),l&&l.__v?(a.__u|=2,c==s-1?m--:c==s+1?m++:c!=s&&(c>s?m--:m++,x=!0)):(~c||(r>h?m--:r<h&&m++),"function"!=typeof a.type&&(a.__u|=4))):v[o]=null;if(x){for(p=[],d=[],o=0;o<r;o++)if((a=v[o])&&2&a.__u){for(u=0,f=p.length;u<f;)p[_=u+f>>1]<a.__i?u=_+1:f=_;p[u]=a.__i,d[o]=u+1}for(m=p.length;o--;)d[o]&&(d[o]==m?m--:v[o].__u|=4)}if(g)for(o=0;o<h;o++)!(l=n[o])||2&l.__u||(l.__e==i&&(i=ze(l)),Je(l,l));return i}(n,t,m,s,x),d=0;d<x;d++)null!=(f=n.__k[d])&&(u=~f.__i&&m[f.__i]||Me,f.__i=d,g=Ke(e,f,u,r,o,a,l,s,c,p),_=f.__e,(u.ref!=f.ref||8&u.__u)&&(u.ref&&Ye(u.ref,null,f,u),f.ref&&p.push(f.ref,f.__c||_,f)),h=h||_,4&f.__u?(s=Ie(f,s,e,!u.__v),u.__e&&(u.__e=null)):"function"==typeof f.type&&void 0!==g?s=g:_&&(s=_.nextSibling),f.__u&=-7);return n.__e=h,s}function Ie(e,t,n,i){var r,o,a;if("function"==typeof e.type){if(e.props.__P)return t;if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&(r[o].__=e,t=Ie(r[o],t,n,!1));return t}for(t&&!t.parentNode&&(t=ze(e))&&!t.parentNode&&(t=null),a=t;a&&8==a.nodeType;)a=a.nextSibling;for(e.__e!=a&&(!i&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t=t&&t.nextSibling)&&8==t.nodeType;);return t}function je(e,t,n,i){var r,o,a,l=e.key,s=e.type,c=t[n],p=c&&!(2&c.__u);if(null===c&&null==l||p&&l==c.key&&s==c.type)return n;if(i>+!!p)for(r=n-1,o=n+1;r>=0||o<t.length;)if((c=t[a=r>=0?r--:o++])&&!(2&c.__u)&&l==c.key&&s==c.type)return a;return-1}function Ve(e,t,n){n??(n=""),"-"==t[0]?e.setProperty(t,n):e[t]=n}function qe(e,t,n,i,r){var o,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Ve(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Ve(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])(e.__e||(e.__e={}))[t]=n,n&&i||(a=Te[t]||(Te[t]=function(e){return function(t){if(this.__e){var n=this.__e[e];if(null==t[Se])t[Se]=Le++;else if(t[Se]<this.__a[e])return;return n(xe.event?xe.event(t):t)}}}(t)),(e.__a||(e.__a={}))[t]=Le,o=t!=(t=t.replace(Ce,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),n?e.addEventListener(t,a,o):e.removeEventListener(t,a,o));else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch{}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function Ke(e,t,n,i,r,o,a,l,s,c){var p,d,u,f,_,h,g,m,x,v,y,b,w,k,S,C,L,T,M,R,E=t.type;if(void 0!==t.constructor)return null;if(128&n.__u&&(s=32&n.__u,p=n.__c.__z)){if(t.__u|=s,d=o=[],8==p.nodeType)for(u=1,f=p.nextSibling;f;f=f.nextSibling){if(8==f.nodeType)if(f.data.startsWith("$s"))u++;else if(f.data.startsWith("/$s")&&! --u)break;o.push(f)}else o.push(p);l=o[0]}(p=xe.__b)&&p(t);e:if("function"==typeof E){_=a.length;try{if(v=t.props,y=(p=E.prototype)&&p.render,b=(p=E.contextType)&&i[p.__c],w=p?b?b.props.value:p.__:i,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1):(y?t.__c=h=new E(v,w):(t.__c=h=new Ne(v,w),h.constructor=E,h.render=Qe),b&&b.sub(h),h.state||(h.state={}),h.__n=i,h.__g|=8,h.__h=[],h.__k=[]),y&&(h.__s||(h.__s=h.state),E.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=$e({},h.__s)),$e(h.__s,E.getDerivedStateFromProps(v,h.__s)))),g=h.props,m=h.state,h.__v=t,n.__c){if(y&&!E.getDerivedStateFromProps&&v!==g&&h.componentWillReceiveProps&&h.componentWillReceiveProps(v,w),t.__v==n.__v&&!(8&h.__g)||!(4&h.__g)&&h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(v,h.__s,w)){t.__v!=n.__v&&(h.props=v,h.state=h.__s,h.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),Re.push.apply(h.__h,h.__k),h.__k=[],h.__h.length&&a.push(h),l=ze(n);break e}h.componentWillUpdate&&h.componentWillUpdate(v,h.__s,w),y&&h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(g,m,x)})}else y&&!E.getDerivedStateFromProps&&h.componentWillMount&&h.componentWillMount(),y&&h.componentDidMount&&h.__h.push(h.componentDidMount);if(h.context=w,h.props=v,h.__P=e,h.__g&=-5,k=xe.__r,S=0,y)h.state=h.__s,h.__g&=-9,k&&k(t),p=h.render(h.props,h.state,h.context),Re.push.apply(h.__h,h.__k),h.__k=[];else do{h.__g&=-9,k&&k(t),p=h.render(h.props,h.state,h.context),h.state=h.__s}while(8&h.__g&&++S<25);h.state=h.__s,h.getChildContext&&(i=$e({},i,h.getChildContext())),y&&n.__c&&h.getSnapshotBeforeUpdate&&(x=h.getSnapshotBeforeUpdate(g,m)),C=p&&p.type===Fe&&null==p.key?p.props.children:p,v.__P&&(p=l,r=(e=v.__P).namespaceURI,s=o=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&Je(e,e)}),n.__k=null),l=n.__k?ze(n,0):null),l=Be(e,Pe(C)?C:[C],t,n,i,r,o,a,l,s,c),v.__P&&(t.__e=null,l=p),t.__u&=-161,128&n.__u&&(h.__z=null),d&&d.some(He),h.__h.length&&a.push(h),1&h.__g&&(h.__g&=-4)}catch(e){if(a.length=_,t.__v=null,s||o)if(e.then){if(L=0,t.__u|=s?160:128,o){for(~(M=o.indexOf(l||void 0))||(M=o.length);(R=o[M-1])&&8==R.nodeType;)M--;for(;M<o.length;M++)if(R=o[M])if(o[M]=null,8==R.nodeType){if(R.data.startsWith("$s"))L++||(T=R);else if(L&&R.data.startsWith("/$s")&&! --L){l=R;break}}else if(!L)break}if(!T){for(;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;T=l}t.__c.__z||(t.__c.__z=T),t.__e=l}else o&&o.some(He);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),e.then||Ge(t),xe.__e(e,t,n)}}else l=t.__e=function(e,t,n,i,r,o,a,l,s,c){var p,d,u,f,_,h,g,m,x,v=n.props||Me,y=t.props,b=t.type;if("svg"==b?r="http://www.w3.org/2000/svg":"math"==b?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o)for(p=0;p<o.length;p++)if((_=o[p])&&(b?_.localName==b:3==_.nodeType)){e=_,o[p]=null;break}if(!e){if(m=c.ownerDocument||document,!b)return m.createTextNode(y);e=m.createElementNS(r,b,y.is&&y),l&&(xe.__m&&xe.__m(t,o),l=!1),o=null}if(b){if(c="template"==b?e.content:e,o="textarea"==b&&null!=y.defaultValue?null:o&&Ae.call(c.childNodes),!l&&o)for(v={},p=0;p<e.attributes.length;p++)v[(_=e.attributes[p]).name]=_.value;for(p in v)_=v[p],"dangerouslySetInnerHTML"==p?u=_:"children"==p||p in y||"value"==p&&"defaultValue"in y||"checked"==p&&"defaultChecked"in y||qe(e,p,null,_,r);for(p in x=1&n.__u,y)_=y[p],"children"==p?f=_:"dangerouslySetInnerHTML"==p?d=_:"value"==p?h=_:"checked"==p?g=_:l&&"function"!=typeof _||!(v[p]!==_||x&&null!=_)||qe(e,p,_,v[p],r);d?(l||u&&(d.__html==u.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(u&&(e.textContent=""),("foreignObject"==b||"http://www.w3.org/1998/Math/MathML"==r&&Ee.test(b))&&(r="http://www.w3.org/1999/xhtml"),Be(c,Pe(f)?f:[f],t,n,i,r,o,a,o?o[0]:n.__k&&ze(n,0),l,s),o&&o.some(He)),l&&"textarea"!=b||(p="value","progress"==b&&null==h?e.removeAttribute(p):null==h||h===e[p]&&("progress"!=b||h)||qe(e,p,h,v[p],r),p="checked",null!=g&&g!=e[p]&&qe(e,p,g,v[p],r))}else v===y||l&&e.data==y||(e.data=y);return e}(n.__e,t,n,i,r,o,a,s,c,e);return(p=xe.diffed)&&p(t),128&t.__u?void 0:l}function Ge(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Ge))}function Xe(e,t,n){for(var i=0;i<n.length;)Ye(n[i++],n[i++],n[i++]);xe.__c&&xe.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){xe.__e(e,t.__v)}})}function Ye(e,t,n,i){try{"function"==typeof e?t?t.__x=e(t)||1:i&&(i=i.__c||i.__e)&&(t=i.__x)&&(i.__x=null,"function"==typeof t?t():e(null)):e.current=t}catch(e){xe.__e(e,n)}}function Je(e,t,n){var i,r;if(xe.unmount&&xe.unmount(e),!(i=e.ref)||i.current&&i.current!=e.__e||Ye(i,null,t,e),i=e.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){xe.__e(e,t)}i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Je(i[r],t,"function"!=typeof e.type||n&&!e.props.__P);(i=e.__e)&&(n||He(i),i.__e&&(i.__e=null)),e.__e=e.__c=e.__=null}function Qe(e,t,n){return this.constructor(e,n)}xe={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!(1&r.__g)){r.__g|=4;try{if((o=r.constructor)&&o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),a=8&r.__g),r.componentDidCatch&&(r.componentDidCatch(e,i||{}),a=8&r.__g),a)return void(r.__g|=2)}catch(t){e=t,a=0}}throw we=0,e}},ve=0,Ne.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=$e({},this.state)),"function"==typeof e&&(e=e($e({},n),this.props)),e&&($e(n,e),this.__v&&(t&&this.__k.push(t),We(this)))},Ne.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),We(this))},Ne.prototype.render=Fe,ye=[],we=0,ke=function(e,t){return e.__v.__b-t.__v.__b},Se=Symbol(),Ce=/(PointerCapture)$|Capture$/i,Le=0,Te={};var Ze,et,tt,nt,it=Object.is,rt=0,ot=[],at=[],lt=xe,st=lt.__b,ct=lt.__r,pt=lt.diffed,dt=lt.__c,ut=lt.unmount,ft=lt.__;function _t(e,t){lt.__h&<.__h(et,e,rt||t),rt=0;var n=et.__H||(et.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ht(e){return rt=1,function(e,t){var n=_t(Ze++,2);if(n.t=e,!n.__c&&(n.__=[Lt(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],i=n.t(t,e);it(t,i)||(n.__N=[i,n.__[1]],n.__c.setState({}))}],n.__c=et,!et.__f)){et.__f=!0;var i=et.shouldComponentUpdate;et.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var o=!1,a=this.props!=e;if(r.__.some(function(e){e.__N&&(o=!0,it(e.__[0],e.__N[0])||(a=!0))}),i){var l=i.call(this,e,t,n);return o?l||a:l}return!o||a}}return n.__}(Lt,e)}function gt(e,t){var n=_t(Ze++,3);!lt.__s&&Ct(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,et.__H.__h.push(n))}function mt(e,t){var n=_t(Ze++,4);!lt.__s&&Ct(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,et.__h.push(n))}function xt(e){return rt=5,function(e,t){var n=_t(Ze++,7);return Ct(n.__H,t)&&(n.__=e(),n.__H=t),n.__}(function(){return{current:e}},[])}function vt(){var e;do{for(;e=at.shift();)try{kt(e)}catch(t){lt.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=ot.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(kt),t.__h.some(St),t.__h=[]}catch(n){t.__h=[],lt.__e(n,e.__v)}}}while(at.length)}lt.__b=function(e){et=null,st&&st(e)},lt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ft&&ft(e,t)},lt.__r=function(e){ct&&ct(e),Ze=0;var t=(et=e.__c).__H;t&&(tt==et?et.__h=[]:(t.__h.some(kt),t.__h.some(St),Ze=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),tt=et},lt.diffed=function(e){pt&&pt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&wt(ot.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),tt=et=null},lt.__c=function(e,t){t.some(function(e){try{e.__h.some(kt),e.__h=e.__h.filter(function(e){return!e.__||St(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],lt.__e(n,e.__v)}}),dt&&dt(e,t)},lt.unmount=function(e){ut&&ut(e);var t,n,i=e.__c;i&&i.__H&&(i.__H.__.some(function(i){try{if(i.__P&&i.__c){if(void 0===n){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}i.__P=n,wt(at.push(i))}else kt(i)}catch(e){t=e}}),i.__H=void 0,t&<.__e(t,i.__v))};var yt="function"==typeof requestAnimationFrame;function bt(e){var t,n=function(){clearTimeout(i),yt&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);yt&&(t=requestAnimationFrame(n))}function wt(e){1!=e&&nt==lt.requestAnimationFrame||((nt=lt.requestAnimationFrame)||bt)(vt)}function kt(e){var t=et,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),et=t}function St(e){var t=et;e.__c=e.__(),et=t}function Ct(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!it(t,e[n])})}function Lt(e,t){return"function"==typeof t?t(e):t}let Tt=()=>matchMedia("(prefers-reduced-motion: reduce)").matches;function Mt(e,t,n="en"){return e?e[t]??e[t.split("-")[0]]??e[n]??Object.values(e)[0]??"":""}let Rt=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`};function Et(e){let t=Number.parseInt(e.slice(1),16),n=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,i=.2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(255&t);return 1.05/(i+.05)>=(i+.05)/.0595?"#ffffff":"#151823"}let Pt={x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',play:'<path d="M5 5a2 2 0 0 1 3-1.7l12 7a2 2 0 0 1 0 3.5l-12 7A2 2 0 0 1 5 19z"/>',"volume-2":'<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.4 18.4a9 9 0 0 0 0-12.7"/>',"volume-x":'<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="m16.5 14.5 5-5"/><path d="m16.5 9.5 5 5"/>',check:'<path d="M20 6 9 17l-5-5"/>',"maximize-2":'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',"arrow-right":'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',"rotate-ccw":'<path d="M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"/><path d="M3 3v5h5"/>',"external-link":'<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',"ps-launcher":'<path d="M12 21a9 9 0 1 0-8-5L3 21l5-.9A9 9 0 0 0 12 21z"/><path d="M10 9v6l5-3z"/>',"ps-level-up":'<path d="M3 21h5v-4h5v-4h5V9"/><path d="M18 9V3l4 2.5L18 8"/>',"ps-guide":'<rect x="4" y="3" width="4" height="18" rx="2"/><path d="M12 5.5v10l7.5-5z"/>'};var At=0;function $t(e,t,n,i,r,o){t||(t={});var a,l,s=t;if("ref"in s&&"function"!=typeof e)for(l in s={},t)"ref"==l?a=t[l]:s[l]=t[l];var c={type:e,props:s,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--At,__i:-1,__u:0};return(r||o)&&(c.__source=r,c.__self=o),xe.vnode&&xe.vnode(c),c}function Ht({name:e}){return $t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",dangerouslySetInnerHTML:{__html:Pt[e]}})}function Dt(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}Array.isArray;let Ft=e=>e.options.locale??navigator.language??"en",Nt=(e,t)=>Mt(t.name,Ft(e),t.locale_default)||t.id;function zt({ctx:e,guide:t,index:n,reduced:i,clip:r,big:o,onExpand:a,onDuration:l}){let s=t.steps[n],c=xt(null),[p,d]=ht(!0),[u,f]=ht(!i&&"embed"!==r.source),[_,h]=ht(r.duration_ms??0),g=i=>e.emit({type:i,guide_id:t.id,guide_version:t.version,step_id:s.id,step_index:n,clip_id:"hosted"===r.source?r.clip_id:void 0,clip_source:r.source}),m=e=>Dt(`${e}|${r.url}`)&&g(e);if(gt(()=>{let e=c.current;e&&u&&(e.muted=p,e.play()?.catch(()=>{}))},[u,r.url]),gt(()=>l(u&&"embed"!==r.source?_:0),[_,u]),"embed"===r.source){let t=function(e){try{let t,n=new URL(e),i=n.hostname.replace(/^(www|m)\./,"");if("youtu.be"===i?t=n.pathname.slice(1):"youtube.com"===i&&(t=n.searchParams.get("v")??n.pathname.match(/^\/(?:embed|shorts)\/([\w-]+)/)?.[1]),t)return{src:`https://www.youtube-nocookie.com/embed/${t}?autoplay=1&rel=0`,thumb:`https://i.ytimg.com/vi/${t}/hqdefault.jpg`};if(t="vimeo.com"===i||"player.vimeo.com"===i?n.pathname.match(/(\d{5,})/)?.[1]:null,t)return{src:`https://player.vimeo.com/video/${t}?autoplay=1`}}catch{}return null}(r.url),n=new URL(r.url).hostname.replace(/^www\./,"");return $t("div",{class:"clip embed",children:u&&t?$t("iframe",{src:t.src,title:`Video: ${Mt(s.title,Ft(e))}`,allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowFullScreen:!0}):$t(Fe,{children:[(r.poster??t?.thumb)&&$t("img",{src:r.poster??t?.thumb,alt:""}),$t("button",{class:"play","aria-label":"Play video",onClick:()=>(f(!0),g("clip_played")),children:$t(Ht,{name:"play"})}),$t("div",{class:"bar",children:$t("span",{class:"pill",children:[$t(Ht,{name:"external-link"}),n,_?` · ${Rt(_)}`:""]})})]})})}return $t("div",{class:"clip",children:[u?$t("video",{ref:c,src:r.url,poster:r.poster,muted:p,loop:!0,autoplay:!0,playsInline:!0,preload:"auto","aria-label":`Clip: ${Mt(s.title,Ft(e))}`,onLoadedData:()=>m("clip_loaded"),onPlaying:()=>m("clip_played"),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&h(1e3*t)}}):$t(Fe,{children:[r.poster&&$t("img",{src:r.poster,alt:""}),$t("button",{class:"play","aria-label":"Play clip",onClick:()=>f(!0),children:$t(Ht,{name:"play"})})]}),u&&$t("div",{class:"bar",children:[$t("span",{class:"pill",children:[$t(Ht,{name:"play"}),_?`${Rt(_)} loop`:"Loop"]}),$t("button",{class:"round","aria-label":p?"Unmute clip":"Mute clip",onClick:()=>{d(!p),c.current&&(c.current.muted=!p),p&&g("clip_unmuted")},children:$t(Ht,{name:p?"volume-x":"volume-2"})}),$t("button",{class:"round","aria-label":o?"Shrink clip":"Expand clip","aria-pressed":o,onClick:a,children:$t(Ht,{name:"maximize-2"})})]})]})}function Ot({ctx:e,guide:t,index:n,reduced:i,cardRef:r,style:o}){let a=t.steps[n],l=t.steps.length,[s,c]=ht(!1),[p,d]=ht(0),u=n=>Mt(n,Ft(e),t.locale_default),f="next_button"===a.complete_on.type;return gt(()=>{c(!1);let r=t.steps[n+1],o=r?.clip;if(o&&"embed"!==o.source&&!i&&!navigator.connection?.saveData){let i=document.createElement("video");i.preload="auto",i.muted=!0,i.src=o.url,"hosted"===o.source&&Dt(`clip_loaded|${o.url}`)&&e.emit({type:"clip_loaded",guide_id:t.id,guide_version:t.version,step_id:r.id,step_index:n+1,clip_id:o.clip_id,clip_source:"hosted"})}},[t.id,n]),$t("div",{ref:r,class:"card"+(s?" big":""),style:o,role:"dialog","aria-modal":"false","aria-labelledby":"ps-title","aria-describedby":"ps-text",tabIndex:-1,"data-step":a.id,children:[a.clip&&$t(zt,{ctx:e,guide:t,index:n,reduced:i,clip:a.clip,big:s,onExpand:()=>c(!s),onDuration:d},a.id),$t("div",{class:"body",children:[$t("div",{class:"meta",children:[$t("span",{children:["Step ",n+1," of ",l," · ",Nt(e,t)]}),$t("button",{class:"x","aria-label":"Close guide",onClick:()=>e.dispatch({type:"dismiss"}),children:$t(Ht,{name:"x"})})]}),$t("div",{class:"steps",role:"img","aria-label":`Step ${n+1} of ${l}`,children:t.steps.map((e,t)=>$t("span",{class:"seg"+(t<n?" done":t===n?" cur"+(p&&!i?" anim":""):""),style:t===n&&p?{"--d":`${p}ms`}:void 0},t))}),$t("h2",{class:"title",id:"ps-title",children:u(a.title)}),$t("p",{class:"text",id:"ps-text",children:u(a.body)})]}),$t("div",{class:"foot",children:[$t("span",f?{class:"sp"}:{class:"wait",children:[$t("span",{class:"pulse","aria-hidden":"true"}),"Waiting for you"]}),n>0&&"page"!==t.steps[n-1].complete_on.type&&!t.steps[n-1].skip_if_on&&$t("button",{class:"btn gho",onClick:()=>e.dispatch({type:"back"}),children:"Back"}),f&&$t("button",{class:"btn pri",onClick:()=>e.dispatch({type:"next"}),children:[n+1===l?"Done":"Next",$t(Ht,{name:"arrow-right"})]})]})]})}let Wt=["width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)","width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)","width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)","width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)","width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)","width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)"];function Ut({ctx:e,guide:t}){let n=e.engine.launcherGuides().find(n=>n.id!==t.id&&"done"!==e.engine.progress.guides[n.id]?.status),i=xt(null);return gt(()=>i.current?.focus(),[]),$t(Fe,{children:[$t("div",{class:"scrim",onClick:()=>e.dispatch({type:"close"})}),$t("div",{class:"cel",ref:i,role:"dialog","aria-modal":"true","aria-labelledby":"ps-cel",tabIndex:-1,children:[$t("div",{class:"art","aria-hidden":"true",children:[Wt.map((e,t)=>$t("span",{class:"bit",style:e},t)),$t("span",{class:"tile",children:$t(Ht,{name:"ps-level-up"})})]}),$t("h2",{id:"ps-cel",children:"Level cleared"}),$t("p",{children:["You finished ",Nt(e,t),".",n?` Next up: ${Nt(e,n)}.`:""]}),$t("div",{class:"acts",children:[$t("button",{class:"btn sec",onClick:()=>e.dispatch({type:"start",guide:t.id}),children:[$t(Ht,{name:"rotate-ccw"}),"Replay"]}),$t("button",n?{class:"btn pri",onClick:()=>e.dispatch({type:"start",guide:n.id}),children:["Next guide",$t(Ht,{name:"arrow-right"})]}:{class:"btn pri",onClick:()=>e.dispatch({type:"close"}),children:"Done"})]})]})]})}function Bt({ctx:e,open:t,setOpen:n,near:i}){let r=xt(null);mt(()=>{let e=r.current;e&&(e.style.cssText="",i&&me(i,e,{strategy:"fixed",placement:"top-start",middleware:[_e(8),ge({padding:12}),he({padding:12})]}).then(({x:t,y:n})=>e.style.cssText=`left:${t}px;top:${n}px;right:auto;bottom:auto`))},[t,i]);let o=xt(null);gt(()=>{t?(o.current=e.root.activeElement??document.activeElement,r.current?.focus()):o.current?.focus()},[t]);let a=e.config.launcher,l=e.engine.launcherGuides();if(!l.length)return null;let s=e.engine.progress.guides,c=l.filter(e=>!s[e.id]).length,p="bottom-left"===a?.position?" left":"";return $t(Fe,{children:[t&&$t("div",{class:`panel${p}${a?.enabled?"":" solo"}`,ref:r,tabIndex:-1,role:"dialog","aria-label":"Guides",children:[$t("button",{class:"x","aria-label":"Close guides",onClick:()=>n(!1),children:$t(Ht,{name:"x"})}),$t("h2",{children:Mt(a?.title,Ft(e))||"Need a hand?"}),$t("p",{children:Mt(a?.description,Ft(e))||"Pick a guide and play it step by step."}),$t("ul",{class:"rows",children:l.map(t=>{let i=s[t.id],r=t.steps.length,o="done"===i?.status,a="running"===i?.status;return $t("li",{children:$t("button",{class:"row",onClick:()=>{n(!1),i&&e.dispatch({type:"reset_progress",guide:t.id}),e.dispatch({type:"start",guide:t.id})},children:[$t("span",{class:"ti"+(o?" mint":i?"":" spark"),children:$t(Ht,{name:o?"check":"ps-guide"})}),$t("span",{class:"rb",children:[$t("span",{class:"rt",children:Nt(e,t)}),$t("span",{class:"rm",children:o?"Completed":a?`Step ${i.step+1} of ${r}`:`${r} steps`}),a&&$t("span",{class:"prog","aria-hidden":"true",children:$t("i",{style:{width:i.step/r*100+"%"}})})]}),$t("span",i?{class:"rp",children:[$t(Ht,{name:"rotate-ccw"}),"Replay"]}:{class:"new",children:"New"})]})},t.id)})}),l.some(e=>s[e.id])&&$t("div",{class:"acts so",children:$t("button",{class:"btn gho",onClick:()=>{e.dispatch({type:"reset_progress"}),e.engine.active?n(!1):r.current?.focus()},children:"Start over"})}),!1!==e.config.flags?.show_badge&&$t("a",{class:"pb",href:"https://playstep.app/?ref=badge",target:"_blank",rel:"noopener",children:[$t("span",{dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>'},style:"display:inline-flex;width:16px;height:16px"}),"Powered by PlayStep"]})]}),a?.enabled&&$t("button",{class:`lb${p}`,"aria-label":t?"Close guides":"Open guides","aria-expanded":t,onClick:()=>n(!t),children:[$t(Ht,{name:"ps-launcher"}),c>0&&!t&&$t("span",{class:"cnt",children:c})]})]})}let It=document.currentScript?.src,jt=e=>!!e?.getClientRects().length;function Vt(e,t){let n=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{n||(n=t?[...document.querySelectorAll(t.css)].find(e=>jt(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return jt(n)?n:null}function qt({ctx:e,guide:t,index:n,reduced:i}){let r=t.steps[n],o=function(e,t,n){let[i,r]=ht(()=>e?Vt(e,t):null);return gt(()=>{if(!e)return r(null);let i=Vt(e,t);r(i);let o=0,a=()=>{o=0;let n=Vt(e,t);n!==i&&r(i=n)},l=new MutationObserver(()=>o||(o=requestAnimationFrame(a)));l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-guide","hidden","style","class"]});let s=setTimeout(()=>!i&&n(e),3e3);return()=>{l.disconnect(),clearTimeout(s),cancelAnimationFrame(o)}},[e,t]),i}(r.anchor,r.find?.web,t=>e.dispatch({type:"anchor_missing",anchor:t})),a=xt(null);gt(()=>{if(!o)return;let t=t=>t.composedPath().includes(o)&&e.dispatch({type:"tap",anchor:r.anchor});return document.addEventListener("click",t,!0),()=>document.removeEventListener("click",t,!0)},[o]);let l=t.theme?.position??"bottom",s=function(e,t,n,i,r){let[o,a]=ht(null);return mt(()=>{let r=t.current;if(!r)return;if(!e){let e=()=>a({x:(innerWidth-r.offsetWidth)/2,y:"center"===i?(innerHeight-r.offsetHeight)/2:innerHeight-r.offsetHeight-24});e();let t=new ResizeObserver(e);return t.observe(r),addEventListener("resize",e),()=>{t.disconnect(),removeEventListener("resize",e)}}let o=e.getBoundingClientRect();(o.bottom<0||o.top>innerHeight)&&e.scrollIntoView({block:"center",behavior:Tt()?"auto":"smooth"});let l=()=>{let t=e.getBoundingClientRect(),i=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;me(e,r,{strategy:"fixed",placement:"auto"===n?"bottom":n,middleware:[_e(18),ge({fallbackPlacements:["top","left","right"],padding:12}),he({padding:12})]}).then(({x:e,y:n})=>a({x:e,y:n,spot:{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(i+6,(t.height+12)/2)}}))};l();let s=new ResizeObserver(l);s.observe(e),s.observe(r),addEventListener("scroll",l,{capture:!0,passive:!0}),addEventListener("resize",l);let c=setInterval(l,400);return()=>{s.disconnect(),clearInterval(c),removeEventListener("scroll",l,{capture:!0}),removeEventListener("resize",l)}},[e,i,n,...r]),o}(o,a,r.placement??"auto",l,[r.id]),c=xt("");gt(()=>{s&&c.current!==r.id&&(c.current=r.id,document.activeElement?.matches("input,textarea,select,[contenteditable]:not([contenteditable=false])")||a.current?.focus({preventScroll:!0}))},[r.id,s]);let[p,d]=ht(!1);gt(()=>{s&&!p&&requestAnimationFrame(()=>d(!0))},[s]),gt(()=>{let t=t=>{if("Tab"!==t.key||!a.current)return;let n=[...a.current.querySelectorAll('button,a,iframe,[tabindex="0"]')],i=t.composedPath().includes(a.current),r=n[0],l=n.at(-1),s=e.root.activeElement;i&&!t.shiftKey&&s===l?(t.preventDefault(),(o??r)?.focus()):i&&t.shiftKey&&s===r?(t.preventDefault(),(o??l)?.focus()):o&&document.activeElement===o&&(t.preventDefault(),(t.shiftKey?l:r)?.focus())};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[o]);let u=s?.spot;return $t(Fe,{children:[o&&u?$t("div",{class:"spot","aria-hidden":"true",style:{width:`${u.w}px`,height:`${u.h}px`,transform:`translate(${u.x}px,${u.y}px)`,borderRadius:`${u.r}px`}}):!o&&"center"===l&&$t("div",{class:"scrim","aria-hidden":"true"}),$t(Ot,{ctx:e,guide:t,index:n,reduced:i,cardRef:a,style:s?{transform:`translate(${Math.round(s.x)}px,${Math.round(s.y)}px)`,transition:p?void 0:"none"}:{visibility:"hidden"}})]})}function Kt({ctx:e,handle:t}){let[,n]=ht(0),[i,r]=ht(!1),[o,a]=ht(),l=Tt();t.update=()=>n(e=>e+1),t.openLauncher=t=>{let n=document.activeElement;a(t??(n!==document.body&&n!==e.root.host?n??void 0:void 0)),r(!0)},gt(()=>{let t=t=>{"Escape"===t.key&&(i?r(!1):e.engine.active&&e.dispatch({type:"completed"===e.engine.active.status?"close":"dismiss"}))};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[i]);let s=e.engine.active,c=s?.guide??e.engine.launcherGuides()[0],p=c?.theme?.mode??"auto",d="dark"===p||"auto"===p&&matchMedia("(prefers-color-scheme: dark)").matches;e.root.host.setAttribute("data-mode",d?"dark":"light");let u=c?.theme?.accent,f=u?{"--ps-accent":u,"--ps-accent-hover":u,"--ps-on-accent":Et(u)}:void 0,_="running"===s?.status?s.guide.steps[s.index]:void 0;return $t("div",{class:"l",style:f,children:[$t(Bt,{ctx:e,open:i,setOpen:r,near:o}),!i&&"running"===s?.status&&$t(qt,{ctx:e,guide:s.guide,index:s.index,reduced:l},s.guide.id),!i&&"completed"===s?.status&&$t(Ut,{ctx:e,guide:s.guide}),$t("div",{class:"sr","aria-live":"polite",children:_?`Step ${s.index+1} of ${s.guide.steps.length}: ${Mt(_.title,Ft(e))}`:s?"Level cleared":""})]})}return e.findAnchor=Vt,e.mount=function(e){let t=e.options,n=t=>{e.outbox.push(t)};new Promise((e,t)=>document.head.append(Object.assign(document.createElement("script"),{src:new URL("events.js",It||location.href).href,integrity:"sha256-AseK8i2RbqbXQKFUcBWNC4a7ke+Nrh85Kuots5BQdv0=",crossOrigin:"anonymous",onload:()=>e(window.__playstep_events),onerror:()=>t(Error("events"))}))).then(({createTransport:i})=>{let r=i({appKey:t.appKey,url:t.eventsUrl,sdk:t.sdkName??"web",version:"0.4.0",preview:t.preview,userId:e.userId,send:t.transport});e.outbox.splice(0).forEach(r.push),n=r.push}).catch(t=>e.emit({type:"sdk_error",message:String(t)}));let i=document.createElement("style");i.textContent=':host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-left:auto}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:99px;border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.bit{position:absolute;border-radius:99px}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.left{right:auto;left:24px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.panel{right:18px;bottom:86px}.solo{bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}',e.root.appendChild(i);let r=document.createElement("div");e.root.appendChild(r);let o={update:()=>{},openLauncher:()=>{},send:e=>n(e)};return function(e,t){var n,i,r,o;xe.__&&xe.__(e,t),9==t.nodeType&&(t=t.documentElement),i=(n=e&&32&e.__u)?null:t.__k,t.__k=De(Fe,{children:[e]}),r=[],o=[],Ke(t,t.__k,i||Me,Me,t.namespaceURI,i?null:t.firstChild?Ae.call(t.childNodes):null,r,i?i.__e:t.firstChild,n,o),Xe(r,t.__k,o),t.__k.props.children=null}($t(Kt,{ctx:e,handle:o}),r),o},e}({});
|
package/dist/index.d.ts
CHANGED
|
@@ -122,6 +122,8 @@ interface AppConfig {
|
|
|
122
122
|
}
|
|
123
123
|
type EventType = 'guide_shown' | 'step_shown' | 'step_completed' | 'clip_loaded' | 'clip_played' | 'clip_unmuted' | 'guide_completed' | 'guide_dismissed' | 'anchor_missing' | 'sdk_error' | 'progress_reset';
|
|
124
124
|
interface AnalyticsEvent {
|
|
125
|
+
/** Random per event, so a batch delivered twice counts once. */
|
|
126
|
+
id?: string;
|
|
125
127
|
type: EventType;
|
|
126
128
|
ts: number;
|
|
127
129
|
guide_id?: string;
|
|
@@ -137,6 +139,14 @@ interface AnalyticsEvent {
|
|
|
137
139
|
//#region src/core/engine.d.ts
|
|
138
140
|
type Traits = Record<string, unknown>;
|
|
139
141
|
//#endregion
|
|
142
|
+
//#region src/core/queue.d.ts
|
|
143
|
+
interface SendResult {
|
|
144
|
+
/** The HTTP status; 0 when the request never got an answer. */
|
|
145
|
+
status: number;
|
|
146
|
+
/** Retry-After, in seconds. */
|
|
147
|
+
retryAfter?: number;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
140
150
|
//#region src/core/sdk.d.ts
|
|
141
151
|
interface InitOptions {
|
|
142
152
|
/** Your publishable key, `ps_pub_…`. */
|
|
@@ -155,8 +165,8 @@ interface InitOptions {
|
|
|
155
165
|
onEvent?: (event: AnalyticsEvent) => void;
|
|
156
166
|
/** @internal Set by @axceera/playstep-react. */
|
|
157
167
|
sdkName?: 'web' | 'react';
|
|
158
|
-
/** @internal Tests: replaces navigator.sendBeacon. */
|
|
159
|
-
transport?: (url: string, body: string) =>
|
|
168
|
+
/** @internal Tests: replaces fetch and navigator.sendBeacon. Returning nothing counts as delivered. */
|
|
169
|
+
transport?: (url: string, body: string) => Promise<SendResult> | SendResult | undefined;
|
|
160
170
|
}
|
|
161
171
|
interface OpenLauncherOptions {
|
|
162
172
|
/** The element that opened the list (your help button): the list opens next to it instead of in a corner. */
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./sdk-
|
|
1
|
+
import{n as e}from"./sdk-PxS4dzh1.js";const t=e(()=>import(`./ui-DiF80WLc.js`),()=>import(`./launcher-button-CbdJMLHL.js`),()=>import(`./capture-Cg3cKBI_.js`));export{t as default,t as playstep};
|
|
@@ -0,0 +1 @@
|
|
|
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,platform:n}=e,a=e.progress??{seen:!1,guides:{}},o=e.traits??{},s=null,c,l=t.flags||{},u=(t.guides??[]).filter(e=>e.spec_version<=3&&(e.targeting?.platforms??[`web`]).includes(n)),d=e=>u.find(t=>t.id===e),f=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),p=e=>!l.disabled&&(!l.paused_for_new_users||a.seen)&&i(e.targeting?.segments,o),m=e=>{let t=a.guides[e.id];return!s&&p(e)&&(!t||t.status!==`done`&&(t.status===`running`||!e.trigger.once))},h=(e,t,n)=>{a.guides[e.id]={version:e.version,step:n,status:t}},g,_=e=>r(e.path,g),v=e=>r(e.skip_if_on,g)||_(e.complete_on),y=(e,t,n)=>{for(;t<e.steps.length;){if(s={guide:e,index:t,status:`running`},c=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 s={guide:e,index:--t,status:`completed`},h(e,`done`,t),n.push(f(`guide_completed`,e)),n},b=(e,t)=>(a.seen=!0,y(e,t,[f(`guide_shown`,e)])),x=()=>{let e=s;return y(e.guide,e.index+1,[f(`step_completed`,e.guide,e.index)])},S=e=>{let t=u.find(t=>m(t)&&e(t));return t?b(t,0):[]},C=()=>S(e=>e.trigger.type===`first_visit`||_(e.trigger));function w(e){let t=s?.status===`running`?s.guide.steps[s.index]:null;switch(e.type){case`init`:{g=e.path;let t=u.find(e=>a.guides[e.id]?.status===`running`&&p(e));if(t){let e=a.guides[t.id];return b(t,e.version===t.version?e.step:0)}return C()}case`page_view`:return g=e.path,t&&v(t)?x():S(e=>_(e.trigger));case`reset_progress`:{let t=typeof e.guide==`string`&&d(e.guide);return t===void 0?[]:((!t||s?.guide===t)&&(s=null),t?delete a.guides[t.id]:a.guides={},[{type:`progress_reset`,guide_id:t?t.id:void 0},...C()])}case`event`:return t?.complete_on.type===`event`&&t.complete_on.name===e.name?x():S(t=>t.trigger.type===`event`&&t.trigger.name===e.name);case`tap`:return t?.complete_on.type===`tap_anchor`&&t.anchor===e.anchor?x():[];case`complete`:return t?.id===e.step?x():[];case`next`:return t?.complete_on.type===`next_button`?x():[];case`back`:return!t||s.index===0?[]:(s={...s,index:s.index-1},h(s.guide,`running`,s.index),[f(`step_shown`,s.guide,s.index)]);case`close`:if(s?.status!==`completed`)return[];case`dismiss`:{if(!s)return[];let e=s;return s=null,e.status===`completed`?[]:(h(e.guide,`dismissed`,e.index),[f(`guide_dismissed`,e.guide,e.index)])}case`start`:{let n=d(e.guide);if(!n||!p(n)||t&&s.guide===n&&n.steps.slice(0,s.index).every(v))return[];let r=[];return s?.status===`running`&&(h(s.guide,`dismissed`,s.index),r.push(f(`guide_dismissed`,s.guide,s.index))),s=null,r.concat(b(n,0))}case`anchor_missing`:return!t||t.anchor!==e.anchor||c===e.anchor?[]:(c=e.anchor,[{...f(`anchor_missing`,s.guide,s.index),anchor:e.anchor}]);case`identify`:return o={...o,...e.traits},[]}}return{get active(){return s},progress:a,dispatch:w,launcherGuides:()=>u.filter(e=>e.launcher!==!1&&p(e))}}const o=`0.4.0`,s=`playstep_preview`;function c(t,n,r,i=`web`){let c,l,u,d,f,p,m,h={},g=[],_=[],v=()=>`p:${c.appKey}`,y=()=>c.preview||e.set(v(),l.progress),b=e=>{let t={...e,ts:Date.now()};c?.preview||(d?d.send(t):_.push(t)),c?.onEvent?.(t)},x=e=>{try{b({type:`sdk_error`,message:String(e)})}catch{}},S=e=>(...t)=>{try{e(...t)}catch(e){x(e)}},C=(e,t)=>S(n=>w({type:e,[t]:n}));function w(t){if(!l)return void g.push(t);let n=l.dispatch(t);y(),n.forEach(S(b)),(l.active||e.get(`q`))&&E(),d?.update()}function T(){return p??(p=document.body.appendChild(document.createElement(`playstep-root`)).attachShadow({mode:`open`}))}function E(){return f??(f=t().then(e=>{let t=T();return t.innerHTML=``,d=e.mount({engine:l,config:u,options:c,root:t,outbox:_,userId:()=>m,dispatch:S(w),emit:S(b)})}).catch(x))}let D,O=S((e={})=>{l?l.launcherGuides().length&&E().then(t=>t?.openLauncher(e.anchor)):D=e});function k(e){e.launcher?.enabled&&l.launcherGuides().length&&!f&&n&&n().then(t=>{f||t.drawLauncher(T(),l,e.launcher.position,O)}).catch(x)}async function A(){let t=c,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));let d=t.config;try{d??(d=await fetch(`${n}/v1/${o?`preview/${o}?key=`:`config/`}${t.appKey}`).then(e=>e.json()))}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(x);if(d?.guides&&!d.flags?.disabled&&(u=d,t.eventsUrl=d.ingest_url??`${n}/v1/events`,l=a({config:d,platform:i,progress:t.preview?void 0:e.get(v())??void 0,traits:h}),w({type:`init`,path:location.pathname}),g.splice(0).forEach(w),D&&O(D),k(d),t.autoPageViews!==!1)){let e=location.pathname,t=S(()=>location.pathname!==e&&w({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:S(e=>{if(c||!e?.appKey)return;c={...e};let t=()=>setTimeout(()=>A().catch(x));document.readyState===`complete`?t():addEventListener(`load`,t)}),identify:S((e,t)=>{m=e,h={...h,...t},w({type:`identify`,traits:h})}),track:C(`event`,`name`),start:C(`start`,`guide`),complete:C(`complete`,`step`),page:S(e=>w({type:`page_view`,path:e??location.pathname})),openLauncher:O,resetProgress:C(`reset_progress`,`guide`),reset:S(()=>{w({type:`dismiss`}),m=void 0,h={},l&&(Object.assign(l.progress,{seen:!1,guides:{}}),y(),d?.update()),c?.preview||e.set(`d`,null)})}}export{c as n,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./util-oI8xpB8k.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},platform:`web`,session_id:n,user_key:o,preview:t.preview}}});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-PxS4dzh1.js";import{t}from"./util-oI8xpB8k.js";import{i as n,n as r,r as i,t as a}from"./text-rFw_ND9o.js";import{computePosition as o,flip as s,offset as c,shift as l}from"@floating-ui/dom";import{render as u}from"preact";import{useEffect as d,useLayoutEffect as f,useRef as p,useState as m}from"preact/hooks";import{Fragment as h,jsx as g,jsxs as _}from"preact/jsx-runtime";const v={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 y({name:e}){return/* @__PURE__ */ g(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:v[e]}})}function b(e){try{let t=JSON.parse(sessionStorage.getItem(`playstep:clips`)??`[]`);if(t.includes(e))return!1;sessionStorage.setItem(`playstep:clips`,JSON.stringify([...t,e].slice(-200)))}catch{}return!0}const x=e=>e.options.locale??navigator.language??`en`,S=(e,t)=>i(t.name,x(e),t.locale_default)||t.id;function C({ctx:e,guide:t,index:n,reduced:o,clip:s,big:c,onExpand:l,onDuration:u}){let f=t.steps[n],v=p(null),[S,C]=m(!0),[w,T]=m(!o&&s.source!==`embed`),[E,D]=m(s.duration_ms??0),O=r=>e.emit({type:r,guide_id:t.id,guide_version:t.version,step_id:f.id,step_index:n,clip_id:s.source===`hosted`?s.clip_id:void 0,clip_source:s.source}),k=e=>b(`${e}|${s.url}`)&&O(e);if(d(()=>{let e=v.current;e&&w&&(e.muted=S,e.play()?.catch(()=>{}))},[w,s.url]),d(()=>u(w&&s.source!==`embed`?E:0),[E,w]),s.source===`embed`){let t=r(s.url),n=new URL(s.url).hostname.replace(/^www\./,``);return/* @__PURE__ */ g(`div`,{class:`clip embed`,children:w&&t?/* @__PURE__ */ g(`iframe`,{src:t.src,title:`Video: ${i(f.title,x(e))}`,allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowFullScreen:!0}):/* @__PURE__ */ _(h,{children:[(s.poster??t?.thumb)&&/* @__PURE__ */ g(`img`,{src:s.poster??t?.thumb,alt:``}),/* @__PURE__ */ g(`button`,{class:`play`,"aria-label":`Play video`,onClick:()=>(T(!0),O(`clip_played`)),children:/* @__PURE__ */ g(y,{name:`play`})}),/* @__PURE__ */ g(`div`,{class:`bar`,children:/* @__PURE__ */ _(`span`,{class:`pill`,children:[/* @__PURE__ */ g(y,{name:`external-link`}),n,E?` · ${a(E)}`:``]})})]})})}return/* @__PURE__ */ _(`div`,{class:`clip`,children:[w?/* @__PURE__ */ g(`video`,{ref:v,src:s.url,poster:s.poster,muted:S,loop:!0,autoplay:!0,playsInline:!0,preload:`auto`,"aria-label":`Clip: ${i(f.title,x(e))}`,onLoadedData:()=>k(`clip_loaded`),onPlaying:()=>k(`clip_played`),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&D(t*1e3)}}):/* @__PURE__ */ _(h,{children:[s.poster&&/* @__PURE__ */ g(`img`,{src:s.poster,alt:``}),/* @__PURE__ */ g(`button`,{class:`play`,"aria-label":`Play clip`,onClick:()=>T(!0),children:/* @__PURE__ */ g(y,{name:`play`})})]}),w&&/* @__PURE__ */ _(`div`,{class:`bar`,children:[/* @__PURE__ */ _(`span`,{class:`pill`,children:[/* @__PURE__ */ g(y,{name:`play`}),E?`${a(E)} loop`:`Loop`]}),/* @__PURE__ */ g(`button`,{class:`round`,"aria-label":S?`Unmute clip`:`Mute clip`,onClick:()=>{C(!S),v.current&&(v.current.muted=!S),S&&O(`clip_unmuted`)},children:/* @__PURE__ */ g(y,{name:S?`volume-x`:`volume-2`})}),/* @__PURE__ */ g(`button`,{class:`round`,"aria-label":c?`Shrink clip`:`Expand clip`,"aria-pressed":c,onClick:l,children:/* @__PURE__ */ g(y,{name:`maximize-2`})})]})]})}function w({ctx:e,guide:t,index:n,reduced:r,cardRef:a,style:o}){let s=t.steps[n],c=t.steps.length,[l,u]=m(!1),[f,p]=m(0),h=n=>i(n,x(e),t.locale_default),v=s.complete_on.type===`next_button`;return d(()=>{u(!1);let i=t.steps[n+1],a=i?.clip;if(a&&a.source!==`embed`&&!r&&!navigator.connection?.saveData){let r=document.createElement(`video`);r.preload=`auto`,r.muted=!0,r.src=a.url,a.source===`hosted`&&b(`clip_loaded|${a.url}`)&&e.emit({type:`clip_loaded`,guide_id:t.id,guide_version:t.version,step_id:i.id,step_index:n+1,clip_id:a.clip_id,clip_source:`hosted`})}},[t.id,n]),/* @__PURE__ */ _(`div`,{ref:a,class:`card${l?` big`:``}`,style:o,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabIndex:-1,"data-step":s.id,children:[s.clip&&/* @__PURE__ */ g(C,{ctx:e,guide:t,index:n,reduced:r,clip:s.clip,big:l,onExpand:()=>u(!l),onDuration:p},s.id),/* @__PURE__ */ _(`div`,{class:`body`,children:[/* @__PURE__ */ _(`div`,{class:`meta`,children:[/* @__PURE__ */ _(`span`,{children:[`Step `,n+1,` of `,c,` · `,S(e,t)]}),/* @__PURE__ */ g(`button`,{class:`x`,"aria-label":`Close guide`,onClick:()=>e.dispatch({type:`dismiss`}),children:/* @__PURE__ */ g(y,{name:`x`})})]}),/* @__PURE__ */ g(`div`,{class:`steps`,role:`img`,"aria-label":`Step ${n+1} of ${c}`,children:t.steps.map((e,t)=>/* @__PURE__ */ g(`span`,{class:`seg${t<n?` done`:t===n?` cur${f&&!r?` anim`:``}`:``}`,style:t===n&&f?{"--d":`${f}ms`}:void 0},t))}),/* @__PURE__ */ g(`h2`,{class:`title`,id:`ps-title`,children:h(s.title)}),/* @__PURE__ */ g(`p`,{class:`text`,id:`ps-text`,children:h(s.body)})]}),/* @__PURE__ */ _(`div`,{class:`foot`,children:[v?/* @__PURE__ */ g(`span`,{class:`sp`}):/* @__PURE__ */ _(`span`,{class:`wait`,children:[/* @__PURE__ */ g(`span`,{class:`pulse`,"aria-hidden":`true`}),`Waiting for you`]}),n>0&&t.steps[n-1].complete_on.type!==`page`&&!t.steps[n-1].skip_if_on&&/* @__PURE__ */ g(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`}),children:`Back`}),v&&/* @__PURE__ */ _(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`}),children:[n+1===c?`Done`:`Next`,/* @__PURE__ */ g(y,{name:`arrow-right`})]})]})]})}const T=[`width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)`,`width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)`,`width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)`,`width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)`,`width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)`,`width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)`];function E({ctx:e,guide:t}){let n=e.engine.launcherGuides().find(n=>n.id!==t.id&&e.engine.progress.guides[n.id]?.status!==`done`),r=p(null);return d(()=>r.current?.focus(),[]),/* @__PURE__ */ _(h,{children:[/* @__PURE__ */ g(`div`,{class:`scrim`,onClick:()=>e.dispatch({type:`close`})}),/* @__PURE__ */ _(`div`,{class:`cel`,ref:r,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabIndex:-1,children:[/* @__PURE__ */ _(`div`,{class:`art`,"aria-hidden":`true`,children:[T.map((e,t)=>/* @__PURE__ */ g(`span`,{class:`bit`,style:e},t)),/* @__PURE__ */ g(`span`,{class:`tile`,children:/* @__PURE__ */ g(y,{name:`ps-level-up`})})]}),/* @__PURE__ */ g(`h2`,{id:`ps-cel`,children:`Level cleared`}),/* @__PURE__ */ _(`p`,{children:[`You finished `,S(e,t),`.`,n?` Next up: ${S(e,n)}.`:``]}),/* @__PURE__ */ _(`div`,{class:`acts`,children:[/* @__PURE__ */ _(`button`,{class:`btn sec`,onClick:()=>e.dispatch({type:`start`,guide:t.id}),children:[/* @__PURE__ */ g(y,{name:`rotate-ccw`}),`Replay`]}),n?/* @__PURE__ */ _(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`start`,guide:n.id}),children:[`Next guide`,/* @__PURE__ */ g(y,{name:`arrow-right`})]}):/* @__PURE__ */ g(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`close`}),children:`Done`})]})]})]})}function D({ctx:e,open:t,setOpen:n,near:r}){let a=p(null);f(()=>{let e=a.current;e&&(e.style.cssText=``,r&&o(r,e,{strategy:`fixed`,placement:`top-start`,middleware:[c(8),s({padding:12}),l({padding:12})]}).then(({x:t,y:n})=>e.style.cssText=`left:${t}px;top:${n}px;right:auto;bottom:auto`))},[t,r]);let u=p(null);d(()=>{t?(u.current=e.root.activeElement??document.activeElement,a.current?.focus()):u.current?.focus()},[t]);let m=e.config.launcher,v=e.engine.launcherGuides();if(!v.length)return null;let b=e.engine.progress.guides,C=v.filter(e=>!b[e.id]).length,w=m?.position===`bottom-left`?` left`:``;return/* @__PURE__ */ _(h,{children:[t&&/* @__PURE__ */ _(`div`,{class:`panel${w}${m?.enabled?``:` solo`}`,ref:a,tabIndex:-1,role:`dialog`,"aria-label":`Guides`,children:[/* @__PURE__ */ g(`button`,{class:`x`,"aria-label":`Close guides`,onClick:()=>n(!1),children:/* @__PURE__ */ g(y,{name:`x`})}),/* @__PURE__ */ g(`h2`,{children:i(m?.title,x(e))||`Need a hand?`}),/* @__PURE__ */ g(`p`,{children:i(m?.description,x(e))||`Pick a guide and play it step by step.`}),/* @__PURE__ */ g(`ul`,{class:`rows`,children:v.map(t=>{let r=b[t.id],i=t.steps.length,a=r?.status===`done`,o=r?.status===`running`;return/* @__PURE__ */ g(`li`,{children:/* @__PURE__ */ _(`button`,{class:`row`,onClick:()=>{n(!1),r&&e.dispatch({type:`reset_progress`,guide:t.id}),e.dispatch({type:`start`,guide:t.id})},children:[/* @__PURE__ */ g(`span`,{class:`ti${a?` mint`:r?``:` spark`}`,children:/* @__PURE__ */ g(y,{name:a?`check`:`ps-guide`})}),/* @__PURE__ */ _(`span`,{class:`rb`,children:[/* @__PURE__ */ g(`span`,{class:`rt`,children:S(e,t)}),/* @__PURE__ */ g(`span`,{class:`rm`,children:a?`Completed`:o?`Step ${r.step+1} of ${i}`:`${i} steps`}),o&&/* @__PURE__ */ g(`span`,{class:`prog`,"aria-hidden":`true`,children:/* @__PURE__ */ g(`i`,{style:{width:`${r.step/i*100}%`}})})]}),r?/* @__PURE__ */ _(`span`,{class:`rp`,children:[/* @__PURE__ */ g(y,{name:`rotate-ccw`}),`Replay`]}):/* @__PURE__ */ g(`span`,{class:`new`,children:`New`})]})},t.id)})}),v.some(e=>b[e.id])&&/* @__PURE__ */ g(`div`,{class:`acts so`,children:/* @__PURE__ */ g(`button`,{class:`btn gho`,onClick:()=>{e.dispatch({type:`reset_progress`}),e.engine.active?n(!1):a.current?.focus()},children:`Start over`})}),e.config.flags?.show_badge!==!1&&/* @__PURE__ */ _(`a`,{class:`pb`,href:`https://playstep.app/?ref=badge`,target:`_blank`,rel:`noopener`,children:[/* @__PURE__ */ g(`span`,{dangerouslySetInnerHTML:{__html:`<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>`},style:`display:inline-flex;width:16px;height:16px`}),`Powered by PlayStep`]})]}),m?.enabled&&/* @__PURE__ */ _(`button`,{class:`lb${w}`,"aria-label":t?`Close guides`:`Open guides`,"aria-expanded":t,onClick:()=>n(!t),children:[/* @__PURE__ */ g(y,{name:`ps-launcher`}),C>0&&!t&&/* @__PURE__ */ g(`span`,{class:`cnt`,children:C})]})]})}document.currentScript?.src;const O=()=>import(`./transport-Cu51h2G6.js`),k=e=>!!e?.getClientRects().length;function A(e,t){let n=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{n||(n=t?[...document.querySelectorAll(t.css)].find(e=>k(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return k(n)?n:null}function j(e,t,n){let[r,i]=m(()=>e?A(e,t):null);return d(()=>{if(!e)return i(null);let r=A(e,t);i(r);let a=0,o=()=>{a=0;let n=A(e,t);n!==r&&i(r=n)},s=new MutationObserver(()=>a||(a=requestAnimationFrame(o)));s.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-guide`,`hidden`,`style`,`class`]});let c=setTimeout(()=>!r&&n(e),3e3);return()=>{s.disconnect(),clearTimeout(c),cancelAnimationFrame(a)}},[e,t]),r}function M(e,n,r,i,a){let[u,d]=m(null);return f(()=>{let a=n.current;if(!a)return;if(!e){let e=()=>d({x:(innerWidth-a.offsetWidth)/2,y:i===`center`?(innerHeight-a.offsetHeight)/2:innerHeight-a.offsetHeight-24});e();let t=new ResizeObserver(e);return t.observe(a),addEventListener(`resize`,e),()=>{t.disconnect(),removeEventListener(`resize`,e)}}let u=e.getBoundingClientRect();(u.bottom<0||u.top>innerHeight)&&e.scrollIntoView({block:`center`,behavior:t()?`auto`:`smooth`});let f=()=>{let t=e.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;o(e,a,{strategy:`fixed`,placement:r===`auto`?`bottom`:r,middleware:[c(18),s({fallbackPlacements:[`top`,`left`,`right`],padding:12}),l({padding:12})]}).then(({x:e,y:r})=>d({x:e,y:r,spot:{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(n+6,(t.height+12)/2)}}))};f();let p=new ResizeObserver(f);p.observe(e),p.observe(a),addEventListener(`scroll`,f,{capture:!0,passive:!0}),addEventListener(`resize`,f);let m=setInterval(f,400);return()=>{p.disconnect(),clearInterval(m),removeEventListener(`scroll`,f,{capture:!0}),removeEventListener(`resize`,f)}},[e,i,r,...a]),u}function N({ctx:e,guide:t,index:n,reduced:r}){let i=t.steps[n],a=j(i.anchor,i.find?.web,t=>e.dispatch({type:`anchor_missing`,anchor:t})),o=p(null);d(()=>{if(!a)return;let t=t=>t.composedPath().includes(a)&&e.dispatch({type:`tap`,anchor:i.anchor});return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[a]);let s=t.theme?.position??`bottom`,c=M(a,o,i.placement??`auto`,s,[i.id]),l=p(``);d(()=>{c&&l.current!==i.id&&(l.current=i.id,document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)||o.current?.focus({preventScroll:!0}))},[i.id,c]);let[u,f]=m(!1);d(()=>{c&&!u&&requestAnimationFrame(()=>f(!0))},[c]),d(()=>{let t=t=>{if(t.key!==`Tab`||!o.current)return;let n=[...o.current.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],r=t.composedPath().includes(o.current),i=n[0],s=n.at(-1),c=e.root.activeElement;r&&!t.shiftKey&&c===s?(t.preventDefault(),(a??i)?.focus()):r&&t.shiftKey&&c===i?(t.preventDefault(),(a??s)?.focus()):a&&document.activeElement===a&&(t.preventDefault(),(t.shiftKey?s:i)?.focus())};return document.addEventListener(`keydown`,t,!0),()=>document.removeEventListener(`keydown`,t,!0)},[a]);let v=c?.spot;return/* @__PURE__ */ _(h,{children:[a&&v?/* @__PURE__ */ g(`div`,{class:`spot`,"aria-hidden":`true`,style:{width:`${v.w}px`,height:`${v.h}px`,transform:`translate(${v.x}px,${v.y}px)`,borderRadius:`${v.r}px`}}):!a&&s===`center`&&/* @__PURE__ */ g(`div`,{class:`scrim`,"aria-hidden":`true`}),/* @__PURE__ */ g(w,{ctx:e,guide:t,index:n,reduced:r,cardRef:o,style:c?{transform:`translate(${Math.round(c.x)}px,${Math.round(c.y)}px)`,transition:u?void 0:`none`}:{visibility:`hidden`}})]})}function P({ctx:e,handle:r}){let[,a]=m(0),o=()=>a(e=>e+1),[s,c]=m(!1),[l,u]=m(),f=t();r.update=o,r.openLauncher=t=>{let n=document.activeElement;u(t??(n!==document.body&&n!==e.root.host?n??void 0:void 0)),c(!0)},d(()=>{let t=t=>{t.key===`Escape`&&(s?c(!1):e.engine.active&&e.dispatch({type:e.engine.active.status===`completed`?`close`:`dismiss`}))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[s]);let p=e.engine.active,h=p?.guide??e.engine.launcherGuides()[0],v=h?.theme?.mode??`auto`,y=v===`dark`||v===`auto`&&matchMedia(`(prefers-color-scheme: dark)`).matches;e.root.host.setAttribute(`data-mode`,y?`dark`:`light`);let b=h?.theme?.accent,S=b?{"--ps-accent":b,"--ps-accent-hover":b,"--ps-on-accent":n(b)}:void 0,C=p?.status===`running`?p.guide.steps[p.index]:void 0;return/* @__PURE__ */ _(`div`,{class:`l`,style:S,children:[/* @__PURE__ */ g(D,{ctx:e,open:s,setOpen:c,near:l}),!s&&p?.status===`running`&&/* @__PURE__ */ g(N,{ctx:e,guide:p.guide,index:p.index,reduced:f},p.guide.id),!s&&p?.status===`completed`&&/* @__PURE__ */ g(E,{ctx:e,guide:p.guide}),/* @__PURE__ */ g(`div`,{class:`sr`,"aria-live":`polite`,children:C?`Step ${p.index+1} of ${p.guide.steps.length}: ${i(C.title,x(e))}`:p?`Level cleared`:``})]})}function F(t){let n=t.options,r=e=>void t.outbox.push(e);O().then(({createTransport:i})=>{let a=i({appKey:n.appKey,url:n.eventsUrl,sdk:n.sdkName??`web`,version:e,preview:n.preview,userId:t.userId,send:n.transport});t.outbox.splice(0).forEach(a.push),r=a.push}).catch(e=>t.emit({type:`sdk_error`,message:String(e)}));let i=document.createElement(`style`);i.textContent=`:host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-left:auto}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:99px;border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.bit{position:absolute;border-radius:99px}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.left{right:auto;left:24px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.panel{right:18px;bottom:86px}.solo{bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}`,t.root.appendChild(i);let a=document.createElement(`div`);t.root.appendChild(a);let o={update:()=>{},openLauncher:()=>{},send:e=>r(e)};return u(/* @__PURE__ */ g(P,{ctx:t,handle:o}),a),o}export{A as findAnchor,F as mount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{return null}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},t=()=>matchMedia(`(prefers-reduced-motion: reduce)`).matches;export{e as n,t};
|
package/package.json
CHANGED
package/dist/sdk-BupMWbuV.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=e=>RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`)}$`),t=e=>e.length>1?e.replace(/\/+$/,``):e;function n(n,r){return!!n&&r!==void 0&&e(t(n)).test(t(r))}function r(e,t){return(e??[]).every(e=>{let n=t[e.trait];return e.op===`exists`?n!=null:e.op===`in`?Array.isArray(e.value)&&e.value.includes(n):n===e.value==(e.op===`eq`)})}function i(e){let{config:t,platform:i}=e,a=e.progress??{seen:!1,guides:{}},o=e.traits??{},s=null,c,l=t.flags||{},u=(t.guides??[]).filter(e=>e.spec_version<=3&&(e.targeting?.platforms??[`web`]).includes(i)),d=e=>u.find(t=>t.id===e),f=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),p=e=>!l.disabled&&(!l.paused_for_new_users||a.seen)&&r(e.targeting?.segments,o),m=e=>{let t=a.guides[e.id];return!s&&p(e)&&(!t||t.status!==`done`&&(t.status===`running`||!e.trigger.once))},h=(e,t,n)=>{a.guides[e.id]={version:e.version,step:n,status:t}},g,_=e=>n(e.path,g),v=e=>n(e.skip_if_on,g)||_(e.complete_on),y=(e,t,n)=>{for(;t<e.steps.length;){if(s={guide:e,index:t,status:`running`},c=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 s={guide:e,index:--t,status:`completed`},h(e,`done`,t),n.push(f(`guide_completed`,e)),n},b=(e,t)=>(a.seen=!0,y(e,t,[f(`guide_shown`,e)])),x=()=>{let e=s;return y(e.guide,e.index+1,[f(`step_completed`,e.guide,e.index)])},S=e=>{let t=u.find(t=>m(t)&&e(t));return t?b(t,0):[]},C=()=>S(e=>e.trigger.type===`first_visit`||_(e.trigger));function w(e){let t=s?.status===`running`?s.guide.steps[s.index]:null;switch(e.type){case`init`:{g=e.path;let t=u.find(e=>a.guides[e.id]?.status===`running`&&p(e));if(t){let e=a.guides[t.id];return b(t,e.version===t.version?e.step:0)}return C()}case`page_view`:return g=e.path,t&&v(t)?x():S(e=>_(e.trigger));case`reset_progress`:{let t=typeof e.guide==`string`&&d(e.guide);return t===void 0?[]:((!t||s?.guide===t)&&(s=null),t?delete a.guides[t.id]:a.guides={},[{type:`progress_reset`,guide_id:t?t.id:void 0},...C()])}case`event`:return t?.complete_on.type===`event`&&t.complete_on.name===e.name?x():S(t=>t.trigger.type===`event`&&t.trigger.name===e.name);case`tap`:return t?.complete_on.type===`tap_anchor`&&t.anchor===e.anchor?x():[];case`complete`:return t?.id===e.step?x():[];case`next`:return t?.complete_on.type===`next_button`?x():[];case`back`:return!t||s.index===0?[]:(s={...s,index:s.index-1},h(s.guide,`running`,s.index),[f(`step_shown`,s.guide,s.index)]);case`close`:if(s?.status!==`completed`)return[];case`dismiss`:{if(!s)return[];let e=s;return s=null,e.status===`completed`?[]:(h(e.guide,`dismissed`,e.index),[f(`guide_dismissed`,e.guide,e.index)])}case`start`:{let n=d(e.guide);if(!n||!p(n)||t&&s.guide===n&&n.steps.slice(0,s.index).every(v))return[];let r=[];return s?.status===`running`&&(h(s.guide,`dismissed`,s.index),r.push(f(`guide_dismissed`,s.guide,s.index))),s=null,r.concat(b(n,0))}case`anchor_missing`:return!t||t.anchor!==e.anchor||c===e.anchor?[]:(c=e.anchor,[{...f(`anchor_missing`,s.guide,s.index),anchor:e.anchor}]);case`identify`:return o={...o,...e.traits},[]}}return{get active(){return s},progress:a,dispatch:w,launcherGuides:()=>u.filter(e=>e.launcher!==!1&&p(e))}}const a={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{return null}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},o=()=>matchMedia(`(prefers-reduced-motion: reduce)`).matches,s=`0.3.0`,c=`playstep_preview`;function l(e,t,n,r=`web`){let o,l,u,d,f,p,m,h={},g=[],_=[],v=()=>`p:${o.appKey}`,y=()=>o.preview||a.set(v(),l.progress),b=e=>{let t={...e,ts:Date.now()};o?.onEvent?.(t),o&&!o.preview&&(d?d.send(t):_.push(t))},x=e=>{try{l&&b({type:`sdk_error`,message:String(e)})}catch{}},S=e=>(...t)=>{try{e(...t)}catch(e){x(e)}},C=(e,t)=>S(n=>w({type:e,[t]:n}));function w(e){if(!l)return void g.push(e);let t=l.dispatch(e);y(),t.forEach(b),l.active&&E(),d?.update()}function T(){return p??(p=document.body.appendChild(document.createElement(`playstep-root`)).attachShadow({mode:`open`}))}function E(){return f??(f=e().then(e=>{let t=T();return t.innerHTML=``,d=e.mount({engine:l,config:u,options:o,root:t,outbox:_,userId:()=>m,dispatch:S(w),emit:S(b)})}).catch(e=>void x(e)))}let D,O=S((e={})=>{l?l.launcherGuides().length&&E().then(t=>t?.openLauncher(e.anchor)):D=e});function k(e){e.launcher?.enabled&&l.launcherGuides().length&&!f&&t&&t().then(t=>{f||t.drawLauncher(T(),l,e.launcher.position,O)}).catch(x)}async function A(){let e=o,t=(e.apiBase??`https://cdn.playstep.app`).replace(/\/$/,``),s=null;try{s=new URLSearchParams(location.search).get(c)||(e.config?null:sessionStorage.getItem(c))}catch{}e.preview||(e.preview=!!(e.config||s));let d=e.config;try{d??(d=await fetch(`${t}/v1/${s?`preview/${s}?key=`:`config/`}${e.appKey}`).then(e=>e.json()))}catch{return}try{s&&sessionStorage[d.guides?`setItem`:`removeItem`](c,s)}catch{}if(d?.capture)return void n?.().then(t=>t.start(d.capture,e.appKey)).catch(x);if(d?.guides&&!d.flags?.disabled&&(u=d,e.eventsUrl=d.ingest_url??`${t}/v1/events`,l=i({config:d,platform:r,progress:e.preview?void 0:a.get(v())??void 0,traits:h}),w({type:`init`,path:location.pathname}),g.splice(0).forEach(w),D&&O(D),k(d),e.autoPageViews!==!1)){let e=location.pathname,t=S(()=>location.pathname!==e&&w({type:`page_view`,path:e=location.pathname}));for(let e of[`pushState`,`replaceState`]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener(`popstate`,t)}}return{version:s,init:S(e=>{if(o||!e?.appKey)return;o={...e};let t=()=>setTimeout(()=>A().catch(x));document.readyState===`complete`?t():addEventListener(`load`,t)}),identify:S((e,t)=>{m=e,h={...h,...t},w({type:`identify`,traits:h})}),track:C(`event`,`name`),start:C(`start`,`guide`),complete:C(`complete`,`step`),page:S(e=>w({type:`page_view`,path:e??location.pathname})),openLauncher:O,resetProgress:C(`reset_progress`,`guide`),reset:S(()=>{w({type:`dismiss`}),m=void 0,h={},l&&(Object.assign(l.progress,{seen:!1,guides:{}}),y(),d?.update()),o?.preview||a.set(`d`,null)})}}export{a as i,l as n,o as r,s as t};
|
package/dist/ui-DkqtUF5u.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t,t as n}from"./sdk-BupMWbuV.js";import{i as r,n as i,r as a,t as o}from"./text-rFw_ND9o.js";import{computePosition as s,flip as c,offset as l,shift as u}from"@floating-ui/dom";import{render as d}from"preact";import{useEffect as f,useLayoutEffect as p,useRef as m,useState as h}from"preact/hooks";import{Fragment as g,jsx as _,jsxs as v}from"preact/jsx-runtime";function y(e){let t=[],n,r=e.send??((e,t)=>{navigator.sendBeacon&&navigator.sendBeacon(e,t)||fetch(e,{method:`POST`,body:t,keepalive:!0,headers:{"content-type":`text/plain`}}).catch(()=>{})});function i(){clearTimeout(n),n=void 0;let i=e.envelope();if(t.length&&i)for(;t.length;)r(e.url,JSON.stringify({...i,events:t.splice(0,20)}))}return addEventListener(`visibilitychange`,()=>document.visibilityState===`hidden`&&i()),addEventListener(`pagehide`,i),{push(r){t.push(r),t.length>=20?i():n??(n=setTimeout(i,e.delayMs??2e3))},flush:i,get size(){return t.length}}}const b=e=>e+(crypto.randomUUID?crypto.randomUUID().replace(/-/g,``):Math.random().toString(36).slice(2)+Date.now().toString(36));function x(){try{let e=sessionStorage.getItem(`playstep:s`);return e||sessionStorage.setItem(`playstep:s`,e=b(`s_`)),e}catch{return b(`s_`)}}async function S(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function C(t){let n=x(),r=e.get(`d`);r||e.set(`d`,r=b(`d_`));let i,a=r,o=!1,s=y({url:t.url,send:t.send,envelope:()=>{let e=t.userId();return e&&e!==i?(o||(o=!0,S(`${t.appKey}:${e}`).then(t=>{i=e,a=`u_${t.slice(0,40)}`,o=!1,s.flush()})),null):(e||(a=r),{key:t.appKey,sdk:{name:t.sdk,version:t.version},platform:`web`,session_id:n,user_key:a,preview:t.preview})}});return{session:n,push:e=>s.push(e.message?{...e,message:e.message.slice(0,300)}:e),flush:s.flush}}const w={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 T({name:e}){return/* @__PURE__ */ _(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:w[e]}})}function E(e){try{let t=JSON.parse(sessionStorage.getItem(`playstep:clips`)??`[]`);if(t.includes(e))return!1;sessionStorage.setItem(`playstep:clips`,JSON.stringify([...t,e].slice(-200)))}catch{}return!0}const D=e=>e.options.locale??navigator.language??`en`,O=(e,t)=>a(t.name,D(e),t.locale_default)||t.id;function k({ctx:e,guide:t,index:n,reduced:r,clip:s,big:c,onExpand:l,onDuration:u}){let d=t.steps[n],p=m(null),[y,b]=h(!0),[x,S]=h(!r&&s.source!==`embed`),[C,w]=h(s.duration_ms??0),O=r=>e.emit({type:r,guide_id:t.id,guide_version:t.version,step_id:d.id,step_index:n,clip_id:s.source===`hosted`?s.clip_id:void 0,clip_source:s.source}),k=e=>E(`${e}|${s.url}`)&&O(e);if(f(()=>{let e=p.current;e&&x&&(e.muted=y,e.play()?.catch(()=>{}))},[x,s.url]),f(()=>u(x&&s.source!==`embed`?C:0),[C,x]),s.source===`embed`){let t=i(s.url),n=new URL(s.url).hostname.replace(/^www\./,``);return/* @__PURE__ */ _(`div`,{class:`clip embed`,children:x&&t?/* @__PURE__ */ _(`iframe`,{src:t.src,title:`Video: ${a(d.title,D(e))}`,allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowFullScreen:!0}):/* @__PURE__ */ v(g,{children:[(s.poster??t?.thumb)&&/* @__PURE__ */ _(`img`,{src:s.poster??t?.thumb,alt:``}),/* @__PURE__ */ _(`button`,{class:`play`,"aria-label":`Play video`,onClick:()=>(S(!0),O(`clip_played`)),children:/* @__PURE__ */ _(T,{name:`play`})}),/* @__PURE__ */ _(`div`,{class:`bar`,children:/* @__PURE__ */ v(`span`,{class:`pill`,children:[/* @__PURE__ */ _(T,{name:`external-link`}),n,C?` · ${o(C)}`:``]})})]})})}return/* @__PURE__ */ v(`div`,{class:`clip`,children:[x?/* @__PURE__ */ _(`video`,{ref:p,src:s.url,poster:s.poster,muted:y,loop:!0,autoplay:!0,playsInline:!0,preload:`auto`,"aria-label":`Clip: ${a(d.title,D(e))}`,onLoadedData:()=>k(`clip_loaded`),onPlaying:()=>k(`clip_played`),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&w(t*1e3)}}):/* @__PURE__ */ v(g,{children:[s.poster&&/* @__PURE__ */ _(`img`,{src:s.poster,alt:``}),/* @__PURE__ */ _(`button`,{class:`play`,"aria-label":`Play clip`,onClick:()=>S(!0),children:/* @__PURE__ */ _(T,{name:`play`})})]}),x&&/* @__PURE__ */ v(`div`,{class:`bar`,children:[/* @__PURE__ */ v(`span`,{class:`pill`,children:[/* @__PURE__ */ _(T,{name:`play`}),C?`${o(C)} loop`:`Loop`]}),/* @__PURE__ */ _(`button`,{class:`round`,"aria-label":y?`Unmute clip`:`Mute clip`,onClick:()=>{b(!y),p.current&&(p.current.muted=!y),y&&O(`clip_unmuted`)},children:/* @__PURE__ */ _(T,{name:y?`volume-x`:`volume-2`})}),/* @__PURE__ */ _(`button`,{class:`round`,"aria-label":c?`Shrink clip`:`Expand clip`,"aria-pressed":c,onClick:l,children:/* @__PURE__ */ _(T,{name:`maximize-2`})})]})]})}function A({ctx:e,guide:t,index:n,reduced:r,cardRef:i,style:o}){let s=t.steps[n],c=t.steps.length,[l,u]=h(!1),[d,p]=h(0),m=n=>a(n,D(e),t.locale_default),g=s.complete_on.type===`next_button`;return f(()=>{u(!1);let e=t.steps[n+1]?.clip;if(e&&e.source!==`embed`&&!r&&!navigator.connection?.saveData){let t=document.createElement(`video`);t.preload=`auto`,t.muted=!0,t.src=e.url}},[t.id,n]),/* @__PURE__ */ v(`div`,{ref:i,class:`card${l?` big`:``}`,style:o,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabIndex:-1,"data-step":s.id,children:[s.clip&&/* @__PURE__ */ _(k,{ctx:e,guide:t,index:n,reduced:r,clip:s.clip,big:l,onExpand:()=>u(!l),onDuration:p},s.id),/* @__PURE__ */ v(`div`,{class:`body`,children:[/* @__PURE__ */ v(`div`,{class:`meta`,children:[/* @__PURE__ */ v(`span`,{children:[`Step `,n+1,` of `,c,` · `,O(e,t)]}),/* @__PURE__ */ _(`button`,{class:`x`,"aria-label":`Close guide`,onClick:()=>e.dispatch({type:`dismiss`}),children:/* @__PURE__ */ _(T,{name:`x`})})]}),/* @__PURE__ */ _(`div`,{class:`steps`,role:`img`,"aria-label":`Step ${n+1} of ${c}`,children:t.steps.map((e,t)=>/* @__PURE__ */ _(`span`,{class:`seg${t<n?` done`:t===n?` cur${d&&!r?` anim`:``}`:``}`,style:t===n&&d?{"--d":`${d}ms`}:void 0},t))}),/* @__PURE__ */ _(`h2`,{class:`title`,id:`ps-title`,children:m(s.title)}),/* @__PURE__ */ _(`p`,{class:`text`,id:`ps-text`,children:m(s.body)})]}),/* @__PURE__ */ v(`div`,{class:`foot`,children:[g?/* @__PURE__ */ _(`span`,{class:`sp`}):/* @__PURE__ */ v(`span`,{class:`wait`,children:[/* @__PURE__ */ _(`span`,{class:`pulse`,"aria-hidden":`true`}),`Waiting for you`]}),n>0&&t.steps[n-1].complete_on.type!==`page`&&!t.steps[n-1].skip_if_on&&/* @__PURE__ */ _(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`}),children:`Back`}),g&&/* @__PURE__ */ v(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`}),children:[n+1===c?`Done`:`Next`,/* @__PURE__ */ _(T,{name:`arrow-right`})]})]})]})}const j=[`width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)`,`width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)`,`width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)`,`width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)`,`width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)`,`width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)`];function M({ctx:e,guide:t}){let n=e.engine.launcherGuides().find(n=>n.id!==t.id&&e.engine.progress.guides[n.id]?.status!==`done`),r=m(null);return f(()=>r.current?.focus(),[]),/* @__PURE__ */ v(g,{children:[/* @__PURE__ */ _(`div`,{class:`scrim`,onClick:()=>e.dispatch({type:`close`})}),/* @__PURE__ */ v(`div`,{class:`cel`,ref:r,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabIndex:-1,children:[/* @__PURE__ */ v(`div`,{class:`art`,"aria-hidden":`true`,children:[j.map((e,t)=>/* @__PURE__ */ _(`span`,{class:`bit`,style:e},t)),/* @__PURE__ */ _(`span`,{class:`tile`,children:/* @__PURE__ */ _(T,{name:`ps-level-up`})})]}),/* @__PURE__ */ _(`h2`,{id:`ps-cel`,children:`Level cleared`}),/* @__PURE__ */ v(`p`,{children:[`You finished `,O(e,t),`.`,n?` Next up: ${O(e,n)}.`:``]}),/* @__PURE__ */ v(`div`,{class:`acts`,children:[/* @__PURE__ */ v(`button`,{class:`btn sec`,onClick:()=>e.dispatch({type:`start`,guide:t.id}),children:[/* @__PURE__ */ _(T,{name:`rotate-ccw`}),`Replay`]}),n?/* @__PURE__ */ v(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`start`,guide:n.id}),children:[`Next guide`,/* @__PURE__ */ _(T,{name:`arrow-right`})]}):/* @__PURE__ */ _(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`close`}),children:`Done`})]})]})]})}function N({ctx:e,open:t,setOpen:n,near:r}){let i=m(null);p(()=>{let e=i.current;e&&(e.style.cssText=``,r&&s(r,e,{strategy:`fixed`,placement:`top-start`,middleware:[l(8),c({padding:12}),u({padding:12})]}).then(({x:t,y:n})=>e.style.cssText=`left:${t}px;top:${n}px;right:auto;bottom:auto`))},[t,r]);let o=m(null);f(()=>{t?(o.current=e.root.activeElement??document.activeElement,i.current?.focus()):o.current?.focus()},[t]);let d=e.config.launcher,h=e.engine.launcherGuides();if(!h.length)return null;let y=e.engine.progress.guides,b=h.filter(e=>!y[e.id]).length,x=d?.position===`bottom-left`?` left`:``;return/* @__PURE__ */ v(g,{children:[t&&/* @__PURE__ */ v(`div`,{class:`panel${x}${d?.enabled?``:` solo`}`,ref:i,tabIndex:-1,role:`dialog`,"aria-label":`Guides`,children:[/* @__PURE__ */ _(`button`,{class:`x`,"aria-label":`Close guides`,onClick:()=>n(!1),children:/* @__PURE__ */ _(T,{name:`x`})}),/* @__PURE__ */ _(`h2`,{children:a(d?.title,D(e))||`Need a hand?`}),/* @__PURE__ */ _(`p`,{children:a(d?.description,D(e))||`Pick a guide and play it step by step.`}),/* @__PURE__ */ _(`ul`,{class:`rows`,children:h.map(t=>{let r=y[t.id],i=t.steps.length,a=r?.status===`done`,o=r?.status===`running`;return/* @__PURE__ */ _(`li`,{children:/* @__PURE__ */ v(`button`,{class:`row`,onClick:()=>{n(!1),r&&e.dispatch({type:`reset_progress`,guide:t.id}),e.dispatch({type:`start`,guide:t.id})},children:[/* @__PURE__ */ _(`span`,{class:`ti${a?` mint`:r?``:` spark`}`,children:/* @__PURE__ */ _(T,{name:a?`check`:`ps-guide`})}),/* @__PURE__ */ v(`span`,{class:`rb`,children:[/* @__PURE__ */ _(`span`,{class:`rt`,children:O(e,t)}),/* @__PURE__ */ _(`span`,{class:`rm`,children:a?`Completed`:o?`Step ${r.step+1} of ${i}`:`${i} steps`}),o&&/* @__PURE__ */ _(`span`,{class:`prog`,"aria-hidden":`true`,children:/* @__PURE__ */ _(`i`,{style:{width:`${r.step/i*100}%`}})})]}),r?/* @__PURE__ */ v(`span`,{class:`rp`,children:[/* @__PURE__ */ _(T,{name:`rotate-ccw`}),`Replay`]}):/* @__PURE__ */ _(`span`,{class:`new`,children:`New`})]})},t.id)})}),h.some(e=>y[e.id])&&/* @__PURE__ */ _(`div`,{class:`acts so`,children:/* @__PURE__ */ _(`button`,{class:`btn gho`,onClick:()=>{e.dispatch({type:`reset_progress`}),e.engine.active?n(!1):i.current?.focus()},children:`Start over`})}),e.config.flags?.show_badge!==!1&&/* @__PURE__ */ v(`a`,{class:`pb`,href:`https://playstep.app/?ref=badge`,target:`_blank`,rel:`noopener`,children:[/* @__PURE__ */ _(`span`,{dangerouslySetInnerHTML:{__html:`<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>`},style:`display:inline-flex;width:16px;height:16px`}),`Powered by PlayStep`]})]}),d?.enabled&&/* @__PURE__ */ v(`button`,{class:`lb${x}`,"aria-label":t?`Close guides`:`Open guides`,"aria-expanded":t,onClick:()=>n(!t),children:[/* @__PURE__ */ _(T,{name:`ps-launcher`}),b>0&&!t&&/* @__PURE__ */ _(`span`,{class:`cnt`,children:b})]})]})}const P=e=>!!e?.getClientRects().length;function F(e,t){let n=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{n||(n=t?[...document.querySelectorAll(t.css)].find(e=>P(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return P(n)?n:null}function I(e,t,n){let[r,i]=h(()=>e?F(e,t):null);return f(()=>{if(!e)return i(null);let r=F(e,t);i(r);let a=0,o=()=>{a=0;let n=F(e,t);n!==r&&i(r=n)},s=new MutationObserver(()=>a||(a=requestAnimationFrame(o)));s.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-guide`,`hidden`,`style`,`class`]});let c=setTimeout(()=>!r&&n(e),3e3);return()=>{s.disconnect(),clearTimeout(c),cancelAnimationFrame(a)}},[e,t]),r}function L(e,n,r,i,a){let[o,d]=h(null);return p(()=>{let a=n.current;if(!a)return;if(!e){let e=()=>d({x:(innerWidth-a.offsetWidth)/2,y:i===`center`?(innerHeight-a.offsetHeight)/2:innerHeight-a.offsetHeight-24});e();let t=new ResizeObserver(e);return t.observe(a),addEventListener(`resize`,e),()=>{t.disconnect(),removeEventListener(`resize`,e)}}let o=e.getBoundingClientRect();(o.bottom<0||o.top>innerHeight)&&e.scrollIntoView({block:`center`,behavior:t()?`auto`:`smooth`});let f=()=>{let t=e.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;s(e,a,{strategy:`fixed`,placement:r===`auto`?`bottom`:r,middleware:[l(18),c({fallbackPlacements:[`top`,`left`,`right`],padding:12}),u({padding:12})]}).then(({x:e,y:r})=>d({x:e,y:r,spot:{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(n+6,(t.height+12)/2)}}))};f();let p=new ResizeObserver(f);p.observe(e),p.observe(a),addEventListener(`scroll`,f,{capture:!0,passive:!0}),addEventListener(`resize`,f);let m=setInterval(f,400);return()=>{p.disconnect(),clearInterval(m),removeEventListener(`scroll`,f,{capture:!0}),removeEventListener(`resize`,f)}},[e,i,r,...a]),o}function R({ctx:e,guide:t,index:n,reduced:r}){let i=t.steps[n],a=I(i.anchor,i.find?.web,t=>e.dispatch({type:`anchor_missing`,anchor:t})),o=m(null);f(()=>{if(!a)return;let t=t=>t.composedPath().includes(a)&&e.dispatch({type:`tap`,anchor:i.anchor});return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[a]);let s=t.theme?.position??`bottom`,c=L(a,o,i.placement??`auto`,s,[i.id]),l=m(``);f(()=>{c&&l.current!==i.id&&(l.current=i.id,document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)||o.current?.focus({preventScroll:!0}))},[i.id,c]);let[u,d]=h(!1);f(()=>{c&&!u&&requestAnimationFrame(()=>d(!0))},[c]),f(()=>{let t=t=>{if(t.key!==`Tab`||!o.current)return;let n=[...o.current.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],r=t.composedPath().includes(o.current),i=n[0],s=n.at(-1),c=e.root.activeElement;r&&!t.shiftKey&&c===s?(t.preventDefault(),(a??i)?.focus()):r&&t.shiftKey&&c===i?(t.preventDefault(),(a??s)?.focus()):a&&document.activeElement===a&&(t.preventDefault(),(t.shiftKey?s:i)?.focus())};return document.addEventListener(`keydown`,t,!0),()=>document.removeEventListener(`keydown`,t,!0)},[a]);let p=c?.spot;return/* @__PURE__ */ v(g,{children:[a&&p?/* @__PURE__ */ _(`div`,{class:`spot`,"aria-hidden":`true`,style:{width:`${p.w}px`,height:`${p.h}px`,transform:`translate(${p.x}px,${p.y}px)`,borderRadius:`${p.r}px`}}):!a&&s===`center`&&/* @__PURE__ */ _(`div`,{class:`scrim`,"aria-hidden":`true`}),/* @__PURE__ */ _(A,{ctx:e,guide:t,index:n,reduced:r,cardRef:o,style:c?{transform:`translate(${Math.round(c.x)}px,${Math.round(c.y)}px)`,transition:u?void 0:`none`}:{visibility:`hidden`}})]})}function z({ctx:e,handle:n}){let[,i]=h(0),o=()=>i(e=>e+1),[s,c]=h(!1),[l,u]=h(),d=t();n.update=o,n.openLauncher=t=>{let n=document.activeElement;u(t??(n!==document.body&&n!==e.root.host?n??void 0:void 0)),c(!0)},f(()=>{let t=t=>{t.key===`Escape`&&(s?c(!1):e.engine.active&&e.dispatch({type:e.engine.active.status===`completed`?`close`:`dismiss`}))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[s]);let p=e.engine.active,m=p?.guide??e.engine.launcherGuides()[0],g=m?.theme?.mode??`auto`,y=g===`dark`||g===`auto`&&matchMedia(`(prefers-color-scheme: dark)`).matches;e.root.host.setAttribute(`data-mode`,y?`dark`:`light`);let b=m?.theme?.accent,x=b?{"--ps-accent":b,"--ps-accent-hover":b,"--ps-on-accent":r(b)}:void 0,S=p?.status===`running`?p.guide.steps[p.index]:void 0;return/* @__PURE__ */ v(`div`,{class:`l`,style:x,children:[/* @__PURE__ */ _(N,{ctx:e,open:s,setOpen:c,near:l}),!s&&p?.status===`running`&&/* @__PURE__ */ _(R,{ctx:e,guide:p.guide,index:p.index,reduced:d},p.guide.id),!s&&p?.status===`completed`&&/* @__PURE__ */ _(M,{ctx:e,guide:p.guide}),/* @__PURE__ */ _(`div`,{class:`sr`,"aria-live":`polite`,children:S?`Step ${p.index+1} of ${p.guide.steps.length}: ${a(S.title,D(e))}`:p?`Level cleared`:``})]})}function B(e){let t=e.options,r=C({appKey:t.appKey,url:t.eventsUrl,sdk:t.sdkName??`web`,version:n,preview:t.preview,userId:e.userId,send:t.transport});e.outbox.splice(0).forEach(r.push);let i=document.createElement(`style`);i.textContent=`:host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-left:auto}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:99px;border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.bit{position:absolute;border-radius:99px}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.left{right:auto;left:24px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.panel{right:18px;bottom:86px}.solo{bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}`,e.root.appendChild(i);let a=document.createElement(`div`);e.root.appendChild(a);let o={update:()=>{},openLauncher:()=>{},send:r.push};return d(/* @__PURE__ */ _(z,{ctx:e,handle:o}),a),o}export{F as findAnchor,B as mount};
|