(function(){'use strict';function d(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var k=d(this),l="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},p;
if("function"==typeof Object.setPrototypeOf)p=Object.setPrototypeOf;else{var q;a:{var r={a:!0},u={};try{u.__proto__=r;q=u.a;break a}catch(a){}q=!1}p=q?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var v=p;var w="currentIndex frameCount frameSnapInterval getFrame goToFrame goForwards goBackwards rotateOnce".split(" ");/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
var x={A:"for",B:"highlight",C:"use-thumbnails"},y=[],z=0,A;for(A in x)y[z++]=x[A];function B(){var a=HTMLElement.call(this)||this;a.g=null;a.o=a.v.bind(a);a.m=a.u.bind(a);a.l=!1;a.h=null;a.i=[];a.j=!1;return a}var C=HTMLElement;B.prototype=l(C.prototype);B.prototype.constructor=B;if(v)v(B,C);else for(var D in C)if("prototype"!=D)if(Object.defineProperties){var E=Object.getOwnPropertyDescriptor(C,D);E&&Object.defineProperty(B,D,E)}else B[D]=C[D];
B.prototype.connectedCallback=function(){if(!this.j){for(;this.firstChild;)this.removeChild(this.firstChild);this.h=this.ownerDocument.createElement("div");this.h.classList.add("button-container");this.appendChild(this.h);this.j=!0}this.h.addEventListener("click",this.s.bind(this),!0);F(this)};B.prototype.disconnectedCallback=function(){this.h.removeEventListener("click",this.s.bind(this));G(this)};B.prototype.attributeChangedCallback=function(a){if(this.j)switch(a){case "for":F(this);break;default:H(this)}};
function F(a){G(a);var b=a.getAttribute("for"),c=null,f=!1,g=!1;if(b){c=document.getElementById(b);for(var h=!1,e=a.parentElement;!c&&e&&!h;e=e.parentElement)if((h="body"==e.tagName.toLowerCase())||e.hasAttribute("data-gwd-group"))c=e.querySelector('[data-gwd-grp-id="'+b+'"]');if(c){a:if(c){for(b=0;b<w.length;b++)if(!(w[b]in c)){f=!1;break a}f=!0}else f=!1;g="gwd-transitiongallery"===c.tagName.toLowerCase()}}if(f||g)a.g=c,c.addEventListener("frameactivated",a.m),c.gwdIsLoaded()?H(a):c.addEventListener("ready",
a.o)}function G(a){a.g&&(a.g.removeEventListener("ready",a.o),a.g.removeEventListener("frameactivated",a.m))}B.prototype.v=function(a){a.target==this.g&&H(this)};B.prototype.u=function(a){a.target==this.g&&I(this,a.detail.id)};B.prototype.s=function(a){for(a=a.target;a&&a!=this;a=a.parentElement)if(a.gwdTargetFrameNum){this.g.goToFrame(a.gwdTargetFrameNum);break}};
function H(a){var b=a.getAttribute("highlight");a.style.color=b||"";a.l=a.hasAttribute("use-thumbnails");for(a.i=[];a.h.firstChild;)a.h.removeChild(a.h.firstChild);if(a.g){b=a.g.frameSnapInterval||1;for(var c=a.l?b:1,f=0;f<a.g.frameCount;f+=b){var g=document.createElement("span");g.classList.add("button");for(var h=0;h<c;h++){var e=a.g.getFrame(f+h+1);if(!e)break;var t=void 0,m=void 0,n=document.createElement("span");a.l?(n.classList.add("frame-thumbnail"),"gwd-image"==e.tagName.toLowerCase()||"img"==
e.tagName.toLowerCase()?m=e:m=e.querySelector("gwd-image"),m&&(t=m.getAttribute("source")||m.getAttribute("src")),n.style.backgroundImage=t?"url("+JSON.stringify(t)+")":"url(data:image/gif;base64,R0lGODlhAQABAPAAAGZmZgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==)"):n.classList.add("frame-dot");g.appendChild(n)}g.gwdTargetFrameNum=f+1;a.i.push(g);a.h.appendChild(g)}I(a)}}
function I(a,b){b=void 0!=b?b-1:a.g.currentIndex-1;a.g.frameSnapInterval&&(b=Math.floor(b/a.g.frameSnapInterval));for(var c=0;c<a.i.length;c++)a.i[c].classList.remove("active");(a=a.i[b])&&a.classList.add("active")}k.Object.defineProperties(B,{observedAttributes:{configurable:!0,enumerable:!0,get:function(){return y}}});customElements.define("gwd-gallerynavigation",B);}).call(this);
