vue-shepherd
Version:
A Vue wrapper for the site tour library Shepherd.
28 lines (27 loc) • 43.4 kB
JavaScript
'use strict';Object.defineProperty(exports,'__esModule',{value:true});/*! shepherd.js 15.0.0 */
function t(t){return t instanceof HTMLElement}function e(t){return "function"==typeof t}function n(t){return "string"==typeof t}function o(t){return void 0===t}class i{on(t,e,n,i=false){var s;return o(this.bindings)&&(this.bindings={}),o(this.bindings[t])&&(this.bindings[t]=[]),null==(s=this.bindings[t])||s.push({handler:e,ctx:n,once:i}),this}once(t,e,n){return this.on(t,e,n,true)}off(t,e){if(o(this.bindings)||o(this.bindings[t]))return this;var n;o(e)?delete this.bindings[t]:null==(n=this.bindings[t])||n.forEach((n,o)=>{var i;n.handler===e&&(null==(i=this.bindings[t])||i.splice(o,1));});return this}trigger(t,...e){var n;!o(this.bindings)&&this.bindings[t]&&(null==(n=this.bindings[t])||n.forEach((n,o)=>{const{ctx:i,handler:s,once:r}=n,l=i||this;var c;(s.apply(l,e),r)&&(null==(c=this.bindings[t])||c.splice(o,1));}));return this}}function s(){return s=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)({}).hasOwnProperty.call(n,o)&&(t[o]=n[o]);}return t},s.apply(null,arguments)}function r(t,e){if(null==t)return {};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(-1!==e.indexOf(o))continue;n[o]=t[o];}return n}const l={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};function c(t,e){return e}function a(t,e){return t.filter(t=>void 0!==t)}var u;function h(t){return "object"!=typeof t||null===t?0:Array.isArray(t)?2:function(t){if(!p.includes(Object.prototype.toString.call(t)))return false;const{constructor:e}=t;if(void 0===e)return true;const n=e.prototype;if(null===n||"object"!=typeof n||!p.includes(Object.prototype.toString.call(n)))return false;if(!n.hasOwnProperty("isPrototypeOf"))return false;return true}(t)?1:t instanceof Set?3:t instanceof Map?4:5}function d(t,e){return "object"==typeof t&&Object.prototype.propertyIsEnumerable.call(t,e)}function f(t){var e;let n=0,o=null==(e=t[0])?void 0:e[Symbol.iterator]();return {[Symbol.iterator]:()=>({next(){for(;;){if(void 0===o)return {done:true,value:void 0};const i=o.next();if(true!==i.done)return {done:false,value:i.value};var e;n+=1,o=null==(e=t[n])?void 0:e[Symbol.iterator]();}}})}}!function(t){t[t.NOT=0]="NOT",t[t.RECORD=1]="RECORD",t[t.ARRAY=2]="ARRAY",t[t.SET=3]="SET",t[t.MAP=4]="MAP",t[t.OTHER=5]="OTHER";}(u||(u={}));const p=["[object Object]","[object Module]"];const g={mergeRecords:function(t,e,n){const o={};for(const i of function(t){const e=new Set;for(const n of t)for(const t of [...Object.keys(n),...Object.getOwnPropertySymbols(n)])e.add(t);return e}(t)){const s=[];for(const e of t)d(e,i)&&s.push(e[i]);if(0===s.length)continue;const r=e.metaDataUpdater(n,{key:i,parents:t}),c=v(s,e,r);c!==l.skip&&("__proto__"===i?Object.defineProperty(o,i,{value:c,configurable:true,enumerable:true,writable:true}):o[i]=c);}return o},mergeArrays:function(t){return t.flat()},mergeSets:function(t){return new Set(f(t))},mergeMaps:function(t){return new Map(f(t))},mergeOthers:function(t){return t.at(-1)}};function m(...t){return function(t,e){const n=function(t,e){var n,o,i;return {defaultMergeFunctions:g,mergeFunctions:s({},g,Object.fromEntries(Object.entries(t).filter(([t,e])=>Object.hasOwn(g,t)).map(([t,e])=>false===e?[t,g.mergeOthers]:[t,e]))),metaDataUpdater:null!=(n=t.metaDataUpdater)?n:c,deepmerge:e,useImplicitDefaultMerging:null!=(o=t.enableImplicitDefaultMerging)&&o,filterValues:false===t.filterValues?void 0:null!=(i=t.filterValues)?i:a,actions:l}}(t,o);function o(...t){return v(t,n,e)}return o}({})(...t)}function v(t,e,n){var o;const i=null!=(o=null==e.filterValues?void 0:e.filterValues(t,n))?o:t;if(0===i.length)return;if(1===i.length)return y(i,e,n);const s=h(i[0]);if(0!==s&&5!==s)for(let t=1;t<i.length;t++)if(h(i[t])!==s)return y(i,e,n);switch(s){case 1:return function(t,e,n){const o=e.mergeFunctions.mergeRecords(t,e,n);if(o===l.defaultMerge||e.useImplicitDefaultMerging&&void 0===o&&e.mergeFunctions.mergeRecords!==e.defaultMergeFunctions.mergeRecords)return e.defaultMergeFunctions.mergeRecords(t,e,n);return o}(i,e,n);case 2:return function(t,e,n){const o=e.mergeFunctions.mergeArrays(t,e,n);if(o===l.defaultMerge||e.useImplicitDefaultMerging&&void 0===o&&e.mergeFunctions.mergeArrays!==e.defaultMergeFunctions.mergeArrays)return e.defaultMergeFunctions.mergeArrays(t);return o}(i,e,n);case 3:return function(t,e,n){const o=e.mergeFunctions.mergeSets(t,e,n);if(o===l.defaultMerge||e.useImplicitDefaultMerging&&void 0===o&&e.mergeFunctions.mergeSets!==e.defaultMergeFunctions.mergeSets)return e.defaultMergeFunctions.mergeSets(t);return o}(i,e,n);case 4:return function(t,e,n){const o=e.mergeFunctions.mergeMaps(t,e,n);if(o===l.defaultMerge||e.useImplicitDefaultMerging&&void 0===o&&e.mergeFunctions.mergeMaps!==e.defaultMergeFunctions.mergeMaps)return e.defaultMergeFunctions.mergeMaps(t);return o}(i,e,n);default:return y(i,e,n)}}function y(t,e,n){const o=e.mergeFunctions.mergeOthers(t,e,n);return o===l.defaultMerge||e.useImplicitDefaultMerging&&void 0===o&&e.mergeFunctions.mergeOthers!==e.defaultMergeFunctions.mergeOthers?e.defaultMergeFunctions.mergeOthers(t):o}function x(t){const e=Object.getOwnPropertyNames(t.constructor.prototype);for(let n=0;n<e.length;n++){const o=e[n],i=t[o];"constructor"!==o&&"function"==typeof i&&(t[o]=i.bind(t));}return t}function b(t){const{event:e,selector:n}=t.options.advanceOn||{};if(e){const i=function(t,e){return n=>{if(t.isOpen()){const i=t.el&&n.currentTarget===t.el;(!o(e)&&n.currentTarget.matches(e)||i)&&t.tour.next();}}}(t,n);let s=null;if(!o(n)&&(s=document.querySelector(n),!s))return;s?(s.addEventListener(e,i),t.on("destroy",()=>s.removeEventListener(e,i))):(document.body.addEventListener(e,i,true),t.on("destroy",()=>document.body.removeEventListener(e,i,true)));}}function w(t){return n(t)&&""!==t?"-"!==t.charAt(t.length-1)?`${t}-`:t:""}function E(t){return null==t||(!t.element||!t.on)}function O(){let t=Date.now();return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?n:3&n|8).toString(16)})}const T=["start","end"],S=["top","right","bottom","left"].reduce((t,e)=>t.concat(e,e+"-"+T[0],e+"-"+T[1]),[]),A=Math.min,L=Math.max,_=Math.round,R=Math.floor,M=t=>({x:t,y:t}),P={left:"right",right:"left",bottom:"top",top:"bottom"},C={start:"end",end:"start"};function k(t,e,n){return L(t,A(e,n))}function D(t,e){return "function"==typeof t?t(e):t}function $(t){return t.split("-")[0]}function F(t){return t.split("-")[1]}function I(t){return "x"===t?"y":"x"}function H(t){return "y"===t?"height":"width"}const j=new Set(["top","bottom"]);function B(t){return j.has($(t))?"y":"x"}function V(t){return I(B(t))}function N(t,e,n){ void 0===n&&(n=false);const o=F(t),i=V(t),s=H(i);let r="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=Z(r)),[r,Z(r)]}function W(t){return t.replace(/start|end/g,t=>C[t])}const q=["left","right"],U=["right","left"],z=["top","bottom"],Y=["bottom","top"];function X(t,e,n,o){const i=F(t);let s=function(t,e,n){switch(t){case "top":case "bottom":return n?e?U:q:e?q:U;case "left":case "right":return e?z:Y;default:return []}}($(t),"start"===n,o);return i&&(s=s.map(t=>t+"-"+i),e&&(s=s.concat(s.map(W)))),s}function Z(t){return t.replace(/left|right|bottom|top/g,t=>P[t])}function K(t){return "number"!=typeof t?function(t){return s({top:0,right:0,bottom:0,left:0},t)}(t):{top:t,right:t,bottom:t,left:t}}function G(t){const{x:e,y:n,width:o,height:i}=t;return {width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}const J=["crossAxis","alignment","allowedPlacements","autoAlignment"],Q=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],tt=["mainAxis","crossAxis","limiter"];function et(t,e,n){let{reference:o,floating:i}=t;const s=B(e),r=V(e),l=H(r),c=$(e),a="y"===s,u=o.x+o.width/2-i.width/2,h=o.y+o.height/2-i.height/2,d=o[l]/2-i[l]/2;let f;switch(c){case "top":f={x:u,y:o.y-i.height};break;case "bottom":f={x:u,y:o.y+o.height};break;case "right":f={x:o.x+o.width,y:h};break;case "left":f={x:o.x-i.width,y:h};break;default:f={x:o.x,y:o.y};}switch(F(e)){case "start":f[r]-=d*(n&&a?-1:1);break;case "end":f[r]+=d*(n&&a?-1:1);}return f}async function nt(t,e){var n;void 0===e&&(e={});const{x:o,y:i,platform:s,rects:r,elements:l,strategy:c}=t,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=false,padding:f=0}=D(e,t),p=K(f),g=l[d?"floating"===h?"reference":"floating":h],m=G(await s.getClippingRect({element:null==(n=await(null==s.isElement?void 0:s.isElement(g)))||n?g:g.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(l.floating)),boundary:a,rootBoundary:u,strategy:c})),v="floating"===h?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,y=await(null==s.getOffsetParent?void 0:s.getOffsetParent(l.floating)),x=await(null==s.isElement?void 0:s.isElement(y))&&await(null==s.getScale?void 0:s.getScale(y))||{x:1,y:1},b=G(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:y,strategy:c}):v);return {top:(m.top-b.top+p.top)/x.y,bottom:(b.bottom-m.bottom+p.bottom)/x.y,left:(m.left-b.left+p.left)/x.x,right:(b.right-m.right+p.right)/x.x}}const ot=new Set(["left","top"]);function it(){return "undefined"!=typeof window}function st(t){return ct(t)?(t.nodeName||"").toLowerCase():"#document"}function rt(t){var e;return (null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function lt(t){var e;return null==(e=(ct(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function ct(t){return !!it()&&(t instanceof Node||t instanceof rt(t).Node)}function at(t){return !!it()&&(t instanceof Element||t instanceof rt(t).Element)}function ut(t){return !!it()&&(t instanceof HTMLElement||t instanceof rt(t).HTMLElement)}function ht(t){return !(!it()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof rt(t).ShadowRoot)}const dt=new Set(["inline","contents"]);function ft(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=St(t);return /auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!dt.has(i)}const pt=new Set(["table","td","th"]);function gt(t){return pt.has(st(t))}const mt=[":popover-open",":modal"];function vt(t){return mt.some(e=>{try{return t.matches(e)}catch(t){return false}})}const yt=["transform","translate","scale","rotate","perspective"],xt=["transform","translate","scale","rotate","perspective","filter"],bt=["paint","layout","strict","content"];function wt(t){const e=Et(),n=at(t)?St(t):t;return yt.some(t=>!!n[t]&&"none"!==n[t])||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||xt.some(t=>(n.willChange||"").includes(t))||bt.some(t=>(n.contain||"").includes(t))}function Et(){return !("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Ot=new Set(["html","body","#document"]);function Tt(t){return Ot.has(st(t))}function St(t){return rt(t).getComputedStyle(t)}function At(t){return at(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Lt(t){if("html"===st(t))return t;const e=t.assignedSlot||t.parentNode||ht(t)&&t.host||lt(t);return ht(e)?e.host:e}function _t(t){const e=Lt(t);return Tt(e)?t.ownerDocument?t.ownerDocument.body:t.body:ut(e)&&ft(e)?e:_t(e)}function Rt(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=true);const i=_t(t),s=i===(null==(o=t.ownerDocument)?void 0:o.body),r=rt(i);if(s){const t=Mt(r);return e.concat(r,r.visualViewport||[],ft(i)?i:[],t&&n?Rt(t):[])}return e.concat(i,Rt(i,[],n))}function Mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Pt(t){const e=St(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=ut(t),s=i?t.offsetWidth:n,r=i?t.offsetHeight:o,l=_(n)!==s||_(o)!==r;return l&&(n=s,o=r),{width:n,height:o,$:l}}function Ct(t){return at(t)?t:t.contextElement}function kt(t){const e=Ct(t);if(!ut(e))return M(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:s}=Pt(e);let r=(s?_(n.width):n.width)/o,l=(s?_(n.height):n.height)/i;return r&&Number.isFinite(r)||(r=1),l&&Number.isFinite(l)||(l=1),{x:r,y:l}}const Dt=M(0);function $t(t){const e=rt(t);return Et()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:Dt}function Ft(t,e,n,o){ void 0===e&&(e=false),void 0===n&&(n=false);const i=t.getBoundingClientRect(),s=Ct(t);let r=M(1);e&&(o?at(o)&&(r=kt(o)):r=kt(t));const l=function(t,e,n){return void 0===e&&(e=false),!(!n||e&&n!==rt(t))&&e}(s,n,o)?$t(s):M(0);let c=(i.left+l.x)/r.x,a=(i.top+l.y)/r.y,u=i.width/r.x,h=i.height/r.y;if(s){const t=rt(s),e=o&&at(o)?rt(o):o;let n=t,i=Mt(n);for(;i&&o&&e!==n;){const t=kt(i),e=i.getBoundingClientRect(),o=St(i),s=e.left+(i.clientLeft+parseFloat(o.paddingLeft))*t.x,r=e.top+(i.clientTop+parseFloat(o.paddingTop))*t.y;c*=t.x,a*=t.y,u*=t.x,h*=t.y,c+=s,a+=r,n=rt(i),i=Mt(n);}}return G({width:u,height:h,x:c,y:a})}function It(t,e){const n=At(t).scrollLeft;return e?e.left+n:Ft(lt(t)).left+n}function Ht(t,e){const n=t.getBoundingClientRect();return {x:n.left+e.scrollLeft-It(t,n),y:n.top+e.scrollTop}}const jt=new Set(["absolute","fixed"]);function Bt(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=rt(t),o=lt(t),i=n.visualViewport;let s=o.clientWidth,r=o.clientHeight,l=0,c=0;if(i){s=i.width,r=i.height;const t=Et();(!t||t&&"fixed"===e)&&(l=i.offsetLeft,c=i.offsetTop);}const a=It(o);if(a<=0){const t=o.ownerDocument,e=t.body,n=getComputedStyle(e),i="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,r=Math.abs(o.clientWidth-e.clientWidth-i);r<=25&&(s-=r);}else a<=25&&(s+=a);return {width:s,height:r,x:l,y:c}}(t,n);else if("document"===e)o=function(t){const e=lt(t),n=At(t),o=t.ownerDocument.body,i=L(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),s=L(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+It(t);const l=-n.scrollTop;return "rtl"===St(o).direction&&(r+=L(e.clientWidth,o.clientWidth)-i),{width:i,height:s,x:r,y:l}}(lt(t));else if(at(e))o=function(t,e){const n=Ft(t,true,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,s=ut(t)?kt(t):M(1);return {width:t.clientWidth*s.x,height:t.clientHeight*s.y,x:i*s.x,y:o*s.y}}(e,n);else {const n=$t(t);o={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height};}return G(o)}function Vt(t,e){const n=Lt(t);return !(n===e||!at(n)||Tt(n))&&("fixed"===St(n).position||Vt(n,e))}function Nt(t,e,n){const o=ut(e),i=lt(e),s="fixed"===n,r=Ft(t,true,s,e);let l={scrollLeft:0,scrollTop:0};const c=M(0);function a(){c.x=It(i);}if(o||!o&&!s)if(("body"!==st(e)||ft(i))&&(l=At(e)),o){const t=Ft(e,true,s,e);c.x=t.x+e.clientLeft,c.y=t.y+e.clientTop;}else i&&a();s&&!o&&i&&a();const u=!i||o||s?M(0):Ht(i,l);return {x:r.left+l.scrollLeft-c.x-u.x,y:r.top+l.scrollTop-c.y-u.y,width:r.width,height:r.height}}function Wt(t){return "static"===St(t).position}function qt(t,e){if(!ut(t)||"fixed"===St(t).position)return null;if(e)return e(t);let n=t.offsetParent;return lt(t)===n&&(n=n.ownerDocument.body),n}function Ut(t,e){const n=rt(t);if(vt(t))return n;if(!ut(t)){let e=Lt(t);for(;e&&!Tt(e);){if(at(e)&&!Wt(e))return e;e=Lt(e);}return n}let o=qt(t,e);for(;o&>(o)&&Wt(o);)o=qt(o,e);return o&&Tt(o)&&Wt(o)&&!wt(o)?n:o||function(t){let e=Lt(t);for(;ut(e)&&!Tt(e);){if(wt(e))return e;if(vt(e))return null;e=Lt(e);}return null}(t)||n}const zt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const s="fixed"===i,r=lt(o),l=!!e&&vt(e.floating);if(o===r||l&&s)return n;let c={scrollLeft:0,scrollTop:0},a=M(1);const u=M(0),h=ut(o);if((h||!h&&!s)&&(("body"!==st(o)||ft(r))&&(c=At(o)),ut(o))){const t=Ft(o);a=kt(o),u.x=t.x+o.clientLeft,u.y=t.y+o.clientTop;}const d=!r||h||s?M(0):Ht(r,c);return {width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+u.x+d.x,y:n.y*a.y-c.scrollTop*a.y+u.y+d.y}},getDocumentElement:lt,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const s=[..."clippingAncestors"===n?vt(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=Rt(t,[],false).filter(t=>at(t)&&"body"!==st(t)),i=null;const s="fixed"===St(t).position;let r=s?Lt(t):t;for(;at(r)&&!Tt(r);){const e=St(r),n=wt(r);n||"fixed"!==e.position||(i=null),(s?!n&&!i:!n&&"static"===e.position&&i&&jt.has(i.position)||ft(r)&&!n&&Vt(t,r))?o=o.filter(t=>t!==r):i=e,r=Lt(r);}return e.set(t,o),o}(e,this._c):[].concat(n),o],r=s[0],l=s.reduce((t,n)=>{const o=Bt(e,n,i);return t.top=L(o.top,t.top),t.right=A(o.right,t.right),t.bottom=A(o.bottom,t.bottom),t.left=L(o.left,t.left),t},Bt(e,r,i));return {width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Ut,getElementRects:async function(t){const e=this.getOffsetParent||Ut,n=this.getDimensions,o=await n(t.floating);return {reference:Nt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=Pt(t);return {width:e,height:n}},getScale:kt,isElement:at,isRTL:function(t){return "rtl"===St(t).direction}};function Yt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Xt(t,e,n,o){ void 0===o&&(o={});const{ancestorScroll:i=true,ancestorResize:r=true,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:a=false}=o,u=Ct(t),h=i||r?[...u?Rt(u):[],...Rt(e)]:[];h.forEach(t=>{i&&t.addEventListener("scroll",n,{passive:true}),r&&t.addEventListener("resize",n);});const d=u&&c?function(t,e){let n,o=null;const i=lt(t);function r(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null;}return function l(c,a){ void 0===c&&(c=false),void 0===a&&(a=1),r();const u=t.getBoundingClientRect(),{left:h,top:d,width:f,height:p}=u;if(c||e(),!f||!p)return;const g={rootMargin:-R(d)+"px "+-R(i.clientWidth-(h+f))+"px "+-R(i.clientHeight-(d+p))+"px "+-R(h)+"px",threshold:L(0,A(1,a))||1};let m=true;function v(e){const o=e[0].intersectionRatio;if(o!==a){if(!m)return l();o?l(false,o):n=setTimeout(()=>{l(false,1e-7);},1e3);}1!==o||Yt(u,t.getBoundingClientRect())||l(),m=false;}try{o=new IntersectionObserver(v,s({},g,{root:i.ownerDocument}));}catch(t){o=new IntersectionObserver(v,g);}o.observe(t);}(true),r}(u,n):null;let f,p=-1,g=null;l&&(g=new ResizeObserver(t=>{let[o]=t;o&&o.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var t;null==(t=g)||t.observe(e);})),n();}),u&&!a&&g.observe(u),g.observe(e));let m=a?Ft(t):null;return a&&function e(){const o=Ft(t);m&&!Yt(m,o)&&n();m=o,f=requestAnimationFrame(e);}(),n(),()=>{var t;h.forEach(t=>{i&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n);}),null==d||d(),null==(t=g)||t.disconnect(),g=null,a&&cancelAnimationFrame(f);}}const Zt=function(t){return void 0===t&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,o,i;const{rects:s,middlewareData:l,placement:c,platform:a,elements:u}=e,h=D(t,e),{crossAxis:d=false,alignment:f,allowedPlacements:p=S,autoAlignment:g=true}=h,m=r(h,J),v=void 0!==f||p===S?function(t,e,n){return (t?[...n.filter(e=>F(e)===t),...n.filter(e=>F(e)!==t)]:n.filter(t=>$(t)===t)).filter(n=>!t||F(n)===t||!!e&&W(n)!==n)}(f||null,g,p):p,y=await a.detectOverflow(e,m),x=(null==(n=l.autoPlacement)?void 0:n.index)||0,b=v[x];if(null==b)return {};const w=N(b,s,await(null==a.isRTL?void 0:a.isRTL(u.floating)));if(c!==b)return {reset:{placement:v[0]}};const E=[y[$(b)],y[w[0]],y[w[1]]],O=[...(null==(o=l.autoPlacement)?void 0:o.overflows)||[],{placement:b,overflows:E}],T=v[x+1];if(T)return {data:{index:x+1,overflows:O},reset:{placement:T}};const A=O.map(t=>{const e=F(t.placement);return [t.placement,e&&d?t.overflows.slice(0,2).reduce((t,e)=>t+e,0):t.overflows[0],t.overflows]}).sort((t,e)=>t[1]-e[1]),L=(null==(i=A.filter(t=>t[2].slice(0,F(t[0])?2:3).every(t=>t<=0))[0])?void 0:i[0])||A[0][0];return L!==c?{data:{index:x+1,overflows:O},reset:{placement:L}}:{}}}},Kt=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:l}=e,c=D(t,e),{mainAxis:a=true,crossAxis:u=false,limiter:h={fn:t=>{let{x:e,y:n}=t;return {x:e,y:n}}}}=c,d=r(c,tt),f={x:n,y:o},p=await l.detectOverflow(e,d),g=B($(i)),m=I(g);let v=f[m],y=f[g];if(a){const t="y"===m?"bottom":"right";v=k(v+p["y"===m?"top":"left"],v,v-p[t]);}if(u){const t="y"===g?"bottom":"right";y=k(y+p["y"===g?"top":"left"],y,y-p[t]);}const x=h.fn(s({},e,{[m]:v,[g]:y}));return s({},x,{data:{x:x.x-n,y:x.y-o,enabled:{[m]:a,[g]:u}}})}}},Gt=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:s,rects:l,initialPlacement:c,platform:a,elements:u}=e,h=D(t,e),{mainAxis:d=true,crossAxis:f=true,fallbackPlacements:p,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=true}=h,y=r(h,Q);if(null!=(n=s.arrow)&&n.alignmentOffset)return {};const x=$(i),b=B(c),w=$(c)===c,E=await(null==a.isRTL?void 0:a.isRTL(u.floating)),O=p||(w||!v?[Z(c)]:function(t){const e=Z(t);return [W(t),e,W(e)]}(c)),T="none"!==m;!p&&T&&O.push(...X(c,v,m,E));const S=[c,...O],A=await a.detectOverflow(e,y),L=[];let _=(null==(o=s.flip)?void 0:o.overflows)||[];if(d&&L.push(A[x]),f){const t=N(i,l,E);L.push(A[t[0]],A[t[1]]);}if(_=[..._,{placement:i,overflows:L}],!L.every(t=>t<=0)){var R,M;const t=((null==(R=s.flip)?void 0:R.index)||0)+1,e=S[t];if(e){if(!("alignment"===f&&b!==B(e))||_.every(t=>B(t.placement)!==b||t.overflows[0]>0))return {data:{index:t,overflows:_},reset:{placement:e}}}let n=null==(M=_.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:M.placement;if(!n)switch(g){case "bestFit":{var P;const t=null==(P=_.filter(t=>{if(T){const e=B(t.placement);return e===b||"y"===e}return true}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:P[0];t&&(n=t);break}case "initialPlacement":n=c;}if(i!==n)return {reset:{placement:n}}}return {}}}},Jt=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:r,platform:l,elements:c,middlewareData:a}=e,{element:u,padding:h=0}=D(t,e)||{};if(null==u)return {};const d=K(h),f={x:n,y:o},p=V(i),g=H(p),m=await l.getDimensions(u),v="y"===p,y=v?"top":"left",x=v?"bottom":"right",b=v?"clientHeight":"clientWidth",w=r.reference[g]+r.reference[p]-f[p]-r.floating[g],E=f[p]-r.reference[p],O=await(null==l.getOffsetParent?void 0:l.getOffsetParent(u));let T=O?O[b]:0;T&&await(null==l.isElement?void 0:l.isElement(O))||(T=c.floating[b]||r.floating[g]);const S=w/2-E/2,L=T/2-m[g]/2-1,_=A(d[y],L),R=A(d[x],L),M=_,P=T-m[g]-R,C=T/2-m[g]/2+S,$=k(M,C,P),I=!a.arrow&&null!=F(i)&&C!==$&&r.reference[g]/2-(C<M?_:R)-m[g]/2<0,j=I?C<M?C-M:C-P:0;return {[p]:f[p]+j,data:s({[p]:$,centerOffset:C-$-j},I&&{alignmentOffset:j}),reset:I}}}),Qt=function(t){return void 0===t&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:i,rects:r,middlewareData:l}=e,{offset:c=0,mainAxis:a=true,crossAxis:u=true}=D(t,e),h={x:n,y:o},d=B(i),f=I(d);let p=h[f],g=h[d];const m=D(c,e),v="number"==typeof m?{mainAxis:m,crossAxis:0}:s({mainAxis:0,crossAxis:0},m);if(a){const t="y"===f?"height":"width",e=r.reference[f]-r.floating[t]+v.mainAxis,n=r.reference[f]+r.reference[t]-v.mainAxis;p<e?p=e:p>n&&(p=n);}if(u){var y,x;const t="y"===f?"width":"height",e=ot.has($(i)),n=r.reference[d]-r.floating[t]+(e&&(null==(y=l.offset)?void 0:y[d])||0)+(e?0:v.crossAxis),o=r.reference[d]+r.reference[t]+(e?0:(null==(x=l.offset)?void 0:x[d])||0)-(e?v.crossAxis:0);g<n?g=n:g>o&&(g=o);}return {[f]:p,[d]:g}}}},te=(t,e,n)=>{const o=new Map,i=s({platform:zt},n),r=s({},i.platform,{_c:o});return (async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,c=r.filter(Boolean),a=await(null==l.isRTL?void 0:l.isRTL(e));let u=await l.getElementRects({reference:t,floating:e,strategy:i}),{x:h,y:d}=et(u,o,a),f=o,p={},g=0;for(let n=0;n<c.length;n++){var m;const{name:r,fn:v}=c[n],{x:y,y:x,data:b,reset:w}=await v({x:h,y:d,initialPlacement:o,placement:f,strategy:i,middlewareData:p,rects:u,platform:s({},l,{detectOverflow:null!=(m=l.detectOverflow)?m:nt}),elements:{reference:t,floating:e}});h=null!=y?y:h,d=null!=x?x:d,p=s({},p,{[r]:s({},p[r],b)}),w&&g<=50&&(g++,"object"==typeof w&&(w.placement&&(f=w.placement),w.rects&&(u=true===w.rects?await l.getElementRects({reference:t,floating:e,strategy:i}):w.rects),({x:h,y:d}=et(u,f,a))),n=-1);}return {x:h,y:d,placement:f,strategy:i,middlewareData:p}})(t,e,s({},i,{platform:r}))};function ee(e){e.cleanup&&e.cleanup();const n=e._getResolvedAttachToOptions();let o=n.element;const i=function(t,e){var n,o,i;const s={strategy:"absolute",middleware:[]},r=function(t){if(t.options.arrow&&t.el)return t.el.querySelector(".shepherd-arrow");return false}(e),l=E(t),c=null==(n=t.on)?void 0:n.includes("auto"),a=(null==t||null==(o=t.on)?void 0:o.includes("-start"))||(null==t||null==(i=t.on)?void 0:i.includes("-end"));if(!l){var u;if(c)s.middleware.push(Zt({crossAxis:true,alignment:a?null==t||null==(u=t.on)?void 0:u.split("-").pop():null}));else s.middleware.push(Gt());if(s.middleware.push(Kt({limiter:Qt(),crossAxis:true})),r){const t="object"==typeof e.options.arrow?e.options.arrow:{padding:4};s.middleware.push(Jt({element:r,padding:a?t.padding:0}));}c||(s.placement=t.on);}return m(s,e.options.floatingUIOptions||{})}(n,e),s=E(n);if(s){var r;o=document.body;const t=null==(r=e.shepherdElementComponent)?void 0:r.element;null==t||t.classList.add("shepherd-centered");}return e.cleanup=Xt(o,e.el,()=>{e.el?function(e,n,o,i){te(e,n.el,o).then(function(e,n){return ({x:o,y:i,placement:s,middlewareData:r})=>e.el?(n?Object.assign(e.el.style,{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)"}):Object.assign(e.el.style,{position:"absolute",left:`${o}px`,top:`${i}px`}),e.el.dataset.popperPlacement=s,function(e,n){const o=e.querySelector(".shepherd-arrow");if(t(o)&&n.arrow){const{x:t,y:e}=n.arrow;Object.assign(o.style,{left:null!=t?`${t}px`:"",top:null!=e?`${e}px`:""});}}(e.el,r),e):e}(n,i)).then(t=>new Promise(e=>{setTimeout(()=>e(t),300);})).then(t=>{null!=t&&t.el&&(t.el.tabIndex=0,t.el.focus({preventScroll:true}));});}(o,e,i,s):null==e.cleanup||e.cleanup();}),e.target=n.element,i}function ne(t,e,...n){const o=document.createElement(t);return ie(o,e),se(o,n),o}function oe(t,e,...n){const o=document.createElementNS("http://www.w3.org/2000/svg",t);return ie(o,e),se(o,n),o}function ie(t,e){if(e)for(const[n,o]of Object.entries(e))null!=o&&false!==o&&(n.startsWith("on")&&"function"==typeof o?t.addEventListener(n.slice(2).toLowerCase(),o):"disabled"===n&&true===o?t.disabled=true:t.setAttribute(n,String(o)));}function se(t,e){for(const n of e)null!=n&&false!==n&&t.append("string"==typeof n?document.createTextNode(n):n);}function re(t,n){return e(t)?t.call(n):t}function le(t,e){const n=t.action?t.action.bind(e.tour):null,o=!!t.disabled&&re(t.disabled,e),i=t.label?re(t.label,e):null,s=t.text?re(t.text,e):null,r=ne("button",{"aria-label":i||null,class:`${t.classes||""} shepherd-button ${t.secondary?"shepherd-button-secondary":""}`,disabled:o||null,onclick:n,tabindex:"0",type:"button"});return s&&(r.innerHTML=s),r}function ce(t,n){const o=ne("header",{class:"shepherd-header"});return n.options.title&&o.append(function(t,n){const o=ne("h3",{id:t,class:"shepherd-title"}),i=e(n)?n():n;return o.innerHTML=i,o}(t,n.options.title)),n.options.cancelIcon&&n.options.cancelIcon.enabled&&o.append(function(t,e){return ne("button",{"aria-label":t.label?t.label:"Close Tour",class:"shepherd-cancel-icon",onclick:t=>{t.preventDefault(),e.cancel();},type:"button"},ne("span",{"aria-hidden":"true"},"×"))}(n.options.cancelIcon,n)),o}function ae(n,i,s){const r=ne("div",{class:"shepherd-content"});return (!o(s.options.title)||s.options.cancelIcon&&s.options.cancelIcon.enabled)&&r.append(ce(i,s)),o(s.options.text)||r.append(function(n,o){const i=ne("div",{class:"shepherd-text",id:n});let s=o.options.text;return e(s)&&(s=s.call(o)),t(s)?i.appendChild(s):i.innerHTML=s,i}(n,s)),Array.isArray(s.options.buttons)&&s.options.buttons.length&&r.append(function(t){const e=ne("footer",{class:"shepherd-footer"});if(t.options.buttons)for(const n of t.options.buttons)e.append(le(n,t));return e}(s)),r}class ue extends i{constructor(t,e={}){return super(),this._resolvedAttachTo=void 0,this._resolvedExtraHighlightElements=void 0,this._originalTabIndexes=void 0,this.classPrefix=void 0,this.el=void 0,this.shepherdElementComponent=void 0,this.target=void 0,this.tour=void 0,this.tour=t,this.classPrefix=this.tour.options?w(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,this._originalTabIndexes=new Map,x(this),this._setOptions(e),this}cancel(){this.tour.cancel(),this.trigger("cancel");}complete(){this.tour.complete(),this.trigger("complete");}destroy(){this._teardownElements(),this.trigger("destroy");}_teardownElements(){var e;(e=this).cleanup&&e.cleanup(),e.cleanup=null,this.shepherdElementComponent&&(this.shepherdElementComponent.cleanup(),this.shepherdElementComponent=void 0),t(this.el)&&(this.el.remove(),this.el=null),this._updateStepTargetOnHide(),this._originalTabIndexes.clear();}getTour(){return this.tour}hide(){var t;null==(t=this.tour.modal)||t.hide(),this.trigger("before-hide"),this.el&&(this.el.hidden=true),this._updateStepTargetOnHide(),this.trigger("hide");}_resolveExtraHiglightElements(){var t;return this._resolvedExtraHighlightElements=(t=this).options.extraHighlights?t.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[],this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=function(t){const o=t.options.attachTo||{},i=Object.assign({},o);if(e(i.element)&&(i.element=i.element.call(t)),n(i.element)){try{i.element=document.querySelector(i.element);}catch(t){}i.element;}return i}(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return null===this._resolvedAttachTo?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return Boolean(this.el&&!this.el.hidden)}show(){return e(this.options.beforeShowPromise)?Promise.resolve(this.options.beforeShowPromise()).then(()=>this._show()):Promise.resolve(this._show())}updateStepOptions(t){Object.assign(this.options,t),this.shepherdElementComponent&&this.el&&(this._teardownElements(),this._setupElements());}getElement(){return this.el}getTarget(){return this.target}_storeOriginalTabIndex(t){const e=t.getAttribute("tabindex");null!==e&&this._originalTabIndexes.set(t,e);}_restoreOriginalTabIndexes(){const t=this.target;t&&(this._originalTabIndexes.has(t)?t.setAttribute("tabindex",this._originalTabIndexes.get(t)):t.removeAttribute("tabindex"));}_createTooltipContent(){const t=`${this.id}-description`,e=`${this.id}-label`;this.shepherdElementComponent=function(t){var e,i,s,r;const{classPrefix:l,descriptionId:c,labelId:a,step:u}=t;let h,d,f,p,g,m,v;const y=null!=(e=null==(i=u.options)||null==(i=i.cancelIcon)?void 0:i.enabled)&&e,x=null!=(s=null==(r=u.options)?void 0:r.title)&&s,b=t=>{const{tour:e}=u;switch(t.keyCode){case 9:if((!d||0===d.length)&&m&&0===m.length){t.preventDefault();break}var n,o,i;if(t.shiftKey){if(document.activeElement===g||null!=(n=document.activeElement)&&n.classList.contains("shepherd-element"))t.preventDefault(),null==(o=null!=p?p:v)||o.focus();else if(document.activeElement===f){var s;t.preventDefault(),null==(s=v)||s.focus();}}else if(document.activeElement===v)t.preventDefault(),null==(i=null!=f?f:g)||i.focus();else if(document.activeElement===p){var r;t.preventDefault(),null==(r=g)||r.focus();}break;case 27:e.options.exitOnEsc&&(t.preventDefault(),t.stopPropagation(),u.cancel());break;case 37:e.options.keyboardNavigation&&(t.preventDefault(),t.stopPropagation(),e.back());break;case 39:e.options.keyboardNavigation&&(t.preventDefault(),t.stopPropagation(),e.next());}},w=ne("dialog",{"aria-describedby":o(u.options.text)?null:c,"aria-labelledby":u.options.title?a:null,class:["shepherd-element",y?"shepherd-has-cancel-icon":"",x?"shepherd-has-title":""].filter(Boolean).join(" "),[`data-${l}shepherd-step-id`]:u.id,onkeydown:b,open:"true"});if(u.options.arrow&&u.options.attachTo&&u.options.attachTo.element&&u.options.attachTo.on&&w.append(ne("div",{class:"shepherd-arrow","data-popper-arrow":""})),w.append(ae(c,a,u)),n(u.options.classes)){const t=u.options.classes.split(" ").filter(t=>!!t.length);t.length&&w.classList.add(...t);}const E='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]';m=[...w.querySelectorAll(E)],g=m[0],v=m[m.length-1];const O=u._getResolvedAttachToOptions();return null!=O&&O.element&&(h=O.element,u._storeOriginalTabIndex(h),h.tabIndex=0,d=[h,...h.querySelectorAll(E)],f=d[0],p=d[d.length-1],h.addEventListener("keydown",b)),{element:w,cleanup:()=>{var t;null==(t=h)||t.removeEventListener("keydown",b);}}}({classPrefix:this.classPrefix,descriptionId:t,labelId:e,step:this});return (this.tour.options.stepsContainer||document.body).append(this.shepherdElementComponent.element),this.shepherdElementComponent.element}_scrollTo(t){const{element:n}=this._getResolvedAttachToOptions();e(this.options.scrollToHandler)?this.options.scrollToHandler(n):n instanceof Element&&"function"==typeof n.scrollIntoView&&n.scrollIntoView(t);}_getClassOptions(t){const e=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,n=t.classes?t.classes:"",o=e&&e.classes?e.classes:"",i=[...n.split(" "),...o.split(" ")],s=new Set(i);return Array.from(s).join(" ").trim()}_setOptions(t={}){let e=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions;e=m({},e||{}),this.options=Object.assign({arrow:true},e,t,function(t,e){return {floatingUIOptions:m(t.floatingUIOptions||{},e.floatingUIOptions||{})}}(e,t));const{when:n}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${O()}`,n&&Object.keys(n).forEach(t=>{this.on(t,n[t],this);});}_setupElements(){o(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&b(this),ee(this);}_show(){var t;this.trigger("before-show"),this._resolveAttachToOptions(),this._resolveExtraHiglightElements(),this._setupElements(),this.tour.modal||this.tour.setupModal(),null==(t=this.tour.modal)||t.setupForStep(this),this._styleTargetElementForStep(this),this.el&&(this.el.hidden=false),this.options.scrollTo&&setTimeout(()=>{this._scrollTo(this.options.scrollTo);}),this.el&&(this.el.hidden=false);const e=this.shepherdElementComponent.element,n=this.target||document.body,o=this._resolvedExtraHighlightElements;n.classList.add(`${this.classPrefix}shepherd-enabled`),n.classList.add(`${this.classPrefix}shepherd-target`),e.classList.add("shepherd-enabled"),null==o||o.forEach(t=>{t.classList.add(`${this.classPrefix}shepherd-enabled`),t.classList.add(`${this.classPrefix}shepherd-target`);}),this.trigger("show");}_styleTargetElementForStep(t){const e=t.target,n=t._resolvedExtraHighlightElements;if(!e)return;const o=t.options.highlightClass;o&&(e.classList.add(o),null==n||n.forEach(t=>t.classList.add(o))),e.classList.remove("shepherd-target-click-disabled"),null==n||n.forEach(t=>t.classList.remove("shepherd-target-click-disabled")),false===t.options.canClickTarget&&(e.classList.add("shepherd-target-click-disabled"),null==n||n.forEach(t=>t.classList.add("shepherd-target-click-disabled")));}_updateStepTargetOnHide(){const t=this.target||document.body,e=this._resolvedExtraHighlightElements,n=this.options.highlightClass;n&&(t.classList.remove(n),null==e||e.forEach(t=>t.classList.remove(n))),t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`),null==e||e.forEach(t=>{t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`);}),this._restoreOriginalTabIndexes();}}function he(t){let e,n=[{width:0,height:0,x:0,y:0,r:0}];const o=oe("path"),i=oe("svg",{class:"shepherd-modal-overlay-container"},o);function s(){o.setAttribute("d",function(t){let e="";const{innerWidth:n,innerHeight:o}=window;return t.forEach(t=>{const{width:n,height:o,x:i=0,y:s=0,r:r=0}=t,{topLeft:l=0,topRight:c=0,bottomRight:a=0,bottomLeft:u=0}="number"==typeof r?{topLeft:r,topRight:r,bottomRight:r,bottomLeft:r}:r;e+=`M${i+l},${s} a${l},${l},0,0,0-${l},${l} V${o+s-u} a${u},${u},0,0,0,${u},${u} H${n+i-a} a${a},${a},0,0,0,${a}-${a} V${s+c} a${c},${c},0,0,0-${c}-${c} Z`;}),`M${n},${o} H0 V0 H${n} V${o} Z ${e}`.replace(/\s/g,"")}(n));}function r(){n=[{width:0,height:0,x:0,y:0,r:0}],s();}function l(){i.classList.remove("shepherd-modal-is-visible"),d();}function c(){i.classList.add("shepherd-modal-is-visible");}function a(t=0,e=0,o=0,i=0,l,c,a){if(c){{const s=[c,...a||[]],r=[];for(const n of s){if(!n)continue;if(s.indexOf(n)!==s.lastIndexOf(n))continue;const{y:c,height:a}=p(n,l),{x:u,width:h,left:d}=n.getBoundingClientRect();s.some(t=>{if(t===n)return false;const e=t.getBoundingClientRect(),{y:o,height:i}=p(t,l);return u>=e.left&&u+h<=e.left+e.width&&c>=o&&c+a<=o+i})||r.push({width:h+2*t,height:a+2*t,x:(u||d)+o-t,y:c+i-t,r:e});}n=r;}s();}else r();}function u(t){t.stopPropagation();}i.addEventListener("touchmove",u),s(),t.append(i);const h=t=>{t.preventDefault();};function d(){e&&(cancelAnimationFrame(e),e=void 0),window.removeEventListener("touchmove",h,{passive:false});}function f(t){if(!t)return null;const e=t instanceof HTMLElement&&window.getComputedStyle(t).overflowY;return "hidden"!==e&&"visible"!==e&&t.scrollHeight>=t.clientHeight?t:f(t.parentElement)}function p(t,e){const n=t.getBoundingClientRect();let o=n.y||n.top,i=n.bottom||o+n.height;if(e){const t=e.getBoundingClientRect(),n=t.y||t.top,s=t.bottom||n+t.height;o=Math.max(o,n),i=Math.min(i,s);}return {y:o,height:Math.max(i-o,0)}}return {closeModalOpening:r,destroy:function(){d(),i.removeEventListener("touchmove",u),i.remove();},hide:l,positionModal:a,setupForStep:function(t){d(),t.tour.options.useModalOverlay?(!function(t){const{modalOverlayOpeningPadding:n,modalOverlayOpeningRadius:o,modalOverlayOpeningXOffset:i=0,modalOverlayOpeningYOffset:s=0}=t.options,r=function(t){const e={top:0,left:0};if(!t)return e;let n=t.ownerDocument.defaultView;try{for(;n&&n!==window.top;){var o;const t=null==(o=n)?void 0:o.frameElement;if(t){const n=t.getBoundingClientRect();e.top+=n.top+t.scrollTop,e.left+=n.left+t.scrollLeft;}n=n.parent;}}catch(t){}return e}(t.target),l=f(t.target),c=()=>{e=void 0,a(n,o,i+r.left,s+r.top,l,t.target,t._resolvedExtraHighlightElements),e=requestAnimationFrame(c);};c(),window.addEventListener("touchmove",h,{passive:false});}(t),c()):l();},show:c,getElement:function(){return i}}}class de extends i{constructor(){super(),this.activeTour=void 0,x(this);}}const fe=new de,pe="undefined"==typeof window;fe.Step=pe?class{constructor(t){}}:ue,fe.Tour=pe?class{constructor(t,e){}}:class extends i{constructor(t={}){super(),this.trackedEvents=["active","cancel","complete","show"],this.classPrefix=void 0,this.currentStep=void 0,this.focusedElBeforeOpen=void 0,this.id=void 0,this.modal=void 0,this.options=void 0,this.steps=void 0,x(this);this.options=Object.assign({},{exitOnEsc:true,keyboardNavigation:true},t),this.classPrefix=w(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps);return ["active","cancel","complete","inactive","show","start"].map(t=>{(t=>{this.on(t,e=>{(e=e||{}).tour=this,fe.trigger(t,e);});})(t);}),this._setTourID(t.id),this}addStep(t,e){let n=t;return n instanceof ue?n.tour=this:n=new ue(this,n),o(e)?this.steps.push(n):this.steps.splice(e,0,n),n}addSteps(t){return Array.isArray(t)&&t.forEach(t=>{this.addStep(t);}),this}back(){const t=this.steps.indexOf(this.currentStep);this.show(t-1,false);}async cancel(){if(this.options.confirmCancel){const t=this.options.confirmCancelMessage||"Are you sure you want to stop the tour?";let n;n=e(this.options.confirmCancel)?await this.options.confirmCancel():window.confirm(t),n&&this._done("cancel");}else this._done("cancel");}complete(){this._done("complete");}getById(t){return this.steps.find(e=>e.id===t)}getCurrentStep(){return this.currentStep}hide(){const t=this.getCurrentStep();if(t)return t.hide()}isActive(){return fe.activeTour===this}next(){const t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,true);}removeStep(t){const e=this.getCurrentStep();this.steps.some((e,n)=>{if(e.id===t)return e.isOpen()&&e.hide(),e.destroy(),this.steps.splice(n,1),true}),e&&e.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel());}show(t=0,o=true){const i=n(t)?this.getById(t):this.steps[t];if(i){this._updateStateBeforeShow();e(i.options.showOn)&&!i.options.showOn()?this._skipStep(i,o):(this.currentStep=i,this.trigger("show",{step:i,previous:this.currentStep}),i.show());}}async start(){this.trigger("start"),this.focusedElBeforeOpen=document.activeElement,this.currentStep=null,this.setupModal(),this._setupActiveTour(),this.next();}_done(e){const n=this.steps.indexOf(this.currentStep);Array.isArray(this.steps)&&this.steps.forEach(t=>t.destroy()),function(e){if(e){const{steps:n}=e;n.forEach(e=>{e.options&&false===e.options.canClickTarget&&e.options.attachTo&&(t(e.target)&&e.target.classList.remove("shepherd-target-click-disabled"),e._resolvedExtraHighlightElements&&e._resolvedExtraHighlightElements.forEach(e=>{t(e)&&e.classList.remove("shepherd-target-click-disabled");}));});}}(this),this.trigger(e,{index:n}),fe.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),"cancel"!==e&&"complete"!==e||this.modal&&(this.modal.destroy(),this.modal=null),t(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus();}_setupActiveTour(){this.trigger("active",{tour:this}),fe.activeTour=this;}setupModal(){const t=this.options.modalContainer||document.body;this.modal=he(t);}_skipStep(t,e){const n=this.steps.indexOf(t);if(n===this.steps.length-1)this.complete();else {const t=e?n+1:n-1;this.show(t,e);}}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour();}_setTourID(t){const e=this.options.tourName||"tour",n=t||O();this.id=`${e}--${n}`;}};
const shepherdKey = '$shepherd';
// create and export composition API's composable function.
const useShepherd = (...args) => new fe.Tour(...args);
const install = function installVueShepherd(app) {
if (install.installed) return;
install.installed = true;
app.config.globalProperties[shepherdKey] = useShepherd;
};
const plugin = {
install
};
// To auto-install on non-es builds, when vue is found
// eslint-disable-next-line no-redeclare
/* global window, global */
{
let GlobalVue = null;
if (typeof window !== 'undefined') {
GlobalVue = window.Vue;
} else if (typeof global !== 'undefined') {
GlobalVue = global.Vue;
}
if (GlobalVue) {
GlobalVue.use(plugin);
}
}exports.default=plugin;exports.useShepherd=useShepherd;