@axceera/playstep 0.5.0 → 0.6.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 CHANGED
@@ -23,7 +23,8 @@ Mark the elements your guides point at with `data-guide`:
23
23
 
24
24
  Other calls: `playstep.start(guideId)`, `playstep.complete(stepId)`, `playstep.page(path)`,
25
25
  `playstep.openLauncher({ anchor })` (the list of guides people can replay, next to your own menu button), `playstep.resetProgress(guideId?)`
26
- (let guides start again, keeping the user) and `playstep.reset()` (on sign-out).
26
+ (let guides start again, keeping the user), `playstep.reset()` (on sign-out) and `playstep.pause()` / `playstep.resume()`
27
+ (no guides for now, for a user who should not see them, keeping their progress).
27
28
 
28
29
  ## Script tag
29
30
 
@@ -1 +1 @@
1
- !function(){let e=e=>e.length>1?e.replace(/\/+$/,""):e;function t(t,n){return!!t&&void 0!==n&&(r=e(t),RegExp(`^${r.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`)).test(e(n));var r}function n(e){let n,r,{config:i,platform:s}=e,a=e.progress??{seen:!1,guides:{}},o=e.traits??{},p=null,u=i.flags||{},c=(i.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,r),f=e=>t(e.skip_if_on,r)||m(e.complete_on),y=(e,t,r)=>{for(;t<e.steps.length;){if(p={guide:e,index:t,status:"running"},n=void 0,h(e,"running",t),r.push(l("step_shown",e,t)),!f(e.steps[t]))return r;r.push(l("step_completed",e,t++))}return p={guide:e,index:--t,status:"completed"},h(e,"done",t),r.push(l("guide_completed",e)),r},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":{r=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 r=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 r=[];return"running"===p?.status&&(h(p.guide,"dismissed",p.index),r.push(l("guide_dismissed",p.guide,p.index))),p=null,r.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 r={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{}}},i="playstep_preview",s=document.currentScript;function a(e,t){return new Promise((n,r)=>{document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,s?.src||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))})}let o=()=>a("launcher","sha256-cRfLn8IceaWlkTL1lnFJJcmfAe8YUXJAr1fXQpdkb8U="),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||r.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=>b({type:e,[t]:n}));function b(e){if(!p)return void m.push(e);let t=p.dispatch(e);v(),t.forEach(x(_)),(p.active||r.get("q"))&&L(),c?.update()}function S(){return l??(l=document.body.appendChild(document.createElement("playstep-root")).attachShadow({mode:"open"}))}function L(){return d??(d=e().then(e=>{let t=S();return t.innerHTML="",c=e.mount({engine:p,config:u,options:o,root:t,outbox:f,userId:()=>g,dispatch:x(b),emit:x(_)})}).catch(w))}let E,I=x((e={})=>{p?p.launcherGuides().length&&L().then(t=>t?.openLauncher(e.anchor)):E=e});function k(e){e.launcher?.enabled&&p.launcherGuides().length&&!d&&t&&t().then(t=>{d||t.drawLauncher(S(),p,e,I,o)}).catch(w)}return{version:"0.5.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(i)||(e.config?null:sessionStorage.getItem(i))}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"](i,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:r.get(y())??void 0,traits:h}),b({type:"init",path:location.pathname}),m.splice(0).forEach(b),E&&I(E),k(d),!1!==e.autoPageViews)){let e=location.pathname,t=x(()=>location.pathname!==e&&b({type:"page_view",path:e=location.pathname}));for(let e of["pushState","replaceState"]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener("popstate",t)}}().catch(w));"complete"===document.readyState?t():addEventListener("load",t)}),identify:x((e,t)=>{g=e,h={...h,...t},b({type:"identify",traits:h})}),track:$("event","name"),start:$("start","guide"),complete:$("complete","step"),page:x(e=>b({type:"page_view",path:e??location.pathname})),openLauncher:I,resetProgress:$("reset_progress","guide"),reset:x(()=>{b({type:"dismiss"}),g=void 0,h={},p&&(Object.assign(p.progress,{seen:!1,guides:{}}),v(),c?.update()),o?.preview||r.set("d",null)})}}(()=>a("ui","sha256-UZb0guphMQkqgHUlV4uy+HWnSb61asz845qD9nMIGVg="),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})}}();
1
+ !function(){let e=e=>e.length>1?e.replace(/\/+$/,""):e;function t(t,n){return!!t&&void 0!==n&&(r=e(t),RegExp(`^${r.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`)).test(e(n));var r}function n(e){let n,r,{config:i,platform:s}=e,a=e.progress??{seen:!1,guides:{}},u=e.traits??{},p=null,o=new Set,c=!1,d=i.flags||{},l=(i.guides??[]).filter(e=>e.spec_version<=3&&(e.targeting?.platforms??["web"]).includes(s)),g=e=>l.find(t=>t.id===e),h=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),m=e=>!c&&!d.disabled&&(!d.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,u),y=(e,t,n)=>{a.guides[e.id]={version:e.version,step:n,status:t}},f=e=>t(e.path,r),v=e=>t(e.skip_if_on,r)||f(e.complete_on),_=(e,t,r)=>{for(;t<e.steps.length;){if(p={guide:e,index:t,status:"running"},n=void 0,y(e,"running",t),r.push(h("step_shown",e,t)),!v(e.steps[t]))return r;r.push(h("step_completed",e,t++))}return p={guide:e,index:--t,status:"completed"},y(e,"done",t),r.push(h("guide_completed",e)),r},w=(e,t)=>(a.seen=!0,_(e,t,[h("guide_shown",e)])),x=()=>{let e=p;return p=null,"running"===e?.status?(y(e.guide,"dismissed",e.index),[h("guide_dismissed",e.guide,e.index)]):[]},$=()=>{let e=p;return _(e.guide,e.index+1,[h("step_completed",e.guide,e.index)])},S=e=>{let t=l.find(t=>(e=>{let t=a.guides[e.id];return!p&&!o.has(e.id)&&m(e)&&(!t||"done"!==t.status&&("running"===t.status||!e.trigger.once))})(t)&&e(t));return t?w(t,0):[]},b=()=>S(e=>"first_visit"===e.trigger.type||f(e.trigger)),L=()=>{let e=l.find(e=>"running"===a.guides[e.id]?.status&&!o.has(e.id)&&m(e));if(!e)return b();let t=a.guides[e.id];return w(e,t.version===e.version?t.step:0)};return{get active(){return c?null:p},progress:a,dispatch:function(e){let t=c||"running"!==p?.status?null:p.guide.steps[p.index];switch(e.type){case"init":return r=e.path,o.clear(),L();case"pause":return c=!0,[];case"resume":return c?(c=!1,p?[]:L()):[];case"page_view":return r=e.path,t&&v(t)?$():S(e=>f(e.trigger));case"reset_progress":{let t="string"==typeof e.guide&&g(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},...(o.clear(),b())])}case"event":return"event"===t?.complete_on.type&&t.complete_on.name===e.name?$():S(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},y(p.guide,"running",p.index),[h("step_shown",p.guide,p.index)]):[];case"hide":return t&&(o.add(p.guide.id),p=null),[];case"close":if("completed"!==p?.status)return[];case"dismiss":return x();case"start":{let n=g(e.guide);return!n||!m(n)||t&&p.guide===n&&n.steps.slice(0,p.index).every(v)?[]:x().concat(w(n,0))}case"anchor_missing":return t&&t.anchor===e.anchor&&n!==e.anchor?(n=e.anchor,[{...h("anchor_missing",p.guide,p.index),anchor:e.anchor}]):[];case"identify":return u={...u,...e.traits},[]}},launcherGuides:()=>l.filter(e=>!1!==e.launcher&&m(e))}}let r={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{}}},i="playstep_preview",s=document.currentScript;function a(e,t){return new Promise((n,r)=>{document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,s?.src||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))})}let u=()=>a("launcher","sha256-cRfLn8IceaWlkTL1lnFJJcmfAe8YUXJAr1fXQpdkb8U="),p=function(e,t,s,a="web"){let u,p,o,c,d,l,g,h={},m=!1,y=[],f=[],v=()=>`p:${u.appKey}`,_=()=>u.preview||r.set(v(),p.progress),w=e=>{let t={...e,ts:Date.now()};u?.preview||(c?c.send(t):f.push(t)),u?.onEvent?.(t)},x=e=>{try{w({type:"sdk_error",message:String(e)})}catch{}},$=e=>(...t)=>{try{e(...t)}catch(e){x(e)}},S=(e,t)=>$(n=>b({type:e,[t]:n}));function b(e){if(!p)return void y.push(e);let t=p.dispatch(e);_(),t.forEach($(w)),(p.active||r.get("q"))&&E(),c?.update()}function L(){return l??(l=document.body.appendChild(document.createElement("playstep-root")).attachShadow({mode:"open"}))}function E(){return d??(d=e().then(e=>{let t=L();return t.innerHTML="",c=e.mount({engine:p,config:o,options:u,root:t,outbox:f,userId:()=>g,dispatch:$(b),emit:$(w)})}).catch(x))}let k,I=$((e={})=>{p?p.launcherGuides().length&&E().then(t=>t?.openLauncher(e.anchor)):k=e});function K(e){e.launcher?.enabled&&p.launcherGuides().length&&!d&&t&&t().then(t=>{d||t.drawLauncher(L(),p,e,I,u)}).catch(x)}let P=e=>$(()=>{m!==e&&(m=e,p&&(b({type:e?"pause":"resume"}),!d&&(e?l&&(l.innerHTML=""):K(o))))});return{version:"0.6.0",init:$(e=>{if(u||!e?.appKey)return;u={...e};let t=()=>setTimeout(()=>async function(){let e=u,t=(e.apiBase??"https://cdn.playstep.app").replace(/\/$/,""),c=null;try{c=new URLSearchParams(location.search).get(i)||(e.config?null:sessionStorage.getItem(i))}catch{}e.preview||(e.preview=!(!e.config&&!c));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"](i,c)}catch{}if(d?.capture)s?.().then(t=>t.start(d.capture,e.appKey)).catch(x);else if(d?.guides&&!d.flags?.disabled&&(o=d,e.eventsUrl=d.ingest_url??`${t}/v1/events`,p=n({config:d,platform:a,progress:e.preview?void 0:r.get(v())??void 0,traits:h}),m&&p.dispatch({type:"pause"}),b({type:"init",path:location.pathname}),y.splice(0).forEach(b),k&&I(k),K(d),!1!==e.autoPageViews)){let e=location.pathname,t=$(()=>location.pathname!==e&&b({type:"page_view",path:e=location.pathname}));for(let e of["pushState","replaceState"]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener("popstate",t)}}().catch(x));"complete"===document.readyState?t():addEventListener("load",t)}),identify:$((e,t)=>{g=e,h={...h,...t},b({type:"identify",traits:h})}),track:S("event","name"),start:S("start","guide"),complete:S("complete","step"),page:$(e=>b({type:"page_view",path:e??location.pathname})),openLauncher:I,resetProgress:S("reset_progress","guide"),reset:$(()=>{b({type:"dismiss"}),g=void 0,h={},p&&(Object.assign(p.progress,{seen:!1,guides:{}}),_(),c?.update()),u?.preview||r.set("d",null)}),pause:P(!0),resume:P(!1),isPaused:()=>m}}(()=>a("ui","sha256-yq9eCLu8vnA1uXD3kPihp1MPoAEviNis6yeCrt8iYos="),u,()=>u().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,r=Math.round,i=e=>({x:e,y:e}),o={left:"right",right:"left",bottom:"top",top:"bottom"};function a(e,r,i){return n(e,t(r,i))}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 r=c(e),i=f(e),o=d(i),a="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"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,r){let i=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,r);return i&&(o=o.map(e=>e+"-"+i),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:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function S(e,t,n){let r,{reference:i,floating:o}=e,a=u(t),l=f(t),p=d(l),_=s(t),h="y"===a,g=i.x+i.width/2-o.width/2,m=i.y+i.height/2-o.height/2,x=i[p]/2-o[p]/2;switch(_){case"top":r={x:g,y:i.y-o.height};break;case"bottom":r={x:g,y:i.y+i.height};break;case"right":r={x:i.x+i.width,y:m};break;case"left":r={x:i.x-o.width,y:m};break;default:r={x:i.x,y:i.y}}let v=c(t);return v&&(r[l]+=x*("end"===v?1:-1)*(n&&h?-1:1)),r}async function L(e,t){void 0===t&&(t={});let{x:n,y:r,platform:i,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 i.getClippingRect({element:await(null==i.isElement?void 0:i.isElement(h))??!0?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:p,strategy:s})),m="floating"===d?{x:n,y:r,width:o.floating.width,height:o.floating.height}:o.reference,x=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),v=await(null==i.isElement?void 0:i.isElement(x))&&await(null==i.getScale?void 0:i.getScale(x))||{x:1,y:1},y=k(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.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:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),a=s(n),p=c(n),d="y"===u(n),f=C.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 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 F(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==i&&"contents"!==i}function N(e){return/^(table|td|th)$/.test(E(e))}function O(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}let z,W=/transform|translate|scale|rotate|perspective|filter/,U=/paint|layout|strict|content/,B=e=>!!e&&"none"!==e;function I(e){let t=A(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 z??(z=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),z}function V(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 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 r=X(e),i=r===e.ownerDocument?.body,o=R(r);if(i){let e=J(o);return t.concat(o,o.visualViewport||[],F(r)?r:[],e&&n?Y(e):[])}return t.concat(r,Y(r,[],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,i=parseFloat(t.height)||0,o=H(e),a=o?e.offsetWidth:n,l=o?e.offsetHeight:i,s=r(n)!==a||r(i)!==l;return s&&(n=a,i=l),{width:n,height:i,$:s}}function Z(e){return A(e)?e:e.contextElement}function ee(e){let t=Z(e);if(!H(t))return i(1);let n=t.getBoundingClientRect(),{width:o,height:a,$:l}=Q(t),s=(l?r(n.width):n.width)/o,c=(l?r(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}let te=i(0);function ne(e){let t=R(e);return j()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:te}function re(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),a=Z(e),l=i(1);t&&(r?A(r)&&(l=ee(r)):l=ee(e));let s=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===R(e)}(a,n,r)?ne(a):i(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&&r){let e=R(a),t=A(r)?R(r):r,n=e,i=J(n);for(;i&&t!==n;){let e=ee(i),t=i.getBoundingClientRect(),r=q(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,p*=e.y,d*=e.x,u*=e.y,c+=o,p+=a,n=R(i),i=J(n)}}return k({width:d,height:u,x:c,y:p})}function ie(e,t){let n=K(e).scrollLeft;return t?t.left+n:re(P(e)).left+n}function oe(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ie(e,n),y:n.top+t.scrollTop}}function ae(e){let t=K(e),r=e.ownerDocument.body,i=n(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=n(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),a=-t.scrollLeft+ie(e),l=-t.scrollTop;return"rtl"===q(r).direction&&(a+=n(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:l}}function le(e,t,n){let r;if("viewport"===t||"layoutViewport"===t)r=function(e,t,n){void 0===n&&(n="viewport");let r="layoutViewport"===n,i=R(e),o=P(e),a=i.visualViewport,l=o.clientWidth,s=o.clientHeight,c=0,p=0;if(a){let e=!j()||"fixed"===t;r?e||(c=-a.offsetLeft,p=-a.offsetTop):(l=a.width,s=a.height,e&&(c=a.offsetLeft,p=a.offsetTop))}if(ie(o)<=0){let e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(o.clientWidth-t.clientWidth-r),a="stable both-edges"===getComputedStyle(o).scrollbarGutter?i/2:i;a<=25&&(l-=a)}return{width:l,height:s,x:c,y:p}}(e,n,t);else if("document"===t)r=ae(P(e));else if(A(t))r=function(e,t){let n=re(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=ee(e);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{let n=ne(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return k(r)}function se(e,t){let n=t.get(e);if(n)return n;let r=Y(e,[],!1).filter(e=>A(e)&&"body"!==E(e)),i=null,o="fixed"===q(e).position,a=o?G(e):e;for(;A(a)&&!V(a);){let e=q(a),t=I(a),n=i?i.position:o?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?i=e:r=r.filter(e=>e!==a),a=G(a)}return t.set(e,r),r}function ce(e,t,n){let r=H(t),o=P(t),a="fixed"===n,l=re(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=i(0);if((r||!a)&&(("body"!==E(t)||F(o))&&(s=K(t)),r)){let e=re(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&o&&(c.x=ie(o));let p=!o||r||a?i(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=R(e);if(O(e))return n;if(!H(e)){let t=G(e);for(;t&&!V(t);){if(A(t)&&!pe(t))return t;t=G(t)}return n}let r=de(e,t);for(;r&&N(r)&&pe(r);)r=de(r,t);return r&&V(r)&&pe(r)&&!I(r)?n:r||function(e){let t=G(e);for(;H(t)&&!V(t);){if(I(t))return t;if(O(t))return null;t=G(t)}return null}(e)||n}let fe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e,a="fixed"===o,l=P(r),s=!!t&&O(t.floating);if(r===l||s&&a)return n;let c={scrollLeft:0,scrollTop:0},p=i(1),d=i(0),u=H(r);if((u||!a)&&(("body"!==E(r)||F(l))&&(c=K(r)),u)){let e=re(r);p=ee(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let f=!l||u||a?i(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:r,boundary:i,rootBoundary:o,strategy:a}=e,l=[..."clippingAncestors"===i?O(r)?[]:se(r,this._c):[].concat(i),o],s=le(r,l[0],a),c=s.top,p=s.right,d=s.bottom,u=s.left;for(let e=1;e<l.length;e++){let i=le(r,l[e],a);c=n(i.top,c),p=t(i.right,p),d=t(i.bottom,d),u=n(i.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,r=await n(e.floating);return{reference:ce(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.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:r,y:i,placement:o,middlewareData:a}=t,l=await T(t,e);return o===a.offset?.placement&&null!=(n=a.arrow)&&n.alignmentOffset?{}:{x:r+l.x,y:i+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:r,placement:i,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:r},h=await o.detectOverflow(t,f),g=u(i),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-r,enabled:{[m]:s,[g]:c}}}}}},ge=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;let{placement:r,middlewareData:i,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=i.arrow)&&n.alignmentOffset)return{};let k=s(r),S=u(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=[],$=i.flip?.overflows||[];if(d&&P.push(R[k]),f){let e=_(r,o,C);P.push(R[e[0]],R[e[1]])}if($=[...$,{placement:r,overflows:P}],!P.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=E[e];if(t&&("alignment"!==f||S===u(t)||$.every(e=>u(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=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(r!==n)return{reset:{placement:n}}}return{}}}},me=(e,t,n)=>{let r=new Map,i=n??{},o={...fe,...i.platform,_c:r};return(async(e,t,n)=>{let{placement:r="bottom",strategy:i="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:i}),{x:p,y:d}=S(c,r,s),u=r,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:r,placement:u,strategy:i,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:i}):b.rects),({x:p,y:d}=S(c,u,s))),n=-1)}return{x:p,y:d,placement:u,strategy:i,middlewareData:_}})(e,t,{...i,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,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i||++ve,__i:-1,__u:0};return!i&&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 Oe(e,t){if(null==t)return e.__?Oe(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:Oe(e)}function ze(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),ze(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,r,i,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&&(r=void 0,i=void 0,o=(i=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((r=Ae({constructor:void 0},i)).__v=i.__v+1,xe.vnode&&xe.vnode(r),Ke(s,r,i,n.__n,s.namespaceURI,32&i.__u?[o]:null,a,o||Oe(i),32&i.__u,l),r.__v=i.__v,r.__.__k[r.__i]=r,Xe(a,r,l),i.__=i.__e=null,r.__e!=o&&ze(r)))}finally{ye.length=we=0}}function Be(e,t,n,r,i,o,a,l,s,c,p){var d,u,f,_,h,g,m=r.__k||Ee,x=t.length;for(s=function(e,t,n,r,i){var o,a,l,s,c,p,d,u,f,_,h=n.length,g=h,m=0,x=!1,v=e.__k=Array(i);for(o=0;o<i;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||(i>h?m--:i<h&&m++),"function"!=typeof a.type&&(a.__u|=4))):v[o]=null;if(x){for(p=[],d=[],o=0;o<i;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==r&&(r=Oe(l)),Je(l,l));return r}(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,i,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,r){var i,o,a;if("function"==typeof e.type){if(e.props.__P)return t;if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&(i[o].__=e,t=Ie(i[o],t,n,!1));return t}for(t&&!t.parentNode&&(t=Oe(e))&&!t.parentNode&&(t=null),a=t;a&&8==a.nodeType;)a=a.nextSibling;for(e.__e!=a&&(!r&&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,r){var i,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(r>+!!p)for(i=n-1,o=n+1;i>=0||o<t.length;)if((c=t[a=i>=0?i--: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,r,i){var o,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Ve(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Ve(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])(e.__e||(e.__e={}))[t]=n,n&&r||(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"==i)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,r,i,o,a,l,s,c){var p,d,u,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,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 R){_=a.length;try{if(v=t.props,y=(p=R.prototype)&&p.render,b=(p=R.contextType)&&r[p.__c],w=p?b?b.props.value:p.__:r,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1):(y?t.__c=h=new R(v,w):(t.__c=h=new Ne(v,w),h.constructor=R,h.render=Qe),b&&b.sub(h),h.state||(h.state={}),h.__n=r,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=Oe(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&&(r=Ae({},r,h.getChildContext())),y&&n.__c&&h.getSnapshotBeforeUpdate&&(x=h.getSnapshotBeforeUpdate(g,m)),L=p&&p.type===Fe&&null==p.key?p.props.children:p,v.__P&&(p=l,i=(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?Oe(n,0):null),l=Be(e,Pe(L)?L:[L],t,n,r,i,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(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,r,i,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?i="http://www.w3.org/2000/svg":"math"==b?i="http://www.w3.org/1998/Math/MathML":i||(i="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(i,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?u=_:"children"==p||p in y||"value"==p&&"defaultValue"in y||"checked"==p&&"defaultChecked"in y||qe(e,p,null,_,i);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],i);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"==i&&Re.test(b))&&(i="http://www.w3.org/1999/xhtml"),Be(c,Pe(f)?f:[f],t,n,r,i,o,a,o?o[0]:n.__k&&Oe(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],i),p="checked",null!=g&&g!=e[p]&&qe(e,p,g,v[p],i))}else v===y||l&&e.data==y||(e.data=y);return e}(n.__e,t,n,r,i,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 r=0;r<n.length;)Ye(n[r++],n[r++],n[r++]);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,r){try{"function"==typeof e?t?t.__x=e(t)||1:r&&(r=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,"function"==typeof t?t():e(null)):e.current=t}catch(e){xe.__e(e,n)}}function Je(e,t,n){var r,i;if(xe.unmount&&xe.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Ye(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){xe.__e(e,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Je(r[i],t,"function"!=typeof e.type||n&&!e.props.__P);(r=e.__e)&&(n||He(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function Qe(e,t,n){return this.constructor(e,n)}xe={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((o=i.constructor)&&o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),a=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),a=8&i.__g),a)return void(i.__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=Ae({},this.state)),"function"==typeof e&&(e=e(Ae({},n),this.props)),e&&(Ae(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(),Le=/(PointerCapture)$|Capture$/i,Ce=0,Te={};var Ze,et,tt,nt,rt=Object.is,it=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&&lt.__h(et,e,it||t),it=0;var n=et.__H||(et.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ht(e){return it=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],r=n.t(t,e);rt(t,r)||(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=et,!et.__f)){et.__f=!0;var r=et.shouldComponentUpdate;et.shouldComponentUpdate=function(e,t,n){var i=this.__H;if(!i)return!0;var o=!1,a=this.props!=e;if(i.__.some(function(e){e.__N&&(o=!0,rt(e.__[0],e.__N[0])||(a=!0))}),r){var l=r.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 it=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)}}),dt&&dt(e,t)},lt.unmount=function(e){ut&&ut(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(void 0===n){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}r.__P=n,wt(at.push(r))}else kt(r)}catch(e){t=e}}),r.__H=void 0,t&&lt.__e(t,r.__v))};var yt="function"==typeof requestAnimationFrame;function bt(e){var t,n=function(){clearTimeout(r),yt&&cancelAnimationFrame(t),setTimeout(e)},r=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!rt(t,e[n])})}function Ct(e,t){return"function"==typeof t?t(e):t}let Tt=()=>matchMedia("(prefers-reduced-motion: reduce)").matches,Mt=e=>"dark"==e||"light"==e?e:void 0;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,r=.2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(255&t);return 1.05/(r+.05)>=(r+.05)/.0595?"#ffffff":"#151823"}let $t={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 Ht(e,t,n,r,i,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(i||o)&&(c.__source=i,c.__self=o),xe.vnode&&xe.vnode(c),c}function Dt({name:e}){return Ht("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",dangerouslySetInnerHTML:{__html:$t[e]}})}function Ft(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 Nt=e=>e.options.locale??navigator.language??"en",Ot=(e,t)=>Et(t.name,Nt(e),t.locale_default)||t.id;function zt({ctx:e,guide:t,index:n,reduced:r,clip:i,big:o,onExpand:a,onDuration:l}){let s=t.steps[n],c=xt(null),[p,d]=ht(!0),[u,f]=ht(!r&&"embed"!==i.source),[_,h]=ht(i.duration_ms??0),g=r=>e.emit({type:r,guide_id:t.id,guide_version:t.version,step_id:s.id,step_index:n,clip_id:"hosted"===i.source?i.clip_id:void 0,clip_source:i.source}),m=e=>Ft(`${e}|${i.url}`)&&g(e);if(gt(()=>{let e=c.current;e&&u&&(e.muted=p,e.play()?.catch(()=>{}))},[u,i.url]),gt(()=>l(u&&"embed"!==i.source?_:0),[_,u]),"embed"===i.source){let t=function(e){try{let t,n=new URL(e),r=n.hostname.replace(/^(www|m)\./,"");if("youtu.be"===r?t=n.pathname.slice(1):"youtube.com"===r&&(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"===r||"player.vimeo.com"===r?n.pathname.match(/(\d{5,})/)?.[1]:null,t)return{src:`https://player.vimeo.com/video/${t}?autoplay=1`}}catch{}return null}(i.url),n=new URL(i.url).hostname.replace(/^www\./,"");return Ht("div",{class:"clip embed",children:u&&t?Ht("iframe",{src:t.src,title:`Video: ${Et(s.title,Nt(e))}`,allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowFullScreen:!0}):Ht(Fe,{children:[(i.poster??t?.thumb)&&Ht("img",{src:i.poster??t?.thumb,alt:""}),Ht("button",{class:"play","aria-label":"Play video",onClick:()=>(f(!0),g("clip_played")),children:Ht(Dt,{name:"play"})}),Ht("div",{class:"bar",children:Ht("span",{class:"pill",children:[Ht(Dt,{name:"external-link"}),n,_?` · ${Rt(_)}`:""]})})]})})}return Ht("div",{class:"clip",children:[u?Ht("video",{ref:c,src:i.url,poster:i.poster,muted:p,loop:!0,autoplay:!0,playsInline:!0,preload:"auto","aria-label":`Clip: ${Et(s.title,Nt(e))}`,onLoadedData:()=>m("clip_loaded"),onPlaying:()=>m("clip_played"),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&h(1e3*t)}}):Ht(Fe,{children:[i.poster&&Ht("img",{src:i.poster,alt:""}),Ht("button",{class:"play","aria-label":"Play clip",onClick:()=>f(!0),children:Ht(Dt,{name:"play"})})]}),u&&Ht("div",{class:"bar",children:[Ht("span",{class:"pill",children:[Ht(Dt,{name:"play"}),_?`${Rt(_)} loop`:"Loop"]}),Ht("button",{class:"round","aria-label":p?"Unmute clip":"Mute clip",onClick:()=>{d(!p),c.current&&(c.current.muted=!p),p&&g("clip_unmuted")},children:Ht(Dt,{name:p?"volume-x":"volume-2"})}),Ht("button",{class:"round","aria-label":o?"Shrink clip":"Expand clip","aria-pressed":o,onClick:a,children:Ht(Dt,{name:"maximize-2"})})]})]})}function Wt({ctx:e,guide:t,index:n,reduced:r,cardRef:i,style:o}){let a=t.steps[n],l=t.steps.length,[s,c]=ht(!1),[p,d]=ht(0),u=n=>Et(n,Nt(e),t.locale_default),f="next_button"===a.complete_on.type;return gt(()=>{c(!1);let i=t.steps[n+1],o=i?.clip;if(o&&"embed"!==o.source&&!r&&!navigator.connection?.saveData){let r=document.createElement("video");r.preload="auto",r.muted=!0,r.src=o.url,"hosted"===o.source&&Ft(`clip_loaded|${o.url}`)&&e.emit({type:"clip_loaded",guide_id:t.id,guide_version:t.version,step_id:i.id,step_index:n+1,clip_id:o.clip_id,clip_source:"hosted"})}},[t.id,n]),Ht("div",{ref:i,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&&Ht(zt,{ctx:e,guide:t,index:n,reduced:r,clip:a.clip,big:s,onExpand:()=>c(!s),onDuration:d},a.id),Ht("div",{class:"body",children:[Ht("div",{class:"meta",children:[Ht("span",{children:["Step ",n+1," of ",l," · ",Ot(e,t)]}),Ht("button",{class:"x","aria-label":"Close guide",onClick:()=>e.dispatch({type:"dismiss"}),children:Ht(Dt,{name:"x"})})]}),Ht("div",{class:"steps",role:"img","aria-label":`Step ${n+1} of ${l}`,children:t.steps.map((e,t)=>Ht("span",{class:"seg"+(t<n?" done":t===n?" cur"+(p&&!r?" anim":""):""),style:t===n&&p?{"--d":`${p}ms`}:void 0},t))}),Ht("h2",{class:"title",id:"ps-title",children:u(a.title)}),Ht("p",{class:"text",id:"ps-text",children:u(a.body)})]}),Ht("div",{class:"foot",children:[Ht("span",f?{class:"sp"}:{class:"wait",children:[Ht("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&&Ht("button",{class:"btn gho",onClick:()=>e.dispatch({type:"back"}),children:"Back"}),f&&Ht("button",{class:"btn pri",onClick:()=>e.dispatch({type:"next"}),children:[n+1===l?"Done":"Next",Ht(Dt,{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 Bt({ctx:e,guide:t}){let n=e.engine.launcherGuides().find(n=>n.id!==t.id&&"done"!==e.engine.progress.guides[n.id]?.status),r=xt(null);return gt(()=>r.current?.focus(),[]),Ht(Fe,{children:[Ht("div",{class:"scrim",onClick:()=>e.dispatch({type:"close"})}),Ht("div",{class:"cel",ref:r,role:"dialog","aria-modal":"true","aria-labelledby":"ps-cel",tabIndex:-1,children:[Ht("div",{class:"art","aria-hidden":"true",children:[Ut.map((e,t)=>Ht("span",{class:"bit",style:e},t)),Ht("span",{class:"tile",children:Ht(Dt,{name:"ps-level-up"})})]}),Ht("h2",{id:"ps-cel",children:"Level cleared"}),Ht("p",{children:["You finished ",Ot(e,t),".",n?` Next up: ${Ot(e,n)}.`:""]}),Ht("div",{class:"acts",children:[Ht("button",{class:"btn sec",onClick:()=>e.dispatch({type:"start",guide:t.id}),children:[Ht(Dt,{name:"rotate-ccw"}),"Replay"]}),Ht("button",n?{class:"btn pri",onClick:()=>e.dispatch({type:"start",guide:n.id}),children:["Next guide",Ht(Dt,{name:"arrow-right"})]}:{class:"btn pri",onClick:()=>e.dispatch({type:"close"}),children:"Done"})]})]})]})}function It({ctx:e,open:t,setOpen:n,near:r}){let i=xt(null);mt(()=>{let e=i.current;e&&(e.style.cssText="",r&&me(r,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,r]);let o=xt(null);gt(()=>{t?(o.current=e.root.activeElement??document.activeElement,i.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 Ht(Fe,{children:[t&&Ht("div",{class:`panel${p}${a?.enabled?"":" solo"}`,ref:i,tabIndex:-1,role:"dialog","aria-label":"Guides",children:[Ht("button",{class:"x","aria-label":"Close guides",onClick:()=>n(!1),children:Ht(Dt,{name:"x"})}),Ht("h2",{children:Et(a?.title,Nt(e))||"Need a hand?"}),Ht("p",{children:Et(a?.description,Nt(e))||"Pick a guide and play it step by step."}),Ht("ul",{class:"rows",children:l.map(t=>{let r=s[t.id],i=t.steps.length,o="done"===r?.status,a="running"===r?.status;return Ht("li",{children:Ht("button",{class:"row",onClick:()=>{n(!1),r&&e.dispatch({type:"reset_progress",guide:t.id}),e.dispatch({type:"start",guide:t.id})},children:[Ht("span",{class:"ti"+(o?" mint":r?"":" spark"),children:Ht(Dt,{name:o?"check":"ps-guide"})}),Ht("span",{class:"rb",children:[Ht("span",{class:"rt",children:Ot(e,t)}),Ht("span",{class:"rm",children:o?"Completed":a?`Step ${r.step+1} of ${i}`:`${i} steps`}),a&&Ht("span",{class:"prog","aria-hidden":"true",children:Ht("i",{style:{width:r.step/i*100+"%"}})})]}),Ht("span",r?{class:"rp",children:[Ht(Dt,{name:"rotate-ccw"}),"Replay"]}:{class:"new",children:"New"})]})},t.id)})}),l.some(e=>s[e.id])&&Ht("div",{class:"acts so",children:Ht("button",{class:"btn gho",onClick:()=>{e.dispatch({type:"reset_progress"}),e.engine.active?n(!1):i.current?.focus()},children:"Start over"})}),!1!==e.config.flags?.show_badge&&Ht("a",{class:"pb",href:"https://playstep.app/?ref=badge",target:"_blank",rel:"noopener",children:[Ht("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&&Ht("button",{class:`lb${p}`,"aria-label":t?"Close guides":"Open guides","aria-expanded":t,onClick:()=>n(!t),children:[Ht(Dt,{name:"ps-launcher"}),c>0&&!t&&Ht("span",{class:"cnt",children:c})]})]})}let jt=document.currentScript?.src,Vt=e=>!!e?.getClientRects().length;function qt(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 Kt({ctx:e,guide:t,index:n,reduced:r}){let i=t.steps[n],o=function(e,t,n){let[r,i]=ht(()=>e?qt(e,t):null);return gt(()=>{if(!e)return i(null);let r=qt(e,t);i(r);let o=0,a=()=>{o=0;let n=qt(e,t);n!==r&&i(r=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(()=>!r&&n(e),3e3);return()=>{l.disconnect(),clearTimeout(s),cancelAnimationFrame(o)}},[e,t]),r}(i.anchor,i.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:i.anchor});return document.addEventListener("click",t,!0),()=>document.removeEventListener("click",t,!0)},[o]);let l=t.theme?.position??"bottom",s=function(e,t,n,r,i){let[o,a]=ht(null);return mt(()=>{let i=t.current;if(!i)return;if(!e){let e=()=>a({x:(innerWidth-i.offsetWidth)/2,y:"center"===r?(innerHeight-i.offsetHeight)/2:innerHeight-i.offsetHeight-24});e();let t=new ResizeObserver(e);return t.observe(i),addEventListener("resize",e),()=>{t.disconnect(),removeEventListener("resize",e)}}let o=e.getBoundingClientRect();(o.bottom<0||o.top>innerHeight)&&e.scrollIntoView({block:"center",behavior:Tt()?"auto":"smooth"});let l=()=>{let t=e.getBoundingClientRect(),r=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;me(e,i,{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(r+6,(t.height+12)/2)}}))};l();let s=new ResizeObserver(l);s.observe(e),s.observe(i),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,r,n,...i]),o}(o,a,i.placement??"auto",l,[i.id]),c=xt("");gt(()=>{s&&c.current!==i.id&&(c.current=i.id,document.activeElement?.matches("input,textarea,select,[contenteditable]:not([contenteditable=false])")||a.current?.focus({preventScroll:!0}))},[i.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"]')],r=t.composedPath().includes(a.current),i=n[0],l=n.at(-1),s=e.root.activeElement;r&&!t.shiftKey&&s===l?(t.preventDefault(),(o??i)?.focus()):r&&t.shiftKey&&s===i?(t.preventDefault(),(o??l)?.focus()):o&&document.activeElement===o&&(t.preventDefault(),(t.shiftKey?l:i)?.focus())};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[o]);let u=s?.spot;return Ht(Fe,{children:[o&&u?Ht("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&&Ht("div",{class:"scrim","aria-hidden":"true"}),Ht(Wt,{ctx:e,guide:t,index:n,reduced:r,cardRef:a,style:s?{transform:`translate(${Math.round(s.x)}px,${Math.round(s.y)}px)`,transition:p?void 0:"none"}:{visibility:"hidden"}})]})}function Gt({ctx:e,handle:t}){let[,n]=ht(0),r=()=>n(e=>e+1),[i,o]=ht(!1),[a,l]=ht(),s=Tt();t.update=r,t.openLauncher=t=>{let n=document.activeElement;l(t??(n!==document.body&&n!==e.root.host?n??void 0:void 0)),o(!0)},gt(()=>{let t=t=>{"Escape"===t.key&&(i?o(!1):e.engine.active&&e.dispatch({type:"completed"===e.engine.active.status?"close":"dismiss"}))};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[i]),gt(()=>{let e=new MutationObserver(r),t=matchMedia("(prefers-color-scheme: dark)");for(let t of[document.documentElement,document.body])e.observe(t,{attributes:!0});return t.addEventListener("change",r),()=>{e.disconnect(),t.removeEventListener("change",r)}},[]);let c=e.engine.active,p=c?.guide,d=function(e,t,n){let r=Mt(n)??Mt(e.theme?.mode)??Mt(t);return r?"dark"==r:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,n=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(n)return"dark"==n[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}(e.config,e.options.colorMode,p?.theme?.mode)?"dark":"light";e.root.host.setAttribute("data-mode",d);let u=e.config.theme,f=p?.theme?.accent,_={};for(let[e,t]of Object.entries({...u?.[d],...p?.theme?.resolved?.[d]??(!u&&f&&{accent:f,"accent-hover":f,"on-accent":Pt(f)})}))_[`--ps-${e}`]=t;let h="running"===c?.status?c.guide.steps[c.index]:void 0;return Ht("div",{class:"l",style:_,children:[Ht(It,{ctx:e,open:i,setOpen:o,near:a}),!i&&"running"===c?.status&&Ht(Kt,{ctx:e,guide:c.guide,index:c.index,reduced:s},c.guide.id),!i&&"completed"===c?.status&&Ht(Bt,{ctx:e,guide:c.guide}),Ht("div",{class:"sr","aria-live":"polite",children:h?`Step ${c.index+1} of ${c.guide.steps.length}: ${Et(h.title,Nt(e))}`:c?"Level cleared":""})]})}return e.findAnchor=qt,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",jt||location.href).href,integrity:"sha256-AseK8i2RbqbXQKFUcBWNC4a7ke+Nrh85Kuots5BQdv0=",crossOrigin:"anonymous",onload:()=>e(window.__playstep_events),onerror:()=>t(Error("events"))}))).then(({createTransport:r})=>{let i=r({appKey:t.appKey,url:t.eventsUrl,sdk:t.sdkName??"web",version:"0.5.0",preview:t.preview,userId:e.userId,send:t.transport});e.outbox.splice(0).forEach(i.push),n=i.push}).catch(t=>e.emit({type:"sdk_error",message:String(t)}));let r=document.createElement("style");r.textContent=':host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-left:auto}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:var(--ps-radius-btn,99px);border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.bit{position:absolute;border-radius:99px}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.left{right:auto;left:24px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.panel{right:18px;bottom:86px}.solo{bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}',e.root.appendChild(r);let i=document.createElement("div");e.root.appendChild(i);let o={update:()=>{},openLauncher:()=>{},send:e=>n(e)};return function(e,t){var n,r,i,o;xe.__&&xe.__(e,t),9==t.nodeType&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=De(Fe,{children:[e]}),i=[],o=[],Ke(t,t.__k,r||Me,Me,t.namespaceURI,r?null:t.firstChild?$e.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,o),Xe(i,t.__k,o),t.__k.props.children=null}(Ht(Gt,{ctx:e,handle:o}),i),o},e}({});
1
+ var __playstep_ui=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t,n,r,i,o,a,l,s,c,p,u={},d=[],f=/^m(i|n|o|s|text|space)$/,_=Array.isArray,h=d.slice,g=Object.assign;function m(e){e&&e.parentNode&&e.remove()}function x(e,t,n){var r,i,o,a={},l=arguments.length;for(o in t)"key"==o?r=t[o]:"ref"==o&&"function"!=typeof e?i=t[o]:a[o]=t[o];return l>2&&(a.children=l>3?h.call(arguments,2):n),v(e,a,r,i,null)}function v(e,r,i,o,a){var l={type:e,props:r,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a||++n,__i:-1,__u:0};return!a&&t.vnode&&t.vnode(l),l}function y(e){return e.children}function b(e,t){this.props=e,this.context=t,this.__g=0}function w(e,t){if(null==t)return e.__?w(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return"function"!=typeof e.type||e.props.__P?null:w(e)}function k(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),k(e)}function S(e){(8&e.__g||!(e.__g|=8)||!r.push(e)||o++)&&i==t.debounceRendering||((i=t.debounceRendering)||queueMicrotask)(L)}function L(){var e,n,i,l,s,c,p,u,d;try{for(n=1;r.length;)r.length>n&&r.sort(a),e=r.shift(),n=r.length,8&e.__g&&(l=void 0,s=void 0,c=(s=(i=e).__v).__e,p=[],u=[],(d=i.__P)&&((l=g({constructor:void 0},s)).__v=s.__v+1,t.vnode&&t.vnode(l),A(d,l,s,i.__n,d.namespaceURI,32&s.__u?[c]:null,p,c||w(s),32&s.__u,u),l.__v=s.__v,l.__.__k[l.__i]=l,D(p,l,u),s.__=s.__e=null,l.__e!=c&&k(l)))}finally{r.length=o=0}}function C(e,t,n,r,i,o,a,l,s,c,p){var f,_,h,g,m,x,v=r.__k||d,y=t.length;for(s=T(n,t,v,s,y),f=0;f<y;f++)null!=(h=n.__k[f])&&(_=~h.__i&&v[h.__i]||u,h.__i=f,x=A(e,h,_,i,o,a,l,s,c,p),g=h.__e,(_.ref!=h.ref||8&_.__u)&&(_.ref&&N(_.ref,null,h,_),h.ref&&p.push(h.ref,h.__c||g,h)),m=m||g,4&h.__u?(s=M(h,s,e,!_.__v),_.__e&&(_.__e=null)):"function"==typeof h.type&&void 0!==x?s=x:g&&(s=g.nextSibling),h.__u&=-7);return n.__e=m,s}function T(e,t,n,r,i){var o,a,l,s,c,p,u,d,f,h,g=n.length,m=g,x=0,b=!1,k=e.__k=Array(i);for(o=0;o<i;o++)null!=(a=t[o])&&"boolean"!=typeof a&&"function"!=typeof a?("object"!=typeof a||a.constructor==String?a=k[o]=v(null,a):_(a)?a=k[o]=v(y,{children:a}):void 0===a.constructor&&a.__b?a=k[o]=v(a.type,a.props,a.key,a.ref,a.__v):k[o]=a,s=o+x,a.__=e,a.__b=e.__b+1,l=null,~(c=a.__i=E(a,n,s,m))&&(m--,(l=n[c])&&(l.__u|=2)),l&&l.__v?(a.__u|=2,c==s-1?x--:c==s+1?x++:c!=s&&(c>s?x--:x++,b=!0)):(~c||(i>g?x--:i<g&&x++),"function"!=typeof a.type&&(a.__u|=4))):k[o]=null;if(b){for(p=[],u=[],o=0;o<i;o++)if((a=k[o])&&2&a.__u){for(d=0,f=p.length;d<f;)p[h=d+f>>1]<a.__i?d=h+1:f=h;p[d]=a.__i,u[o]=d+1}for(x=p.length;o--;)u[o]&&(u[o]==x?x--:k[o].__u|=4)}if(m)for(o=0;o<g;o++)!(l=n[o])||2&l.__u||(l.__e==r&&(r=w(l)),O(l,l));return r}function M(e,t,n,r){var i,o,a;if("function"==typeof e.type){if(e.props.__P)return t;if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&(i[o].__=e,t=M(i[o],t,n,!1));return t}for(t&&!t.parentNode&&(t=w(e))&&!t.parentNode&&(t=null),a=t;a&&8==a.nodeType;)a=a.nextSibling;for(e.__e!=a&&(!r&&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 E(e,t,n,r){var i,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(r>+!!p)for(i=n-1,o=n+1;i>=0||o<t.length;)if((c=t[a=i>=0?i--:o++])&&!(2&c.__u)&&l==c.key&&s==c.type)return a;return-1}function R(e,t,n){n??(n=""),"-"==t[0]?e.setProperty(t,n):e[t]=n}function P(e,t,n,r,i){var o,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||R(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||R(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])(e.__e||(e.__e={}))[t]=n,n&&r||(a=p[t]||(p[t]=$(t)),(e.__a||(e.__a={}))[t]=c,o=t!=(t=t.replace(s,"$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"==i)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 $(e){return function(n){if(this.__e){var r=this.__e[e];if(null==n[l])n[l]=c++;else if(n[l]<this.__a[e])return;return r(t.event?t.event(n):n)}}}function A(e,n,r,i,o,a,l,s,c,p){var u,f,h,x,v,k,S,L,T,M,E,R,P,$,A,D,N,W,U,B,I=n.type;if(void 0!==n.constructor)return null;if(128&r.__u&&(c=32&r.__u,u=r.__c.__z)){if(n.__u|=c,f=a=[],8==u.nodeType)for(h=1,x=u.nextSibling;x;x=x.nextSibling){if(8==x.nodeType)if(x.data.startsWith("$s"))h++;else if(x.data.startsWith("/$s")&&! --h)break;a.push(x)}else a.push(u);s=a[0]}(u=t.__b)&&u(n);e:if("function"==typeof I){v=l.length;try{if(M=n.props,E=(u=I.prototype)&&u.render,R=(u=I.contextType)&&i[u.__c],P=u?R?R.props.value:u.__:i,r.__c?2&(k=n.__c=r.__c).__g&&(k.__g|=1):(E?n.__c=k=new I(M,P):(n.__c=k=new b(M,P),k.constructor=I,k.render=z),R&&R.sub(k),k.state||(k.state={}),k.__n=i,k.__g|=8,k.__h=[],k.__k=[]),E&&(k.__s||(k.__s=k.state),I.getDerivedStateFromProps&&(k.__s==k.state&&(k.__s=g({},k.__s)),g(k.__s,I.getDerivedStateFromProps(M,k.__s)))),S=k.props,L=k.state,k.__v=n,r.__c){if(E&&!I.getDerivedStateFromProps&&M!==S&&k.componentWillReceiveProps&&k.componentWillReceiveProps(M,P),n.__v==r.__v&&!(8&k.__g)||!(4&k.__g)&&k.shouldComponentUpdate&&!1===k.shouldComponentUpdate(M,k.__s,P)){n.__v!=r.__v&&(k.props=M,k.state=k.__s,k.__g&=-9),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),d.push.apply(k.__h,k.__k),k.__k=[],k.__h.length&&l.push(k),s=w(r);break e}k.componentWillUpdate&&k.componentWillUpdate(M,k.__s,P),E&&k.componentDidUpdate&&k.__h.push(function(){k.componentDidUpdate(S,L,T)})}else E&&!I.getDerivedStateFromProps&&k.componentWillMount&&k.componentWillMount(),E&&k.componentDidMount&&k.__h.push(k.componentDidMount);if(k.context=P,k.props=M,k.__P=e,k.__g&=-5,$=t.__r,A=0,E)k.state=k.__s,k.__g&=-9,$&&$(n),u=k.render(k.props,k.state,k.context),d.push.apply(k.__h,k.__k),k.__k=[];else do{k.__g&=-9,$&&$(n),u=k.render(k.props,k.state,k.context),k.state=k.__s}while(8&k.__g&&++A<25);k.state=k.__s,k.getChildContext&&(i=g({},i,k.getChildContext())),E&&r.__c&&k.getSnapshotBeforeUpdate&&(T=k.getSnapshotBeforeUpdate(S,L)),D=u&&u.type===y&&null==u.key?u.props.children:u,M.__P&&(u=s,o=(e=M.__P).namespaceURI,c=a=null,r.props&&r.props.__P!=e&&(r.__k.some(function(e){e&&O(e,e)}),r.__k=null),s=r.__k?w(r,0):null),s=C(e,_(D)?D:[D],n,r,i,o,a,l,s,c,p),M.__P&&(n.__e=null,s=u),n.__u&=-161,128&r.__u&&(k.__z=null),f&&f.some(m),k.__h.length&&l.push(k),1&k.__g&&(k.__g&=-4)}catch(e){if(l.length=v,n.__v=null,c||a)if(e.then){if(N=0,n.__u|=c?160:128,a){for(~(U=a.indexOf(s||void 0))||(U=a.length);(B=a[U-1])&&8==B.nodeType;)U--;for(;U<a.length;U++)if(B=a[U])if(a[U]=null,8==B.nodeType){if(B.data.startsWith("$s"))N++||(W=B);else if(N&&B.data.startsWith("/$s")&&! --N){s=B;break}}else if(!N)break}if(!W){for(;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;W=s}n.__c.__z||(n.__c.__z=W),n.__e=s}else a&&a.some(m);else n.__e=r.__e;n.__k||(n.__k=r.__k||[]),e.then||H(n),t.__e(e,n,r)}}else s=n.__e=F(r.__e,n,r,i,o,a,l,c,p,e);return(u=t.diffed)&&u(n),128&n.__u?void 0:s}function H(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(H))}function D(e,n,r){for(var i=0;i<r.length;)N(r[i++],r[i++],r[i++]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function F(e,n,r,i,o,a,l,s,c,p){var d,g,x,v,y,b,k,S,L,T=r.props||u,M=n.props,E=n.type;if("svg"==E?o="http://www.w3.org/2000/svg":"math"==E?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a)for(d=0;d<a.length;d++)if((y=a[d])&&(E?y.localName==E:3==y.nodeType)){e=y,a[d]=null;break}if(!e){if(S=p.ownerDocument||document,!E)return S.createTextNode(M);e=S.createElementNS(o,E,M.is&&M),s&&(t.__m&&t.__m(n,a),s=!1),a=null}if(E){if(p="template"==E?e.content:e,a="textarea"==E&&null!=M.defaultValue?null:a&&h.call(p.childNodes),!s&&a)for(T={},d=0;d<e.attributes.length;d++)T[(y=e.attributes[d]).name]=y.value;for(d in T)y=T[d],"dangerouslySetInnerHTML"==d?x=y:"children"==d||d in M||"value"==d&&"defaultValue"in M||"checked"==d&&"defaultChecked"in M||P(e,d,null,y,o);for(d in L=1&r.__u,M)y=M[d],"children"==d?v=y:"dangerouslySetInnerHTML"==d?g=y:"value"==d?b=y:"checked"==d?k=y:s&&"function"!=typeof y||!(T[d]!==y||L&&null!=y)||P(e,d,y,T[d],o);g?(s||x&&(g.__html==x.__html||g.__html==e.innerHTML)||(e.innerHTML=g.__html),n.__k=[]):(x&&(e.textContent=""),("foreignObject"==E||"http://www.w3.org/1998/Math/MathML"==o&&f.test(E))&&(o="http://www.w3.org/1999/xhtml"),C(p,_(v)?v:[v],n,r,i,o,a,l,a?a[0]:r.__k&&w(r,0),s,c),a&&a.some(m)),s&&"textarea"!=E||(d="value","progress"==E&&null==b?e.removeAttribute(d):null==b||b===e[d]&&("progress"!=E||b)||P(e,d,b,T[d],o),d="checked",null!=k&&k!=e[d]&&P(e,d,k,T[d],o))}else T===M||s&&e.data==M||(e.data=M);return e}function N(e,n,r,i){try{"function"==typeof e?n?n.__x=e(n)||1:i&&(i=i.__c||i.__e)&&(n=i.__x)&&(i.__x=null,"function"==typeof n?n():e(null)):e.current=n}catch(e){t.__e(e,r)}}function O(e,n,r){var i,o;if(t.unmount&&t.unmount(e),!(i=e.ref)||i.current&&i.current!=e.__e||N(i,null,n,e),i=e.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){t.__e(e,n)}i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&O(i[o],n,"function"!=typeof e.type||r&&!e.props.__P);(i=e.__e)&&(r||m(i),i.__e&&(i.__e=null)),e.__e=e.__c=e.__=null}function z(e,t,n){return this.constructor(e,n)}function W(e,n){var r,i,o,a;t.__&&t.__(e,n),9==n.nodeType&&(n=n.documentElement),i=(r=e&&32&e.__u)?null:n.__k,n.__k=v(y,{children:[e]}),o=[],a=[],A(n,n.__k,i||u,u,n.namespaceURI,i?null:n.firstChild?h.call(n.childNodes):null,o,i?i.__e:n.firstChild,r,a),D(o,n.__k,a),n.__k.props.children=null}t={__e:function(e,t,n,r){for(var i,a,l;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError&&(i.setState(a.getDerivedStateFromError(e)),l=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),l=8&i.__g),l)return void(i.__g|=2)}catch(t){e=t,l=0}}throw o=0,e}},n=0,b.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=g({},this.state)),"function"==typeof e&&(e=e(g({},n),this.props)),e&&(g(n,e),this.__v&&(t&&this.__k.push(t),S(this)))},b.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),S(this))},b.prototype.render=y,r=[],o=0,a=function(e,t){return e.__v.__b-t.__v.__b},l=Symbol(),s=/(PointerCapture)$|Capture$/i,c=0,p={};var U,B,I,j,V=Object.is,q=0,K=[],G=[],X=t,Y=X.__b,J=X.__r,Q=X.diffed,Z=X.__c,ee=X.unmount,te=X.__;function ne(e,t){X.__h&&X.__h(B,e,q||t),q=0;var n=B.__H||(B.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function re(e){return q=1,function(e,t){var n=ne(U++,2);if(n.t=e,!n.__c&&(n.__=[_e(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);V(t,r)||(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=B,!B.__f)){B.__f=!0;var r=B.shouldComponentUpdate;B.shouldComponentUpdate=function(e,t,n){var i=this.__H;if(!i)return!0;var o=!1,a=this.props!=e;if(i.__.some(function(e){e.__N&&(o=!0,V(e.__[0],e.__N[0])||(a=!0))}),r){var l=r.call(this,e,t,n);return o?l||a:l}return!o||a}}return n.__}(_e,e)}function ie(e,t){var n=ne(U++,3);!X.__s&&fe(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,B.__H.__h.push(n))}function oe(e,t){var n=ne(U++,4);!X.__s&&fe(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,B.__h.push(n))}function ae(e){return q=5,function(e,t){var n=ne(U++,7);return fe(n.__H,t)&&(n.__=e(),n.__H=t),n.__}(function(){return{current:e}},[])}function le(){var e;do{for(;e=G.shift();)try{ue(e)}catch(t){X.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=K.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ue),t.__h.some(de),t.__h=[]}catch(n){t.__h=[],X.__e(n,e.__v)}}}while(G.length)}X.__b=function(e){B=null,Y&&Y(e)},X.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),te&&te(e,t)},X.__r=function(e){J&&J(e),U=0;var t=(B=e.__c).__H;t&&(I==B?B.__h=[]:(t.__h.some(ue),t.__h.some(de),U=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),I=B},X.diffed=function(e){Q&&Q(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&pe(K.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),I=B=null},X.__c=function(e,t){t.some(function(e){try{e.__h.some(ue),e.__h=e.__h.filter(function(e){return!e.__||de(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],X.__e(n,e.__v)}}),Z&&Z(e,t)},X.unmount=function(e){ee&&ee(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(void 0===n){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}r.__P=n,pe(G.push(r))}else ue(r)}catch(e){t=e}}),r.__H=void 0,t&&X.__e(t,r.__v))};var se="function"==typeof requestAnimationFrame;function ce(e){var t,n=function(){clearTimeout(r),se&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);se&&(t=requestAnimationFrame(n))}function pe(e){1!=e&&j==X.requestAnimationFrame||((j=X.requestAnimationFrame)||ce)(le)}function ue(e){var t=B,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),B=t}function de(e){var t=B;e.__c=e.__(),B=t}function fe(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!V(t,e[n])})}function _e(e,t){return"function"==typeof t?t(e):t}let he=Math.min,ge=Math.max,me=Math.round,xe=e=>({x:e,y:e}),ve={left:"right",right:"left",bottom:"top",top:"bottom"};function ye(e,t){return"function"==typeof e?e(t):e}function be(e){return e.split("-")[0]}function we(e){return e.split("-")[1]}function ke(e){return"x"===e?"y":"x"}function Se(e){return"y"===e?"height":"width"}function Le(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function Ce(e){return ke(Le(e))}function Te(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let Me=["left","right"],Ee=["right","left"],Re=["top","bottom"],Pe=["bottom","top"];function $e(e){let t=be(e);return ve[t]+e.slice(t.length)}function Ae(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function He(e,t,n){let r,{reference:i,floating:o}=e,a=Le(t),l=Ce(t),s=Se(l),c=be(t),p="y"===a,u=i.x+i.width/2-o.width/2,d=i.y+i.height/2-o.height/2,f=i[s]/2-o[s]/2;switch(c){case"top":r={x:u,y:i.y-o.height};break;case"bottom":r={x:u,y:i.y+i.height};break;case"right":r={x:i.x+i.width,y:d};break;case"left":r={x:i.x-o.width,y:d};break;default:r={x:i.x,y:i.y}}let _=we(t);return _&&(r[l]+=f*("end"===_?1:-1)*(n&&p?-1:1)),r}async function De(e,t){void 0===t&&(t={});let{x:n,y:r,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:s="clippingAncestors",rootBoundary:c="viewport",elementContext:p="floating",altBoundary:u=!1,padding:d=0}=ye(t,e),f=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)}(d),_=a[u?"floating"===p?"reference":"floating":p],h=Ae(await i.getClippingRect({element:await(null==i.isElement?void 0:i.isElement(_))??!0?_:_.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:s,rootBoundary:c,strategy:l})),g="floating"===p?{x:n,y:r,width:o.floating.width,height:o.floating.height}:o.reference,m=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),x=await(null==i.isElement?void 0:i.isElement(m))&&await(null==i.getScale?void 0:i.getScale(m))||{x:1,y:1},v=Ae(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:m,strategy:l}):g);return{top:(h.top-v.top+f.top)/x.y,bottom:(v.bottom-h.bottom+f.bottom)/x.y,left:(h.left-v.left+f.left)/x.x,right:(v.right-h.right+f.right)/x.x}}let Fe=new Set(["left","top"]);function Ne(){return typeof window<"u"}function Oe(e){return Ue(e)?(e.nodeName||"").toLowerCase():"#document"}function ze(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function We(e){return((Ue(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ue(e){return!!Ne()&&(e instanceof Node||e instanceof ze(e).Node)}function Be(e){return!!Ne()&&(e instanceof Element||e instanceof ze(e).Element)}function Ie(e){return!!Ne()&&(e instanceof HTMLElement||e instanceof ze(e).HTMLElement)}function je(e){return!(!Ne()||typeof ShadowRoot>"u")&&(e instanceof ShadowRoot||e instanceof ze(e).ShadowRoot)}function Ve(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=tt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==i&&"contents"!==i}function qe(e){return/^(table|td|th)$/.test(Oe(e))}function Ke(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}let Ge,Xe=/transform|translate|scale|rotate|perspective|filter/,Ye=/paint|layout|strict|content/,Je=e=>!!e&&"none"!==e;function Qe(e){let t=Be(e)?tt(e):e;return Je(t.transform)||Je(t.translate)||Je(t.scale)||Je(t.rotate)||Je(t.perspective)||!Ze()&&(Je(t.backdropFilter)||Je(t.filter))||Xe.test(t.willChange||"")||Ye.test(t.contain||"")}function Ze(){return Ge??(Ge=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ge}function et(e){return/^(html|body|#document)$/.test(Oe(e))}function tt(e){return ze(e).getComputedStyle(e)}function nt(e){return Be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rt(e){if("html"===Oe(e))return e;let t=e.assignedSlot||e.parentNode||je(e)&&e.host||We(e);return je(t)?t.host:t}function it(e){let t=rt(e);return et(t)?(e.ownerDocument||e).body:Ie(t)&&Ve(t)?t:it(t)}function ot(e,t,n){void 0===t&&(t=[]),void 0===n&&(n=!0);let r=it(e),i=r===e.ownerDocument?.body,o=ze(r);if(i){let e=at(o);return t.concat(o,o.visualViewport||[],Ve(r)?r:[],e&&n?ot(e):[])}return t.concat(r,ot(r,[],n))}function at(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lt(e){let t=tt(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ie(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=me(n)!==o||me(r)!==a;return l&&(n=o,r=a),{width:n,height:r,$:l}}function st(e){return Be(e)?e:e.contextElement}function ct(e){let t=st(e);if(!Ie(t))return xe(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:o}=lt(t),a=(o?me(n.width):n.width)/r,l=(o?me(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}let pt=xe(0);function ut(e){let t=ze(e);return Ze()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:pt}function dt(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);let i=e.getBoundingClientRect(),o=st(e),a=xe(1);t&&(r?Be(r)&&(a=ct(r)):a=ct(e));let l=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===ze(e)}(o,n,r)?ut(o):xe(0),s=(i.left+l.x)/a.x,c=(i.top+l.y)/a.y,p=i.width/a.x,u=i.height/a.y;if(o&&r){let e=ze(o),t=Be(r)?ze(r):r,n=e,i=at(n);for(;i&&t!==n;){let e=ct(i),t=i.getBoundingClientRect(),r=tt(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,c*=e.y,p*=e.x,u*=e.y,s+=o,c+=a,n=ze(i),i=at(n)}}return Ae({width:p,height:u,x:s,y:c})}function ft(e,t){let n=nt(e).scrollLeft;return t?t.left+n:dt(We(e)).left+n}function _t(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ft(e,n),y:n.top+t.scrollTop}}function ht(e,t,n){let r;if("viewport"===t||"layoutViewport"===t)r=function(e,t,n){void 0===n&&(n="viewport");let r="layoutViewport"===n,i=ze(e),o=We(e),a=i.visualViewport,l=o.clientWidth,s=o.clientHeight,c=0,p=0;if(a){let e=!Ze()||"fixed"===t;r?e||(c=-a.offsetLeft,p=-a.offsetTop):(l=a.width,s=a.height,e&&(c=a.offsetLeft,p=a.offsetTop))}if(ft(o)<=0){let e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(o.clientWidth-t.clientWidth-r),a="stable both-edges"===getComputedStyle(o).scrollbarGutter?i/2:i;a<=25&&(l-=a)}return{width:l,height:s,x:c,y:p}}(e,n,t);else if("document"===t)r=function(e){let t=nt(e),n=e.ownerDocument.body,r=ge(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ge(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+ft(e),a=-t.scrollTop;return"rtl"===tt(n).direction&&(o+=ge(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:o,y:a}}(We(e));else if(Be(t))r=function(e,t){let n=dt(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=ct(e);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{let n=ut(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ae(r)}function gt(e,t){let n=t.get(e);if(n)return n;let r=ot(e,[],!1).filter(e=>Be(e)&&"body"!==Oe(e)),i=null,o="fixed"===tt(e).position,a=o?rt(e):e;for(;Be(a)&&!et(a);){let e=tt(a),t=Qe(a),n=i?i.position:o?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?i=e:r=r.filter(e=>e!==a),a=rt(a)}return t.set(e,r),r}function mt(e,t,n){let r=Ie(t),i=We(t),o="fixed"===n,a=dt(e,!0,o,t),l={scrollLeft:0,scrollTop:0},s=xe(0);if((r||!o)&&(("body"!==Oe(t)||Ve(i))&&(l=nt(t)),r)){let e=dt(t,!0,o,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}!r&&i&&(s.x=ft(i));let c=!i||r||o?xe(0):_t(i,l);return{x:a.left+l.scrollLeft-s.x-c.x,y:a.top+l.scrollTop-s.y-c.y,width:a.width,height:a.height}}function xt(e){return"static"===tt(e).position}function vt(e,t){if(!Ie(e)||"fixed"===tt(e).position)return null;if(t)return t(e);let n=e.offsetParent;return We(e)===n&&(n=n.ownerDocument.body),n}function yt(e,t){let n=ze(e);if(Ke(e))return n;if(!Ie(e)){let t=rt(e);for(;t&&!et(t);){if(Be(t)&&!xt(t))return t;t=rt(t)}return n}let r=vt(e,t);for(;r&&qe(r)&&xt(r);)r=vt(r,t);return r&&et(r)&&xt(r)&&!Qe(r)?n:r||function(e){let t=rt(e);for(;Ie(t)&&!et(t);){if(Qe(t))return t;if(Ke(t))return null;t=rt(t)}return null}(e)||n}let bt={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,o="fixed"===i,a=We(r),l=!!t&&Ke(t.floating);if(r===a||l&&o)return n;let s={scrollLeft:0,scrollTop:0},c=xe(1),p=xe(0),u=Ie(r);if((u||!o)&&(("body"!==Oe(r)||Ve(a))&&(s=nt(r)),u)){let e=dt(r);c=ct(r),p.x=e.x+r.clientLeft,p.y=e.y+r.clientTop}let d=!a||u||o?xe(0):_t(a,s);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+p.x+d.x,y:n.y*c.y-s.scrollTop*c.y+p.y+d.y}},getDocumentElement:We,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,o=[..."clippingAncestors"===n?Ke(t)?[]:gt(t,this._c):[].concat(n),r],a=ht(t,o[0],i),l=a.top,s=a.right,c=a.bottom,p=a.left;for(let e=1;e<o.length;e++){let n=ht(t,o[e],i);l=ge(n.top,l),s=he(n.right,s),c=he(n.bottom,c),p=ge(n.left,p)}return{width:s-p,height:c-l,x:p,y:l}},getOffsetParent:yt,getElementRects:async function(e){let t=this.getOffsetParent||yt,n=this.getDimensions,r=await n(e.floating);return{reference:mt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){let{width:t,height:n}=lt(e);return{width:t,height:n}},getScale:ct,isElement:Be,isRTL:function(e){return"rtl"===tt(e).direction}},wt=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n;let{x:r,y:i,placement:o,middlewareData:a}=t,l=await async function(e,t){let{placement:n,platform:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),a=be(n),l=we(n),s="y"===Le(n),c=Fe.has(a)?-1:1,p=o&&s?-1:1,u=ye(t,e),{mainAxis:d,crossAxis:f,alignmentAxis:_}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&"number"==typeof _&&(f="end"===l?-1*_:_),s?{x:f*p,y:d*c}:{x:d*c,y:f*p}}(t,e);return o===a.offset?.placement&&null!=(n=a.arrow)&&n.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:o}}}}},kt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:i,platform:o}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=ye(e,t),p={x:n,y:r},u=await o.detectOverflow(t,c),d=Le(i),f=ke(d),_=p[f],h=p[d],g=(e,t)=>function(e,t,n){return ge(e,he(t,n))}(t+u["y"===e?"top":"left"],t,t-u["y"===e?"bottom":"right"]);a&&(_=g(f,_)),l&&(h=g(d,h));let m=s.fn({...t,[f]:_,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:a,[d]:l}}}}}},St=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:s}=t,{mainAxis:c=!0,crossAxis:p=!0,fallbackPlacements:u,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:_=!0,...h}=ye(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};let g=be(r),m=Le(a),x=be(a)===a,v=await(null==l.isRTL?void 0:l.isRTL(s.floating)),y=u||(x||!_?[$e(a)]:function(e){let t=$e(e);return[Te(e),t,Te(t)]}(a)),b="none"!==f;!u&&b&&y.push(...function(e,t,n,r){let i=we(e),o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Ee:Me:t?Me:Ee;case"left":case"right":return t?Re:Pe;default:return[]}}(be(e),"start"===n,r);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(Te)))),o}(a,_,f,v));let w=[a,...y],k=await l.detectOverflow(t,h),S=[],L=i.flip?.overflows||[];if(c&&S.push(k[g]),p){let e=function(e,t,n){void 0===n&&(n=!1);let r=we(e),i=Ce(e),o=Se(i),a="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=$e(a)),[a,$e(a)]}(r,o,v);S.push(k[e[0]],k[e[1]])}if(L=[...L,{placement:r,overflows:S}],!S.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=w[e];if(t&&("alignment"!==p||m===Le(t)||L.every(e=>Le(e.placement)!==m||e.overflows[0]>0)))return{data:{index:e,overflows:L},reset:{placement:t}};let n=L.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(d){case"bestFit":{let e=L.filter(e=>{if(b){let t=Le(e.placement);return t===m||"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(r!==n)return{reset:{placement:n}}}return{}}}},Lt=(e,t,n)=>{let r=new Map,i=n??{},o={...bt,...i.platform,_c:r};return(async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:De},s=await(null==a.isRTL?void 0:a.isRTL(t)),c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:p,y:u}=He(c,r,s),d=r,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:r,placement:d,strategy:i,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:i}):b.rects),({x:p,y:u}=He(c,d,s))),n=-1)}return{x:p,y:u,placement:d,strategy:i,middlewareData:_}})(e,t,{...i,platform:o})},Ct=()=>matchMedia("(prefers-reduced-motion: reduce)").matches,Tt=e=>"dark"==e||"light"==e?e:void 0;function Mt(e,t,n="en"){return e?e[t]??e[t.split("-")[0]]??e[n]??Object.values(e)[0]??"":""}let Et=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`};function Rt(e){let t=Number.parseInt(e.slice(1),16),n=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,r=.2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(255&t);return 1.05/(r+.05)>=(r+.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"/>'};function $t({name:e}){return x("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]}})}let At=(e,t,n,r,i)=>e.emit({type:i,guide_id:t.id,guide_version:t.version,step_id:t.steps[n].id,step_index:n,clip_id:"hosted"===r.source?r.clip_id:void 0,clip_source:r.source}),Ht=(e,t,n,r,i)=>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}(`${i}|${r.url}`)&&At(e,t,n,r,i),Dt=e=>e.options.locale??navigator.language??"en",Ft=(e,t)=>Mt(t.name,Dt(e),t.locale_default)||t.id;function Nt({ctx:e,guide:t,index:n,reduced:r,clip:i,big:o,onExpand:a,onDuration:l}){let s=t.steps[n],c=ae(null),[p,u]=re(!0),[d,f]=re(!r&&"embed"!==i.source),[_,h]=re(i.duration_ms??0),g=r=>At(e,t,n,i,r),m=r=>Ht(e,t,n,i,r);if(ie(()=>{let e=c.current;e&&d&&(e.muted=p,e.play()?.catch(()=>{}))},[d,i.url]),ie(()=>l(d&&"embed"!==i.source?_:0),[_,d]),"embed"===i.source){let t=function(e){try{let t,n=new URL(e),r=n.hostname.replace(/^(www|m)\./,"");if("youtu.be"===r?t=n.pathname.slice(1):"youtube.com"===r&&(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"===r||"player.vimeo.com"===r?n.pathname.match(/(\d{5,})/)?.[1]:null,t)return{src:`https://player.vimeo.com/video/${t}?autoplay=1`}}catch{}return null}(i.url),n=new URL(i.url).hostname.replace(/^www\./,"");return x("div",{class:"clip embed"},d&&t?x("iframe",{src:t.src,title:`Video: ${Mt(s.title,Dt(e))}`,allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowFullScreen:!0}):x(y,null,(i.poster??t?.thumb)&&x("img",{src:i.poster??t?.thumb,alt:""}),x("button",{class:"play","aria-label":"Play video",onClick:()=>(f(!0),g("clip_played"))},x($t,{name:"play"})),x("div",{class:"bar"},x("span",{class:"pill"},x($t,{name:"external-link"}),n,_?` · ${Et(_)}`:""))))}return x("div",{class:"clip"},d?x("video",{ref:c,src:i.url,poster:i.poster,muted:p,loop:!0,autoplay:!0,playsInline:!0,preload:"auto","aria-label":`Clip: ${Mt(s.title,Dt(e))}`,onLoadedData:()=>m("clip_loaded"),onPlaying:()=>m("clip_played"),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&h(1e3*t)}}):x(y,null,i.poster&&x("img",{src:i.poster,alt:""}),x("button",{class:"play","aria-label":"Play clip",onClick:()=>f(!0)},x($t,{name:"play"}))),d&&x("div",{class:"bar"},x("span",{class:"pill"},x($t,{name:"play"}),_?`${Et(_)} loop`:"Loop"),x("button",{class:"round","aria-label":p?"Unmute clip":"Mute clip",onClick:()=>{u(!p),c.current&&(c.current.muted=!p),p&&g("clip_unmuted")}},x($t,{name:p?"volume-x":"volume-2"})),x("button",{class:"round","aria-label":o?"Shrink clip":"Expand clip","aria-pressed":o,onClick:a},x($t,{name:"maximize-2"}))))}function Ot({ctx:e,guide:t,index:n,reduced:r,cardRef:i,style:o}){let a=t.steps[n],l=t.steps.length,[s,c]=re(!1),[p,u]=re(0),d=n=>Mt(n,Dt(e),t.locale_default),f="next_button"===a.complete_on.type;return ie(()=>{c(!1);let i=t.steps[n+1]?.clip;if(i&&"embed"!==i.source&&!r&&!navigator.connection?.saveData){let r=document.createElement("video");r.preload="auto",r.muted=!0,r.src=i.url,"hosted"===i.source&&Ht(e,t,n+1,i,"clip_loaded")}},[t.id,n]),x("div",{ref:i,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},a.clip&&x(Nt,{key:a.id,ctx:e,guide:t,index:n,reduced:r,clip:a.clip,big:s,onExpand:()=>c(!s),onDuration:u}),x("div",{class:"body"},x("div",{class:"meta"},x("span",null,"Step ",n+1," of ",l," · ",Ft(e,t)),x("button",{class:"x","aria-label":"Close guide",onClick:()=>e.dispatch({type:"dismiss"})},x($t,{name:"x"}))),x("div",{class:"steps",role:"img","aria-label":`Step ${n+1} of ${l}`},t.steps.map((e,t)=>x("span",{key:t,class:"seg"+(t<n?" done":t===n?" cur"+(p&&!r?" anim":""):""),style:t===n&&p?{"--d":`${p}ms`}:void 0}))),x("h2",{class:"title",id:"ps-title"},d(a.title)),x("p",{class:"text",id:"ps-text"},d(a.body))),x("div",{class:"foot"},f?x("span",{class:"sp"}):x("span",{class:"wait"},x("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&&x("button",{class:"btn gho",onClick:()=>e.dispatch({type:"back"})},"Back"),f&&x("button",{class:"btn pri",onClick:()=>e.dispatch({type:"next"})},n+1===l?"Done":"Next",x($t,{name:"arrow-right"}))))}let zt=["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),r=ae(null);return ie(()=>r.current?.focus(),[]),x(y,null,x("div",{class:"scrim",onClick:()=>e.dispatch({type:"close"})}),x("div",{class:"cel",ref:r,role:"dialog","aria-modal":"true","aria-labelledby":"ps-cel",tabIndex:-1},x("div",{class:"art","aria-hidden":"true"},zt.map((e,t)=>x("span",{key:t,class:"bit",style:e})),x("span",{class:"tile"},x($t,{name:"ps-level-up"}))),x("h2",{id:"ps-cel"},"Level cleared"),x("p",null,"You finished ",Ft(e,t),".",n?` Next up: ${Ft(e,n)}.`:""),x("div",{class:"acts"},x("button",{class:"btn sec",onClick:()=>e.dispatch({type:"start",guide:t.id})},x($t,{name:"rotate-ccw"}),"Replay"),n?x("button",{class:"btn pri",onClick:()=>e.dispatch({type:"start",guide:n.id})},"Next guide",x($t,{name:"arrow-right"})):x("button",{class:"btn pri",onClick:()=>e.dispatch({type:"close"})},"Done"))))}function Ut({ctx:e,open:t,setOpen:n,near:r}){let i=ae(null);oe(()=>{let e=i.current;e&&(e.style.cssText="",r&&Lt(r,e,{strategy:"fixed",placement:"top-start",middleware:[wt(8),St({padding:12}),kt({padding:12})]}).then(({x:t,y:n})=>e.style.cssText=`left:${t}px;top:${n}px;right:auto;bottom:auto`))},[t,r]);let o=ae(null);ie(()=>{t?(o.current=e.root.activeElement??document.activeElement,i.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 x(y,null,t&&x("div",{class:`panel${p}${a?.enabled?"":" solo"}`,ref:i,tabIndex:-1,role:"dialog","aria-label":"Guides"},x("button",{class:"x","aria-label":"Close guides",onClick:()=>n(!1)},x($t,{name:"x"})),x("h2",null,Mt(a?.title,Dt(e))||"Need a hand?"),x("p",null,Mt(a?.description,Dt(e))||"Pick a guide and play it step by step."),x("ul",{class:"rows"},l.map(t=>{let r=s[t.id],i=t.steps.length,o="done"===r?.status,a="running"===r?.status;return x("li",{key:t.id},x("button",{class:"row",onClick:()=>{n(!1),r&&e.dispatch({type:"reset_progress",guide:t.id}),e.dispatch({type:"start",guide:t.id})}},x("span",{class:"ti"+(o?" mint":r?"":" spark")},x($t,{name:o?"check":"ps-guide"})),x("span",{class:"rb"},x("span",{class:"rt"},Ft(e,t)),x("span",{class:"rm"},o?"Completed":a?`Step ${r.step+1} of ${i}`:`${i} steps`),a&&x("span",{class:"prog","aria-hidden":"true"},x("i",{style:{width:r.step/i*100+"%"}}))),r?x("span",{class:"rp"},x($t,{name:"rotate-ccw"}),"Replay"):x("span",{class:"new"},"New")))})),l.some(e=>s[e.id])&&x("div",{class:"acts so"},x("button",{class:"btn gho",onClick:()=>{e.dispatch({type:"reset_progress"}),e.engine.active?n(!1):i.current?.focus()}},"Start over")),!1!==e.config.flags?.show_badge&&x("a",{class:"pb",href:"https://playstep.app/?ref=badge",target:"_blank",rel:"noopener"},x("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&&x("button",{class:`lb${p}`,"aria-label":t?"Close guides":"Open guides","aria-expanded":t,onClick:()=>n(!t)},x($t,{name:"ps-launcher"}),c>0&&!t&&x("span",{class:"cnt"},c)))}let Bt=document.currentScript?.src,It=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=>It(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return It(n)?n:null}function Vt({ctx:e,guide:t,index:n,reduced:r}){let i=t.steps[n],o=function(e,t,n){let[r,i]=re(()=>e?jt(e,t):null);return ie(()=>{if(!e)return i(null);let r=jt(e,t);i(r);let o=0,a=()=>{o=0;let n=jt(e,t);n!==r&&i(r=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(()=>!r&&n(e),3e3);return()=>{l.disconnect(),clearTimeout(s),cancelAnimationFrame(o)}},[e,t]),r}(i.anchor,i.find?.web,t=>e.dispatch({type:"anchor_missing",anchor:t})),a=ae(null),l=ae("");ie(()=>{if(!o)return;let t=t=>{t.composedPath().includes(o)&&(l.current="",e.dispatch({type:"tap",anchor:i.anchor}))};return document.addEventListener("click",t,!0),()=>document.removeEventListener("click",t,!0)},[o]),ie(()=>{if(o)return void(o==jt(i.anchor,i.find?.web)&&(l.current=i.id));if(l.current!=i.id)return;let r=setTimeout(()=>{for(let r=n;r--;){let i=t.steps[r];if(!i.anchor||"page"==i.complete_on.type)return;if(jt(i.anchor,i.find?.web)){for(let t=n;t-- >r;)e.dispatch({type:"back"});return}}},400);return()=>clearTimeout(r)},[o]);let s=t.theme?.position??"bottom",c=function(e,t,n,r,i){let[o,a]=re(null);return oe(()=>{let i=t.current;if(!i)return;if(!e){let e=()=>a({x:(innerWidth-i.offsetWidth)/2,y:"center"===r?(innerHeight-i.offsetHeight)/2:innerHeight-i.offsetHeight-24});e();let t=new ResizeObserver(e);return t.observe(i),addEventListener("resize",e),()=>{t.disconnect(),removeEventListener("resize",e)}}let o=e.getBoundingClientRect();(o.bottom<0||o.top>innerHeight)&&e.scrollIntoView({block:"center",behavior:Ct()?"auto":"smooth"});let l=()=>{let t=e.getBoundingClientRect(),r=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;Lt(e,i,{strategy:"fixed",placement:"auto"===n?"bottom":n,middleware:[wt(18),St({fallbackPlacements:["top","left","right"],padding:12}),kt({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(r+6,(t.height+12)/2)}}))};l();let s=new ResizeObserver(l);s.observe(e),s.observe(i),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,r,n,...i]),o}(o,a,i.placement??"auto",s,[i.id]),p=ae("");ie(()=>{c&&p.current!==i.id&&(p.current=i.id,document.activeElement?.matches("input,textarea,select,[contenteditable]:not([contenteditable=false])")||a.current?.focus({preventScroll:!0}))},[i.id,c]);let[u,d]=re(!1);ie(()=>{c&&!u&&requestAnimationFrame(()=>d(!0))},[c]),ie(()=>{let t=t=>{if("Tab"!==t.key||!a.current)return;let n=[...a.current.querySelectorAll('button,a,iframe,[tabindex="0"]')],r=t.composedPath().includes(a.current),i=n[0],l=n.at(-1),s=e.root.activeElement;r&&!t.shiftKey&&s===l?(t.preventDefault(),(o??i)?.focus()):r&&t.shiftKey&&s===i?(t.preventDefault(),(o??l)?.focus()):o&&document.activeElement===o&&(t.preventDefault(),(t.shiftKey?l:i)?.focus())};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[o]);let f=c?.spot;return x(y,null,o&&f?x("div",{class:"spot","aria-hidden":"true",style:{width:`${f.w}px`,height:`${f.h}px`,transform:`translate(${f.x}px,${f.y}px)`,borderRadius:`${f.r}px`}}):!o&&"center"===s&&x("div",{class:"scrim","aria-hidden":"true"}),x(Ot,{ctx:e,guide:t,index:n,reduced:r,cardRef:a,style:c?{transform:`translate(${Math.round(c.x)}px,${Math.round(c.y)}px)`,transition:u?void 0:"none"}:{visibility:"hidden"}}))}function qt({ctx:e,handle:t}){let[,n]=re(0),r=()=>n(e=>e+1),[i,o]=re(!1),[a,l]=re(),s=Ct();t.update=()=>{e.engine.launcherGuides().length||o(!1),r()},t.openLauncher=t=>{let n=document.activeElement;l(t??(n!==document.body&&n!==e.root.host?n??void 0:void 0)),o(!0)},ie(()=>{let t=t=>{if("Escape"!==t.key||t.defaultPrevented||!t.composedPath().includes(e.root.host))return;let n=e.engine.active;if(i)o(!1);else if("completed"===n?.status)e.dispatch({type:"close"});else{if(!n)return;{let t=n.guide.steps[n.index],r=t.anchor?jt(t.anchor,t.find?.web):null;e.dispatch({type:"hide"}),r?.focus({preventScroll:!0})}}t.preventDefault(),t.stopPropagation()};return addEventListener("keydown",t,!0),()=>removeEventListener("keydown",t,!0)},[i]),ie(()=>{let e=new MutationObserver(r),t=matchMedia("(prefers-color-scheme: dark)");for(let t of[document.documentElement,document.body])e.observe(t,{attributes:!0});return t.addEventListener("change",r),()=>{e.disconnect(),t.removeEventListener("change",r)}},[]);let c=e.engine.active,p=c?.guide,u=function(e,t,n){let r=Tt(n)??Tt(e.theme?.mode)??Tt(t);return r?"dark"==r:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,n=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(n)return"dark"==n[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}(e.config,e.options.colorMode,p?.theme?.mode)?"dark":"light";e.root.host.setAttribute("data-mode",u);let d=e.config.theme,f=p?.theme?.accent,_={};for(let[e,t]of Object.entries({...d?.[u],...p?.theme?.resolved?.[u]??(!d&&f&&{accent:f,"accent-hover":f,"on-accent":Rt(f)})}))_[`--ps-${e}`]=t;let h="running"===c?.status?c.guide.steps[c.index]:void 0;return x("div",{class:"l",style:_},x(Ut,{ctx:e,open:i,setOpen:o,near:a}),!i&&"running"===c?.status&&x(Vt,{key:c.guide.id,ctx:e,guide:c.guide,index:c.index,reduced:s}),!i&&"completed"===c?.status&&x(Wt,{ctx:e,guide:c.guide}),x("div",{class:"sr","aria-live":"polite"},h?`Step ${c.index+1} of ${c.guide.steps.length}: ${Mt(h.title,Dt(e))}`:c?"Level cleared":""))}return e.findAnchor=jt,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",Bt||location.href).href,integrity:"sha256-AseK8i2RbqbXQKFUcBWNC4a7ke+Nrh85Kuots5BQdv0=",crossOrigin:"anonymous",onload:()=>e(window.__playstep_events),onerror:()=>t(Error("events"))}))).then(({createTransport:r})=>{let i=r({appKey:t.appKey,url:t.eventsUrl,sdk:t.sdkName??"web",version:"0.6.0",preview:t.preview,userId:e.userId,send:t.transport});e.outbox.splice(0).forEach(i.push),n=i.push}).catch(t=>e.emit({type:"sdk_error",message:String(t)}));let r=document.createElement("style");r.textContent=':host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-left:auto}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:var(--ps-radius-btn,99px);border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.bit{position:absolute;border-radius:99px}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.left{right:auto;left:24px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.panel{right:18px;bottom:86px}.solo{bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}',e.root.appendChild(r);let i=document.createElement("div");e.root.appendChild(i);let o={update:()=>{},openLauncher:()=>{},send:e=>n(e)};return W(x(qt,{ctx:e,handle:o}),i),o},e}({});
package/dist/index.d.ts CHANGED
@@ -247,8 +247,20 @@ interface PlayStep {
247
247
  * the current page straight away. Emits `progress_reset`.
248
248
  */
249
249
  resetProgress: (guideId?: string) => void;
250
- /** Forgets the user and their guide progress on this device (call on sign-out). */
250
+ /**
251
+ * Forgets the user and their guide progress on this device (call on sign-out). It does not end a pause().
252
+ */
251
253
  reset: () => void;
254
+ /**
255
+ * Stops guides for now, for a user who should not see them at the moment (a guest in this workspace, say): nothing
256
+ * starts, a guide that is showing leaves the screen with nothing stored, and the guide list cannot open. Stored
257
+ * progress is untouched. Lasts until resume() or the next page load. Use reset() on sign-out instead.
258
+ */
259
+ pause: () => void;
260
+ /** Ends a pause(): the guide that was showing comes back on its step, else triggers are checked for this page. */
261
+ resume: () => void;
262
+ /** Whether guides are paused. */
263
+ isPaused: () => boolean;
252
264
  }
253
265
  //#endregion
254
266
  //#region src/index.d.ts
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{n as e}from"./sdk-Bpu8YvQu.js";const t=e(()=>import(`./ui-CBp6e2ts.js`),()=>import(`./launcher-button-DMxEcXwn.js`),()=>import(`./capture-BhZiRrIB.js`));export{t as default,t as playstep};
1
+ import{n as e}from"./sdk-Bn74MzQg.js";const t=e(()=>import(`./ui-BhNMSBrK.js`),()=>import(`./launcher-button-DMxEcXwn.js`),()=>import(`./capture-BhZiRrIB.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=/* @__PURE__ */ new Set,u=!1,d=t.flags||{},f=(t.guides??[]).filter(e=>e.spec_version<=3&&(e.targeting?.platforms??[`web`]).includes(n)),p=e=>f.find(t=>t.id===e),m=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),h=e=>!u&&!d.disabled&&(!d.paused_for_new_users||a.seen)&&i(e.targeting?.segments,o),g=e=>{let t=a.guides[e.id];return!s&&!l.has(e.id)&&h(e)&&(!t||t.status!==`done`&&(t.status===`running`||!e.trigger.once))},_=(e,t,n)=>{a.guides[e.id]={version:e.version,step:n,status:t}},v,y=e=>r(e.path,v),b=e=>r(e.skip_if_on,v)||y(e.complete_on),x=(e,t,n)=>{for(;t<e.steps.length;){if(s={guide:e,index:t,status:`running`},c=void 0,_(e,`running`,t),n.push(m(`step_shown`,e,t)),!b(e.steps[t]))return n;n.push(m(`step_completed`,e,t++))}return s={guide:e,index:--t,status:`completed`},_(e,`done`,t),n.push(m(`guide_completed`,e)),n},S=(e,t)=>(a.seen=!0,x(e,t,[m(`guide_shown`,e)])),C=()=>{let e=s;return s=null,e?.status===`running`?(_(e.guide,`dismissed`,e.index),[m(`guide_dismissed`,e.guide,e.index)]):[]},w=()=>{let e=s;return x(e.guide,e.index+1,[m(`step_completed`,e.guide,e.index)])},T=e=>{let t=f.find(t=>g(t)&&e(t));return t?S(t,0):[]},E=()=>(l.clear(),D()),D=()=>T(e=>e.trigger.type===`first_visit`||y(e.trigger)),O=()=>{let e=f.find(e=>a.guides[e.id]?.status===`running`&&!l.has(e.id)&&h(e));if(!e)return D();let t=a.guides[e.id];return S(e,t.version===e.version?t.step:0)};function k(e){let t=!u&&s?.status===`running`?s.guide.steps[s.index]:null;switch(e.type){case`init`:return v=e.path,l.clear(),O();case`pause`:return u=!0,[];case`resume`:return u?(u=!1,s?[]:O()):[];case`page_view`:return v=e.path,t&&b(t)?w():T(e=>y(e.trigger));case`reset_progress`:{let t=typeof e.guide==`string`&&p(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},...E()])}case`event`:return t?.complete_on.type===`event`&&t.complete_on.name===e.name?w():T(t=>t.trigger.type===`event`&&t.trigger.name===e.name);case`tap`:return t?.complete_on.type===`tap_anchor`&&t.anchor===e.anchor?w():[];case`complete`:return t?.id===e.step?w():[];case`next`:return t?.complete_on.type===`next_button`?w():[];case`back`:return!t||s.index===0?[]:(s={...s,index:s.index-1},_(s.guide,`running`,s.index),[m(`step_shown`,s.guide,s.index)]);case`hide`:return t&&(l.add(s.guide.id),s=null),[];case`close`:if(s?.status!==`completed`)return[];case`dismiss`:return C();case`start`:{let n=p(e.guide);return!n||!h(n)||t&&s.guide===n&&n.steps.slice(0,s.index).every(b)?[]:C().concat(S(n,0))}case`anchor_missing`:return!t||t.anchor!==e.anchor||c===e.anchor?[]:(c=e.anchor,[{...m(`anchor_missing`,s.guide,s.index),anchor:e.anchor}]);case`identify`:return o={...o,...e.traits},[]}}return{get active(){return u?null:s},progress:a,dispatch:k,launcherGuides:()=>f.filter(e=>e.launcher!==!1&&h(e))}}const o=`0.6.0`,s=`playstep_preview`;function c(t,n,r,i=`web`){let c,l,u,d,f,p,m,h={},g=!1,_=[],v=[],y=()=>`p:${c.appKey}`,b=()=>c.preview||e.set(y(),l.progress),x=e=>{let t={...e,ts:Date.now()};c?.preview||(d?d.send(t):v.push(t)),c?.onEvent?.(t)},S=e=>{try{x({type:`sdk_error`,message:String(e)})}catch{}},C=e=>(...t)=>{try{e(...t)}catch(e){S(e)}},w=(e,t)=>C(n=>T({type:e,[t]:n}));function T(t){if(!l)return void _.push(t);let n=l.dispatch(t);b(),n.forEach(C(x)),(l.active||e.get(`q`))&&D(),d?.update()}function E(){return p??(p=document.body.appendChild(document.createElement(`playstep-root`)).attachShadow({mode:`open`}))}function D(){return f??(f=t().then(e=>{let t=E();return t.innerHTML=``,d=e.mount({engine:l,config:u,options:c,root:t,outbox:v,userId:()=>m,dispatch:C(T),emit:C(x)})}).catch(S))}let O,k=C((e={})=>{l?l.launcherGuides().length&&D().then(t=>t?.openLauncher(e.anchor)):O=e});function A(e){e.launcher?.enabled&&l.launcherGuides().length&&!f&&n&&n().then(t=>{f||t.drawLauncher(E(),l,e,k,c)}).catch(S)}let j=e=>C(()=>{g!==e&&(g=e,l&&(T({type:e?`pause`:`resume`}),!f&&(e?p&&(p.innerHTML=``):A(u))))});async function M(){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(S);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(y())??void 0,traits:h}),g&&l.dispatch({type:`pause`}),T({type:`init`,path:location.pathname}),_.splice(0).forEach(T),O&&k(O),A(d),t.autoPageViews!==!1)){let e=location.pathname,t=C(()=>location.pathname!==e&&T({type:`page_view`,path:e=location.pathname}));for(let e of[`pushState`,`replaceState`]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener(`popstate`,t)}}return{version:o,init:C(e=>{if(c||!e?.appKey)return;c={...e};let t=()=>setTimeout(()=>M().catch(S));document.readyState===`complete`?t():addEventListener(`load`,t)}),identify:C((e,t)=>{m=e,h={...h,...t},T({type:`identify`,traits:h})}),track:w(`event`,`name`),start:w(`start`,`guide`),complete:w(`complete`,`step`),page:C(e=>T({type:`page_view`,path:e??location.pathname})),openLauncher:k,resetProgress:w(`reset_progress`,`guide`),reset:C(()=>{T({type:`dismiss`}),m=void 0,h={},l&&(Object.assign(l.progress,{seen:!1,guides:{}}),b(),d?.update()),c?.preview||e.set(`d`,null)}),pause:j(!0),resume:j(!1),isPaused:()=>g}}export{c as n,o as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./sdk-Bn74MzQg.js";import{t}from"./util-oI8xpB8k.js";import{t as n}from"./mode-CPlpg1Yl.js";import{Fragment as r,h as i,render as a}from"preact";import{useEffect as o,useLayoutEffect as s,useRef as c,useState as l}from"preact/hooks";import{computePosition as u,flip as d,offset as f,shift as p}from"@floating-ui/dom";function m(e,t,n=`en`){return e?e[t]??e[t.split(`-`)[0]]??e[n]??Object.values(e)[0]??``:``}function h(e){try{let t=new URL(e),n=t.hostname.replace(/^(www|m)\./,``),r;if(n===`youtu.be`?r=t.pathname.slice(1):n===`youtube.com`&&(r=t.searchParams.get(`v`)??t.pathname.match(/^\/(?:embed|shorts)\/([\w-]+)/)?.[1]),r)return{src:`https://www.youtube-nocookie.com/embed/${r}?autoplay=1&rel=0`,thumb:`https://i.ytimg.com/vi/${r}/hqdefault.jpg`};if(r=n===`vimeo.com`||n===`player.vimeo.com`?t.pathname.match(/(\d{5,})/)?.[1]:null,r)return{src:`https://player.vimeo.com/video/${r}?autoplay=1`}}catch{}return null}const g=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`};function _(e){let t=Number.parseInt(e.slice(1),16),n=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,r=.2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(t&255);return 1.05/(r+.05)>=(r+.05)/.0595?`#ffffff`:`#151823`}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__ */ i(`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,t,n,r,i)=>e.emit({type:i,guide_id:t.id,guide_version:t.version,step_id:t.steps[n].id,step_index:n,clip_id:r.source===`hosted`?r.clip_id:void 0,clip_source:r.source}),S=(e,t,n,r,i)=>b(`${i}|${r.url}`)&&x(e,t,n,r,i),C=e=>e.options.locale??navigator.language??`en`,w=(e,t)=>m(t.name,C(e),t.locale_default)||t.id;function T({ctx:e,guide:t,index:n,reduced:a,clip:s,big:u,onExpand:d,onDuration:f}){let p=t.steps[n],_=c(null),[v,b]=l(!0),[w,T]=l(!a&&s.source!==`embed`),[E,D]=l(s.duration_ms??0),O=r=>x(e,t,n,s,r),k=r=>S(e,t,n,s,r);if(o(()=>{let e=_.current;e&&w&&(e.muted=v,e.play()?.catch(()=>{}))},[w,s.url]),o(()=>f(w&&s.source!==`embed`?E:0),[E,w]),s.source===`embed`){let t=h(s.url),n=new URL(s.url).hostname.replace(/^www\./,``);return/* @__PURE__ */ i(`div`,{class:`clip embed`},w&&t?/* @__PURE__ */ i(`iframe`,{src:t.src,title:`Video: ${m(p.title,C(e))}`,allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowFullScreen:!0}):/* @__PURE__ */ i(r,null,(s.poster??t?.thumb)&&/* @__PURE__ */ i(`img`,{src:s.poster??t?.thumb,alt:``}),/* @__PURE__ */ i(`button`,{class:`play`,"aria-label":`Play video`,onClick:()=>(T(!0),O(`clip_played`))},/* @__PURE__ */ i(y,{name:`play`})),/* @__PURE__ */ i(`div`,{class:`bar`},/* @__PURE__ */ i(`span`,{class:`pill`},/* @__PURE__ */ i(y,{name:`external-link`}),n,E?` · ${g(E)}`:``))))}return/* @__PURE__ */ i(`div`,{class:`clip`},w?/* @__PURE__ */ i(`video`,{ref:_,src:s.url,poster:s.poster,muted:v,loop:!0,autoplay:!0,playsInline:!0,preload:`auto`,"aria-label":`Clip: ${m(p.title,C(e))}`,onLoadedData:()=>k(`clip_loaded`),onPlaying:()=>k(`clip_played`),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&D(t*1e3)}}):/* @__PURE__ */ i(r,null,s.poster&&/* @__PURE__ */ i(`img`,{src:s.poster,alt:``}),/* @__PURE__ */ i(`button`,{class:`play`,"aria-label":`Play clip`,onClick:()=>T(!0)},/* @__PURE__ */ i(y,{name:`play`}))),w&&/* @__PURE__ */ i(`div`,{class:`bar`},/* @__PURE__ */ i(`span`,{class:`pill`},/* @__PURE__ */ i(y,{name:`play`}),E?`${g(E)} loop`:`Loop`),/* @__PURE__ */ i(`button`,{class:`round`,"aria-label":v?`Unmute clip`:`Mute clip`,onClick:()=>{b(!v),_.current&&(_.current.muted=!v),v&&O(`clip_unmuted`)}},/* @__PURE__ */ i(y,{name:v?`volume-x`:`volume-2`})),/* @__PURE__ */ i(`button`,{class:`round`,"aria-label":u?`Shrink clip`:`Expand clip`,"aria-pressed":u,onClick:d},/* @__PURE__ */ i(y,{name:`maximize-2`}))))}function E({ctx:e,guide:t,index:n,reduced:r,cardRef:a,style:s}){let c=t.steps[n],u=t.steps.length,[d,f]=l(!1),[p,h]=l(0),g=n=>m(n,C(e),t.locale_default),_=c.complete_on.type===`next_button`;return o(()=>{f(!1);let i=t.steps[n+1]?.clip;if(i&&i.source!==`embed`&&!r&&!navigator.connection?.saveData){let r=document.createElement(`video`);r.preload=`auto`,r.muted=!0,r.src=i.url,i.source===`hosted`&&S(e,t,n+1,i,`clip_loaded`)}},[t.id,n]),/* @__PURE__ */ i(`div`,{ref:a,class:`card${d?` big`:``}`,style:s,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabIndex:-1,"data-step":c.id},c.clip&&/* @__PURE__ */ i(T,{key:c.id,ctx:e,guide:t,index:n,reduced:r,clip:c.clip,big:d,onExpand:()=>f(!d),onDuration:h}),/* @__PURE__ */ i(`div`,{class:`body`},/* @__PURE__ */ i(`div`,{class:`meta`},/* @__PURE__ */ i(`span`,null,`Step `,n+1,` of `,u,` · `,w(e,t)),/* @__PURE__ */ i(`button`,{class:`x`,"aria-label":`Close guide`,onClick:()=>e.dispatch({type:`dismiss`})},/* @__PURE__ */ i(y,{name:`x`}))),/* @__PURE__ */ i(`div`,{class:`steps`,role:`img`,"aria-label":`Step ${n+1} of ${u}`},t.steps.map((e,t)=>/* @__PURE__ */ i(`span`,{key:t,class:`seg${t<n?` done`:t===n?` cur${p&&!r?` anim`:``}`:``}`,style:t===n&&p?{"--d":`${p}ms`}:void 0}))),/* @__PURE__ */ i(`h2`,{class:`title`,id:`ps-title`},g(c.title)),/* @__PURE__ */ i(`p`,{class:`text`,id:`ps-text`},g(c.body))),/* @__PURE__ */ i(`div`,{class:`foot`},_?/* @__PURE__ */ i(`span`,{class:`sp`}):/* @__PURE__ */ i(`span`,{class:`wait`},/* @__PURE__ */ i(`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__ */ i(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`})},`Back`),_&&/* @__PURE__ */ i(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`})},n+1===u?`Done`:`Next`,/* @__PURE__ */ i(y,{name:`arrow-right`}))))}const D=[`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 O({ctx:e,guide:t}){let n=e.engine.launcherGuides().find(n=>n.id!==t.id&&e.engine.progress.guides[n.id]?.status!==`done`),a=c(null);return o(()=>a.current?.focus(),[]),/* @__PURE__ */ i(r,null,/* @__PURE__ */ i(`div`,{class:`scrim`,onClick:()=>e.dispatch({type:`close`})}),/* @__PURE__ */ i(`div`,{class:`cel`,ref:a,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabIndex:-1},/* @__PURE__ */ i(`div`,{class:`art`,"aria-hidden":`true`},D.map((e,t)=>/* @__PURE__ */ i(`span`,{key:t,class:`bit`,style:e})),/* @__PURE__ */ i(`span`,{class:`tile`},/* @__PURE__ */ i(y,{name:`ps-level-up`}))),/* @__PURE__ */ i(`h2`,{id:`ps-cel`},`Level cleared`),/* @__PURE__ */ i(`p`,null,`You finished `,w(e,t),`.`,n?` Next up: ${w(e,n)}.`:``),/* @__PURE__ */ i(`div`,{class:`acts`},/* @__PURE__ */ i(`button`,{class:`btn sec`,onClick:()=>e.dispatch({type:`start`,guide:t.id})},/* @__PURE__ */ i(y,{name:`rotate-ccw`}),`Replay`),n?/* @__PURE__ */ i(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`start`,guide:n.id})},`Next guide`,/* @__PURE__ */ i(y,{name:`arrow-right`})):/* @__PURE__ */ i(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`close`})},`Done`))))}function k({ctx:e,open:t,setOpen:n,near:a}){let l=c(null);s(()=>{let e=l.current;e&&(e.style.cssText=``,a&&u(a,e,{strategy:`fixed`,placement:`top-start`,middleware:[f(8),d({padding:12}),p({padding:12})]}).then(({x:t,y:n})=>e.style.cssText=`left:${t}px;top:${n}px;right:auto;bottom:auto`))},[t,a]);let h=c(null);o(()=>{t?(h.current=e.root.activeElement??document.activeElement,l.current?.focus()):h.current?.focus()},[t]);let g=e.config.launcher,_=e.engine.launcherGuides();if(!_.length)return null;let v=e.engine.progress.guides,b=_.filter(e=>!v[e.id]).length,x=g?.position===`bottom-left`?` left`:``;return/* @__PURE__ */ i(r,null,t&&/* @__PURE__ */ i(`div`,{class:`panel${x}${g?.enabled?``:` solo`}`,ref:l,tabIndex:-1,role:`dialog`,"aria-label":`Guides`},/* @__PURE__ */ i(`button`,{class:`x`,"aria-label":`Close guides`,onClick:()=>n(!1)},/* @__PURE__ */ i(y,{name:`x`})),/* @__PURE__ */ i(`h2`,null,m(g?.title,C(e))||`Need a hand?`),/* @__PURE__ */ i(`p`,null,m(g?.description,C(e))||`Pick a guide and play it step by step.`),/* @__PURE__ */ i(`ul`,{class:`rows`},_.map(t=>{let r=v[t.id],a=t.steps.length,o=r?.status===`done`,s=r?.status===`running`;return/* @__PURE__ */ i(`li`,{key:t.id},/* @__PURE__ */ i(`button`,{class:`row`,onClick:()=>{n(!1),r&&e.dispatch({type:`reset_progress`,guide:t.id}),e.dispatch({type:`start`,guide:t.id})}},/* @__PURE__ */ i(`span`,{class:`ti${o?` mint`:r?``:` spark`}`},/* @__PURE__ */ i(y,{name:o?`check`:`ps-guide`})),/* @__PURE__ */ i(`span`,{class:`rb`},/* @__PURE__ */ i(`span`,{class:`rt`},w(e,t)),/* @__PURE__ */ i(`span`,{class:`rm`},o?`Completed`:s?`Step ${r.step+1} of ${a}`:`${a} steps`),s&&/* @__PURE__ */ i(`span`,{class:`prog`,"aria-hidden":`true`},/* @__PURE__ */ i(`i`,{style:{width:`${r.step/a*100}%`}}))),r?/* @__PURE__ */ i(`span`,{class:`rp`},/* @__PURE__ */ i(y,{name:`rotate-ccw`}),`Replay`):/* @__PURE__ */ i(`span`,{class:`new`},`New`)))})),_.some(e=>v[e.id])&&/* @__PURE__ */ i(`div`,{class:`acts so`},/* @__PURE__ */ i(`button`,{class:`btn gho`,onClick:()=>{e.dispatch({type:`reset_progress`}),e.engine.active?n(!1):l.current?.focus()}},`Start over`)),e.config.flags?.show_badge!==!1&&/* @__PURE__ */ i(`a`,{class:`pb`,href:`https://playstep.app/?ref=badge`,target:`_blank`,rel:`noopener`},/* @__PURE__ */ i(`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`)),g?.enabled&&/* @__PURE__ */ i(`button`,{class:`lb${x}`,"aria-label":t?`Close guides`:`Open guides`,"aria-expanded":t,onClick:()=>n(!t)},/* @__PURE__ */ i(y,{name:`ps-launcher`}),b>0&&!t&&/* @__PURE__ */ i(`span`,{class:`cnt`},b)))}document.currentScript?.src;const A=()=>import(`./transport-Cu51h2G6.js`),j=e=>!!e?.getClientRects().length;function M(e,t){let n=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{n||(n=t?[...document.querySelectorAll(t.css)].find(e=>j(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return j(n)?n:null}function N(e,t,n){let[r,i]=l(()=>e?M(e,t):null);return o(()=>{if(!e)return i(null);let r=M(e,t);i(r);let a=0,o=()=>{a=0;let n=M(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 P(e,n,r,i,a){let[o,c]=l(null);return s(()=>{let a=n.current;if(!a)return;if(!e){let e=()=>c({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 s=()=>{let t=e.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;u(e,a,{strategy:`fixed`,placement:r===`auto`?`bottom`:r,middleware:[f(18),d({fallbackPlacements:[`top`,`left`,`right`],padding:12}),p({padding:12})]}).then(({x:e,y:r})=>c({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)}}))};s();let l=new ResizeObserver(s);l.observe(e),l.observe(a),addEventListener(`scroll`,s,{capture:!0,passive:!0}),addEventListener(`resize`,s);let m=setInterval(s,400);return()=>{l.disconnect(),clearInterval(m),removeEventListener(`scroll`,s,{capture:!0}),removeEventListener(`resize`,s)}},[e,i,r,...a]),o}function F({ctx:e,guide:t,index:n,reduced:a}){let s=t.steps[n],u=N(s.anchor,s.find?.web,t=>e.dispatch({type:`anchor_missing`,anchor:t})),d=c(null),f=c(``);o(()=>{if(!u)return;let t=t=>{t.composedPath().includes(u)&&(f.current=``,e.dispatch({type:`tap`,anchor:s.anchor}))};return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[u]),o(()=>{if(u)return void(u==M(s.anchor,s.find?.web)&&(f.current=s.id));if(f.current!=s.id)return;let r=setTimeout(()=>{for(let r=n;r--;){let i=t.steps[r];if(!i.anchor||i.complete_on.type==`page`)return;if(M(i.anchor,i.find?.web)){for(let t=n;t-->r;)e.dispatch({type:`back`});return}}},400);return()=>clearTimeout(r)},[u]);let p=t.theme?.position??`bottom`,m=P(u,d,s.placement??`auto`,p,[s.id]),h=c(``);o(()=>{m&&h.current!==s.id&&(h.current=s.id,document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)||d.current?.focus({preventScroll:!0}))},[s.id,m]);let[g,_]=l(!1);o(()=>{m&&!g&&requestAnimationFrame(()=>_(!0))},[m]),o(()=>{let t=t=>{if(t.key!==`Tab`||!d.current)return;let n=[...d.current.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],r=t.composedPath().includes(d.current),i=n[0],a=n.at(-1),o=e.root.activeElement;r&&!t.shiftKey&&o===a?(t.preventDefault(),(u??i)?.focus()):r&&t.shiftKey&&o===i?(t.preventDefault(),(u??a)?.focus()):u&&document.activeElement===u&&(t.preventDefault(),(t.shiftKey?a:i)?.focus())};return document.addEventListener(`keydown`,t,!0),()=>document.removeEventListener(`keydown`,t,!0)},[u]);let v=m?.spot;return/* @__PURE__ */ i(r,null,u&&v?/* @__PURE__ */ i(`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`}}):!u&&p===`center`&&/* @__PURE__ */ i(`div`,{class:`scrim`,"aria-hidden":`true`}),/* @__PURE__ */ i(E,{ctx:e,guide:t,index:n,reduced:a,cardRef:d,style:m?{transform:`translate(${Math.round(m.x)}px,${Math.round(m.y)}px)`,transition:g?void 0:`none`}:{visibility:`hidden`}}))}function I({ctx:e,handle:r}){let[,a]=l(0),s=()=>a(e=>e+1),[c,u]=l(!1),[d,f]=l(),p=t();r.update=()=>{e.engine.launcherGuides().length||u(!1),s()},r.openLauncher=t=>{let n=document.activeElement;f(t??(n!==document.body&&n!==e.root.host?n??void 0:void 0)),u(!0)},o(()=>{let t=t=>{if(t.key!==`Escape`||t.defaultPrevented||!t.composedPath().includes(e.root.host))return;let n=e.engine.active;if(c)u(!1);else if(n?.status===`completed`)e.dispatch({type:`close`});else if(n){let t=n.guide.steps[n.index],r=t.anchor?M(t.anchor,t.find?.web):null;e.dispatch({type:`hide`}),r?.focus({preventScroll:!0})}else return;t.preventDefault(),t.stopPropagation()};return addEventListener(`keydown`,t,!0),()=>removeEventListener(`keydown`,t,!0)},[c]),o(()=>{let e=new MutationObserver(s),t=matchMedia(`(prefers-color-scheme: dark)`);for(let t of[document.documentElement,document.body])e.observe(t,{attributes:!0});return t.addEventListener(`change`,s),()=>{e.disconnect(),t.removeEventListener(`change`,s)}},[]);let h=e.engine.active,g=h?.guide,v=n(e.config,e.options.colorMode,g?.theme?.mode)?`dark`:`light`;e.root.host.setAttribute(`data-mode`,v);let y=e.config.theme,b=g?.theme?.accent,x={};for(let[e,t]of Object.entries({...y?.[v],...g?.theme?.resolved?.[v]??(!y&&b&&{accent:b,"accent-hover":b,"on-accent":_(b)})}))x[`--ps-${e}`]=t;let S=h?.status===`running`?h.guide.steps[h.index]:void 0;return/* @__PURE__ */ i(`div`,{class:`l`,style:x},/* @__PURE__ */ i(k,{ctx:e,open:c,setOpen:u,near:d}),!c&&h?.status===`running`&&/* @__PURE__ */ i(F,{key:h.guide.id,ctx:e,guide:h.guide,index:h.index,reduced:p}),!c&&h?.status===`completed`&&/* @__PURE__ */ i(O,{ctx:e,guide:h.guide}),/* @__PURE__ */ i(`div`,{class:`sr`,"aria-live":`polite`},S?`Step ${h.index+1} of ${h.guide.steps.length}: ${m(S.title,C(e))}`:h?`Level cleared`:``))}function L(t){let n=t.options,r=e=>void t.outbox.push(e);A().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 o=document.createElement(`style`);o.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:var(--ps-radius-btn,99px);border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.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(o);let s=document.createElement(`div`);t.root.appendChild(s);let c={update:()=>{},openLauncher:()=>{},send:e=>r(e)};return a(/* @__PURE__ */ i(I,{ctx:t,handle:c}),s),c}export{M as findAnchor,L as mount};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@axceera/playstep",
3
- "version": "0.5.0",
4
- "description": "PlayStep web SDK: playable, video-first guides for any web app. A 3 KB loader; the guide UI loads only when a guide shows.",
3
+ "version": "0.6.0",
4
+ "description": "PlayStep web SDK: playable, video-first guides for any web app. A 3.2 KB loader; the guide UI loads only when a guide shows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "homepage": "https://playstep.app/docs/sdk/web",
@@ -1 +0,0 @@
1
- import{n as e}from"./util-oI8xpB8k.js";const t=e=>RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`)}$`),n=e=>e.length>1?e.replace(/\/+$/,``):e;function r(e,r){return!!e&&r!==void 0&&t(n(e)).test(n(r))}function i(e,t){return(e??[]).every(e=>{let n=t[e.trait];return e.op===`exists`?n!=null:e.op===`in`?Array.isArray(e.value)&&e.value.includes(n):n===e.value==(e.op===`eq`)})}function a(e){let{config:t,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.5.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,O,c)}).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};
@@ -1 +0,0 @@
1
- import{t as e}from"./sdk-Bpu8YvQu.js";import{t}from"./util-oI8xpB8k.js";import{t as n}from"./mode-CPlpg1Yl.js";import{computePosition as r,flip as i,offset as a,shift as o}from"@floating-ui/dom";import{render as s}from"preact";import{useEffect as c,useLayoutEffect as l,useRef as u,useState as d}from"preact/hooks";import{Fragment as f,jsx as p,jsxs as m}from"preact/jsx-runtime";function h(e,t,n=`en`){return e?e[t]??e[t.split(`-`)[0]]??e[n]??Object.values(e)[0]??``:``}function g(e){try{let t=new URL(e),n=t.hostname.replace(/^(www|m)\./,``),r;if(n===`youtu.be`?r=t.pathname.slice(1):n===`youtube.com`&&(r=t.searchParams.get(`v`)??t.pathname.match(/^\/(?:embed|shorts)\/([\w-]+)/)?.[1]),r)return{src:`https://www.youtube-nocookie.com/embed/${r}?autoplay=1&rel=0`,thumb:`https://i.ytimg.com/vi/${r}/hqdefault.jpg`};if(r=n===`vimeo.com`||n===`player.vimeo.com`?t.pathname.match(/(\d{5,})/)?.[1]:null,r)return{src:`https://player.vimeo.com/video/${r}?autoplay=1`}}catch{}return null}const _=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`};function v(e){let t=Number.parseInt(e.slice(1),16),n=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,r=.2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(t&255);return 1.05/(r+.05)>=(r+.05)/.0595?`#ffffff`:`#151823`}const y={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 b({name:e}){return/* @__PURE__ */ p(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:y[e]}})}function x(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 S=e=>e.options.locale??navigator.language??`en`,C=(e,t)=>h(t.name,S(e),t.locale_default)||t.id;function w({ctx:e,guide:t,index:n,reduced:r,clip:i,big:a,onExpand:o,onDuration:s}){let l=t.steps[n],v=u(null),[y,C]=d(!0),[w,T]=d(!r&&i.source!==`embed`),[E,D]=d(i.duration_ms??0),O=r=>e.emit({type:r,guide_id:t.id,guide_version:t.version,step_id:l.id,step_index:n,clip_id:i.source===`hosted`?i.clip_id:void 0,clip_source:i.source}),k=e=>x(`${e}|${i.url}`)&&O(e);if(c(()=>{let e=v.current;e&&w&&(e.muted=y,e.play()?.catch(()=>{}))},[w,i.url]),c(()=>s(w&&i.source!==`embed`?E:0),[E,w]),i.source===`embed`){let t=g(i.url),n=new URL(i.url).hostname.replace(/^www\./,``);return/* @__PURE__ */ p(`div`,{class:`clip embed`,children:w&&t?/* @__PURE__ */ p(`iframe`,{src:t.src,title:`Video: ${h(l.title,S(e))}`,allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowFullScreen:!0}):/* @__PURE__ */ m(f,{children:[(i.poster??t?.thumb)&&/* @__PURE__ */ p(`img`,{src:i.poster??t?.thumb,alt:``}),/* @__PURE__ */ p(`button`,{class:`play`,"aria-label":`Play video`,onClick:()=>(T(!0),O(`clip_played`)),children:/* @__PURE__ */ p(b,{name:`play`})}),/* @__PURE__ */ p(`div`,{class:`bar`,children:/* @__PURE__ */ m(`span`,{class:`pill`,children:[/* @__PURE__ */ p(b,{name:`external-link`}),n,E?` · ${_(E)}`:``]})})]})})}return/* @__PURE__ */ m(`div`,{class:`clip`,children:[w?/* @__PURE__ */ p(`video`,{ref:v,src:i.url,poster:i.poster,muted:y,loop:!0,autoplay:!0,playsInline:!0,preload:`auto`,"aria-label":`Clip: ${h(l.title,S(e))}`,onLoadedData:()=>k(`clip_loaded`),onPlaying:()=>k(`clip_played`),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&D(t*1e3)}}):/* @__PURE__ */ m(f,{children:[i.poster&&/* @__PURE__ */ p(`img`,{src:i.poster,alt:``}),/* @__PURE__ */ p(`button`,{class:`play`,"aria-label":`Play clip`,onClick:()=>T(!0),children:/* @__PURE__ */ p(b,{name:`play`})})]}),w&&/* @__PURE__ */ m(`div`,{class:`bar`,children:[/* @__PURE__ */ m(`span`,{class:`pill`,children:[/* @__PURE__ */ p(b,{name:`play`}),E?`${_(E)} loop`:`Loop`]}),/* @__PURE__ */ p(`button`,{class:`round`,"aria-label":y?`Unmute clip`:`Mute clip`,onClick:()=>{C(!y),v.current&&(v.current.muted=!y),y&&O(`clip_unmuted`)},children:/* @__PURE__ */ p(b,{name:y?`volume-x`:`volume-2`})}),/* @__PURE__ */ p(`button`,{class:`round`,"aria-label":a?`Shrink clip`:`Expand clip`,"aria-pressed":a,onClick:o,children:/* @__PURE__ */ p(b,{name:`maximize-2`})})]})]})}function T({ctx:e,guide:t,index:n,reduced:r,cardRef:i,style:a}){let o=t.steps[n],s=t.steps.length,[l,u]=d(!1),[f,g]=d(0),_=n=>h(n,S(e),t.locale_default),v=o.complete_on.type===`next_button`;return c(()=>{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`&&x(`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__ */ m(`div`,{ref:i,class:`card${l?` big`:``}`,style:a,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabIndex:-1,"data-step":o.id,children:[o.clip&&/* @__PURE__ */ p(w,{ctx:e,guide:t,index:n,reduced:r,clip:o.clip,big:l,onExpand:()=>u(!l),onDuration:g},o.id),/* @__PURE__ */ m(`div`,{class:`body`,children:[/* @__PURE__ */ m(`div`,{class:`meta`,children:[/* @__PURE__ */ m(`span`,{children:[`Step `,n+1,` of `,s,` · `,C(e,t)]}),/* @__PURE__ */ p(`button`,{class:`x`,"aria-label":`Close guide`,onClick:()=>e.dispatch({type:`dismiss`}),children:/* @__PURE__ */ p(b,{name:`x`})})]}),/* @__PURE__ */ p(`div`,{class:`steps`,role:`img`,"aria-label":`Step ${n+1} of ${s}`,children:t.steps.map((e,t)=>/* @__PURE__ */ p(`span`,{class:`seg${t<n?` done`:t===n?` cur${f&&!r?` anim`:``}`:``}`,style:t===n&&f?{"--d":`${f}ms`}:void 0},t))}),/* @__PURE__ */ p(`h2`,{class:`title`,id:`ps-title`,children:_(o.title)}),/* @__PURE__ */ p(`p`,{class:`text`,id:`ps-text`,children:_(o.body)})]}),/* @__PURE__ */ m(`div`,{class:`foot`,children:[v?/* @__PURE__ */ p(`span`,{class:`sp`}):/* @__PURE__ */ m(`span`,{class:`wait`,children:[/* @__PURE__ */ p(`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__ */ p(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`}),children:`Back`}),v&&/* @__PURE__ */ m(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`}),children:[n+1===s?`Done`:`Next`,/* @__PURE__ */ p(b,{name:`arrow-right`})]})]})]})}const E=[`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 D({ctx:e,guide:t}){let n=e.engine.launcherGuides().find(n=>n.id!==t.id&&e.engine.progress.guides[n.id]?.status!==`done`),r=u(null);return c(()=>r.current?.focus(),[]),/* @__PURE__ */ m(f,{children:[/* @__PURE__ */ p(`div`,{class:`scrim`,onClick:()=>e.dispatch({type:`close`})}),/* @__PURE__ */ m(`div`,{class:`cel`,ref:r,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabIndex:-1,children:[/* @__PURE__ */ m(`div`,{class:`art`,"aria-hidden":`true`,children:[E.map((e,t)=>/* @__PURE__ */ p(`span`,{class:`bit`,style:e},t)),/* @__PURE__ */ p(`span`,{class:`tile`,children:/* @__PURE__ */ p(b,{name:`ps-level-up`})})]}),/* @__PURE__ */ p(`h2`,{id:`ps-cel`,children:`Level cleared`}),/* @__PURE__ */ m(`p`,{children:[`You finished `,C(e,t),`.`,n?` Next up: ${C(e,n)}.`:``]}),/* @__PURE__ */ m(`div`,{class:`acts`,children:[/* @__PURE__ */ m(`button`,{class:`btn sec`,onClick:()=>e.dispatch({type:`start`,guide:t.id}),children:[/* @__PURE__ */ p(b,{name:`rotate-ccw`}),`Replay`]}),n?/* @__PURE__ */ m(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`start`,guide:n.id}),children:[`Next guide`,/* @__PURE__ */ p(b,{name:`arrow-right`})]}):/* @__PURE__ */ p(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`close`}),children:`Done`})]})]})]})}function O({ctx:e,open:t,setOpen:n,near:s}){let d=u(null);l(()=>{let e=d.current;e&&(e.style.cssText=``,s&&r(s,e,{strategy:`fixed`,placement:`top-start`,middleware:[a(8),i({padding:12}),o({padding:12})]}).then(({x:t,y:n})=>e.style.cssText=`left:${t}px;top:${n}px;right:auto;bottom:auto`))},[t,s]);let g=u(null);c(()=>{t?(g.current=e.root.activeElement??document.activeElement,d.current?.focus()):g.current?.focus()},[t]);let _=e.config.launcher,v=e.engine.launcherGuides();if(!v.length)return null;let y=e.engine.progress.guides,x=v.filter(e=>!y[e.id]).length,w=_?.position===`bottom-left`?` left`:``;return/* @__PURE__ */ m(f,{children:[t&&/* @__PURE__ */ m(`div`,{class:`panel${w}${_?.enabled?``:` solo`}`,ref:d,tabIndex:-1,role:`dialog`,"aria-label":`Guides`,children:[/* @__PURE__ */ p(`button`,{class:`x`,"aria-label":`Close guides`,onClick:()=>n(!1),children:/* @__PURE__ */ p(b,{name:`x`})}),/* @__PURE__ */ p(`h2`,{children:h(_?.title,S(e))||`Need a hand?`}),/* @__PURE__ */ p(`p`,{children:h(_?.description,S(e))||`Pick a guide and play it step by step.`}),/* @__PURE__ */ p(`ul`,{class:`rows`,children:v.map(t=>{let r=y[t.id],i=t.steps.length,a=r?.status===`done`,o=r?.status===`running`;return/* @__PURE__ */ p(`li`,{children:/* @__PURE__ */ m(`button`,{class:`row`,onClick:()=>{n(!1),r&&e.dispatch({type:`reset_progress`,guide:t.id}),e.dispatch({type:`start`,guide:t.id})},children:[/* @__PURE__ */ p(`span`,{class:`ti${a?` mint`:r?``:` spark`}`,children:/* @__PURE__ */ p(b,{name:a?`check`:`ps-guide`})}),/* @__PURE__ */ m(`span`,{class:`rb`,children:[/* @__PURE__ */ p(`span`,{class:`rt`,children:C(e,t)}),/* @__PURE__ */ p(`span`,{class:`rm`,children:a?`Completed`:o?`Step ${r.step+1} of ${i}`:`${i} steps`}),o&&/* @__PURE__ */ p(`span`,{class:`prog`,"aria-hidden":`true`,children:/* @__PURE__ */ p(`i`,{style:{width:`${r.step/i*100}%`}})})]}),r?/* @__PURE__ */ m(`span`,{class:`rp`,children:[/* @__PURE__ */ p(b,{name:`rotate-ccw`}),`Replay`]}):/* @__PURE__ */ p(`span`,{class:`new`,children:`New`})]})},t.id)})}),v.some(e=>y[e.id])&&/* @__PURE__ */ p(`div`,{class:`acts so`,children:/* @__PURE__ */ p(`button`,{class:`btn gho`,onClick:()=>{e.dispatch({type:`reset_progress`}),e.engine.active?n(!1):d.current?.focus()},children:`Start over`})}),e.config.flags?.show_badge!==!1&&/* @__PURE__ */ m(`a`,{class:`pb`,href:`https://playstep.app/?ref=badge`,target:`_blank`,rel:`noopener`,children:[/* @__PURE__ */ p(`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`]})]}),_?.enabled&&/* @__PURE__ */ m(`button`,{class:`lb${w}`,"aria-label":t?`Close guides`:`Open guides`,"aria-expanded":t,onClick:()=>n(!t),children:[/* @__PURE__ */ p(b,{name:`ps-launcher`}),x>0&&!t&&/* @__PURE__ */ p(`span`,{class:`cnt`,children:x})]})]})}document.currentScript?.src;const k=()=>import(`./transport-Cu51h2G6.js`),A=e=>!!e?.getClientRects().length;function j(e,t){let n=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{n||(n=t?[...document.querySelectorAll(t.css)].find(e=>A(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return A(n)?n:null}function M(e,t,n){let[r,i]=d(()=>e?j(e,t):null);return c(()=>{if(!e)return i(null);let r=j(e,t);i(r);let a=0,o=()=>{a=0;let n=j(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 N(e,n,s,c,u){let[f,p]=d(null);return l(()=>{let l=n.current;if(!l)return;if(!e){let e=()=>p({x:(innerWidth-l.offsetWidth)/2,y:c===`center`?(innerHeight-l.offsetHeight)/2:innerHeight-l.offsetHeight-24});e();let t=new ResizeObserver(e);return t.observe(l),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 d=()=>{let t=e.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||8;r(e,l,{strategy:`fixed`,placement:s===`auto`?`bottom`:s,middleware:[a(18),i({fallbackPlacements:[`top`,`left`,`right`],padding:12}),o({padding:12})]}).then(({x:e,y:r})=>p({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)}}))};d();let f=new ResizeObserver(d);f.observe(e),f.observe(l),addEventListener(`scroll`,d,{capture:!0,passive:!0}),addEventListener(`resize`,d);let m=setInterval(d,400);return()=>{f.disconnect(),clearInterval(m),removeEventListener(`scroll`,d,{capture:!0}),removeEventListener(`resize`,d)}},[e,c,s,...u]),f}function P({ctx:e,guide:t,index:n,reduced:r}){let i=t.steps[n],a=M(i.anchor,i.find?.web,t=>e.dispatch({type:`anchor_missing`,anchor:t})),o=u(null);c(()=>{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`,l=N(a,o,i.placement??`auto`,s,[i.id]),h=u(``);c(()=>{l&&h.current!==i.id&&(h.current=i.id,document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)||o.current?.focus({preventScroll:!0}))},[i.id,l]);let[g,_]=d(!1);c(()=>{l&&!g&&requestAnimationFrame(()=>_(!0))},[l]),c(()=>{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=l?.spot;return/* @__PURE__ */ m(f,{children:[a&&v?/* @__PURE__ */ p(`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__ */ p(`div`,{class:`scrim`,"aria-hidden":`true`}),/* @__PURE__ */ p(T,{ctx:e,guide:t,index:n,reduced:r,cardRef:o,style:l?{transform:`translate(${Math.round(l.x)}px,${Math.round(l.y)}px)`,transition:g?void 0:`none`}:{visibility:`hidden`}})]})}function F({ctx:e,handle:r}){let[,i]=d(0),a=()=>i(e=>e+1),[o,s]=d(!1),[l,u]=d(),f=t();r.update=a,r.openLauncher=t=>{let n=document.activeElement;u(t??(n!==document.body&&n!==e.root.host?n??void 0:void 0)),s(!0)},c(()=>{let t=t=>{t.key===`Escape`&&(o?s(!1):e.engine.active&&e.dispatch({type:e.engine.active.status===`completed`?`close`:`dismiss`}))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[o]),c(()=>{let e=new MutationObserver(a),t=matchMedia(`(prefers-color-scheme: dark)`);for(let t of[document.documentElement,document.body])e.observe(t,{attributes:!0});return t.addEventListener(`change`,a),()=>{e.disconnect(),t.removeEventListener(`change`,a)}},[]);let g=e.engine.active,_=g?.guide,y=n(e.config,e.options.colorMode,_?.theme?.mode)?`dark`:`light`;e.root.host.setAttribute(`data-mode`,y);let b=e.config.theme,x=_?.theme?.accent,C={};for(let[e,t]of Object.entries({...b?.[y],..._?.theme?.resolved?.[y]??(!b&&x&&{accent:x,"accent-hover":x,"on-accent":v(x)})}))C[`--ps-${e}`]=t;let w=g?.status===`running`?g.guide.steps[g.index]:void 0;return/* @__PURE__ */ m(`div`,{class:`l`,style:C,children:[/* @__PURE__ */ p(O,{ctx:e,open:o,setOpen:s,near:l}),!o&&g?.status===`running`&&/* @__PURE__ */ p(P,{ctx:e,guide:g.guide,index:g.index,reduced:f},g.guide.id),!o&&g?.status===`completed`&&/* @__PURE__ */ p(D,{ctx:e,guide:g.guide}),/* @__PURE__ */ p(`div`,{class:`sr`,"aria-live":`polite`,children:w?`Step ${g.index+1} of ${g.guide.steps.length}: ${h(w.title,S(e))}`:g?`Level cleared`:``})]})}function I(t){let n=t.options,r=e=>void t.outbox.push(e);k().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:var(--ps-radius-btn,99px);border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.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 s(/* @__PURE__ */ p(F,{ctx:t,handle:o}),a),o}export{j as findAnchor,I as mount};