@axceera/playstep 0.8.0 → 0.10.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 +17 -4
- package/dist/capture-cKutY_OF.js +13 -0
- package/dist/cdn/capture.js +1 -1
- package/dist/cdn/events.js +1 -1
- package/dist/cdn/insights.js +1 -0
- package/dist/cdn/launcher.js +1 -1
- package/dist/cdn/loader.js +1 -1
- package/dist/cdn/ui.js +1 -1
- package/dist/{done-CIjuDrGz.js → done-kxa44syt.js} +1 -1
- package/dist/index.d.ts +2 -321
- package/dist/index.js +1 -1
- package/dist/launcher-button-B62YRJZF.js +1 -0
- package/dist/{list-BL3FY9X7.js → list-DJOai7g8.js} +1 -1
- package/dist/plugin-DtuC_pEx.d.ts +426 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +1 -0
- package/dist/queue-CTbppTdt.js +1 -0
- package/dist/sdk-DpzIfiet.js +1 -0
- package/dist/transport-dyLfVpw6.js +1 -0
- package/dist/ui-BVaIwTOj.js +1 -0
- package/package.json +8 -4
- package/dist/capture-NeIia2Wg.js +0 -13
- package/dist/launcher-button-BFeH6G4k.js +0 -1
- package/dist/sdk-wO7F4vdJ.js +0 -1
- package/dist/transport-DZeLw3bE.js +0 -1
- package/dist/ui-WHd-CNG8.js +0 -1
package/dist/ui-WHd-CNG8.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./sdk-wO7F4vdJ.js";import{t}from"./util-X5IoDowG.js";import{t as n}from"./mode-CPlpg1Yl.js";var r=Object.defineProperty,i=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n};const a={x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,play:`<path d="M5 5a2 2 0 0 1 3-1.7l12 7a2 2 0 0 1 0 3.5l-12 7A2 2 0 0 1 5 19z"/>`,"volume-2":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.4 18.4a9 9 0 0 0 0-12.7"/>`,"volume-x":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="m16.5 14.5 5-5"/><path d="m16.5 9.5 5 5"/>`,check:`<path d="M20 6 9 17l-5-5"/>`,"maximize-2":`<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>`,"arrow-right":`<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>`,"rotate-ccw":`<path d="M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"/><path d="M3 3v5h5"/>`,"external-link":`<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>`,"ps-launcher":`<path d="M12 21a9 9 0 1 0-8-5L3 21l5-.9A9 9 0 0 0 12 21z"/><path d="M10 9v6l5-3z"/>`,"ps-level-up":`<path d="M3 21h5v-4h5v-4h5V9"/><path d="M18 9V3l4 2.5L18 8"/>`,"ps-guide":`<rect x="4" y="3" width="4" height="18" rx="2"/><path d="M12 5.5v10l7.5-5z"/>`};function o(e,t,...n){let r=document.createElement(e);for(let e in t){let n=t[e];if(n!=null&&n!==!1){if(e[0]==`o`&&e[1]==`n`)r.addEventListener(e.slice(2).toLowerCase(),n);else if(e==`ref`)n(r);else if(e==`style`)for(let e in n)r.style.setProperty(e,n[e]);else r.setAttribute(e,n===!0?``:String(n))}}return s(r,n),r}function s(e,t){for(let n of t)Array.isArray(n)?s(e,n):n!=null&&n!==!1&&e.appendChild(typeof n==`object`?n:document.createTextNode(String(n)))}const c=document.createElement(`template`);function l(e){return c.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${a[e]}</svg>`,c.content.firstChild}const u=(e,...t)=>{e.textContent=``,s(e,t)},d=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e),f=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},p=e=>e.options.locale??navigator.language??`en`,m=(e,t=e.config.lang)=>(n,r)=>d(e.config.words[t]?.[n]??n,r);function h(e,t){let n=e=>!!e?.getClientRects().length,r=document.querySelector(`[data-guide="${CSS.escape(e)}"]`);try{r||(r=t?[...document.querySelectorAll(t.css)].find(e=>n(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return n(r)?r:null}function g(e){try{let t=JSON.parse(sessionStorage.getItem(`playstep:clips`)??`[]`);if(t.includes(e))return!1;sessionStorage.setItem(`playstep:clips`,JSON.stringify([...t,e].slice(-200)))}catch{}return!0}function _(e,t,n,r,i,a){(!a||g(`${i}|${r.url}`))&&e.emit({type:i,guide_id:t.id,guide_version:t.version,step_id:t.steps[n].id,step_index:n,clip_id:r.clip_id,clip_source:r.source})}function v(e,t,n,r,i,a,s){let c=m(e,t.lang),d=t.steps[n].title,p=o(`div`,{class:`clip`}),h=!0,g=r.duration_ms??0;if(r.kind==`embed`)return p.className=`clip embed`,u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_video`),onClick:()=>{u(p,o(`iframe`,{src:r.url,title:c(`video`,{title:d}),allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowfullscreen:!0})),_(e,t,n,r,`clip_played`)}},l(`play`)),o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`external-link`),r.label,g?` · ${f(g)}`:``))),s(0),p;let v=()=>{let i=o(`video`,{src:r.url,poster:r.poster,loop:!0,autoplay:!0,playsinline:!0,preload:`auto`,"aria-label":c(`clip`,{title:d}),onLoadeddata:()=>_(e,t,n,r,`clip_loaded`,!0),onPlaying:()=>_(e,t,n,r,`clip_played`,!0),onLoadedmetadata:()=>{Number.isFinite(i.duration)&&(g=i.duration*1e3,m.textContent=`${f(g)} `,s(g))}});i.muted=!0;let m=o(`span`,null,g?`${f(g)} `:``),v=o(`button`,{class:`round`,"aria-label":c(`unmute_clip`),onClick:()=>{h=!h,i.muted=h,v.setAttribute(`aria-label`,c(h?`unmute_clip`:`mute_clip`)),u(v,l(h?`volume-x`:`volume-2`)),h||_(e,t,n,r,`clip_unmuted`)}},l(`volume-x`)),y=o(`button`,{class:`round`,"aria-label":c(`expand_clip`),"aria-pressed":`false`,onClick:()=>{let e=a.classList.toggle(`big`);y.setAttribute(`aria-label`,c(e?`shrink_clip`:`expand_clip`)),y.setAttribute(`aria-pressed`,String(e))}},l(`maximize-2`));u(p,i,o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`play`),m,c(`loop`)),v,y)),i.play()?.catch(()=>{}),s(g)};return i?u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_clip`),onClick:v},l(`play`))):v(),p}function y(e,t,n,r,i){let a=t.steps[n],s=t.steps.length,c=m(e,t.lang),d=a.complete_on.type==`next_button`,f=a.media,p=c(`step_of`,{n:n+1,total:s}),h=t.steps.map((e,t)=>o(`span`,{class:`seg${t<n?` done`:t==n?` cur`:``}`})),g=e=>{let t=h[n];t.className=`seg cur${e&&!r?` anim`:``}`,e?t.style.setProperty(`--d`,`${e}ms`):t.style.removeProperty(`--d`)};i.classList.remove(`big`),i.dataset.step=a.id,i.lang=t.lang,t.rtl?i.dir=`rtl`:i.removeAttribute(`dir`),u(i,f?.kind==`image`?o(`div`,{class:`clip img`},o(`img`,{src:f.url,alt:f.label??``,width:f.width,height:f.height})):f&&v(e,t,n,f,r,i,g),o(`div`,{class:`body`},o(`div`,{class:`meta`},o(`span`,null,`${p} · ${t.name}`),o(`button`,{class:`x`,"aria-label":c(`close_guide`),onClick:()=>e.dispatch({type:`dismiss`})},l(`x`))),o(`div`,{class:`steps`,role:`img`,"aria-label":p},h),o(`h2`,{class:`title`,id:`ps-title`},a.title),o(`p`,{class:`text`,id:`ps-text`},a.body)),o(`div`,{class:`foot`},d?o(`span`,{class:`sp`}):o(`span`,{class:`wait`},o(`span`,{class:`pulse`,"aria-hidden":`true`}),c(`waiting`)),a.back&&o(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`})},c(`back`)),d&&o(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`})},c(n+1==s?`done`:`next`),l(`arrow-right`))));let y=t.steps[n+1]?.media;if(y&&y.kind!=`embed`&&!r&&!navigator.connection?.saveData){if(y.kind==`image`)new Image().src=y.url;else{let r=document.createElement(`video`);r.preload=`auto`,r.muted=!0,r.src=y.url,y.source==`hosted`&&_(e,t,n+1,y,`clip_loaded`,!0)}}}function b(e,t,n,r,i,a=!1,o=12){let s={bottom:e.bottom+i+n<=innerHeight-o,top:e.top-i-n>=o,left:e.left-i-t>=o,right:e.right+i+t<=innerWidth-o},c=r.find(e=>s[e])??r[0],l=(e,t)=>Math.max(o,Math.min(e,t-o));return c==`top`||c==`bottom`?{x:l(a?e.left:e.left+(e.width-t)/2,innerWidth-t),y:c==`top`?e.top-i-n:e.bottom+i}:{x:c==`left`?e.left-i-t:e.right+i,y:l(e.top+(e.height-n)/2,innerHeight-n)}}var x=/* @__PURE__ */ i({fillEl:()=>u,h:()=>o,icon:()=>l,mount:()=>j,words:()=>m});const S=document.currentScript?.src,C=(e,t,n)=>t?new Promise((n,r)=>document.head.append(Object.assign(document.createElement(`script`),{src:new URL(`${e}.js`,S||location.href).href,integrity:t,crossOrigin:`anonymous`,onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))):n(),w=()=>C(`events`,``,()=>import(`./transport-DZeLw3bE.js`)),T=()=>C(`list`,typeof __PLAYSTEP_LIST_INTEGRITY__==`string`?__PLAYSTEP_LIST_INTEGRITY__:``,()=>import(`./list-BL3FY9X7.js`)),E=()=>C(`done`,typeof __PLAYSTEP_DONE_INTEGRITY__==`string`?__PLAYSTEP_DONE_INTEGRITY__:``,()=>import(`./done-CIjuDrGz.js`));function D(e,t,n){let r=m(e),i=e.engine.launcherGuides().filter(t=>!e.engine.progress.guides[t.id]).length;t.className=`lb${e.config.launcher.position==`bottom-left`?` left`:``}`,t.setAttribute(`aria-label`,r(n?`close_guides`:`open_guides`)),t.setAttribute(`aria-expanded`,String(n)),u(t,l(`ps-launcher`),i>0&&!n&&o(`span`,{class:`cnt`},i))}function O(e=``){let t=location.pathname.split(`/`),n=!!e,r=e.split(`/`).map((e,r)=>e==`*`?t[r]||(n=!1,``):e).join(`/`);return n?r:``}const k=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r));function A(e,t,n){let r=o(`div`,{class:`card`,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabindex:`-1`,style:{visibility:`hidden`}}),i=o(`div`,{class:`spot`,"aria-hidden":`true`}),a=o(`div`,{class:`scrim`,"aria-hidden":`true`}),s=!1,c=!1,l,u=-1,d=null,f=[],p=[],m=[],g=!1,_=``,v=``,x,S=e=>e.splice(0).forEach(e=>e()),C=()=>l.steps[u];function w(e,t,a){r.style.transform=`translate(${Math.round(e)}px,${Math.round(t)}px)`,r.style.visibility=``,g||(r.style.transition=`none`,requestAnimationFrame(()=>(g=!0,r.style.transition=``))),s!=!!(d&&a)&&(s=!s,n()),d&&a&&Object.assign(i.style,{width:`${a.w}px`,height:`${a.h}px`,transform:`translate(${a.x}px,${a.y}px)`,borderRadius:`${a.r}px`}),_!=C().id&&(_=C().id,document.hasFocus()&&!document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)&&r.focus({preventScroll:!0}))}function T(){S(m);let e=r;if(c!=(!d&&l.position==`center`)&&(c=!c,n()),!d){let t=()=>w((innerWidth-e.offsetWidth)/2,l.position==`center`?(innerHeight-e.offsetHeight)/2:innerHeight-e.offsetHeight-24);t();let n=new ResizeObserver(t);n.observe(e),m.push(()=>n.disconnect(),k(window,`resize`,t));return}let i=d,a=i.getBoundingClientRect();(a.bottom<0||a.top>innerHeight)&&i.scrollIntoView({block:`center`,behavior:t?`auto`:`smooth`});let o=()=>{let t=i.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(i).borderTopLeftRadius)||8,r=C().placement,{x:a,y:o}=b(t,e.offsetWidth,e.offsetHeight,[r==`auto`?`bottom`:r,`top`,`left`,`right`],18);w(a,o,{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(n+6,(t.height+12)/2)})};o();let s=new ResizeObserver(o);s.observe(i),s.observe(e);let u=setInterval(o,400);m.push(()=>s.disconnect(),()=>clearInterval(u),k(window,`scroll`,o,{capture:!0,passive:!0}),k(window,`resize`,o))}function E(t){d=t,S(p),clearTimeout(x);let n=C();if(t)p.push(k(document,`click`,(r=>{r.composedPath().includes(t)&&(v=``,e.dispatch({type:`tap`,anchor:n.anchor}))}),!0)),t==h(n.anchor,n.find?.web)&&(v=n.id);else if(v==n.id){let t=u;x=setTimeout(()=>{for(let n=t;n--;){let r=l.steps[n];if(!r.anchor||r.complete_on.type==`page`)return;if(h(r.anchor,r.find?.web)){for(let r=t;r-->n;)e.dispatch({type:`back`});return}}},400)}p.push(k(document,`keydown`,(n=>{if(n.key!=`Tab`)return;let i=[...r.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],a=n.composedPath().includes(r),o=i[0],s=i.at(-1),c=e.root.activeElement;a&&!n.shiftKey&&c==s?(n.preventDefault(),(t??o)?.focus()):a&&n.shiftKey&&c==o?(n.preventDefault(),(t??s)?.focus()):t&&document.activeElement==t&&(n.preventDefault(),(n.shiftKey?s:o)?.focus())}),!0)),T()}function D(){S(f);let t=C(),n=t.anchor?h(t.anchor,t.find?.web):null;if(E(n),!t.anchor)return;let r=0,i=()=>{r=0;let e=h(t.anchor,t.find?.web);e!=n&&E(n=e)},a=new MutationObserver(()=>r||(r=requestAnimationFrame(i)));a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-guide`,`hidden`,`style`,`class`]});let o=setTimeout(()=>!n&&e.dispatch({type:`anchor_missing`,anchor:t.anchor}),3e3);f.push(()=>a.disconnect(),()=>clearTimeout(o),()=>cancelAnimationFrame(r))}return{nodes:()=>[s&&i,c&&a,r],get guide(){return l},update(n,i){if(n==l&&i==u)return;let a=!l||i!=u||n.steps[i]?.id!=C().id;l=n,u=i,y(e,n,i,t,r),a?D():T()},stop(){S(f),S(p),S(m),clearTimeout(x)}}}function j(r){let i=r.options,a=e=>void r.outbox.push(e);w().then(({createTransport:t})=>{let n=t({appKey:i.appKey,url:i.eventsUrl,sdk:i.sdkName??`web`,version:e,preview:i.preview,userId:r.userId,locale:()=>p(r),send:i.transport});r.outbox.splice(0).forEach(n.push),a=n.push}).catch(e=>r.emit({type:`sdk_error`,message:String(e)}));let s=r.root;s.appendChild(o(`style`,null,`:host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-inline-start:auto}[dir=rtl] .btn svg{transform:scaleX(-1)}.img>img{object-fit:contain}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:var(--ps-radius-btn,99px);border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.left{right:auto;left:24px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}`));let c=s.appendChild(o(`div`,{class:`l`})),l=o(`div`,{class:`sr`,"aria-live":`polite`}),u=!1,d,f,g=null,_=o(`button`,{onClick:()=>L(!u)}),v,y,x,S,C=e=>r.emit({type:`sdk_error`,message:String(e)}),j=()=>x??(x=T().then(e=>(v=e,s.appendChild(o(`style`,null,e.css)),z())).catch(C)),M=()=>S??(S=E().then(e=>(y=e,s.appendChild(o(`style`,null,e.css)),z())).catch(C)),N,P=[],F=()=>[l],I,L=e=>{u=e,z()};function R(e){let t=e.filter(Boolean);for(t.forEach((e,t)=>c.childNodes[t]!=e&&c.insertBefore(e,c.childNodes[t]??null));c.childNodes.length>t.length;)c.lastChild.remove()}function z(){let e=r.engine.active,a=e?.guide,p=n(r.config,i.colorMode,a?.mode)?`dark`:`light`;s.host.setAttribute(`data-mode`,p),c.removeAttribute(`style`);for(let[e,t]of Object.entries({...r.config.theme?.[p],...a?.tokens?.[p]}))c.style.setProperty(`--ps-${e}`,t);let h=r.engine.launcherGuides().length>0,x=!!f;u&&h&&v?(f??(f=o(`div`,{tabindex:`-1`,role:`dialog`})),v.drawList(r,f,()=>L(!1))):(f=void 0,u&&h&&j()),h&&D(r,_,u),!u&&e?.status==`running`?N?.guide?.id!=a.id&&(N?.stop(),N=A(r,t(),()=>R(F()))):(N?.stop(),N=void 0),e?.status==`running`&&e.index==a.steps.length-1&&M();let S=!u&&e?.status==`completed`&&!!y;!u&&e?.status==`completed`&&!y&&M();let C=S&&(I!=a||!P.length);if(S?C&&(P=y.drawDone(r,a)):P=[],I=S?a:void 0,l.textContent=e?.status==`running`?`${m(r,a.lang)(`step_of`,{n:e.index+1,total:a.steps.length})}: ${a.steps[e.index].title}`:e?.status==`completed`?m(r,a.lang)(`level_cleared`):``,F=()=>[f,h&&r.config.launcher.enabled&&_,...N?.nodes()??[],...P,l],R(F()),N?.update(a,e.index),f&&!x){if(g=s.activeElement??document.activeElement,d){let{x:e,y:t}=b(d.getBoundingClientRect(),f.offsetWidth,f.offsetHeight,[`top`,`bottom`],8,!0);f.style.cssText=`left:${e}px;top:${t}px;right:auto;bottom:auto`}f.focus()}else!f&&x&&g?.focus();C&&P[1]?.focus()}k(window,`keydown`,(e=>{if(e.key!=`Escape`||e.defaultPrevented||!e.composedPath().includes(s.host))return;let t=r.engine.active;if(u)L(!1);else if(t?.status==`completed`)r.dispatch({type:`close`});else if(t?.status==`running`){let e=t.guide.steps[t.index],n=e.anchor?h(e.anchor,e.find?.web):null;r.dispatch({type:`hide`}),n?.focus({preventScroll:!0})}else return;e.preventDefault(),e.stopPropagation()}),!0);let B=new MutationObserver(()=>z());for(let e of[document.documentElement,document.body])B.observe(e,{attributes:!0});return k(matchMedia(`(prefers-color-scheme: dark)`),`change`,()=>z()),z(),{update:()=>{r.engine.launcherGuides().length||(u=!1),z()},openLauncher:e=>{let t=document.activeElement;d=e??(t!=document.body&&t!=s.host?t??void 0:void 0),L(!0)},send:e=>a(e),start:e=>{let t=O(r.config.guides.find(t=>t.id==e.guide)?.start_path);r.dispatch({...e,to:t});let n=r.engine.active;if(n?.status==`waiting`&&n.guide.id==e.guide)try{i.navigate(t)}catch(t){C(t),r.dispatch({...e,to:``})}}}}export{u as fillEl,o as h,l as icon,j as mount,x as t,m as words};
|