siteguide.js 0.9.2 → 0.9.4
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/dist/css/siteguide.css +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +371 -353
- package/package.json +71 -71
package/dist/css/siteguide.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--sg-bg: var(--sg-mono-100);--sg-text: var(--sg-mono-900);--sg-line: var(--sg-mono-500);--sg-primary: #2e62d9;--sg-primary-hover: #2ca2fd;--sg-secondary: #2ca2fd;--sg-secondary-hover: #2ca2fd;--sg-danger: #ff3b30;--sg-success: #52b52f;--sg-attention: #ffa900;--sg-mono-900: #101828;--sg-mono-800: #4c525e;--sg-mono-700: #7c8089;--sg-mono-600: #acaeb5;--sg-mono-500: #d5d6d9;--sg-mono-400: #e6e7e8;--sg-mono-300: #f4f4f5;--sg-mono-200: #f9f9fa;--sg-mono-100: #fff;--sg-padding-s: 8px;--sg-padding-m: 12px;--sg-padding-l: 16px;--sg-padding-2l: 20px;--sg-text-xs: 12px;--sg-text-s: 14px;--sg-text-m: 16px;--sg-text-l: 18px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}[class^=siteguide]{box-sizing:border-box;font-family:Inter,sans-serif}.siteguide-background{position:fixed;inset:0;background
|
|
1
|
+
:root{--sg-bg: var(--sg-mono-100);--sg-text: var(--sg-mono-900);--sg-line: var(--sg-mono-500);--sg-primary: #2e62d9;--sg-primary-hover: #2ca2fd;--sg-secondary: #2ca2fd;--sg-secondary-hover: #2ca2fd;--sg-danger: #ff3b30;--sg-success: #52b52f;--sg-attention: #ffa900;--sg-mono-900: #101828;--sg-mono-800: #4c525e;--sg-mono-700: #7c8089;--sg-mono-600: #acaeb5;--sg-mono-500: #d5d6d9;--sg-mono-400: #e6e7e8;--sg-mono-300: #f4f4f5;--sg-mono-200: #f9f9fa;--sg-mono-100: #fff;--sg-padding-s: 8px;--sg-padding-m: 12px;--sg-padding-l: 16px;--sg-padding-2l: 20px;--sg-text-xs: 12px;--sg-text-s: 14px;--sg-text-m: 16px;--sg-text-l: 18px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}[class^=siteguide]{box-sizing:border-box;font-family:Inter,sans-serif}.siteguide-background{position:fixed;inset:0;background:transparent;z-index:999999;opacity:0;transition:opacity .3s ease-out}.siteguide-host{position:relative;z-index:99999999!important}.siteguide-host-parent{opacity:1;transform:none;filter:none;isolation:auto;will-change:auto;animation-play-state:paused}.siteguide-highlight{border:2px solid var(--sg-mono-900);border-radius:4px;box-shadow:0 0 #212121cc,0 0 0 5000px #21212180;opacity:0;transition:all .3s ease-out}.siteguide-highlight-pos{position:absolute;z-index:9999998}.siteguide-interaction{position:fixed;border-radius:4px;z-index:99999999}.siteguide{width:280px;min-height:150px;max-height:400px;background-color:var(--sg-bg);border-radius:8px;border:1px solid var(--sg-line);box-shadow:0 10px 10px #0001;display:flex;flex-direction:column;color:var(--sg-text);font-size:var(--sg-text-m)}.siteguide-pos{position:absolute;z-index:100000000}.siteguide-animation{animation:fadeIn .3s ease-out}.siteguide-arrow{position:absolute;width:10px;height:10px;background-color:inherit;z-index:1}.siteguide-header{display:flex;align-items:center;width:100%;padding:var(--sg-padding-m) var(--sg-padding-2l) 0;position:relative}.siteguide-content{width:100%;padding:var(--sg-padding-m) var(--sg-padding-2l);overflow-y:auto}.siteguide-content::-webkit-scrollbar{width:4px}.siteguide-content::-webkit-scrollbar-thumb{background-color:var(--sg-primary);border-radius:4px}.siteguide-title{display:block;font-size:var(--sg-text-l);font-weight:800;color:var(--sg-text)}.siteguide-image{width:100%;height:auto;border-radius:4px;object-fit:cover;margin-bottom:var(--sg-padding-m)}.siteguide-description{font-size:14px;font-weight:400;color:var(--sg-text)}.siteguide-footer{width:100%;display:flex;align-items:center;justify-content:space-between;padding:var(--sg-padding-m);border-top:1px solid var(--sg-line);gap:var(--sg-padding-l);margin-top:auto}.siteguide-button{padding:var(--sg-padding-s) var(--sg-padding-l);border-radius:4px;cursor:pointer;font-size:14px;line-height:20px;transition:background-color .3s ease-out;color:var(--sg-mono-100);border:none}.siteguide-button-secondary{background-color:var(--sg-secondary)}.siteguide-button-secondary:hover{background-color:var(--sg-secondary-hover)}.siteguide-button-primary{background-color:var(--sg-primary)}.siteguide-button-primary:hover{background-color:var(--sg-primary-hover)}.siteguide-button-link{color:var(--sg-primary);background-color:transparent;cursor:pointer;transition:color .3s ease-out}.siteguide-button-link:hover{color:var(--sg-primary-hover)}.siteguide-progress{font-size:var(--sg-text-s);color:var(--sg-mono-800)}.siteguide-close{width:24px;height:24px;display:flex;align-items:center;justify-content:center;background-color:transparent;border-radius:4px;cursor:pointer;position:absolute;top:10px;right:10px;transition:color .3s ease-out,background-color .3s ease-out;border:none}.siteguide-close:hover{background-color:var(--sg-secondary-hover);color:#fff}
|
package/dist/index.d.ts
CHANGED
|
@@ -186,11 +186,13 @@ export declare class Tour {
|
|
|
186
186
|
get popup(): HTMLElement | null;
|
|
187
187
|
get highlight(): HTMLElement | null;
|
|
188
188
|
get interaction(): HTMLElement | null;
|
|
189
|
+
get background(): HTMLElement | null;
|
|
189
190
|
get activeStep(): TourStep | null;
|
|
190
191
|
get activeStepIndex(): number | null;
|
|
191
192
|
readonly popupRenderer: IRenderer;
|
|
192
193
|
readonly highlightRenderer: IRenderer;
|
|
193
194
|
readonly interactionRenderer: IRenderer;
|
|
195
|
+
readonly backgroundRenderer: IRenderer;
|
|
194
196
|
private _popup;
|
|
195
197
|
private _highlight;
|
|
196
198
|
private _interaction;
|
|
@@ -366,6 +368,16 @@ export declare type TourConfig = {
|
|
|
366
368
|
*/
|
|
367
369
|
disable?: boolean;
|
|
368
370
|
};
|
|
371
|
+
/**
|
|
372
|
+
* Configuration for the background
|
|
373
|
+
*/
|
|
374
|
+
background?: {
|
|
375
|
+
/**
|
|
376
|
+
* Disabling background
|
|
377
|
+
* @default true
|
|
378
|
+
*/
|
|
379
|
+
disable?: boolean;
|
|
380
|
+
};
|
|
369
381
|
/**
|
|
370
382
|
* Control tour from keyboard arrows
|
|
371
383
|
* @default false
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Kt=Object.defineProperty,Xt=Object.defineProperties;var Gt=Object.getOwnPropertyDescriptors;var nt=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable;var Pt=Math.pow,ut=(e,t,i)=>t in e?Kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,A=(e,t)=>{for(var i in t||(t={}))Ct.call(t,i)&&ut(e,i,t[i]);if(nt)for(var i of nt(t))Tt.call(t,i)&&ut(e,i,t[i]);return e},Q=(e,t)=>Xt(e,Gt(t));var Et=(e,t)=>{var i={};for(var n in e)Ct.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&nt)for(var n of nt(e))t.indexOf(n)<0&&Tt.call(e,n)&&(i[n]=e[n]);return i};var x=(e,t,i)=>ut(e,typeof t!="symbol"?t+"":t,i);var k=(e,t,i)=>new Promise((n,o)=>{var s=a=>{try{c(i.next(a))}catch(l){o(l)}},r=a=>{try{c(i.throw(a))}catch(l){o(l)}},c=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,r);c((i=i.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Jt=["top","right","bottom","left"],Lt=["start","end"],Ot=Jt.reduce((e,t)=>e.concat(t,t+"-"+Lt[0],t+"-"+Lt[1]),[]),Z=Math.min,U=Math.max,st=Math.round,B=e=>({x:e,y:e}),Qt={left:"right",right:"left",bottom:"top",top:"bottom"},Zt={start:"end",end:"start"};function te(e,t,i){return U(e,Z(t,i))}function ct(e,t){return typeof e=="function"?e(t):e}function et(e){return e.split("-")[0]}function V(e){return e.split("-")[1]}function ee(e){return e==="x"?"y":"x"}function yt(e){return e==="y"?"height":"width"}function xt(e){return["top","bottom"].includes(et(e))?"y":"x"}function wt(e){return ee(xt(e))}function ie(e,t,i){i===void 0&&(i=!1);const n=V(e),o=wt(e),s=yt(o);let r=o==="x"?n===(i?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=Rt(r)),[r,Rt(r)]}function ne(e){return e.replace(/start|end/g,t=>Zt[t])}function Rt(e){return e.replace(/left|right|bottom|top/g,t=>Qt[t])}function oe(e){return A({top:0,right:0,bottom:0,left:0},e)}function Nt(e){return typeof e!="number"?oe(e):{top:e,right:e,bottom:e,left:e}}function rt(e){const{x:t,y:i,width:n,height:o}=e;return{width:n,height:o,top:i,left:t,right:t+n,bottom:i+o,x:t,y:i}}function $t(e,t,i){let{reference:n,floating:o}=e;const s=xt(t),r=wt(t),c=yt(r),a=et(t),l=s==="y",h=n.x+n.width/2-o.width/2,f=n.y+n.height/2-o.height/2,g=n[c]/2-o[c]/2;let u;switch(a){case"top":u={x:h,y:n.y-o.height};break;case"bottom":u={x:h,y:n.y+n.height};break;case"right":u={x:n.x+n.width,y:f};break;case"left":u={x:n.x-o.width,y:f};break;default:u={x:n.x,y:n.y}}switch(V(t)){case"start":u[r]-=g*(i&&l?-1:1);break;case"end":u[r]+=g*(i&&l?-1:1);break}return u}const se=(e,t,i)=>k(exports,null,function*(){const{placement:n="bottom",strategy:o="absolute",middleware:s=[],platform:r}=i,c=s.filter(Boolean),a=yield r.isRTL==null?void 0:r.isRTL(t);let l=yield r.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:f}=$t(l,n,a),g=n,u={},d=0;for(let p=0;p<c.length;p++){const{name:m,fn:y}=c[p],{x:_,y:v,data:S,reset:b}=yield y({x:h,y:f,initialPlacement:n,placement:g,strategy:o,middlewareData:u,rects:l,platform:r,elements:{reference:e,floating:t}});h=_!=null?_:h,f=v!=null?v:f,u=Q(A({},u),{[m]:A(A({},u[m]),S)}),b&&d<=50&&(d++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(l=b.rects===!0?yield r.getElementRects({reference:e,floating:t,strategy:o}):b.rects),{x:h,y:f}=$t(l,g,a)),p=-1)}return{x:h,y:f,placement:g,strategy:o,middlewareData:u}});function re(e,t){return k(this,null,function*(){var i;t===void 0&&(t={});const{x:n,y:o,platform:s,rects:r,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:g=!1,padding:u=0}=ct(t,e),d=Nt(u),m=c[g?f==="floating"?"reference":"floating":f],y=rt(yield s.getClippingRect({element:(i=yield s.isElement==null?void 0:s.isElement(m))==null||i?m:m.contextElement||(yield s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:h,strategy:a})),_=f==="floating"?{x:n,y:o,width:r.floating.width,height:r.floating.height}:r.reference,v=yield s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating),S=(yield s.isElement==null?void 0:s.isElement(v))?(yield s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},b=rt(s.convertOffsetParentRelativeRectToViewportRelativeRect?yield s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:_,offsetParent:v,strategy:a}):_);return{top:(y.top-b.top+d.top)/S.y,bottom:(b.bottom-y.bottom+d.bottom)/S.y,left:(y.left-b.left+d.left)/S.x,right:(b.right-y.right+d.right)/S.x}})}const ce=e=>({name:"arrow",options:e,fn(i){return k(this,null,function*(){const{x:n,y:o,placement:s,rects:r,platform:c,elements:a,middlewareData:l}=i,{element:h,padding:f=0}=ct(e,i)||{};if(h==null)return{};const g=Nt(f),u={x:n,y:o},d=wt(s),p=yt(d),m=yield c.getDimensions(h),y=d==="y",_=y?"top":"left",v=y?"bottom":"right",S=y?"clientHeight":"clientWidth",b=r.reference[p]+r.reference[d]-u[d]-r.floating[p],w=u[d]-r.reference[d],P=yield c.getOffsetParent==null?void 0:c.getOffsetParent(h);let E=P?P[S]:0;(!E||!(yield c.isElement==null?void 0:c.isElement(P)))&&(E=a.floating[S]||r.floating[p]);const W=b/2-w/2,M=E/2-m[p]/2-1,I=Z(g[_],M),T=Z(g[v],M),O=I,Y=E-m[p]-T,$=E/2-m[p]/2+W,q=te(O,$,Y),J=!l.arrow&&V(s)!=null&&$!==q&&r.reference[p]/2-($<O?I:T)-m[p]/2<0,ht=J?$<O?$-O:$-Y:0;return{[d]:u[d]+ht,data:A({[d]:q,centerOffset:$-q-ht},J&&{alignmentOffset:ht}),reset:J}})}});function le(e,t,i){return(e?[...i.filter(o=>V(o)===e),...i.filter(o=>V(o)!==e)]:i.filter(o=>et(o)===o)).filter(o=>e?V(o)===e||(t?ne(o)!==o:!1):!0)}const ae=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,fn(i){return k(this,null,function*(){var n,o,s;const{rects:r,middlewareData:c,placement:a,platform:l,elements:h}=i,I=ct(e,i),{crossAxis:f=!1,alignment:g,allowedPlacements:u=Ot,autoAlignment:d=!0}=I,p=Et(I,["crossAxis","alignment","allowedPlacements","autoAlignment"]),m=g!==void 0||u===Ot?le(g||null,d,u):u,y=yield re(i,p),_=((n=c.autoPlacement)==null?void 0:n.index)||0,v=m[_];if(v==null)return{};const S=ie(v,r,yield l.isRTL==null?void 0:l.isRTL(h.floating));if(a!==v)return{reset:{placement:m[0]}};const b=[y[et(v)],y[S[0]],y[S[1]]],w=[...((o=c.autoPlacement)==null?void 0:o.overflows)||[],{placement:v,overflows:b}],P=m[_+1];if(P)return{data:{index:_+1,overflows:w},reset:{placement:P}};const E=w.map(T=>{const O=V(T.placement);return[T.placement,O&&f?T.overflows.slice(0,2).reduce((Y,$)=>Y+$,0):T.overflows[0],T.overflows]}).sort((T,O)=>T[1]-O[1]),M=((s=E.filter(T=>T[2].slice(0,V(T[0])?2:3).every(O=>O<=0))[0])==null?void 0:s[0])||E[0][0];return M!==a?{data:{index:_+1,overflows:w},reset:{placement:M}}:{}})}}};function fe(e,t){return k(this,null,function*(){const{placement:i,platform:n,elements:o}=e,s=yield n.isRTL==null?void 0:n.isRTL(o.floating),r=et(i),c=V(i),a=xt(i)==="y",l=["left","top"].includes(r)?-1:1,h=s&&a?-1:1,f=ct(t,e);let{mainAxis:g,crossAxis:u,alignmentAxis:d}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof d=="number"&&(u=c==="end"?d*-1:d),a?{x:u*h,y:g*l}:{x:g*l,y:u*h}})}const he=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(i){return k(this,null,function*(){var n,o;const{x:s,y:r,placement:c,middlewareData:a}=i,l=yield fe(i,e);return c===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:r+l.y,data:Q(A({},l),{placement:c})}})}}};function lt(){return typeof window!="undefined"}function G(e){return Bt(e)?(e.nodeName||"").toLowerCase():"#document"}function R(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function z(e){var t;return(t=(Bt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bt(e){return lt()?e instanceof Node||e instanceof R(e).Node:!1}function D(e){return lt()?e instanceof Element||e instanceof R(e).Element:!1}function F(e){return lt()?e instanceof HTMLElement||e instanceof R(e).HTMLElement:!1}function At(e){return!lt()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof R(e).ShadowRoot}function it(e){const{overflow:t,overflowX:i,overflowY:n,display:o}=H(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+i)&&!["inline","contents"].includes(o)}function ue(e){return["table","td","th"].includes(G(e))}function at(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(i){return!1}})}function vt(e){const t=bt(),i=D(e)?H(e):e;return i.transform!=="none"||i.perspective!=="none"||(i.containerType?i.containerType!=="normal":!1)||!t&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!t&&(i.filter?i.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(i.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(i.contain||"").includes(n))}function de(e){let t=j(e);for(;F(t)&&!X(t);){if(vt(t))return t;if(at(t))return null;t=j(t)}return null}function bt(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function X(e){return["html","body","#document"].includes(G(e))}function H(e){return R(e).getComputedStyle(e)}function ft(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function j(e){if(G(e)==="html")return e;const t=e.assignedSlot||e.parentNode||At(e)&&e.host||z(e);return At(t)?t.host:t}function Ft(e){const t=j(e);return X(t)?e.ownerDocument?e.ownerDocument.body:e.body:F(t)&&it(t)?t:Ft(t)}function pt(e,t,i){var n;t===void 0&&(t=[]),i===void 0&&(i=!0);const o=Ft(e),s=o===((n=e.ownerDocument)==null?void 0:n.body),r=R(o);if(s){const c=mt(r);return t.concat(r,r.visualViewport||[],it(o)?o:[],c&&i?pt(c):[])}return t.concat(o,pt(o,[],i))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Mt(e){const t=H(e);let i=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=F(e),s=o?e.offsetWidth:i,r=o?e.offsetHeight:n,c=st(i)!==s||st(n)!==r;return c&&(i=s,n=r),{width:i,height:n,$:c}}function Vt(e){return D(e)?e:e.contextElement}function K(e){const t=Vt(e);if(!F(t))return B(1);const i=t.getBoundingClientRect(),{width:n,height:o,$:s}=Mt(t);let r=(s?st(i.width):i.width)/n,c=(s?st(i.height):i.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const ge=B(0);function zt(e){const t=R(e);return!bt()||!t.visualViewport?ge:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pe(e,t,i){return t===void 0&&(t=!1),!i||t&&i!==R(e)?!1:t}function tt(e,t,i,n){t===void 0&&(t=!1),i===void 0&&(i=!1);const o=e.getBoundingClientRect(),s=Vt(e);let r=B(1);t&&(n?D(n)&&(r=K(n)):r=K(e));const c=pe(s,i,n)?zt(s):B(0);let a=(o.left+c.x)/r.x,l=(o.top+c.y)/r.y,h=o.width/r.x,f=o.height/r.y;if(s){const g=R(s),u=n&&D(n)?R(n):n;let d=g,p=mt(d);for(;p&&n&&u!==d;){const m=K(p),y=p.getBoundingClientRect(),_=H(p),v=y.left+(p.clientLeft+parseFloat(_.paddingLeft))*m.x,S=y.top+(p.clientTop+parseFloat(_.paddingTop))*m.y;a*=m.x,l*=m.y,h*=m.x,f*=m.y,a+=v,l+=S,d=R(p),p=mt(d)}}return rt({width:h,height:f,x:a,y:l})}function _t(e,t){const i=ft(e).scrollLeft;return t?t.left+i:tt(z(e)).left+i}function Wt(e,t,i){i===void 0&&(i=!1);const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-(i?0:_t(e,n)),s=n.top+t.scrollTop;return{x:o,y:s}}function me(e){let{elements:t,rect:i,offsetParent:n,strategy:o}=e;const s=o==="fixed",r=z(n),c=t?at(t.floating):!1;if(n===r||c&&s)return i;let a={scrollLeft:0,scrollTop:0},l=B(1);const h=B(0),f=F(n);if((f||!f&&!s)&&((G(n)!=="body"||it(r))&&(a=ft(n)),F(n))){const u=tt(n);l=K(n),h.x=u.x+n.clientLeft,h.y=u.y+n.clientTop}const g=r&&!f&&!s?Wt(r,a,!0):B(0);return{width:i.width*l.x,height:i.height*l.y,x:i.x*l.x-a.scrollLeft*l.x+h.x+g.x,y:i.y*l.y-a.scrollTop*l.y+h.y+g.y}}function ye(e){return Array.from(e.getClientRects())}function xe(e){const t=z(e),i=ft(e),n=e.ownerDocument.body,o=U(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=U(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-i.scrollLeft+_t(e);const c=-i.scrollTop;return H(n).direction==="rtl"&&(r+=U(t.clientWidth,n.clientWidth)-o),{width:o,height:s,x:r,y:c}}function we(e,t){const i=R(e),n=z(e),o=i.visualViewport;let s=n.clientWidth,r=n.clientHeight,c=0,a=0;if(o){s=o.width,r=o.height;const l=bt();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}return{width:s,height:r,x:c,y:a}}function ve(e,t){const i=tt(e,!0,t==="fixed"),n=i.top+e.clientTop,o=i.left+e.clientLeft,s=F(e)?K(e):B(1),r=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=n*s.y;return{width:r,height:c,x:a,y:l}}function kt(e,t,i){let n;if(t==="viewport")n=we(e,i);else if(t==="document")n=xe(z(e));else if(D(t))n=ve(t,i);else{const o=zt(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return rt(n)}function It(e,t){const i=j(e);return i===t||!D(i)||X(i)?!1:H(i).position==="fixed"||It(i,t)}function be(e,t){const i=t.get(e);if(i)return i;let n=pt(e,[],!1).filter(c=>D(c)&&G(c)!=="body"),o=null;const s=H(e).position==="fixed";let r=s?j(e):e;for(;D(r)&&!X(r);){const c=H(r),a=vt(r);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||it(r)&&!a&&It(e,r))?n=n.filter(h=>h!==r):o=c,r=j(r)}return t.set(e,n),n}function _e(e){let{element:t,boundary:i,rootBoundary:n,strategy:o}=e;const r=[...i==="clippingAncestors"?at(t)?[]:be(t,this._c):[].concat(i),n],c=r[0],a=r.reduce((l,h)=>{const f=kt(t,h,o);return l.top=U(f.top,l.top),l.right=Z(f.right,l.right),l.bottom=Z(f.bottom,l.bottom),l.left=U(f.left,l.left),l},kt(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Se(e){const{width:t,height:i}=Mt(e);return{width:t,height:i}}function Ce(e,t,i){const n=F(t),o=z(t),s=i==="fixed",r=tt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=B(0);if(n||!n&&!s)if((G(t)!=="body"||it(o))&&(c=ft(t)),n){const g=tt(t,!0,s,t);a.x=g.x+t.clientLeft,a.y=g.y+t.clientTop}else o&&(a.x=_t(o));const l=o&&!n&&!s?Wt(o,c):B(0),h=r.left+c.scrollLeft-a.x-l.x,f=r.top+c.scrollTop-a.y-l.y;return{x:h,y:f,width:r.width,height:r.height}}function dt(e){return H(e).position==="static"}function Dt(e,t){if(!F(e)||H(e).position==="fixed")return null;if(t)return t(e);let i=e.offsetParent;return z(e)===i&&(i=i.ownerDocument.body),i}function jt(e,t){const i=R(e);if(at(e))return i;if(!F(e)){let o=j(e);for(;o&&!X(o);){if(D(o)&&!dt(o))return o;o=j(o)}return i}let n=Dt(e,t);for(;n&&ue(n)&&dt(n);)n=Dt(n,t);return n&&X(n)&&dt(n)&&!vt(n)?i:n||de(e)||i}const Te=function(e){return k(this,null,function*(){const t=this.getOffsetParent||jt,i=this.getDimensions,n=yield i(e.floating);return{reference:Ce(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}})};function Pe(e){return H(e).direction==="rtl"}const Ee={convertOffsetParentRelativeRectToViewportRelativeRect:me,getDocumentElement:z,getClippingRect:_e,getOffsetParent:jt,getElementRects:Te,getClientRects:ye,getDimensions:Se,getScale:K,isElement:D,isRTL:Pe},Le=he,Oe=ae,Re=ce,$e=(e,t,i)=>{const n=new Map,o=A({platform:Ee},i),s=Q(A({},o.platform),{_c:n});return se(e,t,Q(A({},o),{platform:s}))};function N(e){return e===null||typeof e=="undefined"}function C(e){return!N(e)}function Ht(e){return new Promise(t=>setTimeout(t,e))}function Yt(e){var n;const t=e.parentElement;return!t||t.nodeName==="HTML"?!1:((n=document.defaultView)==null?void 0:n.getComputedStyle(e,null).getPropertyValue("position"))==="fixed"?!0:Yt(t)}function St(e){return Yt(e)?"fixed":"absolute"}class Ae{renderContent(t,i,n){t.querySelector(`.${n.classPrefix}-content`).appendChild(i.node)}}function L(e,t){const i=document.createElement(e);return t&&t.length>0&&(t=t.filter(n=>n),i.classList.add(...t)),i}class ke{renderContent(t,i,n){var s,r,c,a;const o=t.querySelector(`.${n.classPrefix}-content`);if(i.imgSrc){const l=L("img",[`${n.classPrefix}-image`,`${(r=(s=i.customization)==null?void 0:s.imageClass)!=null?r:""}`]);l.src=i.imgSrc,o.appendChild(l)}if(i.text){const l=L("p",[`${n.classPrefix}-description`,`${(a=(c=i.customization)==null?void 0:c.descriptionClass)!=null?a:""}`]);l.innerHTML=n.translateFn(i.text),o.appendChild(l)}}}function De(e,t,i){var c,a,l,h,f,g,u,d,p,m,y,_,v,S,b;if(e.innerHTML="",e.className=`${(c=i.config.class)!=null?c:""} ${i.config.classPrefix} ${i.config.animationClass}`,!i.config.arrow.disable&&((a=i.activeStep)!=null&&a.hasHost)){const w=L("div",[(l=i.config.arrow.class)!=null?l:"",`${i.config.classPrefix}-arrow`]);e.appendChild(w)}(h=t.customization)!=null&&h.class&&e.classList.add(t.customization.class);const n=L("div",[`${i.config.classPrefix}-header`,`${(g=(f=t.customization)==null?void 0:f.headerClass)!=null?g:""}`]);e.appendChild(n);const o=L("h1",[`${i.config.classPrefix}-title`,`${(d=(u=t.customization)==null?void 0:u.titleClass)!=null?d:""}`]);o.innerHTML=i.config.translateFn((p=t.title)!=null?p:""),n.appendChild(o),i.config.close.button&&(i.config.closeIcon.onclick=i.complete.bind(i),n.appendChild(i.config.closeIcon));const s=L("div",[`${i.config.classPrefix}-content`,`${(y=(m=t.customization)==null?void 0:m.contentClass)!=null?y:""}`]);e.appendChild(s);const r=L("div",[`${i.config.classPrefix}-footer`,`${(v=(_=t.customization)==null?void 0:_.footerClass)!=null?v:""}`]);if(N(t.buttonList)&&(t.buttonList=He(i)),t.buttonList.forEach(w=>{var W;const P=[`${i.config.classPrefix}-button`,(W=w.class)!=null?W:""];N(w.type)||w.type==="secondary"?P.push(`${i.config.classPrefix}-button-secondary`):w.type==="primary"?P.push(`${i.config.classPrefix}-button-primary`):w.type==="link"&&P.push(`${i.config.classPrefix}-button-link`),!N(w.class)&&w.class!==""&&P.push(w.class);const E=L("button",P);E.innerHTML=i.config.translateFn(w.text),E.onclick=M=>{w.action.call(i)},r.appendChild(E)}),!i.config.progress.disable&&i.config.progress.text&&C(i.activeStepIndex)){const w=L("p",[`${i.config.classPrefix}-progress`,`${(b=(S=t.customization)==null?void 0:S.progressClass)!=null?b:""}`]);w.innerHTML=i.config.translateFn(Ne(i.config.progress.text,i.activeStepIndex+1,i.stepList.length)),r.appendChild(w)}e.appendChild(r)}function He(e){return[{text:e.config.buttons.prevText,action:e.prev},{text:e.config.buttons.nextText,type:"primary",action:e.next}]}function Ne(e,t,i){return e.replace("{{currentStep}}",t.toString()).replace("{{totalSteps}}",i.toString())}class Be{constructor(){x(this,"_renderContentStrategy",new Map);x(this,"_staticSides",{top:"bottom",right:"left",bottom:"top",left:"right"});this.setUpStrategies()}render(t,i){return new Promise(n=>{var o,s;if(!this._renderContentStrategy.has(i.popupData.type))throw new Error("Missing popup creator strategy");t.style.display="none",t.classList.remove(i.tour.config.animationClass),i.hostElement?t.style.position=St(i.hostElement):t.style.position="fixed",De(t,i.popupData,i.tour),(o=this._renderContentStrategy.get(i.popupData.type))==null||o.renderContent(t,i.popupData,i.tour.config),(s=i.hostElement)==null||s.scrollIntoView(i.tour.config.scrollTo),n()}).then(()=>i.isFirst&&i.direction==="toNext"?Ht(0):Ht(400)).then(()=>{t.style.display="flex",this.updatePosition(t,i),t.classList.add(i.tour.config.animationClass)})}updatePosition(t,i){C(i.hostElement)?this.renderFloatingPopup(t,i):this.renderCenterPopup(t)}renderFloatingPopup(t,i){var l;const n=t.style.position==="fixed"?window.scrollY||document.documentElement.scrollTop:0,o=t.querySelector(`.${i.tour.config.classPrefix}-arrow`),s=[],r=C(i.popupData.position)&&i.popupData.position!=="auto"?i.popupData.position:void 0,c=(l=o==null?void 0:o.offsetWidth)!=null?l:10,a=Math.sqrt(2*Pt(c,2))/2+i.tour.config.highlight.padding;s.push(Le(a)),(i.popupData.position==="auto"||N(r))&&s.push(Oe()),!i.tour.config.arrow.disable&&C(o)&&s.push(Re({element:o})),$e(i.hostElement,t,{placement:r,middleware:[...s]}).then(({x:h,y:f,middlewareData:g,placement:u})=>{Object.assign(t.style,{top:`${f-n}px`,left:`${h}px`,marginTop:"0",marginLeft:"0"});const d=u.split("-")[0],p=this._staticSides[d];if(g.arrow&&C(o)){const{x:m,y}=g.arrow;Object.assign(o.style,{left:m!=null?`${m}px`:"",top:y!=null?`${y}px`:"",right:"",bottom:"",[p]:`${-c/2}px`,transform:"rotate(45deg)"})}})}renderCenterPopup(t){Object.assign(t.style,{top:"50%",left:"50%",marginTop:`-${t.clientHeight/2}px`,marginLeft:`-${t.clientWidth/2}px`})}setUpStrategies(){this._renderContentStrategy.set("text",new ke),this._renderContentStrategy.set("custom",new Ae)}}class Fe{render(t,i){return new Promise(n=>{i.hostElement&&(t.style.position=St(i.hostElement)),n()}).then(()=>{this.updatePosition(t,i)})}updatePosition(t,i){var r,c;if(!i.hostElement){t.style.width="0",t.style.height="0",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.opacity="0";return}const n=i.hostElement.getBoundingClientRect(),o=(c=(r=i.tour.config.highlight)==null?void 0:r.padding)!=null?c:8,s=t.style.position==="fixed"?0:window.scrollY||document.documentElement.scrollTop;t.style.transform="",t.style.left=`${n.left-o}px`,t.style.top=`${n.top+s-o}px`,t.style.width=`${n.width+2*o}px`,t.style.height=`${n.height+2*o}px`,t.style.opacity="1"}}class Me{render(t,i){return new Promise(n=>{i.hostElement&&(t.style.position=St(i.hostElement)),n()}).then(()=>{this.updatePosition(t,i)})}updatePosition(t,i){var r,c;if(!i.hostElement){t.style.width="0",t.style.height="0",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)";return}const n=i.hostElement.getBoundingClientRect(),o=(c=(r=i.tour.config.highlight)==null?void 0:r.padding)!=null?c:8,s=t.style.position==="fixed"?0:window.scrollY||document.documentElement.scrollTop;t.style.transform="",t.style.left=`${n.left-o}px`,t.style.top=`${n.top+s-o}px`,t.style.width=`${n.width+2*o}px`,t.style.height=`${n.height+2*o}px`}}class qt{constructor(t,i){x(this,"popupData");x(this,"tour");x(this,"_index");x(this,"_hostElement",null);x(this,"_direction","toNext");x(this,"_hostData");x(this,"_resizeObserver",null);var n;this.popupData=i.popup,this.tour=t,this._index=(n=i.index)!=null?n:null,this._hostData=i.host}get isFirst(){return this.tour.stepList.indexOf(this)===0}get direction(){return this._direction}get hasHost(){return C(this._hostElement)}get hostElement(){return this._hostElement}get index(){return this._index}set index(t){this._index=t}show(t){return k(this,null,function*(){var n;if(N(this.tour.popup))return;this._direction=t,this._hostData&&(this._hostElement=this.resolveHostElement(typeof this._hostData=="function"?this._hostData():(n=this._hostData)!=null?n:null)),this._resizeObserver=this.listenHostResize();const i=[this.tour.popupRenderer.render(this.tour.popup,this)];this.tour.config.interaction.disable&&C(this.tour.interaction)?i.push(this.tour.interactionRenderer.render(this.tour.interaction,this)):!this.tour.config.interaction.disable&&C(this.tour.interaction)&&i.push(this.tour.interactionRenderer.render(this.tour.interaction,{})),!this.tour.config.highlight.disable&&!N(this.tour.highlight)&&i.push(this.tour.highlightRenderer.render(this.tour.highlight,this)),this.tour.config.highlight.disable&&C(this.tour.highlight)&&this.tour.highlightRenderer.render(this.tour.highlight,{}),yield Promise.all(i),this.toggleHostClass(!0)})}hide(){return k(this,null,function*(){var t;(t=this._resizeObserver)==null||t.disconnect(),this.toggleHostClass(!1)})}toggleHostClass(t){N(this._hostElement)||(t?this._hostElement.classList.add("siteguide-host"):this._hostElement.classList.remove("siteguide-host"))}resolveHostElement(t){return typeof this._hostData=="string"?document.querySelector(this._hostData):t}listenHostResize(){const t=new ResizeObserver(()=>{N(this.tour.activeStep)||(C(this.tour.popup)&&this.tour.popupRenderer.updatePosition(this.tour.popup,this.tour.activeStep),C(this.tour.highlight)&&!this.tour.config.highlight.disable&&this.tour.highlightRenderer.updatePosition(this.tour.highlight,this.tour.activeStep),C(this.tour.interaction)&&this.tour.config.interaction.disable&&this.tour.interactionRenderer.updatePosition(this.tour.interaction,this.tour.activeStep))});return C(this._hostElement)&&t.observe(this._hostElement),t}}function gt(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Ut(e,t){const i=A({},e);return gt(e)&>(t)&&Object.keys(t).forEach(n=>{const o=n,s=n;gt(t[o])?(s in e||Object.assign(i,{[s]:{}}),i[s]=Ut(e[s],t[o])):Object.assign(i,{[s]:t[o]})}),i}function Ve(e){const t=L("button",[`${e}-close`]);return t.innerHTML="✖",t}class ze{constructor(){x(this,"_activeTour",null)}get isActive(){return C(this.activeTour)}get activeTour(){return this._activeTour}setActiveTour(t){this._activeTour=t}}const ot=new ze;class We{constructor(t){x(this,"popupRenderer",new Be);x(this,"highlightRenderer",new Fe);x(this,"interactionRenderer",new Me);x(this,"_popup",null);x(this,"_highlight",null);x(this,"_interaction",null);x(this,"_background",null);x(this,"_stepList",[]);x(this,"_activeStep",null);x(this,"_bodyResizeObserver",null);x(this,"_config");x(this,"closeOnEsc",t=>{t.key==="Escape"&&this.complete()});x(this,"closeOnClick",()=>{this.complete()});x(this,"keyboardControl",t=>{t.key==="ArrowRight"?this.next():t.key==="ArrowLeft"&&this.prev()});var i,n,o,s,r,c,a,l,h,f,g,u,d,p,m,y,_,v,S,b,w,P,E,W,M,I,T,O,Y,$,q;this._config={classPrefix:(i=t.classPrefix)!=null?i:"siteguide",class:"",buttons:{nextText:(o=(n=t.buttons)==null?void 0:n.nextText)!=null?o:"Next",prevText:(r=(s=t.buttons)==null?void 0:s.prevText)!=null?r:"Back"},animationClass:(c=t.animationClass)!=null?c:"siteguide-animation",close:{button:(l=(a=t.close)==null?void 0:a.button)!=null?l:!0,clickout:(f=(h=t.close)==null?void 0:h.clickout)!=null?f:!1,esc:(u=(g=t.close)==null?void 0:g.esc)!=null?u:!0},scrollTo:(d=t.scrollTo)!=null?d:{behavior:"smooth",block:"center",inline:"center"},closeIcon:(m=t.closeIcon)!=null?m:Ve((p=t.classPrefix)!=null?p:"siteguide"),arrow:{disable:(_=(y=t.arrow)==null?void 0:y.disable)!=null?_:!1,class:(S=(v=t.arrow)==null?void 0:v.class)!=null?S:""},highlight:{disable:(w=(b=t.highlight)==null?void 0:b.disable)!=null?w:!1,padding:(E=(P=t.highlight)==null?void 0:P.padding)!=null?E:8,class:(M=(W=t.highlight)==null?void 0:W.class)!=null?M:""},progress:{disable:(T=(I=t.progress)==null?void 0:I.disable)!=null?T:!0,text:"Step {{currentStep}} of {{totalSteps}}"},interaction:{disable:(Y=(O=t.interaction)==null?void 0:O.disable)!=null?Y:!0},keyboardControl:($=t.keyboardControl)!=null?$:!1,translateFn:(q=t.translateFn)!=null?q:J=>J}}get stepList(){return this._stepList}get config(){return this._config}get popup(){return this._popup}get highlight(){return this._highlight}get interaction(){return this._interaction}get activeStep(){return this._activeStep}get activeStepIndex(){return this._activeStep?this.stepList.indexOf(this._activeStep):null}addStep(t){if(N(t.index)){const n=this._stepList.reduce((o,s)=>s.index!==null&&s.index!==void 0&&s.index>o?s.index:o,-1);t.index=n+1}const i=new qt(this,t);this._stepList.push(i),this._stepList.sort((n,o)=>n.index-o.index)}addSteps(t){t.forEach(i=>this.addStep(i))}removeStep(t){this._stepList=this._stepList.filter(i=>t!==i.index)}start(){ot.isActive||(ot.setActiveTour(this),this._bodyResizeObserver=this.getBodyResizeObserver(),this.config.close.esc&&document.addEventListener("keydown",this.closeOnEsc),this.config.keyboardControl&&document.addEventListener("keydown",this.keyboardControl),this._background=L("div",["siteguide-background"]),document.body.appendChild(this._background),this.config.close.clickout&&this._background.addEventListener("click",this.closeOnClick),this._config.highlight.disable||(this._highlight=L("div",[this._config.highlight.class,`${this._config.classPrefix}-highlight`]),document.body.appendChild(this._highlight)),this._config.interaction.disable&&(this._interaction=L("div",["siteguide-interaction"]),document.body.appendChild(this._interaction)),this._popup=L("div",[this._config.classPrefix]),document.body.appendChild(this._popup),this.next())}complete(){var t,i;this._popup&&document.body.removeChild(this._popup),this._highlight&&document.body.removeChild(this._highlight),this._interaction&&document.body.removeChild(this._interaction),this._background&&document.body.removeChild(this._background),(t=this._bodyResizeObserver)==null||t.disconnect(),(i=this._activeStep)==null||i.hide(),this._activeStep=null,ot.setActiveTour(null),this.config.close.esc&&document.removeEventListener("keydown",this.closeOnEsc),this.config.keyboardControl&&document.removeEventListener("keydown",this.keyboardControl)}prev(){const t=C(this._activeStep)?this._stepList.indexOf(this._activeStep)-1:this._stepList.indexOf(this._stepList[this._stepList.length-1]);if(t<0){this.complete();return}this.changeStepTo(t,"fromBack")}next(){return k(this,null,function*(){var i,n,o;const t=C(this._activeStep)?this._stepList.indexOf(this._activeStep)+1:this._stepList.indexOf(this._stepList[0]);if(t>=this._stepList.length){this.complete();return}C((i=this._activeStep)==null?void 0:i.popupData.allowNext)&&!((o=yield(n=this._activeStep)==null?void 0:n.popupData.allowNext.call(this))==null||o)||this.changeStepTo(t,"toNext")})}goTo(t){var i;if(t>this._stepList.length-1){console.error("Provided index was larger than steps amount");return}this.changeStepTo(t,t>((i=this.activeStepIndex)!=null?i:-1)?"toNext":"fromBack")}setConfig(t){this._config=Ut(this._config,t)}changeStepTo(t,i){var n;(n=this._activeStep)==null||n.hide(),this._activeStep=this._stepList[t],this._activeStep.show(i)}getBodyResizeObserver(){const t=new ResizeObserver(()=>{this._activeStep&&(C(this._popup)&&this.popupRenderer.updatePosition(this._popup,this._activeStep),C(this._highlight)&&!this.config.highlight.disable&&this.highlightRenderer.updatePosition(this._highlight,this._activeStep),C(this._interaction)&&this.config.interaction.disable&&this.interactionRenderer.updatePosition(this._interaction,this._activeStep))});return t.observe(document.body),t}}const Ie=ot;exports.Siteguide=Ie;exports.Tour=We;exports.TourStep=qt;exports.createElement=L;
|
|
1
|
+
"use strict";var Xt=Object.defineProperty,Gt=Object.defineProperties;var Jt=Object.getOwnPropertyDescriptors;var ot=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var Pt=Math.pow,ut=(e,t,i)=>t in e?Xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,$=(e,t)=>{for(var i in t||(t={}))Ct.call(t,i)&&ut(e,i,t[i]);if(ot)for(var i of ot(t))Et.call(t,i)&&ut(e,i,t[i]);return e},Z=(e,t)=>Gt(e,Jt(t));var Tt=(e,t)=>{var i={};for(var n in e)Ct.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&ot)for(var n of ot(e))t.indexOf(n)<0&&Et.call(e,n)&&(i[n]=e[n]);return i};var x=(e,t,i)=>ut(e,typeof t!="symbol"?t+"":t,i);var A=(e,t,i)=>new Promise((n,o)=>{var s=a=>{try{c(i.next(a))}catch(l){o(l)}},r=a=>{try{c(i.throw(a))}catch(l){o(l)}},c=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,r);c((i=i.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qt=["top","right","bottom","left"],Lt=["start","end"],Ot=Qt.reduce((e,t)=>e.concat(t,t+"-"+Lt[0],t+"-"+Lt[1]),[]),tt=Math.min,X=Math.max,rt=Math.round,N=e=>({x:e,y:e}),Zt={left:"right",right:"left",bottom:"top",top:"bottom"},te={start:"end",end:"start"};function ee(e,t,i){return X(e,tt(t,i))}function lt(e,t){return typeof e=="function"?e(t):e}function it(e){return e.split("-")[0]}function V(e){return e.split("-")[1]}function ie(e){return e==="x"?"y":"x"}function yt(e){return e==="y"?"height":"width"}function xt(e){return["top","bottom"].includes(it(e))?"y":"x"}function wt(e){return ie(xt(e))}function ne(e,t,i){i===void 0&&(i=!1);const n=V(e),o=wt(e),s=yt(o);let r=o==="x"?n===(i?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=Rt(r)),[r,Rt(r)]}function oe(e){return e.replace(/start|end/g,t=>te[t])}function Rt(e){return e.replace(/left|right|bottom|top/g,t=>Zt[t])}function se(e){return $({top:0,right:0,bottom:0,left:0},e)}function Ht(e){return typeof e!="number"?se(e):{top:e,right:e,bottom:e,left:e}}function ct(e){const{x:t,y:i,width:n,height:o}=e;return{width:n,height:o,top:i,left:t,right:t+n,bottom:i+o,x:t,y:i}}function kt(e,t,i){let{reference:n,floating:o}=e;const s=xt(t),r=wt(t),c=yt(r),a=it(t),l=s==="y",f=n.x+n.width/2-o.width/2,h=n.y+n.height/2-o.height/2,g=n[c]/2-o[c]/2;let u;switch(a){case"top":u={x:f,y:n.y-o.height};break;case"bottom":u={x:f,y:n.y+n.height};break;case"right":u={x:n.x+n.width,y:h};break;case"left":u={x:n.x-o.width,y:h};break;default:u={x:n.x,y:n.y}}switch(V(t)){case"start":u[r]-=g*(i&&l?-1:1);break;case"end":u[r]+=g*(i&&l?-1:1);break}return u}const re=(e,t,i)=>A(exports,null,function*(){const{placement:n="bottom",strategy:o="absolute",middleware:s=[],platform:r}=i,c=s.filter(Boolean),a=yield r.isRTL==null?void 0:r.isRTL(t);let l=yield r.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:h}=kt(l,n,a),g=n,u={},d=0;for(let p=0;p<c.length;p++){const{name:m,fn:y}=c[p],{x:_,y:b,data:C,reset:v}=yield y({x:f,y:h,initialPlacement:n,placement:g,strategy:o,middlewareData:u,rects:l,platform:r,elements:{reference:e,floating:t}});f=_!=null?_:f,h=b!=null?b:h,u=Z($({},u),{[m]:$($({},u[m]),C)}),v&&d<=50&&(d++,typeof v=="object"&&(v.placement&&(g=v.placement),v.rects&&(l=v.rects===!0?yield r.getElementRects({reference:e,floating:t,strategy:o}):v.rects),{x:f,y:h}=kt(l,g,a)),p=-1)}return{x:f,y:h,placement:g,strategy:o,middlewareData:u}});function ce(e,t){return A(this,null,function*(){var i;t===void 0&&(t={});const{x:n,y:o,platform:s,rects:r,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:u=0}=lt(t,e),d=Ht(u),m=c[g?h==="floating"?"reference":"floating":h],y=ct(yield s.getClippingRect({element:(i=yield s.isElement==null?void 0:s.isElement(m))==null||i?m:m.contextElement||(yield s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:f,strategy:a})),_=h==="floating"?{x:n,y:o,width:r.floating.width,height:r.floating.height}:r.reference,b=yield s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating),C=(yield s.isElement==null?void 0:s.isElement(b))?(yield s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},v=ct(s.convertOffsetParentRelativeRectToViewportRelativeRect?yield s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:_,offsetParent:b,strategy:a}):_);return{top:(y.top-v.top+d.top)/C.y,bottom:(v.bottom-y.bottom+d.bottom)/C.y,left:(y.left-v.left+d.left)/C.x,right:(v.right-y.right+d.right)/C.x}})}const le=e=>({name:"arrow",options:e,fn(i){return A(this,null,function*(){const{x:n,y:o,placement:s,rects:r,platform:c,elements:a,middlewareData:l}=i,{element:f,padding:h=0}=lt(e,i)||{};if(f==null)return{};const g=Ht(h),u={x:n,y:o},d=wt(s),p=yt(d),m=yield c.getDimensions(f),y=d==="y",_=y?"top":"left",b=y?"bottom":"right",C=y?"clientHeight":"clientWidth",v=r.reference[p]+r.reference[d]-u[d]-r.floating[p],w=u[d]-r.reference[d],P=yield c.getOffsetParent==null?void 0:c.getOffsetParent(f);let T=P?P[C]:0;(!T||!(yield c.isElement==null?void 0:c.isElement(P)))&&(T=a.floating[C]||r.floating[p]);const W=v/2-w/2,M=T/2-m[p]/2-1,I=tt(g[_],M),E=tt(g[b],M),O=I,Y=T-m[p]-E,k=T/2-m[p]/2+W,q=ee(O,k,Y),U=!l.arrow&&V(s)!=null&&k!==q&&r.reference[p]/2-(k<O?I:E)-m[p]/2<0,K=U?k<O?k-O:k-Y:0;return{[d]:u[d]+K,data:$({[d]:q,centerOffset:k-q-K},U&&{alignmentOffset:K}),reset:U}})}});function ae(e,t,i){return(e?[...i.filter(o=>V(o)===e),...i.filter(o=>V(o)!==e)]:i.filter(o=>it(o)===o)).filter(o=>e?V(o)===e||(t?oe(o)!==o:!1):!0)}const he=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,fn(i){return A(this,null,function*(){var n,o,s;const{rects:r,middlewareData:c,placement:a,platform:l,elements:f}=i,I=lt(e,i),{crossAxis:h=!1,alignment:g,allowedPlacements:u=Ot,autoAlignment:d=!0}=I,p=Tt(I,["crossAxis","alignment","allowedPlacements","autoAlignment"]),m=g!==void 0||u===Ot?ae(g||null,d,u):u,y=yield ce(i,p),_=((n=c.autoPlacement)==null?void 0:n.index)||0,b=m[_];if(b==null)return{};const C=ne(b,r,yield l.isRTL==null?void 0:l.isRTL(f.floating));if(a!==b)return{reset:{placement:m[0]}};const v=[y[it(b)],y[C[0]],y[C[1]]],w=[...((o=c.autoPlacement)==null?void 0:o.overflows)||[],{placement:b,overflows:v}],P=m[_+1];if(P)return{data:{index:_+1,overflows:w},reset:{placement:P}};const T=w.map(E=>{const O=V(E.placement);return[E.placement,O&&h?E.overflows.slice(0,2).reduce((Y,k)=>Y+k,0):E.overflows[0],E.overflows]}).sort((E,O)=>E[1]-O[1]),M=((s=T.filter(E=>E[2].slice(0,V(E[0])?2:3).every(O=>O<=0))[0])==null?void 0:s[0])||T[0][0];return M!==a?{data:{index:_+1,overflows:w},reset:{placement:M}}:{}})}}};function fe(e,t){return A(this,null,function*(){const{placement:i,platform:n,elements:o}=e,s=yield n.isRTL==null?void 0:n.isRTL(o.floating),r=it(i),c=V(i),a=xt(i)==="y",l=["left","top"].includes(r)?-1:1,f=s&&a?-1:1,h=lt(t,e);let{mainAxis:g,crossAxis:u,alignmentAxis:d}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof d=="number"&&(u=c==="end"?d*-1:d),a?{x:u*f,y:g*l}:{x:g*l,y:u*f}})}const ue=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(i){return A(this,null,function*(){var n,o;const{x:s,y:r,placement:c,middlewareData:a}=i,l=yield fe(i,e);return c===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:r+l.y,data:Z($({},l),{placement:c})}})}}};function at(){return typeof window!="undefined"}function Q(e){return Nt(e)?(e.nodeName||"").toLowerCase():"#document"}function R(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function z(e){var t;return(t=(Nt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Nt(e){return at()?e instanceof Node||e instanceof R(e).Node:!1}function D(e){return at()?e instanceof Element||e instanceof R(e).Element:!1}function F(e){return at()?e instanceof HTMLElement||e instanceof R(e).HTMLElement:!1}function $t(e){return!at()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof R(e).ShadowRoot}function nt(e){const{overflow:t,overflowX:i,overflowY:n,display:o}=B(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+i)&&!["inline","contents"].includes(o)}function de(e){return["table","td","th"].includes(Q(e))}function ht(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(i){return!1}})}function bt(e){const t=vt(),i=D(e)?B(e):e;return i.transform!=="none"||i.perspective!=="none"||(i.containerType?i.containerType!=="normal":!1)||!t&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!t&&(i.filter?i.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(i.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(i.contain||"").includes(n))}function ge(e){let t=j(e);for(;F(t)&&!J(t);){if(bt(t))return t;if(ht(t))return null;t=j(t)}return null}function vt(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function J(e){return["html","body","#document"].includes(Q(e))}function B(e){return R(e).getComputedStyle(e)}function ft(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function j(e){if(Q(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$t(e)&&e.host||z(e);return $t(t)?t.host:t}function Ft(e){const t=j(e);return J(t)?e.ownerDocument?e.ownerDocument.body:e.body:F(t)&&nt(t)?t:Ft(t)}function pt(e,t,i){var n;t===void 0&&(t=[]),i===void 0&&(i=!0);const o=Ft(e),s=o===((n=e.ownerDocument)==null?void 0:n.body),r=R(o);if(s){const c=mt(r);return t.concat(r,r.visualViewport||[],nt(o)?o:[],c&&i?pt(c):[])}return t.concat(o,pt(o,[],i))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Mt(e){const t=B(e);let i=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=F(e),s=o?e.offsetWidth:i,r=o?e.offsetHeight:n,c=rt(i)!==s||rt(n)!==r;return c&&(i=s,n=r),{width:i,height:n,$:c}}function Vt(e){return D(e)?e:e.contextElement}function G(e){const t=Vt(e);if(!F(t))return N(1);const i=t.getBoundingClientRect(),{width:n,height:o,$:s}=Mt(t);let r=(s?rt(i.width):i.width)/n,c=(s?rt(i.height):i.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const pe=N(0);function zt(e){const t=R(e);return!vt()||!t.visualViewport?pe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function me(e,t,i){return t===void 0&&(t=!1),!i||t&&i!==R(e)?!1:t}function et(e,t,i,n){t===void 0&&(t=!1),i===void 0&&(i=!1);const o=e.getBoundingClientRect(),s=Vt(e);let r=N(1);t&&(n?D(n)&&(r=G(n)):r=G(e));const c=me(s,i,n)?zt(s):N(0);let a=(o.left+c.x)/r.x,l=(o.top+c.y)/r.y,f=o.width/r.x,h=o.height/r.y;if(s){const g=R(s),u=n&&D(n)?R(n):n;let d=g,p=mt(d);for(;p&&n&&u!==d;){const m=G(p),y=p.getBoundingClientRect(),_=B(p),b=y.left+(p.clientLeft+parseFloat(_.paddingLeft))*m.x,C=y.top+(p.clientTop+parseFloat(_.paddingTop))*m.y;a*=m.x,l*=m.y,f*=m.x,h*=m.y,a+=b,l+=C,d=R(p),p=mt(d)}}return ct({width:f,height:h,x:a,y:l})}function _t(e,t){const i=ft(e).scrollLeft;return t?t.left+i:et(z(e)).left+i}function Wt(e,t,i){i===void 0&&(i=!1);const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-(i?0:_t(e,n)),s=n.top+t.scrollTop;return{x:o,y:s}}function ye(e){let{elements:t,rect:i,offsetParent:n,strategy:o}=e;const s=o==="fixed",r=z(n),c=t?ht(t.floating):!1;if(n===r||c&&s)return i;let a={scrollLeft:0,scrollTop:0},l=N(1);const f=N(0),h=F(n);if((h||!h&&!s)&&((Q(n)!=="body"||nt(r))&&(a=ft(n)),F(n))){const u=et(n);l=G(n),f.x=u.x+n.clientLeft,f.y=u.y+n.clientTop}const g=r&&!h&&!s?Wt(r,a,!0):N(0);return{width:i.width*l.x,height:i.height*l.y,x:i.x*l.x-a.scrollLeft*l.x+f.x+g.x,y:i.y*l.y-a.scrollTop*l.y+f.y+g.y}}function xe(e){return Array.from(e.getClientRects())}function we(e){const t=z(e),i=ft(e),n=e.ownerDocument.body,o=X(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=X(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-i.scrollLeft+_t(e);const c=-i.scrollTop;return B(n).direction==="rtl"&&(r+=X(t.clientWidth,n.clientWidth)-o),{width:o,height:s,x:r,y:c}}function be(e,t){const i=R(e),n=z(e),o=i.visualViewport;let s=n.clientWidth,r=n.clientHeight,c=0,a=0;if(o){s=o.width,r=o.height;const l=vt();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}return{width:s,height:r,x:c,y:a}}function ve(e,t){const i=et(e,!0,t==="fixed"),n=i.top+e.clientTop,o=i.left+e.clientLeft,s=F(e)?G(e):N(1),r=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=n*s.y;return{width:r,height:c,x:a,y:l}}function At(e,t,i){let n;if(t==="viewport")n=be(e,i);else if(t==="document")n=we(z(e));else if(D(t))n=ve(t,i);else{const o=zt(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ct(n)}function It(e,t){const i=j(e);return i===t||!D(i)||J(i)?!1:B(i).position==="fixed"||It(i,t)}function _e(e,t){const i=t.get(e);if(i)return i;let n=pt(e,[],!1).filter(c=>D(c)&&Q(c)!=="body"),o=null;const s=B(e).position==="fixed";let r=s?j(e):e;for(;D(r)&&!J(r);){const c=B(r),a=bt(r);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||nt(r)&&!a&&It(e,r))?n=n.filter(f=>f!==r):o=c,r=j(r)}return t.set(e,n),n}function Se(e){let{element:t,boundary:i,rootBoundary:n,strategy:o}=e;const r=[...i==="clippingAncestors"?ht(t)?[]:_e(t,this._c):[].concat(i),n],c=r[0],a=r.reduce((l,f)=>{const h=At(t,f,o);return l.top=X(h.top,l.top),l.right=tt(h.right,l.right),l.bottom=tt(h.bottom,l.bottom),l.left=X(h.left,l.left),l},At(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ce(e){const{width:t,height:i}=Mt(e);return{width:t,height:i}}function Ee(e,t,i){const n=F(t),o=z(t),s=i==="fixed",r=et(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=N(0);if(n||!n&&!s)if((Q(t)!=="body"||nt(o))&&(c=ft(t)),n){const g=et(t,!0,s,t);a.x=g.x+t.clientLeft,a.y=g.y+t.clientTop}else o&&(a.x=_t(o));const l=o&&!n&&!s?Wt(o,c):N(0),f=r.left+c.scrollLeft-a.x-l.x,h=r.top+c.scrollTop-a.y-l.y;return{x:f,y:h,width:r.width,height:r.height}}function dt(e){return B(e).position==="static"}function Dt(e,t){if(!F(e)||B(e).position==="fixed")return null;if(t)return t(e);let i=e.offsetParent;return z(e)===i&&(i=i.ownerDocument.body),i}function jt(e,t){const i=R(e);if(ht(e))return i;if(!F(e)){let o=j(e);for(;o&&!J(o);){if(D(o)&&!dt(o))return o;o=j(o)}return i}let n=Dt(e,t);for(;n&&de(n)&&dt(n);)n=Dt(n,t);return n&&J(n)&&dt(n)&&!bt(n)?i:n||ge(e)||i}const Pe=function(e){return A(this,null,function*(){const t=this.getOffsetParent||jt,i=this.getDimensions,n=yield i(e.floating);return{reference:Ee(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}})};function Te(e){return B(e).direction==="rtl"}const Le={convertOffsetParentRelativeRectToViewportRelativeRect:ye,getDocumentElement:z,getClippingRect:Se,getOffsetParent:jt,getElementRects:Pe,getClientRects:xe,getDimensions:Ce,getScale:G,isElement:D,isRTL:Te},Oe=ue,Re=he,ke=le,$e=(e,t,i)=>{const n=new Map,o=$({platform:Le},i),s=Z($({},o.platform),{_c:n});return re(e,t,Z($({},o),{platform:s}))};function H(e){return e===null||typeof e=="undefined"}function S(e){return!H(e)}function Bt(e){return new Promise(t=>setTimeout(t,e))}function Yt(e){var n;const t=e.parentElement;return!t||t.nodeName==="HTML"?!1:((n=document.defaultView)==null?void 0:n.getComputedStyle(e,null).getPropertyValue("position"))==="fixed"?!0:Yt(t)}function St(e){return Yt(e)?"fixed":"absolute"}class Ae{renderContent(t,i,n){t.querySelector(`.${n.classPrefix}-content`).appendChild(i.node)}}function L(e,t){const i=document.createElement(e);return t&&t.length>0&&(t=t.filter(n=>n),i.classList.add(...t)),i}class De{renderContent(t,i,n){var s,r,c,a;const o=t.querySelector(`.${n.classPrefix}-content`);if(i.imgSrc){const l=L("img",[`${n.classPrefix}-image`,`${(r=(s=i.customization)==null?void 0:s.imageClass)!=null?r:""}`]);l.src=i.imgSrc,o.appendChild(l)}if(i.text){const l=L("p",[`${n.classPrefix}-description`,`${(a=(c=i.customization)==null?void 0:c.descriptionClass)!=null?a:""}`]);l.innerHTML=n.translateFn(i.text),o.appendChild(l)}}}function Be(e,t,i){var c,a,l,f,h,g,u,d,p,m,y,_,b,C,v;if(e.innerHTML="",e.className=`${(c=i.config.class)!=null?c:""} siteguide-pos ${i.config.classPrefix} ${i.config.animationClass}`,!i.config.arrow.disable&&((a=i.activeStep)!=null&&a.hasHost)){const w=L("div",[(l=i.config.arrow.class)!=null?l:"",`${i.config.classPrefix}-arrow`]);e.appendChild(w)}(f=t.customization)!=null&&f.class&&e.classList.add(t.customization.class);const n=L("div",[`${i.config.classPrefix}-header`,`${(g=(h=t.customization)==null?void 0:h.headerClass)!=null?g:""}`]);e.appendChild(n);const o=L("h1",[`${i.config.classPrefix}-title`,`${(d=(u=t.customization)==null?void 0:u.titleClass)!=null?d:""}`]);o.innerHTML=i.config.translateFn((p=t.title)!=null?p:""),n.appendChild(o),i.config.close.button&&(i.config.closeIcon.onclick=i.complete.bind(i),n.appendChild(i.config.closeIcon));const s=L("div",[`${i.config.classPrefix}-content`,`${(y=(m=t.customization)==null?void 0:m.contentClass)!=null?y:""}`]);e.appendChild(s);const r=L("div",[`${i.config.classPrefix}-footer`,`${(b=(_=t.customization)==null?void 0:_.footerClass)!=null?b:""}`]);if(H(t.buttonList)&&(t.buttonList=He(i)),t.buttonList.forEach(w=>{var W;const P=[`${i.config.classPrefix}-button`,(W=w.class)!=null?W:""];H(w.type)||w.type==="secondary"?P.push(`${i.config.classPrefix}-button-secondary`):w.type==="primary"?P.push(`${i.config.classPrefix}-button-primary`):w.type==="link"&&P.push(`${i.config.classPrefix}-button-link`),!H(w.class)&&w.class!==""&&P.push(w.class);const T=L("button",P);T.innerHTML=i.config.translateFn(w.text),T.onclick=M=>{w.action.call(i)},r.appendChild(T)}),!i.config.progress.disable&&i.config.progress.text&&S(i.activeStepIndex)){const w=L("p",[`${i.config.classPrefix}-progress`,`${(v=(C=t.customization)==null?void 0:C.progressClass)!=null?v:""}`]);w.innerHTML=i.config.translateFn(Ne(i.config.progress.text,i.activeStepIndex+1,i.stepList.length)),r.appendChild(w)}e.appendChild(r)}function He(e){return[{text:e.config.buttons.prevText,action:e.prev},{text:e.config.buttons.nextText,type:"primary",action:e.next}]}function Ne(e,t,i){return e.replace("{{currentStep}}",t.toString()).replace("{{totalSteps}}",i.toString())}class Fe{constructor(){x(this,"_renderContentStrategy",new Map);x(this,"_staticSides",{top:"bottom",right:"left",bottom:"top",left:"right"});this.setUpStrategies()}render(t,i){return new Promise(n=>{var o,s;if(!this._renderContentStrategy.has(i.popupData.type))throw new Error("Missing popup creator strategy");t.style.display="none",t.classList.remove(i.tour.config.animationClass),i.hostElement?t.style.position=St(i.hostElement):t.style.position="fixed",Be(t,i.popupData,i.tour),(o=this._renderContentStrategy.get(i.popupData.type))==null||o.renderContent(t,i.popupData,i.tour.config),(s=i.hostElement)==null||s.scrollIntoView(i.tour.config.scrollTo),n()}).then(()=>i.isFirst&&i.direction==="toNext"?Bt(0):Bt(400)).then(()=>{t.style.display="flex",this.updatePosition(t,i),t.classList.add(i.tour.config.animationClass)})}updatePosition(t,i){S(i.hostElement)?this.renderFloatingPopup(t,i):this.renderCenterPopup(t)}renderFloatingPopup(t,i){var l;const n=t.style.position==="fixed"?window.scrollY||document.documentElement.scrollTop:0,o=t.querySelector(`.${i.tour.config.classPrefix}-arrow`),s=[],r=S(i.popupData.position)&&i.popupData.position!=="auto"?i.popupData.position:void 0,c=(l=o==null?void 0:o.offsetWidth)!=null?l:10,a=Math.sqrt(2*Pt(c,2))/2+i.tour.config.highlight.padding;s.push(Oe(a)),(i.popupData.position==="auto"||H(r))&&s.push(Re()),!i.tour.config.arrow.disable&&S(o)&&s.push(ke({element:o})),$e(i.hostElement,t,{placement:r,middleware:[...s]}).then(({x:f,y:h,middlewareData:g,placement:u})=>{Object.assign(t.style,{top:`${h-n}px`,left:`${f}px`,marginTop:"0",marginLeft:"0"});const d=u.split("-")[0],p=this._staticSides[d];if(g.arrow&&S(o)){const{x:m,y}=g.arrow;Object.assign(o.style,{left:m!=null?`${m}px`:"",top:y!=null?`${y}px`:"",right:"",bottom:"",[p]:`${-c/2}px`,transform:"rotate(45deg)"})}})}renderCenterPopup(t){Object.assign(t.style,{top:"50%",left:"50%",marginTop:`-${t.clientHeight/2}px`,marginLeft:`-${t.clientWidth/2}px`})}setUpStrategies(){this._renderContentStrategy.set("text",new De),this._renderContentStrategy.set("custom",new Ae)}}class Me{render(t,i){return new Promise(n=>{i.hostElement&&(t.style.position=St(i.hostElement)),n()}).then(()=>{this.updatePosition(t,i)})}updatePosition(t,i){var r,c;if(!i.hostElement){t.style.width="0",t.style.height="0",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.opacity="0";return}const n=i.hostElement.getBoundingClientRect(),o=(c=(r=i.tour.config.highlight)==null?void 0:r.padding)!=null?c:8,s=t.style.position==="fixed"?0:window.scrollY||document.documentElement.scrollTop;t.style.transform="",t.style.left=`${n.left-o}px`,t.style.top=`${n.top+s-o}px`,t.style.width=`${n.width+2*o}px`,t.style.height=`${n.height+2*o}px`,t.style.opacity="1"}}class Ve{render(t,i){return new Promise(n=>{i.hostElement&&(t.style.position=St(i.hostElement)),n()}).then(()=>{this.updatePosition(t,i)})}updatePosition(t,i){var r,c;if(!i.hostElement){t.style.width="0",t.style.height="0",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)";return}const n=i.hostElement.getBoundingClientRect(),o=(c=(r=i.tour.config.highlight)==null?void 0:r.padding)!=null?c:8,s=t.style.position==="fixed"?0:window.scrollY||document.documentElement.scrollTop;t.style.transform="",t.style.left=`${n.left-o}px`,t.style.top=`${n.top+s-o}px`,t.style.width=`${n.width+2*o}px`,t.style.height=`${n.height+2*o}px`}}class qt{constructor(t,i){x(this,"popupData");x(this,"tour");x(this,"_index");x(this,"_hostElement",null);x(this,"_direction","toNext");x(this,"_hostData");x(this,"_resizeObserver",null);var n;this.popupData=i.popup,this.tour=t,this._index=(n=i.index)!=null?n:null,this._hostData=i.host}get isFirst(){return this.tour.stepList.indexOf(this)===0}get direction(){return this._direction}get hasHost(){return S(this._hostElement)}get hostElement(){return this._hostElement}get index(){return this._index}set index(t){this._index=t}show(t){return A(this,null,function*(){var n;if(H(this.tour.popup))return;this._direction=t,this._hostData&&(this._hostElement=this.resolveHostElement(typeof this._hostData=="function"?this._hostData():(n=this._hostData)!=null?n:null)),this._resizeObserver=this.listenHostResize();const i=[];S(this.tour.background)&&i.push(this.tour.backgroundRenderer.render(this.tour.background,this)),!this.tour.config.highlight.disable&&!H(this.tour.highlight)&&i.push(this.tour.highlightRenderer.render(this.tour.highlight,this)),this.tour.config.highlight.disable&&S(this.tour.highlight)&&this.tour.highlightRenderer.render(this.tour.highlight,{}),this.tour.config.interaction.disable&&S(this.tour.interaction)?i.push(this.tour.interactionRenderer.render(this.tour.interaction,this)):!this.tour.config.interaction.disable&&S(this.tour.interaction)&&i.push(this.tour.interactionRenderer.render(this.tour.interaction,{})),i.push(this.tour.popupRenderer.render(this.tour.popup,this)),yield Promise.all(i),this.toggleHostClass(!0)})}hide(){return A(this,null,function*(){var t;(t=this._resizeObserver)==null||t.disconnect(),this.toggleHostClass(!1)})}toggleHostClass(t){var i,n;H(this._hostElement)||(t?(this._hostElement.classList.add("siteguide-host"),(i=this._hostElement.parentElement)==null||i.classList.add("siteguide-host-parent")):(this._hostElement.classList.remove("siteguide-host"),(n=this._hostElement.parentElement)==null||n.classList.remove("siteguide-host-parent")))}resolveHostElement(t){return typeof this._hostData=="string"?document.querySelector(this._hostData):t}listenHostResize(){const t=new ResizeObserver(()=>{H(this.tour.activeStep)||(S(this.tour.popup)&&this.tour.popupRenderer.updatePosition(this.tour.popup,this.tour.activeStep),S(this.tour.highlight)&&!this.tour.config.highlight.disable&&this.tour.highlightRenderer.updatePosition(this.tour.highlight,this.tour.activeStep),S(this.tour.interaction)&&this.tour.config.interaction.disable&&this.tour.interactionRenderer.updatePosition(this.tour.interaction,this.tour.activeStep))});return S(this._hostElement)&&t.observe(this._hostElement),t}}function gt(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Ut(e,t){const i=$({},e);return gt(e)&>(t)&&Object.keys(t).forEach(n=>{const o=n,s=n;gt(t[o])?(s in e||Object.assign(i,{[s]:{}}),i[s]=Ut(e[s],t[o])):Object.assign(i,{[s]:t[o]})}),i}function ze(e){const t=L("button",[`${e}-close`]);return t.innerHTML="✖",t}class We{render(t,i){return i.tour.config.background.disable?t.style.pointerEvents="none":t.style.pointerEvents="auto",Promise.resolve()}updatePosition(t,i){}}class Ie{constructor(){x(this,"_activeTour",null)}get isActive(){return S(this.activeTour)}get activeTour(){return this._activeTour}setActiveTour(t){this._activeTour=t}}const st=new Ie;class je{constructor(t){x(this,"popupRenderer",new Fe);x(this,"highlightRenderer",new Me);x(this,"interactionRenderer",new Ve);x(this,"backgroundRenderer",new We);x(this,"_popup",null);x(this,"_highlight",null);x(this,"_interaction",null);x(this,"_background",null);x(this,"_stepList",[]);x(this,"_activeStep",null);x(this,"_bodyResizeObserver",null);x(this,"_config");x(this,"closeOnEsc",t=>{t.key==="Escape"&&this.complete()});x(this,"closeOnClick",()=>{this.complete()});x(this,"keyboardControl",t=>{t.key==="ArrowRight"?this.next():t.key==="ArrowLeft"&&this.prev()});var i,n,o,s,r,c,a,l,f,h,g,u,d,p,m,y,_,b,C,v,w,P,T,W,M,I,E,O,Y,k,q,U,K;this._config={classPrefix:(i=t.classPrefix)!=null?i:"siteguide",class:"",buttons:{nextText:(o=(n=t.buttons)==null?void 0:n.nextText)!=null?o:"Next",prevText:(r=(s=t.buttons)==null?void 0:s.prevText)!=null?r:"Back"},animationClass:(c=t.animationClass)!=null?c:"siteguide-animation",close:{button:(l=(a=t.close)==null?void 0:a.button)!=null?l:!0,clickout:(h=(f=t.close)==null?void 0:f.clickout)!=null?h:!1,esc:(u=(g=t.close)==null?void 0:g.esc)!=null?u:!0},scrollTo:(d=t.scrollTo)!=null?d:{behavior:"smooth",block:"center",inline:"center"},closeIcon:(m=t.closeIcon)!=null?m:ze((p=t.classPrefix)!=null?p:"siteguide"),arrow:{disable:(_=(y=t.arrow)==null?void 0:y.disable)!=null?_:!1,class:(C=(b=t.arrow)==null?void 0:b.class)!=null?C:""},highlight:{disable:(w=(v=t.highlight)==null?void 0:v.disable)!=null?w:!1,padding:(T=(P=t.highlight)==null?void 0:P.padding)!=null?T:8,class:(M=(W=t.highlight)==null?void 0:W.class)!=null?M:""},progress:{disable:(E=(I=t.progress)==null?void 0:I.disable)!=null?E:!0,text:"Step {{currentStep}} of {{totalSteps}}"},interaction:{disable:(Y=(O=t.interaction)==null?void 0:O.disable)!=null?Y:!0},background:{disable:(q=(k=t.background)==null?void 0:k.disable)!=null?q:!0},keyboardControl:(U=t.keyboardControl)!=null?U:!1,translateFn:(K=t.translateFn)!=null?K:Kt=>Kt}}get stepList(){return this._stepList}get config(){return this._config}get popup(){return this._popup}get highlight(){return this._highlight}get interaction(){return this._interaction}get background(){return this._background}get activeStep(){return this._activeStep}get activeStepIndex(){return this._activeStep?this.stepList.indexOf(this._activeStep):null}addStep(t){if(H(t.index)){const n=this._stepList.reduce((o,s)=>s.index!==null&&s.index!==void 0&&s.index>o?s.index:o,-1);t.index=n+1}const i=new qt(this,t);this._stepList.push(i),this._stepList.sort((n,o)=>n.index-o.index)}addSteps(t){t.forEach(i=>this.addStep(i))}removeStep(t){this._stepList=this._stepList.filter(i=>t!==i.index)}start(){st.isActive||(st.setActiveTour(this),this._bodyResizeObserver=this.getBodyResizeObserver(),this.config.close.esc&&document.addEventListener("keydown",this.closeOnEsc),this.config.keyboardControl&&document.addEventListener("keydown",this.keyboardControl),this._background=L("div",["siteguide-background"]),document.body.appendChild(this._background),this.config.close.clickout&&this._background.addEventListener("click",this.closeOnClick),this._config.highlight.disable||(this._highlight=L("div",[this._config.highlight.class,"siteguide-highlight-pos",`${this._config.classPrefix}-highlight`]),document.body.appendChild(this._highlight)),this._config.interaction.disable&&(this._interaction=L("div",["siteguide-interaction"]),document.body.appendChild(this._interaction)),this._popup=L("div",["siteguide-pos",this._config.classPrefix]),document.body.appendChild(this._popup),this.next())}complete(){var t,i;this._popup&&document.body.removeChild(this._popup),this._highlight&&document.body.removeChild(this._highlight),this._interaction&&document.body.removeChild(this._interaction),this._background&&document.body.removeChild(this._background),(t=this._bodyResizeObserver)==null||t.disconnect(),(i=this._activeStep)==null||i.hide(),this._activeStep=null,st.setActiveTour(null),this.config.close.esc&&document.removeEventListener("keydown",this.closeOnEsc),this.config.keyboardControl&&document.removeEventListener("keydown",this.keyboardControl)}prev(){const t=S(this._activeStep)?this._stepList.indexOf(this._activeStep)-1:this._stepList.indexOf(this._stepList[this._stepList.length-1]);if(t<0){this.complete();return}this.changeStepTo(t,"fromBack")}next(){return A(this,null,function*(){var i,n,o;const t=S(this._activeStep)?this._stepList.indexOf(this._activeStep)+1:this._stepList.indexOf(this._stepList[0]);if(t>=this._stepList.length){this.complete();return}S((i=this._activeStep)==null?void 0:i.popupData.allowNext)&&!((o=yield(n=this._activeStep)==null?void 0:n.popupData.allowNext.call(this))==null||o)||this.changeStepTo(t,"toNext")})}goTo(t){var i;if(t>this._stepList.length-1){console.error("Provided index was larger than steps amount");return}this.changeStepTo(t,t>((i=this.activeStepIndex)!=null?i:-1)?"toNext":"fromBack")}setConfig(t){this._config=Ut(this._config,t)}changeStepTo(t,i){var n;(n=this._activeStep)==null||n.hide(),this._activeStep=this._stepList[t],this._activeStep.show(i)}getBodyResizeObserver(){const t=new ResizeObserver(()=>{this._activeStep&&(S(this._popup)&&this.popupRenderer.updatePosition(this._popup,this._activeStep),S(this._highlight)&&!this.config.highlight.disable&&this.highlightRenderer.updatePosition(this._highlight,this._activeStep),S(this._interaction)&&this.config.interaction.disable&&this.interactionRenderer.updatePosition(this._interaction,this._activeStep))});return t.observe(document.body),t}}const Ye=st;exports.Siteguide=Ye;exports.Tour=je;exports.TourStep=qt;exports.createElement=L;
|