/*!
 * @splidejs/splide-extension-url-hash
 * Version  : 0.3.0
 * License  : MIT
 * Copyright: 2022 Naotoshi Fujita
*/(function(h){typeof define=="function"&&define.amd?define(h):h()})(function(){"use strict";function h(n){n.length=0}function w(n,t,i){return Array.prototype.slice.call(n,t,i)}function m(n){return n.bind.apply(n,[null].concat(w(arguments,1)))}function b(n,t){return typeof t===n}var _=Array.isArray;m(b,"function"),m(b,"string"),m(b,"undefined");function T(n){return _(n)?n:[n]}function x(n,t){T(n).forEach(t)}var L=Object.keys;function H(n,t,i){if(n){var r=L(n);r=i?r.reverse():r;for(var v=0;v<r.length;v++){var d=r[v];if(d!=="__proto__"&&t(n[d],d)===!1)break}}return n}function O(n){return w(arguments,1).forEach(function(t){H(t,function(i,r){n[r]=t[r]})}),n}function R(){var n=[];function t(o,a,u,f){v(o,a,function(e,l,c){var p="addEventListener"in e,s=p?e.removeEventListener.bind(e,l,u,f):e.removeListener.bind(e,u);p?e.addEventListener(l,u,f):e.addListener(u),n.push([e,l,c,u,s])})}function i(o,a,u){v(o,a,function(f,e,l){n=n.filter(function(c){return c[0]===f&&c[1]===e&&c[2]===l&&(!u||c[3]===u)?(c[4](),!1):!0})})}function r(o,a,u){var f,e=!0;return typeof CustomEvent=="function"?f=new CustomEvent(a,{bubbles:e,detail:u}):(f=document.createEvent("CustomEvent"),f.initCustomEvent(a,e,!1,u)),o.dispatchEvent(f),f}function v(o,a,u){x(o,function(f){f&&x(a,function(e){e.split(" ").forEach(function(l){var c=l.split(".");u(f,c[0],c[1])})})})}function d(){n.forEach(function(o){o[4]()}),h(n)}return{bind:t,unbind:i,dispatch:r,destroy:d}}var $="active",N="destroy";function U(n){var t=n?n.event.bus:document.createDocumentFragment(),i=R();function r(d,o){i.bind(t,T(d).join(" "),function(a){o.apply(o,_(a.detail)?a.detail:[])})}function v(d){i.dispatch(t,d,w(arguments,1))}return n&&n.event.on(N,i.destroy),O(i,{bus:t,on:r,off:m(i.unbind,t),emit:v})}function V(n,t,i){return Array.prototype.slice.call(n,t,i)}function A(n){return n.bind.apply(n,[null].concat(V(arguments,1)))}function g(n,t){return typeof t===n}A(g,"function"),A(g,"string"),A(g,"undefined");function C(n,t){return n.getAttribute(t)}var I="data-splide-hash";function B(n,t,i){var r=U(n),v=r.on,d=r.bind,o=t.Controller,a=o.setIndex,u=o.go;function f(){var s=p(location.hash);a(s>-1?s:i.start||0)}function e(){v($,l),d(window,"hashchange",c)}function l(s){var E=C(s.slide,I);E?location.hash=E:history?history.replaceState(null,null," "):location.hash=""}function c(){var s=p(location.hash);s>-1&&u(s)}function p(s){if(s=s.replace("#",""),s){for(var E=t.Elements.slides,y=0;y<E.length;y++)if(C(E[y],I)===s)return y}return-1}return{setup:f,mount:e}}typeof window<"u"&&(window.splide=window.splide||{},window.splide.Extensions=window.splide.Extensions||{},window.splide.Extensions.URLHash=B)});