smartphoto 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,7 +17,6 @@ If you are Japasese, See here [https://www.appleple.com/blog/javascript/smartpho
17
17
 
18
18
  ## Installation
19
19
  - [npm](https://www.npmjs.com/package/smartphoto)
20
- - [standalone](https://raw.githubusercontent.com/appleple/smart-photo/master/js/smartphoto.js)
21
20
 
22
21
  via npm
23
22
  ```shell
@@ -69,8 +69,8 @@
69
69
  max-width: 100%;
70
70
  max-height: 100%;
71
71
  overflow: hidden;
72
- height: 100dvh;
73
- max-height: 100dvh;
72
+ height: var(--smartphoto-vh, 100dvh);
73
+ max-height: var(--smartphoto-vh, 100dvh);
74
74
  background-color: var(--smartphoto-backdrop-color, rgb(0, 0, 0));
75
75
  opacity: 1;
76
76
  font-family: sans-serif;
@@ -84,6 +84,13 @@
84
84
  background-color: var(--smartphoto-backdrop-color, rgb(0, 0, 0));
85
85
  }
86
86
 
87
+ ::view-transition-group(smartphoto-hero),
88
+ ::view-transition-old(smartphoto-hero),
89
+ ::view-transition-new(smartphoto-hero) {
90
+ animation-duration: var(--smartphoto-animation-speed, 0.3s);
91
+ animation-timing-function: var(--smartphoto-animation-function, ease-out);
92
+ }
93
+
87
94
  .smartphoto-close {
88
95
  opacity: 0;
89
96
  }
@@ -393,6 +400,7 @@
393
400
  height: 0;
394
401
  transform: translate(50vw, 50vh);
395
402
  transform: translate(50vw, 50dvh);
403
+ transform: translate(50vw, calc(var(--smartphoto-vh, 100dvh) / 2));
396
404
  }
397
405
 
398
406
  .smartphoto-loader {
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../scss/smartphoto.scss"],"names":[],"mappings":"AAKA;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;;;AAUJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;;;AAIF;EAEE;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAKA;EAKA;EACA;EACA;EACA;EACA;EACA;EAKA,YACE;;AAIF;EACE;;AAGF;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;;;AAGF;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAKN;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EAGA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"smartphoto.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../scss/smartphoto.scss"],"names":[],"mappings":"AAKA;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;;;AAUJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;;;AAIF;EAEE;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAKA;EAQA;EACA;EACA;EACA;EACA;EACA;EAKA,YACE;;AAIF;EACE;;AAGF;EACE;;;AASJ;AAAA;AAAA;EAGE;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;;;AAGF;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAKN;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EAIA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"smartphoto.css"}
@@ -1 +1 @@
1
- @keyframes smartphoto{from{opacity:0}to{opacity:1}}@keyframes smartphoto-img-wrap{from{opacity:0}to{opacity:1}}@keyframes smartphoto-inner{from{transform:translate(0, 100px)}to{transform:translate(0, 0)}}@keyframes smartphoto-loader{0%{opacity:.4;transform:rotate(0deg)}50%{opacity:1;transform:rotate(180deg)}100%{opacity:.4;transform:rotate(360deg)}}@keyframes smartphoto-appear{0%{opacity:0}100%{opacity:1}}@keyframes smartphoto-hide{0%{opacity:1}100%{opacity:0}}:root:has(dialog.smartphoto[open]){overflow:hidden}.smartphoto{border:none;background:rgba(0,0,0,0);padding:0;margin:0;outline:none;position:fixed;inset:0;width:100%;height:100%;max-width:100%;max-height:100%;overflow:hidden;height:100dvh;max-height:100dvh;background-color:var(--smartphoto-backdrop-color, rgb(0, 0, 0));opacity:1;font-family:sans-serif;cursor:pointer;transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out),display var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out) allow-discrete,overlay var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out) allow-discrete}.smartphoto:not([open]){opacity:0}.smartphoto::backdrop{background-color:var(--smartphoto-backdrop-color, rgb(0, 0, 0))}.smartphoto-close{opacity:0}.smartphoto-count{display:inline-block;color:#fff;font-size:16px}.smartphoto-header{display:block;box-sizing:border-box;position:fixed;z-index:102;top:0;left:0;width:100%;height:50px;padding:15px;background-color:var(--smartphoto-header-color, rgba(0, 0, 0, 0.2))}.smartphoto-content{display:block;position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none}.smartphoto-dismiss{display:block;position:absolute;top:15px;right:10px;width:20px;height:20px;padding:0;border:none;background-color:rgba(0,0,0,0);background-image:url(data:image/svg+xml;base64,PHN2ZyBpZD0i44Os44Kk44Ok44O8XzEiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDI4MzQuNjUgMjgzNC42NSIgZmlsbD0iI0ZGRiI+PHRpdGxlPmljb248L3RpdGxlPjxwYXRoIGQ9Ik0xNTc2LjQyLDE0MDYuNzYsMjc4NCwxOTkuMTlhNTYuODYsNTYuODYsMCwwLDAsMC04MC4xOGwtNzguOTItNzguOTJhNTYuODYsNTYuODYsMCwwLDAtODAuMTgsMEwxNDE3LjMyLDEyNDcuNjYsMjA5Ljc1LDQwLjA5YTU2Ljg2LDU2Ljg2LDAsMCwwLTgwLjE4LDBMNTAuNjUsMTE5YTU2Ljg2LDU2Ljg2LDAsMCwwLDAsODAuMThMMTI1OC4yMywxNDA2Ljc2LDUwLjY1LDI2MTQuMzRhNTYuODYsNTYuODYsMCwwLDAsMCw4MC4xOGw3OC45Miw3OC45MmE1Ni44Niw1Ni44NiwwLDAsMCw4MC4xOCwwTDE0MTcuMzIsMTU2NS44NiwyNjI0LjksMjc3My40NGE1Ni44Niw1Ni44NiwwLDAsMCw4MC4xOCwwbDc4LjkyLTc4LjkyYTU2Ljg2LDU2Ljg2LDAsMCwwLDAtODAuMThaIi8+PC9zdmc+);text-shadow:0 1px 0 #fff;color:#fff;font-size:30px;text-decoration:none;cursor:pointer;line-height:1}.smartphoto-body{position:relative;z-index:102;width:100%;height:100%;margin:0 auto}.smartphoto-inner{position:relative;width:100%;height:100%;vertical-align:top}.smartphoto-img{display:none;max-width:none;width:auto;height:auto;cursor:zoom-in;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:transform var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);-webkit-user-drag:none}.smartphoto-img.active{display:block}.smartphoto-img-onmove{cursor:grab;cursor:-webkit-grab;transition:none}.smartphoto-img-elasticmove{transition:transform var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out)}.smartphoto-img-wrap{display:inline-block;opacity:1;touch-action:none;-webkit-transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);-moz-transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);-ms-transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);-o-transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);animation-name:smartphoto-img-wrap;animation-duration:var(--smartphoto-animation-speed, 0.3s);animation-timing-function:var(--smartphoto-animation-function, ease-out)}.smartphoto-img-left{transform:translateX(150%) !important}.smartphoto-img-right{transform:translateX(-150%) !important}.smartphoto-arrows{list-style-type:none;margin:0;padding:0;position:relative;z-index:1002;top:50%;left:0;opacity:1;animation-name:smartphoto-appear;animation-duration:var(--smartphoto-animation-speed, 0.3s);animation-timing-function:var(--smartphoto-animation-function, ease-out)}.smartphoto-arrows[aria-hidden=true]{animation-name:smartphoto-hide;display:none}.smartphoto-arrows li{display:block;position:absolute;top:50%;width:30px;height:30px;margin-top:-20px;box-sizing:content-box;animation-duration:var(--smartphoto-animation-speed, 0.3s);animation-timing-function:var(--smartphoto-animation-function, ease-out);animation-name:smartphoto-appear}.smartphoto-arrows li:focus{outline:none}.smartphoto-arrows [aria-hidden=true]{animation-name:smartphoto-hide;display:none}.smartphoto-arrows button{appearance:none;display:block;width:100%;height:100%;margin:0;padding:0;border:none;background-color:rgba(0,0,0,0);cursor:pointer}.smartphoto-arrow-right{right:0;padding:5px 0;background-color:rgba(0,0,0,.5)}.smartphoto-arrow-right button{background-image:url(data:image/svg+xml;base64,PHN2ZyBpZD0i44Os44Kk44Ok44O8XzEiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDI4MzQuNjUgMjgzNC42NSIgZmlsbD0iI0ZGRiAiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNMTgzNy44OCwxNDE3LjMyLDY0My41OSwyMjNhNzIuMjEsNzIuMjEsMCwwLDEsMC0xMDEuODJMNzQzLjgyLDIxYTcyLjIxLDcyLjIxLDAsMCwxLDEwMS44MiwwTDIwOTAuODMsMTI2Ni4xOWwxMDAuMjMsMTAwLjIzYTcyLjIxLDcyLjIxLDAsMCwxLDAsMTAxLjgyTDg0NS42NCwyODEzLjY1YTcyLjIxLDcyLjIxLDAsMCwxLTEwMS44MiwwTDY0My41OSwyNzEzLjQyYTcyLjIxLDcyLjIxLDAsMCwxLDAtMTAxLjgyWiIvPjwvc3ZnPg==)}.smartphoto-arrow-left{left:0;padding:5px 0;background-color:rgba(0,0,0,.5)}.smartphoto-arrow-left button{background-image:url(data:image/svg+xml;base64,PHN2ZyBpZD0i44Os44Kk44Ok44O8XzEiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDI4MzQuNjUgMjgzNC42NSIgZmlsbD0iI0ZGRiI+PHRpdGxlPmljb248L3RpdGxlPjxwYXRoIGQ9Ik05OTYuNzcsMTQxNy4zMiwyMTkxLjA2LDIyM2E3Mi4yMSw3Mi4yMSwwLDAsMCwwLTEwMS44MkwyMDkwLjgzLDIxQTcyLjIxLDcyLjIxLDAsMCwwLDE5ODksMjFMNzQzLjgyLDEyNjYuMTksNjQzLjU5LDEzNjYuNDJhNzIuMjEsNzIuMjEsMCwwLDAsMCwxMDEuODJMMTk4OSwyODEzLjY1YTcyLjIxLDcyLjIxLDAsMCwwLDEwMS44MiwwbDEwMC4yMy0xMDAuMjNhNzIuMjEsNzIuMjEsMCwwLDAsMC0xMDEuODJaIi8+PC9zdmc+)}.smartPhotoArrowHideIcon{display:none}.smartphoto-nav{position:absolute;bottom:0;left:0;width:100%;opacity:1;animation-name:smartphoto-appear;animation-duration:var(--smartphoto-animation-speed, 0.3s);animation-timing-function:var(--smartphoto-animation-function, ease-out)}.smartphoto-nav[aria-hidden=true]{animation-name:smartphoto-hide;display:none}.smartphoto-nav ul{display:block;overflow-x:auto;list-style:none;margin:0;padding:0;text-align:center;white-space:nowrap;-webkit-overflow-scrolling:touch}.smartphoto-nav li{display:inline-block;overflow:hidden;width:50px;height:50px}.smartphoto-nav button{appearance:none;display:block;width:100%;height:100%;margin:0;padding:0;border:none;background-color:#fff;background-position:center center;background-size:cover;opacity:.5;cursor:pointer}.smartphoto-nav button:focus{opacity:.8}.smartphoto-nav button.current{opacity:1}.smartphoto-nav img{width:auto;height:100%}.smartphoto-list{list-style-type:none;position:absolute;z-index:101;top:0;left:0;margin:0;padding:0;white-space:nowrap}.smartphoto-list li{display:block;position:absolute;top:0;left:0;width:100%;height:100%;transition:all var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out)}.smartphoto-list li:focus{outline:none}.smartphoto-list-onmove{transition:all .3s var(--smartphoto-animation-function, ease-out)}.smartphoto-caption{overflow:hidden;box-sizing:border-box;position:absolute;top:0;left:0;width:100%;height:50px;padding:0 50px;color:#fff;font-size:12px;text-align:center;line-height:50px;white-space:nowrap;text-overflow:ellipsis;margin:0;font-weight:normal}.smartphoto-caption:focus{outline:none}.smartphoto-loader-wrap{display:block;position:relative;z-index:103;width:0;height:0;transform:translate(50vw, 50vh);transform:translate(50vw, 50dvh)}.smartphoto-loader{position:absolute;z-index:101;top:0;left:0;width:30px;height:30px;margin-top:-25px;margin-left:-25px;border:8px solid #17cddd;border-right-color:rgba(0,0,0,0);border-radius:50%;animation:smartphoto-loader .5s infinite linear}.smartphoto-img-clone{position:fixed;z-index:100;top:0;left:0;transition:all var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out)}.smartphoto-sr-only{overflow:hidden;position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;clip:rect(0, 0, 0, 0)}
1
+ @keyframes smartphoto{from{opacity:0}to{opacity:1}}@keyframes smartphoto-img-wrap{from{opacity:0}to{opacity:1}}@keyframes smartphoto-inner{from{transform:translate(0, 100px)}to{transform:translate(0, 0)}}@keyframes smartphoto-loader{0%{opacity:.4;transform:rotate(0deg)}50%{opacity:1;transform:rotate(180deg)}100%{opacity:.4;transform:rotate(360deg)}}@keyframes smartphoto-appear{0%{opacity:0}100%{opacity:1}}@keyframes smartphoto-hide{0%{opacity:1}100%{opacity:0}}:root:has(dialog.smartphoto[open]){overflow:hidden}.smartphoto{border:none;background:rgba(0,0,0,0);padding:0;margin:0;outline:none;position:fixed;inset:0;width:100%;height:100%;max-width:100%;max-height:100%;overflow:hidden;height:var(--smartphoto-vh, 100dvh);max-height:var(--smartphoto-vh, 100dvh);background-color:var(--smartphoto-backdrop-color, rgb(0, 0, 0));opacity:1;font-family:sans-serif;cursor:pointer;transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out),display var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out) allow-discrete,overlay var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out) allow-discrete}.smartphoto:not([open]){opacity:0}.smartphoto::backdrop{background-color:var(--smartphoto-backdrop-color, rgb(0, 0, 0))}::view-transition-group(smartphoto-hero),::view-transition-old(smartphoto-hero),::view-transition-new(smartphoto-hero){animation-duration:var(--smartphoto-animation-speed, 0.3s);animation-timing-function:var(--smartphoto-animation-function, ease-out)}.smartphoto-close{opacity:0}.smartphoto-count{display:inline-block;color:#fff;font-size:16px}.smartphoto-header{display:block;box-sizing:border-box;position:fixed;z-index:102;top:0;left:0;width:100%;height:50px;padding:15px;background-color:var(--smartphoto-header-color, rgba(0, 0, 0, 0.2))}.smartphoto-content{display:block;position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none}.smartphoto-dismiss{display:block;position:absolute;top:15px;right:10px;width:20px;height:20px;padding:0;border:none;background-color:rgba(0,0,0,0);background-image:url(data:image/svg+xml;base64,PHN2ZyBpZD0i44Os44Kk44Ok44O8XzEiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDI4MzQuNjUgMjgzNC42NSIgZmlsbD0iI0ZGRiI+PHRpdGxlPmljb248L3RpdGxlPjxwYXRoIGQ9Ik0xNTc2LjQyLDE0MDYuNzYsMjc4NCwxOTkuMTlhNTYuODYsNTYuODYsMCwwLDAsMC04MC4xOGwtNzguOTItNzguOTJhNTYuODYsNTYuODYsMCwwLDAtODAuMTgsMEwxNDE3LjMyLDEyNDcuNjYsMjA5Ljc1LDQwLjA5YTU2Ljg2LDU2Ljg2LDAsMCwwLTgwLjE4LDBMNTAuNjUsMTE5YTU2Ljg2LDU2Ljg2LDAsMCwwLDAsODAuMThMMTI1OC4yMywxNDA2Ljc2LDUwLjY1LDI2MTQuMzRhNTYuODYsNTYuODYsMCwwLDAsMCw4MC4xOGw3OC45Miw3OC45MmE1Ni44Niw1Ni44NiwwLDAsMCw4MC4xOCwwTDE0MTcuMzIsMTU2NS44NiwyNjI0LjksMjc3My40NGE1Ni44Niw1Ni44NiwwLDAsMCw4MC4xOCwwbDc4LjkyLTc4LjkyYTU2Ljg2LDU2Ljg2LDAsMCwwLDAtODAuMThaIi8+PC9zdmc+);text-shadow:0 1px 0 #fff;color:#fff;font-size:30px;text-decoration:none;cursor:pointer;line-height:1}.smartphoto-body{position:relative;z-index:102;width:100%;height:100%;margin:0 auto}.smartphoto-inner{position:relative;width:100%;height:100%;vertical-align:top}.smartphoto-img{display:none;max-width:none;width:auto;height:auto;cursor:zoom-in;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:transform var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);-webkit-user-drag:none}.smartphoto-img.active{display:block}.smartphoto-img-onmove{cursor:grab;cursor:-webkit-grab;transition:none}.smartphoto-img-elasticmove{transition:transform var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out)}.smartphoto-img-wrap{display:inline-block;opacity:1;touch-action:none;-webkit-transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);-moz-transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);-ms-transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);-o-transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);transition:opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);animation-name:smartphoto-img-wrap;animation-duration:var(--smartphoto-animation-speed, 0.3s);animation-timing-function:var(--smartphoto-animation-function, ease-out)}.smartphoto-img-left{transform:translateX(150%) !important}.smartphoto-img-right{transform:translateX(-150%) !important}.smartphoto-arrows{list-style-type:none;margin:0;padding:0;position:relative;z-index:1002;top:50%;left:0;opacity:1;animation-name:smartphoto-appear;animation-duration:var(--smartphoto-animation-speed, 0.3s);animation-timing-function:var(--smartphoto-animation-function, ease-out)}.smartphoto-arrows[aria-hidden=true]{animation-name:smartphoto-hide;display:none}.smartphoto-arrows li{display:block;position:absolute;top:50%;width:30px;height:30px;margin-top:-20px;box-sizing:content-box;animation-duration:var(--smartphoto-animation-speed, 0.3s);animation-timing-function:var(--smartphoto-animation-function, ease-out);animation-name:smartphoto-appear}.smartphoto-arrows li:focus{outline:none}.smartphoto-arrows [aria-hidden=true]{animation-name:smartphoto-hide;display:none}.smartphoto-arrows button{appearance:none;display:block;width:100%;height:100%;margin:0;padding:0;border:none;background-color:rgba(0,0,0,0);cursor:pointer}.smartphoto-arrow-right{right:0;padding:5px 0;background-color:rgba(0,0,0,.5)}.smartphoto-arrow-right button{background-image:url(data:image/svg+xml;base64,PHN2ZyBpZD0i44Os44Kk44Ok44O8XzEiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDI4MzQuNjUgMjgzNC42NSIgZmlsbD0iI0ZGRiAiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNMTgzNy44OCwxNDE3LjMyLDY0My41OSwyMjNhNzIuMjEsNzIuMjEsMCwwLDEsMC0xMDEuODJMNzQzLjgyLDIxYTcyLjIxLDcyLjIxLDAsMCwxLDEwMS44MiwwTDIwOTAuODMsMTI2Ni4xOWwxMDAuMjMsMTAwLjIzYTcyLjIxLDcyLjIxLDAsMCwxLDAsMTAxLjgyTDg0NS42NCwyODEzLjY1YTcyLjIxLDcyLjIxLDAsMCwxLTEwMS44MiwwTDY0My41OSwyNzEzLjQyYTcyLjIxLDcyLjIxLDAsMCwxLDAtMTAxLjgyWiIvPjwvc3ZnPg==)}.smartphoto-arrow-left{left:0;padding:5px 0;background-color:rgba(0,0,0,.5)}.smartphoto-arrow-left button{background-image:url(data:image/svg+xml;base64,PHN2ZyBpZD0i44Os44Kk44Ok44O8XzEiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDI4MzQuNjUgMjgzNC42NSIgZmlsbD0iI0ZGRiI+PHRpdGxlPmljb248L3RpdGxlPjxwYXRoIGQ9Ik05OTYuNzcsMTQxNy4zMiwyMTkxLjA2LDIyM2E3Mi4yMSw3Mi4yMSwwLDAsMCwwLTEwMS44MkwyMDkwLjgzLDIxQTcyLjIxLDcyLjIxLDAsMCwwLDE5ODksMjFMNzQzLjgyLDEyNjYuMTksNjQzLjU5LDEzNjYuNDJhNzIuMjEsNzIuMjEsMCwwLDAsMCwxMDEuODJMMTk4OSwyODEzLjY1YTcyLjIxLDcyLjIxLDAsMCwwLDEwMS44MiwwbDEwMC4yMy0xMDAuMjNhNzIuMjEsNzIuMjEsMCwwLDAsMC0xMDEuODJaIi8+PC9zdmc+)}.smartPhotoArrowHideIcon{display:none}.smartphoto-nav{position:absolute;bottom:0;left:0;width:100%;opacity:1;animation-name:smartphoto-appear;animation-duration:var(--smartphoto-animation-speed, 0.3s);animation-timing-function:var(--smartphoto-animation-function, ease-out)}.smartphoto-nav[aria-hidden=true]{animation-name:smartphoto-hide;display:none}.smartphoto-nav ul{display:block;overflow-x:auto;list-style:none;margin:0;padding:0;text-align:center;white-space:nowrap;-webkit-overflow-scrolling:touch}.smartphoto-nav li{display:inline-block;overflow:hidden;width:50px;height:50px}.smartphoto-nav button{appearance:none;display:block;width:100%;height:100%;margin:0;padding:0;border:none;background-color:#fff;background-position:center center;background-size:cover;opacity:.5;cursor:pointer}.smartphoto-nav button:focus{opacity:.8}.smartphoto-nav button.current{opacity:1}.smartphoto-nav img{width:auto;height:100%}.smartphoto-list{list-style-type:none;position:absolute;z-index:101;top:0;left:0;margin:0;padding:0;white-space:nowrap}.smartphoto-list li{display:block;position:absolute;top:0;left:0;width:100%;height:100%;transition:all var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out)}.smartphoto-list li:focus{outline:none}.smartphoto-list-onmove{transition:all .3s var(--smartphoto-animation-function, ease-out)}.smartphoto-caption{overflow:hidden;box-sizing:border-box;position:absolute;top:0;left:0;width:100%;height:50px;padding:0 50px;color:#fff;font-size:12px;text-align:center;line-height:50px;white-space:nowrap;text-overflow:ellipsis;margin:0;font-weight:normal}.smartphoto-caption:focus{outline:none}.smartphoto-loader-wrap{display:block;position:relative;z-index:103;width:0;height:0;transform:translate(50vw, 50vh);transform:translate(50vw, 50dvh);transform:translate(50vw, calc(var(--smartphoto-vh, 100dvh) / 2))}.smartphoto-loader{position:absolute;z-index:101;top:0;left:0;width:30px;height:30px;margin-top:-25px;margin-left:-25px;border:8px solid #17cddd;border-right-color:rgba(0,0,0,0);border-radius:50%;animation:smartphoto-loader .5s infinite linear}.smartphoto-img-clone{position:fixed;z-index:100;top:0;left:0;transition:all var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out)}.smartphoto-sr-only{overflow:hidden;position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;clip:rect(0, 0, 0, 0)}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SmartPhoto v2.1.2
2
+ * SmartPhoto v2.1.3
3
3
  * (c) appleple
4
4
  * Released under the MIT License.
5
5
  */
@@ -1075,7 +1075,8 @@
1075
1075
  return document.documentElement.clientWidth;
1076
1076
  }
1077
1077
  function getWindowHeight() {
1078
- return document.documentElement.clientHeight;
1078
+ var _a, _b;
1079
+ return (_b = (_a = window.visualViewport) == null ? void 0 : _a.height) != null ? _b : document.documentElement.clientHeight;
1079
1080
  }
1080
1081
  function isElementArray(source) {
1081
1082
  return source.length > 0 && source[0] instanceof Element;
@@ -1107,6 +1108,12 @@
1107
1108
  this.loadAllFired = /* @__PURE__ */ new Set();
1108
1109
  this.syncedGroupId = null;
1109
1110
  // ---- 内部: window イベント ----
1111
+ this.updateViewportHeight = () => {
1112
+ this.view.refs.dialog.style.setProperty(
1113
+ "--smartphoto-vh",
1114
+ `${getWindowHeight()}px`
1115
+ );
1116
+ };
1110
1117
  this.handleResize = () => {
1111
1118
  if (!currentItems(this.state)) {
1112
1119
  return;
@@ -1186,6 +1193,18 @@
1186
1193
  this.openPhoto(restored, null);
1187
1194
  }
1188
1195
  }
1196
+ this.updateViewportHeight();
1197
+ if (window.visualViewport) {
1198
+ window.visualViewport.addEventListener(
1199
+ "resize",
1200
+ this.updateViewportHeight,
1201
+ { signal: this.abortController.signal }
1202
+ );
1203
+ } else {
1204
+ window.addEventListener("resize", this.updateViewportHeight, {
1205
+ signal: this.abortController.signal
1206
+ });
1207
+ }
1189
1208
  if (!this.isSmartPhoneFlag) {
1190
1209
  window.addEventListener("resize", this.handleResize, {
1191
1210
  signal: this.abortController.signal
@@ -1494,6 +1513,10 @@
1494
1513
  }
1495
1514
  openPhotoWithViewTransition(trigger) {
1496
1515
  var _a, _b;
1516
+ document.documentElement.style.setProperty(
1517
+ "--smartphoto-animation-speed",
1518
+ `${this.state.options.animationSpeed}ms`
1519
+ );
1497
1520
  const transitionName = "smartphoto-hero";
1498
1521
  const thumbImg = (_a = trigger == null ? void 0 : trigger.querySelector("img")) != null ? _a : null;
1499
1522
  if (thumbImg) {
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * SmartPhoto v2.1.2
2
+ * SmartPhoto v2.1.3
3
3
  * (c) appleple
4
4
  * Released under the MIT License.
5
5
  */
6
- "use strict";(()=>{var j=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function fe(t,...e){var i;t=t||{};for(let o=0;o<e.length;o++){let r=e[o];if(r){for(let s in r)if(Object.hasOwn(r,s)){let n=r[s];n&&typeof n=="object"?t[s]=fe((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var ve=fe,ne=(t,e,i)=>{let o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,i)),t.dispatchEvent(o)},we=t=>{let e={};for(let i of t.split("&")){let o=i.split("="),r=o[0],s=o.length>1?o.slice(1).join("="):r;e[r]=decodeURIComponent(s)}return e},ge=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var Xe={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog",carouselLabel:"Images"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:300};function Ee(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Ee(i)}),Object.freeze(t)}function Pe(t){return{options:Ee(ve({},Xe,t)),viewer:{isOpen:!1,currentGroup:null,currentIndex:0,oldIndex:0,total:0,translateX:0,translateY:0,photoPosX:0,photoPosY:0,scaleSize:1,scale:!1,elastic:!1,hideUi:!1,onMove:!1,appear:!1,appearEffect:null,prev:-1,next:-1,showPrevArrow:!1,showNextArrow:!1},groups:new Map}}function ae(t){return t.getAttribute("data-group")||"nogroup"}function le(t){return t.group||"nogroup"}function be(t,e,i,o){let r=ae(t),s=t.getAttribute("href"),n=t.querySelector("img"),c=s;n&&(n.getAttribute(e.lazyAttribute)?c=n.getAttribute(e.lazyAttribute):n.currentSrc?c=n.currentSrc:c=n.src);let p="";n!=null&&n.getAttribute("alt")?p=n.getAttribute("alt"):t.getAttribute("data-caption")?p=t.getAttribute("data-caption"):p=s!=null?s:"";let E=t.getAttribute("data-id");return{src:s,thumb:c,caption:t.getAttribute("data-caption"),alt:p,groupId:r,translateX:o*i,translateY:0,index:i,width:50,height:50,scale:1,x:0,y:0,id:E||i,loaded:!1,processed:!1,element:t}}function ye(t,e,i){var E,v,x,b,I;let o=le(t),r=t.src,s=(E=t.thumb)!=null?E:r,n=(v=t.caption)!=null?v:null,c=(b=(x=t.alt)!=null?x:n)!=null?b:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:c,groupId:o,translateX:i*e,translateY:0,index:e,width:p?t.width:50,height:p?t.height:50,scale:1,x:0,y:0,id:(I=t.id)!=null?I:e,loaded:p,processed:!1,element:null}}function he(t,e){t.groups.has(e.groupId)||t.groups.set(e.groupId,[]),t.groups.get(e.groupId).push(e),t.viewer.currentGroup=e.groupId}function H(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function M(t){var i;let e=H(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function ue(t){let e=H(t);if(!e)return;let i=e.length,o=t.viewer.currentIndex+1,r=t.viewer.currentIndex-1;t.viewer.showNextArrow=!1,t.viewer.showPrevArrow=!1,o!==i&&(t.viewer.next=o,t.viewer.showNextArrow=!0),r!==-1&&(t.viewer.prev=r,t.viewer.showPrevArrow=!0)}function Se(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function Q(t,e){let i=10**e;return Math.round(t*i)/i}function V(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function xe(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,c,p,E;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(E=(o-s)/2,c=-1*E):(E=(s-o)/2,c=-1*E),{minX:Q(n,6)*e.scaleSize,minY:Q(c,6)*e.scaleSize,maxX:Q(p,6)*e.scaleSize,maxY:Q(E,6)*e.scaleSize}}function Ie(t,e,i,o,r){let s=i-(o+r);t.forEach(n=>{n.loaded&&(n.processed=!0,n.scale=s/n.height,n.height<s&&(n.scale=1),n.x=(n.scale-1)/2*n.width+(e-n.width*n.scale)/2,n.y=(n.scale-1)/2*n.height+(i-n.height*n.scale)/2,n.width*n.scale>e&&(n.scale=e/n.width,n.x=(n.scale-1)/2*n.width))})}function Le(t){let e=M(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function Te(t,e){let i=null;return t.groups.forEach(o=>{o.forEach(r=>{e.group===r.groupId&&e.photo===r.id&&(i=r)})}),i}function de(t,e){let i=10**e;return Math.round(t*i)/i}function W(t){return{x:t.pageX,y:t.pageY}}function Ce(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}function Ye(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function Ae(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function He({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,c=null,p=null,E=null,v=!1,x=null,b=null,I=0,z=0,y=!1,Y=0,L=0,T=0;function N(){return j()}function D(a){let{width:h,height:f}=Ae();return xe(a,t.viewer,h,f)}function u(a){let{width:h,height:f}=Ae();return V(a,h,f,N())}function J(a,h){let f=M(t),m=D(f);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=m.minX:a===-1&&(t.viewer.photoPosX=m.maxX),h===1?t.viewer.photoPosY=m.minY:h===-1&&(t.viewer.photoPosY=m.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let R=setInterval(()=>{if(y||s||v||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=L,t.viewer.photoPosY+=T;let a=M(t);if(!a)return;let h=D(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,L*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,L*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,T*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,T*=-.2);let f=Ye(L,T),m=f.force-t.options.registance;Math.abs(m)<.5||(L=Math.cos(f.theta)*m,T=Math.sin(f.theta)*m,e.onPhotoDragMove())},t.options.forceInterval);function $(a,h){(a>5||a<-5)&&(L+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(T+=h*.05)}function K(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||y||s||v||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?$(a.gamma,a.beta):h===90?$(a.beta,a.gamma):h===-90?$(-a.beta,-a.gamma):h===180&&$(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",K,{signal:i});function B(){y=!0,s=!1,v=!1;let a=Array.from(o.values());Y=Ce(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function U(a){let h=W(a);s=!0,n=!0,c=h,p=h}function _(a){v=!0;let h=W(a);b=h,x=h}function Z(a){var h,f;try{(f=(h=a.currentTarget).setPointerCapture)==null||f.call(h,a.pointerId)}catch(m){}if(o.set(a.pointerId,W(a)),o.size>1){B();return}if(t.viewer.scale){_(a);return}U(a)}function ee(){let a=Array.from(o.values()),h=Ce(a[0],a[1]),f=(h-Y)/100,m=t.viewer.scaleSize,C=t.viewer.photoPosX,A=t.viewer.photoPosY;t.viewer.scaleSize+=de(f,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<m&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-m)*C,t.viewer.photoPosY=(1+t.viewer.scaleSize-m)*A);let X=M(t);if(X){let re=u(X);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>re}Y=h,e.onGestureMove()}function te(a){let h=W(a),f=h.x-p.x,m=h.y-c.y;n&&(e.onSwipeStart(),n=!1,E=Math.abs(f)>Math.abs(m)?"horizontal":"vertical"),E==="horizontal"?t.viewer.translateX+=f:t.viewer.translateY=m,p=h,e.onSwipeMove()}function ie(a){let h=W(a),f=h.x-b.x,m=h.y-b.y,C=de(t.viewer.scaleSize*f,6),A=de(t.viewer.scaleSize*m,6);t.viewer.photoPosX+=C,I=C,t.viewer.photoPosY+=A,z=A,b=h,e.onPhotoDragMove()}function oe(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,W(a)),y){ee();return}if(v){ie(a);return}te(a)}}function d(){y=!1;let a=M(t);if(!a)return;let h=u(a);t.viewer.scaleSize>h||(t.viewer.photoPosX=0,t.viewer.photoPosY=0,t.viewer.scale=!1,t.viewer.scaleSize=1,t.viewer.hideUi=!1,e.onGestureEnd())}function l(){var pe;s=!1;let a=c,h=p,f=Date.now(),m=r-f,C=h.x-a.x,A=h.y-a.y,X=C===0&&A===0;if(!N()&&X){e.onTap();return}if(Math.abs(m)<=500&&X){e.onTap();return}r=f;let re=(pe=H(t))!=null?pe:[];if(E==="horizontal"){let k="stay";C>=t.options.swipeOffset&&t.viewer.currentIndex!==0?k="prev":C<=-t.options.swipeOffset&&t.viewer.currentIndex!==re.length-1&&(k="next"),e.onSwipeEnd(k)}else{let k="stay";t.options.swipeBottomToClose&&A>=t.options.swipeOffset?k="close-bottom":t.options.swipeTopToClose&&A<=-t.options.swipeOffset&&(k="close-top"),e.onSwipeEnd(k)}}function P(){v=!1;let a=b,h=x;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let f=M(t);if(!f){e.onPhotoDragEnd(null);return}let m=D(f),C=t.options.swipeOffset*t.viewer.scaleSize,A=0,X=0;if(t.viewer.photoPosX>m.maxX?A=-1:t.viewer.photoPosX<m.minX&&(A=1),t.viewer.photoPosY>m.maxY?X=-1:t.viewer.photoPosY<m.minY&&(X=1),t.viewer.photoPosX-m.maxX>C&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(m.minX-t.viewer.photoPosX>C&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}A===0&&X===0?(L=I/5,T=z/5):J(A,X),e.onPhotoDragEnd(null)}function g(a){if(o.delete(a.pointerId),y){o.size<2&&d();return}if(v){P();return}s&&l()}function w(...a){for(let h of a)h.addEventListener("pointerdown",Z,{signal:i}),h.addEventListener("pointermove",oe,{signal:i}),h.addEventListener("pointerup",g,{signal:i}),h.addEventListener("pointercancel",g,{signal:i})}function S(){clearInterval(R)}return{attach:w,detach:S}}function q(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function ce(){let t=document.createElement("button");return t.type="button",t}function Ne(t){return t.replace(/"/g,'\\"')}function Me({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let c=document.createElement("dialog");c.className=r.smartPhoto,c.setAttribute("aria-labelledby",`smartphoto-${t}-title`),c.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let E=document.createElement("div");E.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let x=document.createElement("span");x.className=r.smartPhotoCount;let b=document.createElement("h1");b.id=`smartphoto-${t}-title`,b.className=r.smartPhotoCaption,b.setAttribute("tabindex","-1");let I=document.createElement("button");I.className=r.smartPhotoDismiss,I.appendChild(q(s.closeDialog)),I.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(x,b,I);let z=document.createElement("div");z.className=r.smartPhotoContent,z.addEventListener("click",d=>{d.target===z&&i.onBackdropClick()},{signal:o});let y=document.createElement("ul");y.className=r.smartPhotoList,y.setAttribute("role","region"),y.setAttribute("aria-roledescription","carousel"),y.setAttribute("aria-label",s.carouselLabel),y.setAttribute("aria-live","polite"),y.setAttribute("aria-atomic","false"),E.append(v,z,y);let Y=null,L=null,T=null;if(e.arrows){Y=document.createElement("ul"),Y.className=r.smartPhotoArrows,L=document.createElement("li"),L.className=r.smartPhotoArrowLeft;let d=ce();d.appendChild(q(s.gotoPrevImage)),d.addEventListener("click",()=>i.onPrev(),{signal:o}),L.appendChild(d),T=document.createElement("li"),T.className=r.smartPhotoArrowRight;let l=ce();l.appendChild(q(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),T.appendChild(l),Y.append(L,T),E.appendChild(Y)}let N=null,D=null;e.nav&&(N=document.createElement("nav"),N.className=r.smartPhotoNav,N.setAttribute("aria-label","Choose slide to display"),D=document.createElement("ul"),N.appendChild(D),E.appendChild(N)),p.appendChild(E),c.appendChild(p),n.appendChild(c);let u={dialog:c,count:x,caption:b,dismiss:I,content:z,list:y,arrows:Y,arrowLeft:L,arrowRight:T,nav:N,navList:D,slides:new Map,imgClone:null};function J(){let d=document.createElement("div");d.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,d.appendChild(l),d}function R(d){var g,w;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let P=document.createElement("img");return P.className=r.smartPhotoImg,P.src=(g=d.src)!=null?g:"",P.alt=(w=d.alt)!=null?w:"",P.addEventListener("dragstart",S=>S.preventDefault(),{signal:o}),l.appendChild(P),{imgWrap:l,img:P}}function $(d,l){var P;u.list.replaceChildren(),(P=u.navList)==null||P.replaceChildren(),u.slides=new Map,d.forEach(g=>{var a,h;let w=document.createElement("li");w.setAttribute("role","group"),w.setAttribute("aria-roledescription","slide"),w.setAttribute("aria-label",`${g.index+1} of ${d.length}`);let S={li:w,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(g.processed){let{imgWrap:f,img:m}=R(g);w.appendChild(f),S.imgWrap=f,S.img=m}else{let f=J();w.appendChild(f),S.loaderWrap=f}if(u.list.appendChild(w),u.slides.set(g,S),u.navList){let f=document.createElement("li"),m=ce();m.style.backgroundImage=`url("${Ne((a=g.thumb)!=null?a:"")}")`;let C=g.index;m.addEventListener("click",()=>i.onNavigate(C),{signal:o}),m.appendChild(q(`go to ${(h=g.caption)!=null?h:""}`)),f.appendChild(m),u.navList.appendChild(f),S.navLink=m}}),U(l)}function K(d,l){var w;if(l.imgWrap||!d.processed)return l;let{imgWrap:P,img:g}=R(d);return(w=l.loaderWrap)==null||w.replaceWith(P),l.loaderWrap=null,l.imgWrap=P,l.img=g,l}function B(d){d&&document.activeElement&&d.contains(document.activeElement)&&u.caption.focus()}function U(d){let{viewer:l}=d;u.count.textContent=`${l.currentIndex+1}/${l.total}`,u.slides.forEach((P,g)=>{var a;let w=K(g,P),S=g.index===l.currentIndex;w.li.style.transform=`translate(${g.translateX}px,${g.translateY}px)`,w.li.classList.toggle("current",S),S?w.li.removeAttribute("aria-hidden"):w.li.setAttribute("aria-hidden","true"),S&&(u.caption.textContent=(a=g.caption)!=null?a:""),w.imgWrap&&w.img&&(w.imgWrap.style.transform=`translate(${g.x}px,${g.y}px) scale(${g.scale})`,w.img.style.width=`${g.width}px`,w.img.classList.toggle("active",l.appear),w.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),w.navLink&&(w.navLink.classList.toggle("current",S),S?w.navLink.setAttribute("aria-current","true"):w.navLink.removeAttribute("aria-current"))}),u.arrowLeft&&(l.showPrevArrow?u.arrowLeft.removeAttribute("aria-hidden"):(B(u.arrowLeft),u.arrowLeft.setAttribute("aria-hidden","true"))),u.arrowRight&&(l.showNextArrow?u.arrowRight.removeAttribute("aria-hidden"):(B(u.arrowRight),u.arrowRight.setAttribute("aria-hidden","true"))),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function _(d){for(let[l,P]of u.slides)if(l.index===d.viewer.currentIndex)return P;return null}function Z(d){let{viewer:l}=d,P=_(d),g=P==null?void 0:P.img;g&&(g.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,g.classList.toggle(r.smartPhotoImgOnMove,l.scale),g.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ee(d){let{viewer:l}=d;u.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,u.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function te(d){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=d.img,l.style.width=`${d.width}px`,l.style.height=`${d.height}px`,l.style.transform=`translate(${d.left}px,${d.top}px) scale(1)`,p.appendChild(l),u.imgClone=l}function ie(){var d;(d=u.imgClone)==null||d.remove(),u.imgClone=null}function oe(){n.remove()}return{root:n,refs:u,render:U,syncSlides:$,updatePhotoTransform:Z,updateListTransform:ee,showAppearEffect:te,removeAppearEffect:ie,destroy:oe}}function O(){return document.documentElement.clientWidth}function G(){return document.documentElement.clientHeight}function Be(t){return t.length>0&&t[0]instanceof Element}function De(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function ze(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var F=class{constructor(e,i){this.id=De();this.abortController=new AbortController;this.isSmartPhoneFlag=j();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.handleResize=()=>{H(this.state)&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleKeydown=e=>{if(!this.state.viewer.isOpen)return;let i=e.keyCode||e.which;i===37?this.gotoSlide(this.state.viewer.prev):i===39?this.gotoSlide(this.state.viewer.next):i===27&&this.hidePhoto()};this.handleOrientationChange=()=>{if(!H(this.state))return;this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=O(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==O()?(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.state=Pe(i!=null?i:{}),this.view=Me({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=He({state:this.state,callbacks:this.buildGestureCallbacks()},{signal:this.abortController.signal}),this.gestures.attach(this.view.refs.content,this.view.refs.list),this.view.refs.dialog.addEventListener("close",()=>{!this.isFiringPublicCloseEvent&&this.state.viewer.isOpen&&this.hidePhoto()},{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&(o.element?ne(o.element,"click"):this.openPhoto(o,null)),!this.isSmartPhoneFlag){window.addEventListener("resize",this.handleResize,{signal:this.abortController.signal}),window.addEventListener("keydown",this.handleKeydown,{signal:this.abortController.signal});return}window.addEventListener("orientationchange",this.handleOrientationChange,{signal:this.abortController.signal})}on(e,i){let o=this.view.refs.dialog,r=s=>i.call(o,s);o.addEventListener(e,r,{signal:this.abortController.signal})}destroy(){this.state.viewer.isOpen=!1,this.view.refs.dialog.open&&this.view.refs.dialog.close(),this.abortController.abort(),this.timeouts.forEach(e=>{clearTimeout(e)}),this.timeouts=[],this.gestures.detach(),this.view.destroy()}[Symbol.dispose](){this.destroy()}gotoSlide(e){this.state.viewer.currentIndex=Number.parseInt(String(e),10),this.state.viewer.currentIndex||(this.state.viewer.currentIndex=0),this.slideList()}hidePhoto(e="bottom"){var o;if(!this.state.viewer.isOpen)return;this.state.viewer.isOpen=!1,this.state.viewer.appear=!1,this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.scaleSize=1;let i=ze();location.hash&&this.setHash(""),window.scroll(i.x,i.y),this.syncDialog(),(o=this.lastTriggerElement)!=null&&o.isConnected&&this.lastTriggerElement.focus(),this.lastTriggerElement=null,this.doHideEffect(e).then(()=>{this.view.render(this.state),this.isFiringPublicCloseEvent=!0,this.fireEvent("close"),this.isFiringPublicCloseEvent=!1})}zoomPhoto(){let e=M(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=V(e,O(),G(),this.isSmartPhoneFlag),!(this.state.viewer.scaleSize<=1)&&(this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.scheduleTimeout(()=>{this.state.viewer.scale=!0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomin")},300)))}zoomOutPhoto(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomout")}addNewItem(e){return this.addItem(e)}show(e=0,i={}){var p,E,v;let o=(p=i.group)!=null?p:this.state.viewer.currentGroup;if(o===null)return;let r=this.state.groups.get(o);if(!(r!=null&&r.length))return;let s=typeof e=="number"?r[e]:r.find(x=>x.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,c=(v=(E=i.trigger)!=null?E:s.element)!=null?v:n;this.openPhoto(s,c)}hide(){this.hidePhoto()}next(){this.state.viewer.showNextArrow&&this.gotoSlide(this.state.viewer.next)}prev(){this.state.viewer.showPrevArrow&&this.gotoSlide(this.state.viewer.prev)}addItem(e){let i=e instanceof Element?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!Be(e)){e.forEach(o=>{this.addSlideItem(o)});return}Array.from(typeof e=="string"?document.querySelectorAll(e):e).forEach(o=>{this.addElementItem(o)})}addElementItem(e){var s,n;let i=ae(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=be(e,this.state.options,o,O());return he(this.state,r),this.loadAllFired.delete(i),this.bindThumbnailClick(e,r),r}addSlideItem(e){var s,n;let i=le(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=ye(e,o,O());return he(this.state,r),this.loadAllFired.delete(i),r}bindThumbnailClick(e,i){e.addEventListener("click",o=>{o.preventDefault(),this.openPhoto(i,e)},{signal:this.abortController.signal})}syncCurrentGroupView(){let e=H(this.state);e&&(this.view.syncSlides(e,this.state),this.syncedGroupId=this.state.viewer.currentGroup)}setHash(e){var o;if(!((o=window.history)!=null&&o.pushState)||!this.state.options.useHistoryApi)return;let i=`${location.pathname}${location.search}`;window.history.replaceState(null,"",e?`${i}#${e}`:i)}setHashByCurrentIndex(){let e=ze();this.setHash(Le(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?Te(this.state,we(e)):null}setPosByCurrentIndex(){let e=M(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=H(this.state);e&&Ie(e,O(),G(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){Se(H(this.state),O())}currentImgElement(){for(let[e,i]of this.view.refs.slides)if(e.index===this.state.viewer.currentIndex)return i.img;return null}syncDialog(){let{dialog:e,caption:i}=this.view.refs;this.state.viewer.isOpen&&!e.open?(e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&e.close()}commit(){this.view.render(this.state),this.syncDialog()}initPhoto(){var i;(i=this.finishHideEffect)==null||i.call(this),this.view.refs.dialog.style.opacity="";let e=H(this.state);if(this.state.viewer.total=e.length,this.state.viewer.isOpen=!0,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.setPosByCurrentIndex(),this.setSizeByScreen(),ue(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=M(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=V(o,O(),G(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,c;let i="smartphoto-hero",o=(n=e==null?void 0:e.querySelector("img"))!=null?n:null;o&&(o.style.viewTransitionName=i);let r=()=>{o&&(o.style.viewTransitionName="");let p=this.currentImgElement();p&&(p.style.viewTransitionName="")},s=(c=document.startViewTransition)==null?void 0:c.call(document,()=>{this.initPhoto(),this.state.viewer.appear=!0,this.commit(),o&&(o.style.viewTransitionName=""),this.currentImgElement().style.viewTransitionName=i});s==null||s.ready.catch(()=>{r()}),s==null||s.finished.then(r,r)}addAppearEffect(e,i){var z;let o=(z=e==null?void 0:e.querySelector("img"))!=null?z:null;if(!o){this.state.viewer.appear=!0;return}let r=ge(o),s=o.offsetWidth,n=o.offsetHeight,c=O(),p=G(),E=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=c/s:(s>=n?i.height<E?v=i.width/s:v=E/n:i.height<E?v=i.height/n:v=E/n,s*v>c&&(v=c/s));let x=(v-1)/2*s+(c-s*v)/2,b=(v-1)/2*n+(p-n*v)/2,I=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:I||i.src||"",afterX:x,afterY:b,scale:v}}runAppearEffect(e){this.view.showAppearEffect(e);let i=this.view.refs.imgClone;return new Promise(o=>{let r=()=>{i.removeEventListener("transitionend",r,!0),o()};i.addEventListener("transitionend",r,!0),this.scheduleTimeout(()=>{i.style.transform=`translate(${e.afterX}px, ${e.afterY}px) scale(${e.scale})`},10)})}doOpen(e,i){if(this.state.options.showAnimation!==!1&&this.supportsViewTransition())this.openPhotoWithViewTransition(e);else if(this.state.options.showAnimation===!1)this.initPhoto(),this.state.viewer.appear=!0,this.commit();else{this.initPhoto(),this.addAppearEffect(e,i),this.commit();let o=this.state.viewer.appearEffect;o&&this.runAppearEffect(o).then(()=>{this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.appear=!0,this.commit()})}this.fireEvent("open"),this.resyncSizeAfterOpen()}resyncSizeAfterOpen(){let e=O(),i=G();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(O()===e&&G()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,this.syncedGroupId!==e.groupId&&this.syncCurrentGroupView(),this.setHashByCurrentIndex(),e.loaded?this.doOpen(i,e):this.loadItem(e).then(()=>{this.doOpen(i,e)})}doHideEffect(e){return new Promise(i=>{let o=this.view.refs.dialog,r=this.currentImgElement(),s=G(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,c=()=>{this.finishHideEffect===c&&(this.finishHideEffect=null,o.removeEventListener("transitionend",c,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=c,r&&(r.style.transform=n),o.addEventListener("transitionend",c,!0),this.scheduleTimeout(c,this.state.options.animationSpeed+100)})}loadItem(e){return new Promise(i=>{var r;let o=new Image;o.onload=()=>{e.width=o.width,e.height=o.height,e.loaded=!0,this.checkLoadAll(e.groupId),i()},o.onerror=()=>i(),o.src=(r=e.src)!=null?r:""})}checkLoadAll(e){if(this.loadAllFired.has(e))return;let i=this.state.groups.get(e);i!=null&&i.length&&i.every(o=>o.loaded)&&(this.loadAllFired.add(e),this.fireEvent("loadall"))}loadNeighborItems(){let e=H(this.state);if(!e)return;let{currentIndex:i}=this.state.viewer,{loadOffset:o}=this.state.options,r=[];for(let s=i-o;s<i+o;s++){let n=e[s];n&&!n.loaded&&r.push(this.loadItem(n))}r.length&&Promise.all(r).then(()=>{this.initPhoto(),this.commit()})}slideList(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.state.viewer.onMove=!0,this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=M(this.state);this.state.viewer.onMove=!1,ue(this.state),this.commit(),this.state.viewer.oldIndex!==this.state.viewer.currentIndex&&this.fireEvent("change"),this.state.viewer.oldIndex=this.state.viewer.currentIndex,this.loadNeighborItems(),e&&!e.loaded&&this.loadItem(e).then(()=>{this.initPhoto(),this.commit()})},200)}scheduleTimeout(e,i){let o=window.setTimeout(()=>{this.timeouts=this.timeouts.filter(r=>r!==o),e()},i);return this.timeouts.push(o),o}fireEvent(e){ne(this.view.refs.dialog,e)}buildViewHandlers(){return{onDismiss:()=>this.hidePhoto(),onPrev:()=>this.prev(),onNext:()=>this.next(),onNavigate:e=>this.gotoSlide(e),onBackdropClick:()=>this.hidePhoto()}}buildGestureCallbacks(){return{onSwipeStart:()=>this.fireEvent("swipestart"),onSwipeMove:()=>this.view.updateListTransform(this.state),onSwipeEnd:e=>{if(this.fireEvent("swipeend"),e==="close-bottom"){this.hidePhoto("bottom");return}if(e==="close-top"){this.hidePhoto("top");return}e==="prev"?this.state.viewer.currentIndex-=1:e==="next"&&(this.state.viewer.currentIndex+=1),this.slideList()},onTap:()=>this.zoomPhoto(),onGestureStart:()=>{this.fireEvent("gesturestart"),this.view.updatePhotoTransform(this.state)},onGestureMove:()=>this.view.updatePhotoTransform(this.state),onGestureEnd:()=>{this.fireEvent("gestureend"),this.view.updatePhotoTransform(this.state)},onPhotoDragMove:()=>this.view.updatePhotoTransform(this.state),onPhotoDragEnd:e=>{if(e==="zoom-out"){this.zoomOutPhoto();return}if(e==="prev"){this.gotoSlide(this.state.viewer.prev);return}if(e==="next"){this.gotoSlide(this.state.viewer.next);return}this.view.updatePhotoTransform(this.state)}}}};var Oe=F;var me=t=>{t.fn.SmartPhoto=function(e){return typeof e=="string"||new Oe(this,e),this}};if(typeof define=="function"&&define.amd)define(["jquery"],me);else{let t=window,e=t.jQuery?t.jQuery:t.$;typeof e!="undefined"&&me(e)}var Je=me;})();
6
+ "use strict";(()=>{var j=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function fe(t,...e){var i;t=t||{};for(let o=0;o<e.length;o++){let r=e[o];if(r){for(let s in r)if(Object.hasOwn(r,s)){let n=r[s];n&&typeof n=="object"?t[s]=fe((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var ve=fe,ne=(t,e,i)=>{let o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,i)),t.dispatchEvent(o)},we=t=>{let e={};for(let i of t.split("&")){let o=i.split("="),r=o[0],s=o.length>1?o.slice(1).join("="):r;e[r]=decodeURIComponent(s)}return e},ge=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var Xe={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog",carouselLabel:"Images"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:300};function Ee(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Ee(i)}),Object.freeze(t)}function Pe(t){return{options:Ee(ve({},Xe,t)),viewer:{isOpen:!1,currentGroup:null,currentIndex:0,oldIndex:0,total:0,translateX:0,translateY:0,photoPosX:0,photoPosY:0,scaleSize:1,scale:!1,elastic:!1,hideUi:!1,onMove:!1,appear:!1,appearEffect:null,prev:-1,next:-1,showPrevArrow:!1,showNextArrow:!1},groups:new Map}}function ae(t){return t.getAttribute("data-group")||"nogroup"}function le(t){return t.group||"nogroup"}function be(t,e,i,o){let r=ae(t),s=t.getAttribute("href"),n=t.querySelector("img"),c=s;n&&(n.getAttribute(e.lazyAttribute)?c=n.getAttribute(e.lazyAttribute):n.currentSrc?c=n.currentSrc:c=n.src);let p="";n!=null&&n.getAttribute("alt")?p=n.getAttribute("alt"):t.getAttribute("data-caption")?p=t.getAttribute("data-caption"):p=s!=null?s:"";let E=t.getAttribute("data-id");return{src:s,thumb:c,caption:t.getAttribute("data-caption"),alt:p,groupId:r,translateX:o*i,translateY:0,index:i,width:50,height:50,scale:1,x:0,y:0,id:E||i,loaded:!1,processed:!1,element:t}}function ye(t,e,i){var E,v,x,b,I;let o=le(t),r=t.src,s=(E=t.thumb)!=null?E:r,n=(v=t.caption)!=null?v:null,c=(b=(x=t.alt)!=null?x:n)!=null?b:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:c,groupId:o,translateX:i*e,translateY:0,index:e,width:p?t.width:50,height:p?t.height:50,scale:1,x:0,y:0,id:(I=t.id)!=null?I:e,loaded:p,processed:!1,element:null}}function he(t,e){t.groups.has(e.groupId)||t.groups.set(e.groupId,[]),t.groups.get(e.groupId).push(e),t.viewer.currentGroup=e.groupId}function H(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function M(t){var i;let e=H(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function ue(t){let e=H(t);if(!e)return;let i=e.length,o=t.viewer.currentIndex+1,r=t.viewer.currentIndex-1;t.viewer.showNextArrow=!1,t.viewer.showPrevArrow=!1,o!==i&&(t.viewer.next=o,t.viewer.showNextArrow=!0),r!==-1&&(t.viewer.prev=r,t.viewer.showPrevArrow=!0)}function Se(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function Q(t,e){let i=10**e;return Math.round(t*i)/i}function W(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function xe(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,c,p,E;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(E=(o-s)/2,c=-1*E):(E=(s-o)/2,c=-1*E),{minX:Q(n,6)*e.scaleSize,minY:Q(c,6)*e.scaleSize,maxX:Q(p,6)*e.scaleSize,maxY:Q(E,6)*e.scaleSize}}function Ie(t,e,i,o,r){let s=i-(o+r);t.forEach(n=>{n.loaded&&(n.processed=!0,n.scale=s/n.height,n.height<s&&(n.scale=1),n.x=(n.scale-1)/2*n.width+(e-n.width*n.scale)/2,n.y=(n.scale-1)/2*n.height+(i-n.height*n.scale)/2,n.width*n.scale>e&&(n.scale=e/n.width,n.x=(n.scale-1)/2*n.width))})}function Le(t){let e=M(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function Ce(t,e){let i=null;return t.groups.forEach(o=>{o.forEach(r=>{e.group===r.groupId&&e.photo===r.id&&(i=r)})}),i}function de(t,e){let i=10**e;return Math.round(t*i)/i}function $(t){return{x:t.pageX,y:t.pageY}}function Te(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}function Ye(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function Ae(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function He({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,c=null,p=null,E=null,v=!1,x=null,b=null,I=0,z=0,y=!1,Y=0,L=0,C=0;function N(){return j()}function k(a){let{width:h,height:f}=Ae();return xe(a,t.viewer,h,f)}function u(a){let{width:h,height:f}=Ae();return W(a,h,f,N())}function J(a,h){let f=M(t),m=k(f);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=m.minX:a===-1&&(t.viewer.photoPosX=m.maxX),h===1?t.viewer.photoPosY=m.minY:h===-1&&(t.viewer.photoPosY=m.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let R=setInterval(()=>{if(y||s||v||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=L,t.viewer.photoPosY+=C;let a=M(t);if(!a)return;let h=k(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,L*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,L*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,C*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,C*=-.2);let f=Ye(L,C),m=f.force-t.options.registance;Math.abs(m)<.5||(L=Math.cos(f.theta)*m,C=Math.sin(f.theta)*m,e.onPhotoDragMove())},t.options.forceInterval);function G(a,h){(a>5||a<-5)&&(L+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(C+=h*.05)}function K(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||y||s||v||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?G(a.gamma,a.beta):h===90?G(a.beta,a.gamma):h===-90?G(-a.beta,-a.gamma):h===180&&G(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",K,{signal:i});function B(){y=!0,s=!1,v=!1;let a=Array.from(o.values());Y=Te(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function U(a){let h=$(a);s=!0,n=!0,c=h,p=h}function _(a){v=!0;let h=$(a);b=h,x=h}function Z(a){var h,f;try{(f=(h=a.currentTarget).setPointerCapture)==null||f.call(h,a.pointerId)}catch(m){}if(o.set(a.pointerId,$(a)),o.size>1){B();return}if(t.viewer.scale){_(a);return}U(a)}function ee(){let a=Array.from(o.values()),h=Te(a[0],a[1]),f=(h-Y)/100,m=t.viewer.scaleSize,T=t.viewer.photoPosX,A=t.viewer.photoPosY;t.viewer.scaleSize+=de(f,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<m&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-m)*T,t.viewer.photoPosY=(1+t.viewer.scaleSize-m)*A);let X=M(t);if(X){let re=u(X);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>re}Y=h,e.onGestureMove()}function te(a){let h=$(a),f=h.x-p.x,m=h.y-c.y;n&&(e.onSwipeStart(),n=!1,E=Math.abs(f)>Math.abs(m)?"horizontal":"vertical"),E==="horizontal"?t.viewer.translateX+=f:t.viewer.translateY=m,p=h,e.onSwipeMove()}function ie(a){let h=$(a),f=h.x-b.x,m=h.y-b.y,T=de(t.viewer.scaleSize*f,6),A=de(t.viewer.scaleSize*m,6);t.viewer.photoPosX+=T,I=T,t.viewer.photoPosY+=A,z=A,b=h,e.onPhotoDragMove()}function oe(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,$(a)),y){ee();return}if(v){ie(a);return}te(a)}}function d(){y=!1;let a=M(t);if(!a)return;let h=u(a);t.viewer.scaleSize>h||(t.viewer.photoPosX=0,t.viewer.photoPosY=0,t.viewer.scale=!1,t.viewer.scaleSize=1,t.viewer.hideUi=!1,e.onGestureEnd())}function l(){var pe;s=!1;let a=c,h=p,f=Date.now(),m=r-f,T=h.x-a.x,A=h.y-a.y,X=T===0&&A===0;if(!N()&&X){e.onTap();return}if(Math.abs(m)<=500&&X){e.onTap();return}r=f;let re=(pe=H(t))!=null?pe:[];if(E==="horizontal"){let V="stay";T>=t.options.swipeOffset&&t.viewer.currentIndex!==0?V="prev":T<=-t.options.swipeOffset&&t.viewer.currentIndex!==re.length-1&&(V="next"),e.onSwipeEnd(V)}else{let V="stay";t.options.swipeBottomToClose&&A>=t.options.swipeOffset?V="close-bottom":t.options.swipeTopToClose&&A<=-t.options.swipeOffset&&(V="close-top"),e.onSwipeEnd(V)}}function P(){v=!1;let a=b,h=x;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let f=M(t);if(!f){e.onPhotoDragEnd(null);return}let m=k(f),T=t.options.swipeOffset*t.viewer.scaleSize,A=0,X=0;if(t.viewer.photoPosX>m.maxX?A=-1:t.viewer.photoPosX<m.minX&&(A=1),t.viewer.photoPosY>m.maxY?X=-1:t.viewer.photoPosY<m.minY&&(X=1),t.viewer.photoPosX-m.maxX>T&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(m.minX-t.viewer.photoPosX>T&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}A===0&&X===0?(L=I/5,C=z/5):J(A,X),e.onPhotoDragEnd(null)}function g(a){if(o.delete(a.pointerId),y){o.size<2&&d();return}if(v){P();return}s&&l()}function w(...a){for(let h of a)h.addEventListener("pointerdown",Z,{signal:i}),h.addEventListener("pointermove",oe,{signal:i}),h.addEventListener("pointerup",g,{signal:i}),h.addEventListener("pointercancel",g,{signal:i})}function S(){clearInterval(R)}return{attach:w,detach:S}}function q(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function ce(){let t=document.createElement("button");return t.type="button",t}function Ne(t){return t.replace(/"/g,'\\"')}function Me({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let c=document.createElement("dialog");c.className=r.smartPhoto,c.setAttribute("aria-labelledby",`smartphoto-${t}-title`),c.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let E=document.createElement("div");E.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let x=document.createElement("span");x.className=r.smartPhotoCount;let b=document.createElement("h1");b.id=`smartphoto-${t}-title`,b.className=r.smartPhotoCaption,b.setAttribute("tabindex","-1");let I=document.createElement("button");I.className=r.smartPhotoDismiss,I.appendChild(q(s.closeDialog)),I.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(x,b,I);let z=document.createElement("div");z.className=r.smartPhotoContent,z.addEventListener("click",d=>{d.target===z&&i.onBackdropClick()},{signal:o});let y=document.createElement("ul");y.className=r.smartPhotoList,y.setAttribute("role","region"),y.setAttribute("aria-roledescription","carousel"),y.setAttribute("aria-label",s.carouselLabel),y.setAttribute("aria-live","polite"),y.setAttribute("aria-atomic","false"),E.append(v,z,y);let Y=null,L=null,C=null;if(e.arrows){Y=document.createElement("ul"),Y.className=r.smartPhotoArrows,L=document.createElement("li"),L.className=r.smartPhotoArrowLeft;let d=ce();d.appendChild(q(s.gotoPrevImage)),d.addEventListener("click",()=>i.onPrev(),{signal:o}),L.appendChild(d),C=document.createElement("li"),C.className=r.smartPhotoArrowRight;let l=ce();l.appendChild(q(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),C.appendChild(l),Y.append(L,C),E.appendChild(Y)}let N=null,k=null;e.nav&&(N=document.createElement("nav"),N.className=r.smartPhotoNav,N.setAttribute("aria-label","Choose slide to display"),k=document.createElement("ul"),N.appendChild(k),E.appendChild(N)),p.appendChild(E),c.appendChild(p),n.appendChild(c);let u={dialog:c,count:x,caption:b,dismiss:I,content:z,list:y,arrows:Y,arrowLeft:L,arrowRight:C,nav:N,navList:k,slides:new Map,imgClone:null};function J(){let d=document.createElement("div");d.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,d.appendChild(l),d}function R(d){var g,w;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let P=document.createElement("img");return P.className=r.smartPhotoImg,P.src=(g=d.src)!=null?g:"",P.alt=(w=d.alt)!=null?w:"",P.addEventListener("dragstart",S=>S.preventDefault(),{signal:o}),l.appendChild(P),{imgWrap:l,img:P}}function G(d,l){var P;u.list.replaceChildren(),(P=u.navList)==null||P.replaceChildren(),u.slides=new Map,d.forEach(g=>{var a,h;let w=document.createElement("li");w.setAttribute("role","group"),w.setAttribute("aria-roledescription","slide"),w.setAttribute("aria-label",`${g.index+1} of ${d.length}`);let S={li:w,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(g.processed){let{imgWrap:f,img:m}=R(g);w.appendChild(f),S.imgWrap=f,S.img=m}else{let f=J();w.appendChild(f),S.loaderWrap=f}if(u.list.appendChild(w),u.slides.set(g,S),u.navList){let f=document.createElement("li"),m=ce();m.style.backgroundImage=`url("${Ne((a=g.thumb)!=null?a:"")}")`;let T=g.index;m.addEventListener("click",()=>i.onNavigate(T),{signal:o}),m.appendChild(q(`go to ${(h=g.caption)!=null?h:""}`)),f.appendChild(m),u.navList.appendChild(f),S.navLink=m}}),U(l)}function K(d,l){var w;if(l.imgWrap||!d.processed)return l;let{imgWrap:P,img:g}=R(d);return(w=l.loaderWrap)==null||w.replaceWith(P),l.loaderWrap=null,l.imgWrap=P,l.img=g,l}function B(d){d&&document.activeElement&&d.contains(document.activeElement)&&u.caption.focus()}function U(d){let{viewer:l}=d;u.count.textContent=`${l.currentIndex+1}/${l.total}`,u.slides.forEach((P,g)=>{var a;let w=K(g,P),S=g.index===l.currentIndex;w.li.style.transform=`translate(${g.translateX}px,${g.translateY}px)`,w.li.classList.toggle("current",S),S?w.li.removeAttribute("aria-hidden"):w.li.setAttribute("aria-hidden","true"),S&&(u.caption.textContent=(a=g.caption)!=null?a:""),w.imgWrap&&w.img&&(w.imgWrap.style.transform=`translate(${g.x}px,${g.y}px) scale(${g.scale})`,w.img.style.width=`${g.width}px`,w.img.classList.toggle("active",l.appear),w.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),w.navLink&&(w.navLink.classList.toggle("current",S),S?w.navLink.setAttribute("aria-current","true"):w.navLink.removeAttribute("aria-current"))}),u.arrowLeft&&(l.showPrevArrow?u.arrowLeft.removeAttribute("aria-hidden"):(B(u.arrowLeft),u.arrowLeft.setAttribute("aria-hidden","true"))),u.arrowRight&&(l.showNextArrow?u.arrowRight.removeAttribute("aria-hidden"):(B(u.arrowRight),u.arrowRight.setAttribute("aria-hidden","true"))),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function _(d){for(let[l,P]of u.slides)if(l.index===d.viewer.currentIndex)return P;return null}function Z(d){let{viewer:l}=d,P=_(d),g=P==null?void 0:P.img;g&&(g.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,g.classList.toggle(r.smartPhotoImgOnMove,l.scale),g.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ee(d){let{viewer:l}=d;u.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,u.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function te(d){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=d.img,l.style.width=`${d.width}px`,l.style.height=`${d.height}px`,l.style.transform=`translate(${d.left}px,${d.top}px) scale(1)`,p.appendChild(l),u.imgClone=l}function ie(){var d;(d=u.imgClone)==null||d.remove(),u.imgClone=null}function oe(){n.remove()}return{root:n,refs:u,render:U,syncSlides:G,updatePhotoTransform:Z,updateListTransform:ee,showAppearEffect:te,removeAppearEffect:ie,destroy:oe}}function O(){return document.documentElement.clientWidth}function D(){var t,e;return(e=(t=window.visualViewport)==null?void 0:t.height)!=null?e:document.documentElement.clientHeight}function Be(t){return t.length>0&&t[0]instanceof Element}function De(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function ze(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var F=class{constructor(e,i){this.id=De();this.abortController=new AbortController;this.isSmartPhoneFlag=j();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${D()}px`)};this.handleResize=()=>{H(this.state)&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleKeydown=e=>{if(!this.state.viewer.isOpen)return;let i=e.keyCode||e.which;i===37?this.gotoSlide(this.state.viewer.prev):i===39?this.gotoSlide(this.state.viewer.next):i===27&&this.hidePhoto()};this.handleOrientationChange=()=>{if(!H(this.state))return;this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=O(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==O()?(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.state=Pe(i!=null?i:{}),this.view=Me({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=He({state:this.state,callbacks:this.buildGestureCallbacks()},{signal:this.abortController.signal}),this.gestures.attach(this.view.refs.content,this.view.refs.list),this.view.refs.dialog.addEventListener("close",()=>{!this.isFiringPublicCloseEvent&&this.state.viewer.isOpen&&this.hidePhoto()},{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&(o.element?ne(o.element,"click"):this.openPhoto(o,null)),this.updateViewportHeight(),window.visualViewport?window.visualViewport.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}):window.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}),!this.isSmartPhoneFlag){window.addEventListener("resize",this.handleResize,{signal:this.abortController.signal}),window.addEventListener("keydown",this.handleKeydown,{signal:this.abortController.signal});return}window.addEventListener("orientationchange",this.handleOrientationChange,{signal:this.abortController.signal})}on(e,i){let o=this.view.refs.dialog,r=s=>i.call(o,s);o.addEventListener(e,r,{signal:this.abortController.signal})}destroy(){this.state.viewer.isOpen=!1,this.view.refs.dialog.open&&this.view.refs.dialog.close(),this.abortController.abort(),this.timeouts.forEach(e=>{clearTimeout(e)}),this.timeouts=[],this.gestures.detach(),this.view.destroy()}[Symbol.dispose](){this.destroy()}gotoSlide(e){this.state.viewer.currentIndex=Number.parseInt(String(e),10),this.state.viewer.currentIndex||(this.state.viewer.currentIndex=0),this.slideList()}hidePhoto(e="bottom"){var o;if(!this.state.viewer.isOpen)return;this.state.viewer.isOpen=!1,this.state.viewer.appear=!1,this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.scaleSize=1;let i=ze();location.hash&&this.setHash(""),window.scroll(i.x,i.y),this.syncDialog(),(o=this.lastTriggerElement)!=null&&o.isConnected&&this.lastTriggerElement.focus(),this.lastTriggerElement=null,this.doHideEffect(e).then(()=>{this.view.render(this.state),this.isFiringPublicCloseEvent=!0,this.fireEvent("close"),this.isFiringPublicCloseEvent=!1})}zoomPhoto(){let e=M(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=W(e,O(),D(),this.isSmartPhoneFlag),!(this.state.viewer.scaleSize<=1)&&(this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.scheduleTimeout(()=>{this.state.viewer.scale=!0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomin")},300)))}zoomOutPhoto(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomout")}addNewItem(e){return this.addItem(e)}show(e=0,i={}){var p,E,v;let o=(p=i.group)!=null?p:this.state.viewer.currentGroup;if(o===null)return;let r=this.state.groups.get(o);if(!(r!=null&&r.length))return;let s=typeof e=="number"?r[e]:r.find(x=>x.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,c=(v=(E=i.trigger)!=null?E:s.element)!=null?v:n;this.openPhoto(s,c)}hide(){this.hidePhoto()}next(){this.state.viewer.showNextArrow&&this.gotoSlide(this.state.viewer.next)}prev(){this.state.viewer.showPrevArrow&&this.gotoSlide(this.state.viewer.prev)}addItem(e){let i=e instanceof Element?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!Be(e)){e.forEach(o=>{this.addSlideItem(o)});return}Array.from(typeof e=="string"?document.querySelectorAll(e):e).forEach(o=>{this.addElementItem(o)})}addElementItem(e){var s,n;let i=ae(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=be(e,this.state.options,o,O());return he(this.state,r),this.loadAllFired.delete(i),this.bindThumbnailClick(e,r),r}addSlideItem(e){var s,n;let i=le(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=ye(e,o,O());return he(this.state,r),this.loadAllFired.delete(i),r}bindThumbnailClick(e,i){e.addEventListener("click",o=>{o.preventDefault(),this.openPhoto(i,e)},{signal:this.abortController.signal})}syncCurrentGroupView(){let e=H(this.state);e&&(this.view.syncSlides(e,this.state),this.syncedGroupId=this.state.viewer.currentGroup)}setHash(e){var o;if(!((o=window.history)!=null&&o.pushState)||!this.state.options.useHistoryApi)return;let i=`${location.pathname}${location.search}`;window.history.replaceState(null,"",e?`${i}#${e}`:i)}setHashByCurrentIndex(){let e=ze();this.setHash(Le(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?Ce(this.state,we(e)):null}setPosByCurrentIndex(){let e=M(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=H(this.state);e&&Ie(e,O(),D(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){Se(H(this.state),O())}currentImgElement(){for(let[e,i]of this.view.refs.slides)if(e.index===this.state.viewer.currentIndex)return i.img;return null}syncDialog(){let{dialog:e,caption:i}=this.view.refs;this.state.viewer.isOpen&&!e.open?(e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&e.close()}commit(){this.view.render(this.state),this.syncDialog()}initPhoto(){var i;(i=this.finishHideEffect)==null||i.call(this),this.view.refs.dialog.style.opacity="";let e=H(this.state);if(this.state.viewer.total=e.length,this.state.viewer.isOpen=!0,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.setPosByCurrentIndex(),this.setSizeByScreen(),ue(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=M(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=W(o,O(),D(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,c;document.documentElement.style.setProperty("--smartphoto-animation-speed",`${this.state.options.animationSpeed}ms`);let i="smartphoto-hero",o=(n=e==null?void 0:e.querySelector("img"))!=null?n:null;o&&(o.style.viewTransitionName=i);let r=()=>{o&&(o.style.viewTransitionName="");let p=this.currentImgElement();p&&(p.style.viewTransitionName="")},s=(c=document.startViewTransition)==null?void 0:c.call(document,()=>{this.initPhoto(),this.state.viewer.appear=!0,this.commit(),o&&(o.style.viewTransitionName=""),this.currentImgElement().style.viewTransitionName=i});s==null||s.ready.catch(()=>{r()}),s==null||s.finished.then(r,r)}addAppearEffect(e,i){var z;let o=(z=e==null?void 0:e.querySelector("img"))!=null?z:null;if(!o){this.state.viewer.appear=!0;return}let r=ge(o),s=o.offsetWidth,n=o.offsetHeight,c=O(),p=D(),E=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=c/s:(s>=n?i.height<E?v=i.width/s:v=E/n:i.height<E?v=i.height/n:v=E/n,s*v>c&&(v=c/s));let x=(v-1)/2*s+(c-s*v)/2,b=(v-1)/2*n+(p-n*v)/2,I=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:I||i.src||"",afterX:x,afterY:b,scale:v}}runAppearEffect(e){this.view.showAppearEffect(e);let i=this.view.refs.imgClone;return new Promise(o=>{let r=()=>{i.removeEventListener("transitionend",r,!0),o()};i.addEventListener("transitionend",r,!0),this.scheduleTimeout(()=>{i.style.transform=`translate(${e.afterX}px, ${e.afterY}px) scale(${e.scale})`},10)})}doOpen(e,i){if(this.state.options.showAnimation!==!1&&this.supportsViewTransition())this.openPhotoWithViewTransition(e);else if(this.state.options.showAnimation===!1)this.initPhoto(),this.state.viewer.appear=!0,this.commit();else{this.initPhoto(),this.addAppearEffect(e,i),this.commit();let o=this.state.viewer.appearEffect;o&&this.runAppearEffect(o).then(()=>{this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.appear=!0,this.commit()})}this.fireEvent("open"),this.resyncSizeAfterOpen()}resyncSizeAfterOpen(){let e=O(),i=D();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(O()===e&&D()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,this.syncedGroupId!==e.groupId&&this.syncCurrentGroupView(),this.setHashByCurrentIndex(),e.loaded?this.doOpen(i,e):this.loadItem(e).then(()=>{this.doOpen(i,e)})}doHideEffect(e){return new Promise(i=>{let o=this.view.refs.dialog,r=this.currentImgElement(),s=D(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,c=()=>{this.finishHideEffect===c&&(this.finishHideEffect=null,o.removeEventListener("transitionend",c,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=c,r&&(r.style.transform=n),o.addEventListener("transitionend",c,!0),this.scheduleTimeout(c,this.state.options.animationSpeed+100)})}loadItem(e){return new Promise(i=>{var r;let o=new Image;o.onload=()=>{e.width=o.width,e.height=o.height,e.loaded=!0,this.checkLoadAll(e.groupId),i()},o.onerror=()=>i(),o.src=(r=e.src)!=null?r:""})}checkLoadAll(e){if(this.loadAllFired.has(e))return;let i=this.state.groups.get(e);i!=null&&i.length&&i.every(o=>o.loaded)&&(this.loadAllFired.add(e),this.fireEvent("loadall"))}loadNeighborItems(){let e=H(this.state);if(!e)return;let{currentIndex:i}=this.state.viewer,{loadOffset:o}=this.state.options,r=[];for(let s=i-o;s<i+o;s++){let n=e[s];n&&!n.loaded&&r.push(this.loadItem(n))}r.length&&Promise.all(r).then(()=>{this.initPhoto(),this.commit()})}slideList(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.state.viewer.onMove=!0,this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=M(this.state);this.state.viewer.onMove=!1,ue(this.state),this.commit(),this.state.viewer.oldIndex!==this.state.viewer.currentIndex&&this.fireEvent("change"),this.state.viewer.oldIndex=this.state.viewer.currentIndex,this.loadNeighborItems(),e&&!e.loaded&&this.loadItem(e).then(()=>{this.initPhoto(),this.commit()})},200)}scheduleTimeout(e,i){let o=window.setTimeout(()=>{this.timeouts=this.timeouts.filter(r=>r!==o),e()},i);return this.timeouts.push(o),o}fireEvent(e){ne(this.view.refs.dialog,e)}buildViewHandlers(){return{onDismiss:()=>this.hidePhoto(),onPrev:()=>this.prev(),onNext:()=>this.next(),onNavigate:e=>this.gotoSlide(e),onBackdropClick:()=>this.hidePhoto()}}buildGestureCallbacks(){return{onSwipeStart:()=>this.fireEvent("swipestart"),onSwipeMove:()=>this.view.updateListTransform(this.state),onSwipeEnd:e=>{if(this.fireEvent("swipeend"),e==="close-bottom"){this.hidePhoto("bottom");return}if(e==="close-top"){this.hidePhoto("top");return}e==="prev"?this.state.viewer.currentIndex-=1:e==="next"&&(this.state.viewer.currentIndex+=1),this.slideList()},onTap:()=>this.zoomPhoto(),onGestureStart:()=>{this.fireEvent("gesturestart"),this.view.updatePhotoTransform(this.state)},onGestureMove:()=>this.view.updatePhotoTransform(this.state),onGestureEnd:()=>{this.fireEvent("gestureend"),this.view.updatePhotoTransform(this.state)},onPhotoDragMove:()=>this.view.updatePhotoTransform(this.state),onPhotoDragEnd:e=>{if(e==="zoom-out"){this.zoomOutPhoto();return}if(e==="prev"){this.gotoSlide(this.state.viewer.prev);return}if(e==="next"){this.gotoSlide(this.state.viewer.next);return}this.view.updatePhotoTransform(this.state)}}}};var Oe=F;var me=t=>{t.fn.SmartPhoto=function(e){return typeof e=="string"||new Oe(this,e),this}};if(typeof define=="function"&&define.amd)define(["jquery"],me);else{let t=window,e=t.jQuery?t.jQuery:t.$;typeof e!="undefined"&&me(e)}var Je=me;})();
package/js/smartphoto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SmartPhoto v2.1.2
2
+ * SmartPhoto v2.1.3
3
3
  * (c) appleple
4
4
  * Released under the MIT License.
5
5
  */
@@ -1099,7 +1099,8 @@ var SmartPhoto = (() => {
1099
1099
  return document.documentElement.clientWidth;
1100
1100
  }
1101
1101
  function getWindowHeight() {
1102
- return document.documentElement.clientHeight;
1102
+ var _a, _b;
1103
+ return (_b = (_a = window.visualViewport) == null ? void 0 : _a.height) != null ? _b : document.documentElement.clientHeight;
1103
1104
  }
1104
1105
  function isElementArray(source) {
1105
1106
  return source.length > 0 && source[0] instanceof Element;
@@ -1131,6 +1132,12 @@ var SmartPhoto = (() => {
1131
1132
  this.loadAllFired = /* @__PURE__ */ new Set();
1132
1133
  this.syncedGroupId = null;
1133
1134
  // ---- 内部: window イベント ----
1135
+ this.updateViewportHeight = () => {
1136
+ this.view.refs.dialog.style.setProperty(
1137
+ "--smartphoto-vh",
1138
+ `${getWindowHeight()}px`
1139
+ );
1140
+ };
1134
1141
  this.handleResize = () => {
1135
1142
  if (!currentItems(this.state)) {
1136
1143
  return;
@@ -1210,6 +1217,18 @@ var SmartPhoto = (() => {
1210
1217
  this.openPhoto(restored, null);
1211
1218
  }
1212
1219
  }
1220
+ this.updateViewportHeight();
1221
+ if (window.visualViewport) {
1222
+ window.visualViewport.addEventListener(
1223
+ "resize",
1224
+ this.updateViewportHeight,
1225
+ { signal: this.abortController.signal }
1226
+ );
1227
+ } else {
1228
+ window.addEventListener("resize", this.updateViewportHeight, {
1229
+ signal: this.abortController.signal
1230
+ });
1231
+ }
1213
1232
  if (!this.isSmartPhoneFlag) {
1214
1233
  window.addEventListener("resize", this.handleResize, {
1215
1234
  signal: this.abortController.signal
@@ -1518,6 +1537,10 @@ var SmartPhoto = (() => {
1518
1537
  }
1519
1538
  openPhotoWithViewTransition(trigger) {
1520
1539
  var _a, _b;
1540
+ document.documentElement.style.setProperty(
1541
+ "--smartphoto-animation-speed",
1542
+ `${this.state.options.animationSpeed}ms`
1543
+ );
1521
1544
  const transitionName = "smartphoto-hero";
1522
1545
  const thumbImg = (_a = trigger == null ? void 0 : trigger.querySelector("img")) != null ? _a : null;
1523
1546
  if (thumbImg) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * SmartPhoto v2.1.2
2
+ * SmartPhoto v2.1.3
3
3
  * (c) appleple
4
4
  * Released under the MIT License.
5
5
  */
6
- "use strict";var SmartPhoto=(()=>{var ne=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Xe=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Ne=(t,e)=>{for(var i in e)ne(t,i,{get:e[i],enumerable:!0})},Be=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Xe(e))!Ye.call(t,r)&&r!==i&&ne(t,r,{get:()=>e[r],enumerable:!(o=Oe(e,r))||o.enumerable});return t};var De=t=>Be(ne({},"__esModule",{value:!0}),t);var Re={};Ne(Re,{default:()=>Fe});var q=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function fe(t,...e){var i;t=t||{};for(let o=0;o<e.length;o++){let r=e[o];if(r){for(let s in r)if(Object.hasOwn(r,s)){let n=r[s];n&&typeof n=="object"?t[s]=fe((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var ve=fe,se=(t,e,i)=>{let o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,i)),t.dispatchEvent(o)},we=t=>{let e={};for(let i of t.split("&")){let o=i.split("="),r=o[0],s=o.length>1?o.slice(1).join("="):r;e[r]=decodeURIComponent(s)}return e},ge=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var Ge={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog",carouselLabel:"Images"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:300};function Ee(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Ee(i)}),Object.freeze(t)}function Pe(t){return{options:Ee(ve({},Ge,t)),viewer:{isOpen:!1,currentGroup:null,currentIndex:0,oldIndex:0,total:0,translateX:0,translateY:0,photoPosX:0,photoPosY:0,scaleSize:1,scale:!1,elastic:!1,hideUi:!1,onMove:!1,appear:!1,appearEffect:null,prev:-1,next:-1,showPrevArrow:!1,showNextArrow:!1},groups:new Map}}function le(t){return t.getAttribute("data-group")||"nogroup"}function he(t){return t.group||"nogroup"}function be(t,e,i,o){let r=le(t),s=t.getAttribute("href"),n=t.querySelector("img"),c=s;n&&(n.getAttribute(e.lazyAttribute)?c=n.getAttribute(e.lazyAttribute):n.currentSrc?c=n.currentSrc:c=n.src);let p="";n!=null&&n.getAttribute("alt")?p=n.getAttribute("alt"):t.getAttribute("data-caption")?p=t.getAttribute("data-caption"):p=s!=null?s:"";let E=t.getAttribute("data-id");return{src:s,thumb:c,caption:t.getAttribute("data-caption"),alt:p,groupId:r,translateX:o*i,translateY:0,index:i,width:50,height:50,scale:1,x:0,y:0,id:E||i,loaded:!1,processed:!1,element:t}}function ye(t,e,i){var E,v,x,b,I;let o=he(t),r=t.src,s=(E=t.thumb)!=null?E:r,n=(v=t.caption)!=null?v:null,c=(b=(x=t.alt)!=null?x:n)!=null?b:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:c,groupId:o,translateX:i*e,translateY:0,index:e,width:p?t.width:50,height:p?t.height:50,scale:1,x:0,y:0,id:(I=t.id)!=null?I:e,loaded:p,processed:!1,element:null}}function ue(t,e){t.groups.has(e.groupId)||t.groups.set(e.groupId,[]),t.groups.get(e.groupId).push(e),t.viewer.currentGroup=e.groupId}function H(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function M(t){var i;let e=H(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function de(t){let e=H(t);if(!e)return;let i=e.length,o=t.viewer.currentIndex+1,r=t.viewer.currentIndex-1;t.viewer.showNextArrow=!1,t.viewer.showPrevArrow=!1,o!==i&&(t.viewer.next=o,t.viewer.showNextArrow=!0),r!==-1&&(t.viewer.prev=r,t.viewer.showPrevArrow=!0)}function Se(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function j(t,e){let i=10**e;return Math.round(t*i)/i}function $(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function xe(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,c,p,E;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(E=(o-s)/2,c=-1*E):(E=(s-o)/2,c=-1*E),{minX:j(n,6)*e.scaleSize,minY:j(c,6)*e.scaleSize,maxX:j(p,6)*e.scaleSize,maxY:j(E,6)*e.scaleSize}}function Ie(t,e,i,o,r){let s=i-(o+r);t.forEach(n=>{n.loaded&&(n.processed=!0,n.scale=s/n.height,n.height<s&&(n.scale=1),n.x=(n.scale-1)/2*n.width+(e-n.width*n.scale)/2,n.y=(n.scale-1)/2*n.height+(i-n.height*n.scale)/2,n.width*n.scale>e&&(n.scale=e/n.width,n.x=(n.scale-1)/2*n.width))})}function Le(t){let e=M(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function Te(t,e){let i=null;return t.groups.forEach(o=>{o.forEach(r=>{e.group===r.groupId&&e.photo===r.id&&(i=r)})}),i}function ce(t,e){let i=10**e;return Math.round(t*i)/i}function V(t){return{x:t.pageX,y:t.pageY}}function Ce(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}function ke(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function Ae(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function He({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,c=null,p=null,E=null,v=!1,x=null,b=null,I=0,z=0,y=!1,Y=0,L=0,T=0;function N(){return q()}function D(a){let{width:h,height:f}=Ae();return xe(a,t.viewer,h,f)}function u(a){let{width:h,height:f}=Ae();return $(a,h,f,N())}function Q(a,h){let f=M(t),m=D(f);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=m.minX:a===-1&&(t.viewer.photoPosX=m.maxX),h===1?t.viewer.photoPosY=m.minY:h===-1&&(t.viewer.photoPosY=m.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let R=setInterval(()=>{if(y||s||v||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=L,t.viewer.photoPosY+=T;let a=M(t);if(!a)return;let h=D(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,L*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,L*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,T*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,T*=-.2);let f=ke(L,T),m=f.force-t.options.registance;Math.abs(m)<.5||(L=Math.cos(f.theta)*m,T=Math.sin(f.theta)*m,e.onPhotoDragMove())},t.options.forceInterval);function W(a,h){(a>5||a<-5)&&(L+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(T+=h*.05)}function _(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||y||s||v||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?W(a.gamma,a.beta):h===90?W(a.beta,a.gamma):h===-90?W(-a.beta,-a.gamma):h===180&&W(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",_,{signal:i});function B(){y=!0,s=!1,v=!1;let a=Array.from(o.values());Y=Ce(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function U(a){let h=V(a);s=!0,n=!0,c=h,p=h}function J(a){v=!0;let h=V(a);b=h,x=h}function Z(a){var h,f;try{(f=(h=a.currentTarget).setPointerCapture)==null||f.call(h,a.pointerId)}catch(m){}if(o.set(a.pointerId,V(a)),o.size>1){B();return}if(t.viewer.scale){J(a);return}U(a)}function ee(){let a=Array.from(o.values()),h=Ce(a[0],a[1]),f=(h-Y)/100,m=t.viewer.scaleSize,C=t.viewer.photoPosX,A=t.viewer.photoPosY;t.viewer.scaleSize+=ce(f,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<m&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-m)*C,t.viewer.photoPosY=(1+t.viewer.scaleSize-m)*A);let X=M(t);if(X){let re=u(X);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>re}Y=h,e.onGestureMove()}function te(a){let h=V(a),f=h.x-p.x,m=h.y-c.y;n&&(e.onSwipeStart(),n=!1,E=Math.abs(f)>Math.abs(m)?"horizontal":"vertical"),E==="horizontal"?t.viewer.translateX+=f:t.viewer.translateY=m,p=h,e.onSwipeMove()}function ie(a){let h=V(a),f=h.x-b.x,m=h.y-b.y,C=ce(t.viewer.scaleSize*f,6),A=ce(t.viewer.scaleSize*m,6);t.viewer.photoPosX+=C,I=C,t.viewer.photoPosY+=A,z=A,b=h,e.onPhotoDragMove()}function oe(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,V(a)),y){ee();return}if(v){ie(a);return}te(a)}}function d(){y=!1;let a=M(t);if(!a)return;let h=u(a);t.viewer.scaleSize>h||(t.viewer.photoPosX=0,t.viewer.photoPosY=0,t.viewer.scale=!1,t.viewer.scaleSize=1,t.viewer.hideUi=!1,e.onGestureEnd())}function l(){var pe;s=!1;let a=c,h=p,f=Date.now(),m=r-f,C=h.x-a.x,A=h.y-a.y,X=C===0&&A===0;if(!N()&&X){e.onTap();return}if(Math.abs(m)<=500&&X){e.onTap();return}r=f;let re=(pe=H(t))!=null?pe:[];if(E==="horizontal"){let G="stay";C>=t.options.swipeOffset&&t.viewer.currentIndex!==0?G="prev":C<=-t.options.swipeOffset&&t.viewer.currentIndex!==re.length-1&&(G="next"),e.onSwipeEnd(G)}else{let G="stay";t.options.swipeBottomToClose&&A>=t.options.swipeOffset?G="close-bottom":t.options.swipeTopToClose&&A<=-t.options.swipeOffset&&(G="close-top"),e.onSwipeEnd(G)}}function P(){v=!1;let a=b,h=x;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let f=M(t);if(!f){e.onPhotoDragEnd(null);return}let m=D(f),C=t.options.swipeOffset*t.viewer.scaleSize,A=0,X=0;if(t.viewer.photoPosX>m.maxX?A=-1:t.viewer.photoPosX<m.minX&&(A=1),t.viewer.photoPosY>m.maxY?X=-1:t.viewer.photoPosY<m.minY&&(X=1),t.viewer.photoPosX-m.maxX>C&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(m.minX-t.viewer.photoPosX>C&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}A===0&&X===0?(L=I/5,T=z/5):Q(A,X),e.onPhotoDragEnd(null)}function g(a){if(o.delete(a.pointerId),y){o.size<2&&d();return}if(v){P();return}s&&l()}function w(...a){for(let h of a)h.addEventListener("pointerdown",Z,{signal:i}),h.addEventListener("pointermove",oe,{signal:i}),h.addEventListener("pointerup",g,{signal:i}),h.addEventListener("pointercancel",g,{signal:i})}function S(){clearInterval(R)}return{attach:w,detach:S}}function K(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function me(){let t=document.createElement("button");return t.type="button",t}function We(t){return t.replace(/"/g,'\\"')}function Me({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let c=document.createElement("dialog");c.className=r.smartPhoto,c.setAttribute("aria-labelledby",`smartphoto-${t}-title`),c.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let E=document.createElement("div");E.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let x=document.createElement("span");x.className=r.smartPhotoCount;let b=document.createElement("h1");b.id=`smartphoto-${t}-title`,b.className=r.smartPhotoCaption,b.setAttribute("tabindex","-1");let I=document.createElement("button");I.className=r.smartPhotoDismiss,I.appendChild(K(s.closeDialog)),I.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(x,b,I);let z=document.createElement("div");z.className=r.smartPhotoContent,z.addEventListener("click",d=>{d.target===z&&i.onBackdropClick()},{signal:o});let y=document.createElement("ul");y.className=r.smartPhotoList,y.setAttribute("role","region"),y.setAttribute("aria-roledescription","carousel"),y.setAttribute("aria-label",s.carouselLabel),y.setAttribute("aria-live","polite"),y.setAttribute("aria-atomic","false"),E.append(v,z,y);let Y=null,L=null,T=null;if(e.arrows){Y=document.createElement("ul"),Y.className=r.smartPhotoArrows,L=document.createElement("li"),L.className=r.smartPhotoArrowLeft;let d=me();d.appendChild(K(s.gotoPrevImage)),d.addEventListener("click",()=>i.onPrev(),{signal:o}),L.appendChild(d),T=document.createElement("li"),T.className=r.smartPhotoArrowRight;let l=me();l.appendChild(K(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),T.appendChild(l),Y.append(L,T),E.appendChild(Y)}let N=null,D=null;e.nav&&(N=document.createElement("nav"),N.className=r.smartPhotoNav,N.setAttribute("aria-label","Choose slide to display"),D=document.createElement("ul"),N.appendChild(D),E.appendChild(N)),p.appendChild(E),c.appendChild(p),n.appendChild(c);let u={dialog:c,count:x,caption:b,dismiss:I,content:z,list:y,arrows:Y,arrowLeft:L,arrowRight:T,nav:N,navList:D,slides:new Map,imgClone:null};function Q(){let d=document.createElement("div");d.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,d.appendChild(l),d}function R(d){var g,w;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let P=document.createElement("img");return P.className=r.smartPhotoImg,P.src=(g=d.src)!=null?g:"",P.alt=(w=d.alt)!=null?w:"",P.addEventListener("dragstart",S=>S.preventDefault(),{signal:o}),l.appendChild(P),{imgWrap:l,img:P}}function W(d,l){var P;u.list.replaceChildren(),(P=u.navList)==null||P.replaceChildren(),u.slides=new Map,d.forEach(g=>{var a,h;let w=document.createElement("li");w.setAttribute("role","group"),w.setAttribute("aria-roledescription","slide"),w.setAttribute("aria-label",`${g.index+1} of ${d.length}`);let S={li:w,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(g.processed){let{imgWrap:f,img:m}=R(g);w.appendChild(f),S.imgWrap=f,S.img=m}else{let f=Q();w.appendChild(f),S.loaderWrap=f}if(u.list.appendChild(w),u.slides.set(g,S),u.navList){let f=document.createElement("li"),m=me();m.style.backgroundImage=`url("${We((a=g.thumb)!=null?a:"")}")`;let C=g.index;m.addEventListener("click",()=>i.onNavigate(C),{signal:o}),m.appendChild(K(`go to ${(h=g.caption)!=null?h:""}`)),f.appendChild(m),u.navList.appendChild(f),S.navLink=m}}),U(l)}function _(d,l){var w;if(l.imgWrap||!d.processed)return l;let{imgWrap:P,img:g}=R(d);return(w=l.loaderWrap)==null||w.replaceWith(P),l.loaderWrap=null,l.imgWrap=P,l.img=g,l}function B(d){d&&document.activeElement&&d.contains(document.activeElement)&&u.caption.focus()}function U(d){let{viewer:l}=d;u.count.textContent=`${l.currentIndex+1}/${l.total}`,u.slides.forEach((P,g)=>{var a;let w=_(g,P),S=g.index===l.currentIndex;w.li.style.transform=`translate(${g.translateX}px,${g.translateY}px)`,w.li.classList.toggle("current",S),S?w.li.removeAttribute("aria-hidden"):w.li.setAttribute("aria-hidden","true"),S&&(u.caption.textContent=(a=g.caption)!=null?a:""),w.imgWrap&&w.img&&(w.imgWrap.style.transform=`translate(${g.x}px,${g.y}px) scale(${g.scale})`,w.img.style.width=`${g.width}px`,w.img.classList.toggle("active",l.appear),w.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),w.navLink&&(w.navLink.classList.toggle("current",S),S?w.navLink.setAttribute("aria-current","true"):w.navLink.removeAttribute("aria-current"))}),u.arrowLeft&&(l.showPrevArrow?u.arrowLeft.removeAttribute("aria-hidden"):(B(u.arrowLeft),u.arrowLeft.setAttribute("aria-hidden","true"))),u.arrowRight&&(l.showNextArrow?u.arrowRight.removeAttribute("aria-hidden"):(B(u.arrowRight),u.arrowRight.setAttribute("aria-hidden","true"))),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function J(d){for(let[l,P]of u.slides)if(l.index===d.viewer.currentIndex)return P;return null}function Z(d){let{viewer:l}=d,P=J(d),g=P==null?void 0:P.img;g&&(g.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,g.classList.toggle(r.smartPhotoImgOnMove,l.scale),g.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ee(d){let{viewer:l}=d;u.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,u.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function te(d){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=d.img,l.style.width=`${d.width}px`,l.style.height=`${d.height}px`,l.style.transform=`translate(${d.left}px,${d.top}px) scale(1)`,p.appendChild(l),u.imgClone=l}function ie(){var d;(d=u.imgClone)==null||d.remove(),u.imgClone=null}function oe(){n.remove()}return{root:n,refs:u,render:U,syncSlides:W,updatePhotoTransform:Z,updateListTransform:ee,showAppearEffect:te,removeAppearEffect:ie,destroy:oe}}function O(){return document.documentElement.clientWidth}function k(){return document.documentElement.clientHeight}function Ve(t){return t.length>0&&t[0]instanceof Element}function $e(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function ze(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var F=class{constructor(e,i){this.id=$e();this.abortController=new AbortController;this.isSmartPhoneFlag=q();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.handleResize=()=>{H(this.state)&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleKeydown=e=>{if(!this.state.viewer.isOpen)return;let i=e.keyCode||e.which;i===37?this.gotoSlide(this.state.viewer.prev):i===39?this.gotoSlide(this.state.viewer.next):i===27&&this.hidePhoto()};this.handleOrientationChange=()=>{if(!H(this.state))return;this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=O(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==O()?(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.state=Pe(i!=null?i:{}),this.view=Me({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=He({state:this.state,callbacks:this.buildGestureCallbacks()},{signal:this.abortController.signal}),this.gestures.attach(this.view.refs.content,this.view.refs.list),this.view.refs.dialog.addEventListener("close",()=>{!this.isFiringPublicCloseEvent&&this.state.viewer.isOpen&&this.hidePhoto()},{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&(o.element?se(o.element,"click"):this.openPhoto(o,null)),!this.isSmartPhoneFlag){window.addEventListener("resize",this.handleResize,{signal:this.abortController.signal}),window.addEventListener("keydown",this.handleKeydown,{signal:this.abortController.signal});return}window.addEventListener("orientationchange",this.handleOrientationChange,{signal:this.abortController.signal})}on(e,i){let o=this.view.refs.dialog,r=s=>i.call(o,s);o.addEventListener(e,r,{signal:this.abortController.signal})}destroy(){this.state.viewer.isOpen=!1,this.view.refs.dialog.open&&this.view.refs.dialog.close(),this.abortController.abort(),this.timeouts.forEach(e=>{clearTimeout(e)}),this.timeouts=[],this.gestures.detach(),this.view.destroy()}[Symbol.dispose](){this.destroy()}gotoSlide(e){this.state.viewer.currentIndex=Number.parseInt(String(e),10),this.state.viewer.currentIndex||(this.state.viewer.currentIndex=0),this.slideList()}hidePhoto(e="bottom"){var o;if(!this.state.viewer.isOpen)return;this.state.viewer.isOpen=!1,this.state.viewer.appear=!1,this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.scaleSize=1;let i=ze();location.hash&&this.setHash(""),window.scroll(i.x,i.y),this.syncDialog(),(o=this.lastTriggerElement)!=null&&o.isConnected&&this.lastTriggerElement.focus(),this.lastTriggerElement=null,this.doHideEffect(e).then(()=>{this.view.render(this.state),this.isFiringPublicCloseEvent=!0,this.fireEvent("close"),this.isFiringPublicCloseEvent=!1})}zoomPhoto(){let e=M(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=$(e,O(),k(),this.isSmartPhoneFlag),!(this.state.viewer.scaleSize<=1)&&(this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.scheduleTimeout(()=>{this.state.viewer.scale=!0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomin")},300)))}zoomOutPhoto(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomout")}addNewItem(e){return this.addItem(e)}show(e=0,i={}){var p,E,v;let o=(p=i.group)!=null?p:this.state.viewer.currentGroup;if(o===null)return;let r=this.state.groups.get(o);if(!(r!=null&&r.length))return;let s=typeof e=="number"?r[e]:r.find(x=>x.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,c=(v=(E=i.trigger)!=null?E:s.element)!=null?v:n;this.openPhoto(s,c)}hide(){this.hidePhoto()}next(){this.state.viewer.showNextArrow&&this.gotoSlide(this.state.viewer.next)}prev(){this.state.viewer.showPrevArrow&&this.gotoSlide(this.state.viewer.prev)}addItem(e){let i=e instanceof Element?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!Ve(e)){e.forEach(o=>{this.addSlideItem(o)});return}Array.from(typeof e=="string"?document.querySelectorAll(e):e).forEach(o=>{this.addElementItem(o)})}addElementItem(e){var s,n;let i=le(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=be(e,this.state.options,o,O());return ue(this.state,r),this.loadAllFired.delete(i),this.bindThumbnailClick(e,r),r}addSlideItem(e){var s,n;let i=he(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=ye(e,o,O());return ue(this.state,r),this.loadAllFired.delete(i),r}bindThumbnailClick(e,i){e.addEventListener("click",o=>{o.preventDefault(),this.openPhoto(i,e)},{signal:this.abortController.signal})}syncCurrentGroupView(){let e=H(this.state);e&&(this.view.syncSlides(e,this.state),this.syncedGroupId=this.state.viewer.currentGroup)}setHash(e){var o;if(!((o=window.history)!=null&&o.pushState)||!this.state.options.useHistoryApi)return;let i=`${location.pathname}${location.search}`;window.history.replaceState(null,"",e?`${i}#${e}`:i)}setHashByCurrentIndex(){let e=ze();this.setHash(Le(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?Te(this.state,we(e)):null}setPosByCurrentIndex(){let e=M(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=H(this.state);e&&Ie(e,O(),k(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){Se(H(this.state),O())}currentImgElement(){for(let[e,i]of this.view.refs.slides)if(e.index===this.state.viewer.currentIndex)return i.img;return null}syncDialog(){let{dialog:e,caption:i}=this.view.refs;this.state.viewer.isOpen&&!e.open?(e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&e.close()}commit(){this.view.render(this.state),this.syncDialog()}initPhoto(){var i;(i=this.finishHideEffect)==null||i.call(this),this.view.refs.dialog.style.opacity="";let e=H(this.state);if(this.state.viewer.total=e.length,this.state.viewer.isOpen=!0,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.setPosByCurrentIndex(),this.setSizeByScreen(),de(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=M(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=$(o,O(),k(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,c;let i="smartphoto-hero",o=(n=e==null?void 0:e.querySelector("img"))!=null?n:null;o&&(o.style.viewTransitionName=i);let r=()=>{o&&(o.style.viewTransitionName="");let p=this.currentImgElement();p&&(p.style.viewTransitionName="")},s=(c=document.startViewTransition)==null?void 0:c.call(document,()=>{this.initPhoto(),this.state.viewer.appear=!0,this.commit(),o&&(o.style.viewTransitionName=""),this.currentImgElement().style.viewTransitionName=i});s==null||s.ready.catch(()=>{r()}),s==null||s.finished.then(r,r)}addAppearEffect(e,i){var z;let o=(z=e==null?void 0:e.querySelector("img"))!=null?z:null;if(!o){this.state.viewer.appear=!0;return}let r=ge(o),s=o.offsetWidth,n=o.offsetHeight,c=O(),p=k(),E=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=c/s:(s>=n?i.height<E?v=i.width/s:v=E/n:i.height<E?v=i.height/n:v=E/n,s*v>c&&(v=c/s));let x=(v-1)/2*s+(c-s*v)/2,b=(v-1)/2*n+(p-n*v)/2,I=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:I||i.src||"",afterX:x,afterY:b,scale:v}}runAppearEffect(e){this.view.showAppearEffect(e);let i=this.view.refs.imgClone;return new Promise(o=>{let r=()=>{i.removeEventListener("transitionend",r,!0),o()};i.addEventListener("transitionend",r,!0),this.scheduleTimeout(()=>{i.style.transform=`translate(${e.afterX}px, ${e.afterY}px) scale(${e.scale})`},10)})}doOpen(e,i){if(this.state.options.showAnimation!==!1&&this.supportsViewTransition())this.openPhotoWithViewTransition(e);else if(this.state.options.showAnimation===!1)this.initPhoto(),this.state.viewer.appear=!0,this.commit();else{this.initPhoto(),this.addAppearEffect(e,i),this.commit();let o=this.state.viewer.appearEffect;o&&this.runAppearEffect(o).then(()=>{this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.appear=!0,this.commit()})}this.fireEvent("open"),this.resyncSizeAfterOpen()}resyncSizeAfterOpen(){let e=O(),i=k();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(O()===e&&k()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,this.syncedGroupId!==e.groupId&&this.syncCurrentGroupView(),this.setHashByCurrentIndex(),e.loaded?this.doOpen(i,e):this.loadItem(e).then(()=>{this.doOpen(i,e)})}doHideEffect(e){return new Promise(i=>{let o=this.view.refs.dialog,r=this.currentImgElement(),s=k(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,c=()=>{this.finishHideEffect===c&&(this.finishHideEffect=null,o.removeEventListener("transitionend",c,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=c,r&&(r.style.transform=n),o.addEventListener("transitionend",c,!0),this.scheduleTimeout(c,this.state.options.animationSpeed+100)})}loadItem(e){return new Promise(i=>{var r;let o=new Image;o.onload=()=>{e.width=o.width,e.height=o.height,e.loaded=!0,this.checkLoadAll(e.groupId),i()},o.onerror=()=>i(),o.src=(r=e.src)!=null?r:""})}checkLoadAll(e){if(this.loadAllFired.has(e))return;let i=this.state.groups.get(e);i!=null&&i.length&&i.every(o=>o.loaded)&&(this.loadAllFired.add(e),this.fireEvent("loadall"))}loadNeighborItems(){let e=H(this.state);if(!e)return;let{currentIndex:i}=this.state.viewer,{loadOffset:o}=this.state.options,r=[];for(let s=i-o;s<i+o;s++){let n=e[s];n&&!n.loaded&&r.push(this.loadItem(n))}r.length&&Promise.all(r).then(()=>{this.initPhoto(),this.commit()})}slideList(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.state.viewer.onMove=!0,this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=M(this.state);this.state.viewer.onMove=!1,de(this.state),this.commit(),this.state.viewer.oldIndex!==this.state.viewer.currentIndex&&this.fireEvent("change"),this.state.viewer.oldIndex=this.state.viewer.currentIndex,this.loadNeighborItems(),e&&!e.loaded&&this.loadItem(e).then(()=>{this.initPhoto(),this.commit()})},200)}scheduleTimeout(e,i){let o=window.setTimeout(()=>{this.timeouts=this.timeouts.filter(r=>r!==o),e()},i);return this.timeouts.push(o),o}fireEvent(e){se(this.view.refs.dialog,e)}buildViewHandlers(){return{onDismiss:()=>this.hidePhoto(),onPrev:()=>this.prev(),onNext:()=>this.next(),onNavigate:e=>this.gotoSlide(e),onBackdropClick:()=>this.hidePhoto()}}buildGestureCallbacks(){return{onSwipeStart:()=>this.fireEvent("swipestart"),onSwipeMove:()=>this.view.updateListTransform(this.state),onSwipeEnd:e=>{if(this.fireEvent("swipeend"),e==="close-bottom"){this.hidePhoto("bottom");return}if(e==="close-top"){this.hidePhoto("top");return}e==="prev"?this.state.viewer.currentIndex-=1:e==="next"&&(this.state.viewer.currentIndex+=1),this.slideList()},onTap:()=>this.zoomPhoto(),onGestureStart:()=>{this.fireEvent("gesturestart"),this.view.updatePhotoTransform(this.state)},onGestureMove:()=>this.view.updatePhotoTransform(this.state),onGestureEnd:()=>{this.fireEvent("gestureend"),this.view.updatePhotoTransform(this.state)},onPhotoDragMove:()=>this.view.updatePhotoTransform(this.state),onPhotoDragEnd:e=>{if(e==="zoom-out"){this.zoomOutPhoto();return}if(e==="prev"){this.gotoSlide(this.state.viewer.prev);return}if(e==="next"){this.gotoSlide(this.state.viewer.next);return}this.view.updatePhotoTransform(this.state)}}}};var Fe=F;return De(Re);})();
6
+ "use strict";var SmartPhoto=(()=>{var ne=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Xe=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Ne=(t,e)=>{for(var i in e)ne(t,i,{get:e[i],enumerable:!0})},Be=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Xe(e))!Ye.call(t,r)&&r!==i&&ne(t,r,{get:()=>e[r],enumerable:!(o=Oe(e,r))||o.enumerable});return t};var De=t=>Be(ne({},"__esModule",{value:!0}),t);var Re={};Ne(Re,{default:()=>Fe});var q=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function fe(t,...e){var i;t=t||{};for(let o=0;o<e.length;o++){let r=e[o];if(r){for(let s in r)if(Object.hasOwn(r,s)){let n=r[s];n&&typeof n=="object"?t[s]=fe((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var ve=fe,se=(t,e,i)=>{let o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,i)),t.dispatchEvent(o)},we=t=>{let e={};for(let i of t.split("&")){let o=i.split("="),r=o[0],s=o.length>1?o.slice(1).join("="):r;e[r]=decodeURIComponent(s)}return e},ge=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var Ve={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog",carouselLabel:"Images"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:300};function Ee(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Ee(i)}),Object.freeze(t)}function Pe(t){return{options:Ee(ve({},Ve,t)),viewer:{isOpen:!1,currentGroup:null,currentIndex:0,oldIndex:0,total:0,translateX:0,translateY:0,photoPosX:0,photoPosY:0,scaleSize:1,scale:!1,elastic:!1,hideUi:!1,onMove:!1,appear:!1,appearEffect:null,prev:-1,next:-1,showPrevArrow:!1,showNextArrow:!1},groups:new Map}}function le(t){return t.getAttribute("data-group")||"nogroup"}function he(t){return t.group||"nogroup"}function be(t,e,i,o){let r=le(t),s=t.getAttribute("href"),n=t.querySelector("img"),c=s;n&&(n.getAttribute(e.lazyAttribute)?c=n.getAttribute(e.lazyAttribute):n.currentSrc?c=n.currentSrc:c=n.src);let p="";n!=null&&n.getAttribute("alt")?p=n.getAttribute("alt"):t.getAttribute("data-caption")?p=t.getAttribute("data-caption"):p=s!=null?s:"";let E=t.getAttribute("data-id");return{src:s,thumb:c,caption:t.getAttribute("data-caption"),alt:p,groupId:r,translateX:o*i,translateY:0,index:i,width:50,height:50,scale:1,x:0,y:0,id:E||i,loaded:!1,processed:!1,element:t}}function ye(t,e,i){var E,v,x,b,I;let o=he(t),r=t.src,s=(E=t.thumb)!=null?E:r,n=(v=t.caption)!=null?v:null,c=(b=(x=t.alt)!=null?x:n)!=null?b:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:c,groupId:o,translateX:i*e,translateY:0,index:e,width:p?t.width:50,height:p?t.height:50,scale:1,x:0,y:0,id:(I=t.id)!=null?I:e,loaded:p,processed:!1,element:null}}function ue(t,e){t.groups.has(e.groupId)||t.groups.set(e.groupId,[]),t.groups.get(e.groupId).push(e),t.viewer.currentGroup=e.groupId}function H(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function M(t){var i;let e=H(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function de(t){let e=H(t);if(!e)return;let i=e.length,o=t.viewer.currentIndex+1,r=t.viewer.currentIndex-1;t.viewer.showNextArrow=!1,t.viewer.showPrevArrow=!1,o!==i&&(t.viewer.next=o,t.viewer.showNextArrow=!0),r!==-1&&(t.viewer.prev=r,t.viewer.showPrevArrow=!0)}function Se(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function j(t,e){let i=10**e;return Math.round(t*i)/i}function W(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function xe(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,c,p,E;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(E=(o-s)/2,c=-1*E):(E=(s-o)/2,c=-1*E),{minX:j(n,6)*e.scaleSize,minY:j(c,6)*e.scaleSize,maxX:j(p,6)*e.scaleSize,maxY:j(E,6)*e.scaleSize}}function Ie(t,e,i,o,r){let s=i-(o+r);t.forEach(n=>{n.loaded&&(n.processed=!0,n.scale=s/n.height,n.height<s&&(n.scale=1),n.x=(n.scale-1)/2*n.width+(e-n.width*n.scale)/2,n.y=(n.scale-1)/2*n.height+(i-n.height*n.scale)/2,n.width*n.scale>e&&(n.scale=e/n.width,n.x=(n.scale-1)/2*n.width))})}function Le(t){let e=M(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function Ce(t,e){let i=null;return t.groups.forEach(o=>{o.forEach(r=>{e.group===r.groupId&&e.photo===r.id&&(i=r)})}),i}function ce(t,e){let i=10**e;return Math.round(t*i)/i}function k(t){return{x:t.pageX,y:t.pageY}}function Te(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}function Ge(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function Ae(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function He({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,c=null,p=null,E=null,v=!1,x=null,b=null,I=0,z=0,y=!1,Y=0,L=0,C=0;function N(){return q()}function V(a){let{width:h,height:f}=Ae();return xe(a,t.viewer,h,f)}function u(a){let{width:h,height:f}=Ae();return W(a,h,f,N())}function Q(a,h){let f=M(t),m=V(f);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=m.minX:a===-1&&(t.viewer.photoPosX=m.maxX),h===1?t.viewer.photoPosY=m.minY:h===-1&&(t.viewer.photoPosY=m.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let R=setInterval(()=>{if(y||s||v||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=L,t.viewer.photoPosY+=C;let a=M(t);if(!a)return;let h=V(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,L*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,L*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,C*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,C*=-.2);let f=Ge(L,C),m=f.force-t.options.registance;Math.abs(m)<.5||(L=Math.cos(f.theta)*m,C=Math.sin(f.theta)*m,e.onPhotoDragMove())},t.options.forceInterval);function $(a,h){(a>5||a<-5)&&(L+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(C+=h*.05)}function _(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||y||s||v||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?$(a.gamma,a.beta):h===90?$(a.beta,a.gamma):h===-90?$(-a.beta,-a.gamma):h===180&&$(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",_,{signal:i});function B(){y=!0,s=!1,v=!1;let a=Array.from(o.values());Y=Te(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function U(a){let h=k(a);s=!0,n=!0,c=h,p=h}function J(a){v=!0;let h=k(a);b=h,x=h}function Z(a){var h,f;try{(f=(h=a.currentTarget).setPointerCapture)==null||f.call(h,a.pointerId)}catch(m){}if(o.set(a.pointerId,k(a)),o.size>1){B();return}if(t.viewer.scale){J(a);return}U(a)}function ee(){let a=Array.from(o.values()),h=Te(a[0],a[1]),f=(h-Y)/100,m=t.viewer.scaleSize,T=t.viewer.photoPosX,A=t.viewer.photoPosY;t.viewer.scaleSize+=ce(f,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<m&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-m)*T,t.viewer.photoPosY=(1+t.viewer.scaleSize-m)*A);let X=M(t);if(X){let re=u(X);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>re}Y=h,e.onGestureMove()}function te(a){let h=k(a),f=h.x-p.x,m=h.y-c.y;n&&(e.onSwipeStart(),n=!1,E=Math.abs(f)>Math.abs(m)?"horizontal":"vertical"),E==="horizontal"?t.viewer.translateX+=f:t.viewer.translateY=m,p=h,e.onSwipeMove()}function ie(a){let h=k(a),f=h.x-b.x,m=h.y-b.y,T=ce(t.viewer.scaleSize*f,6),A=ce(t.viewer.scaleSize*m,6);t.viewer.photoPosX+=T,I=T,t.viewer.photoPosY+=A,z=A,b=h,e.onPhotoDragMove()}function oe(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,k(a)),y){ee();return}if(v){ie(a);return}te(a)}}function d(){y=!1;let a=M(t);if(!a)return;let h=u(a);t.viewer.scaleSize>h||(t.viewer.photoPosX=0,t.viewer.photoPosY=0,t.viewer.scale=!1,t.viewer.scaleSize=1,t.viewer.hideUi=!1,e.onGestureEnd())}function l(){var pe;s=!1;let a=c,h=p,f=Date.now(),m=r-f,T=h.x-a.x,A=h.y-a.y,X=T===0&&A===0;if(!N()&&X){e.onTap();return}if(Math.abs(m)<=500&&X){e.onTap();return}r=f;let re=(pe=H(t))!=null?pe:[];if(E==="horizontal"){let G="stay";T>=t.options.swipeOffset&&t.viewer.currentIndex!==0?G="prev":T<=-t.options.swipeOffset&&t.viewer.currentIndex!==re.length-1&&(G="next"),e.onSwipeEnd(G)}else{let G="stay";t.options.swipeBottomToClose&&A>=t.options.swipeOffset?G="close-bottom":t.options.swipeTopToClose&&A<=-t.options.swipeOffset&&(G="close-top"),e.onSwipeEnd(G)}}function P(){v=!1;let a=b,h=x;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let f=M(t);if(!f){e.onPhotoDragEnd(null);return}let m=V(f),T=t.options.swipeOffset*t.viewer.scaleSize,A=0,X=0;if(t.viewer.photoPosX>m.maxX?A=-1:t.viewer.photoPosX<m.minX&&(A=1),t.viewer.photoPosY>m.maxY?X=-1:t.viewer.photoPosY<m.minY&&(X=1),t.viewer.photoPosX-m.maxX>T&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(m.minX-t.viewer.photoPosX>T&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}A===0&&X===0?(L=I/5,C=z/5):Q(A,X),e.onPhotoDragEnd(null)}function g(a){if(o.delete(a.pointerId),y){o.size<2&&d();return}if(v){P();return}s&&l()}function w(...a){for(let h of a)h.addEventListener("pointerdown",Z,{signal:i}),h.addEventListener("pointermove",oe,{signal:i}),h.addEventListener("pointerup",g,{signal:i}),h.addEventListener("pointercancel",g,{signal:i})}function S(){clearInterval(R)}return{attach:w,detach:S}}function K(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function me(){let t=document.createElement("button");return t.type="button",t}function $e(t){return t.replace(/"/g,'\\"')}function Me({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let c=document.createElement("dialog");c.className=r.smartPhoto,c.setAttribute("aria-labelledby",`smartphoto-${t}-title`),c.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let E=document.createElement("div");E.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let x=document.createElement("span");x.className=r.smartPhotoCount;let b=document.createElement("h1");b.id=`smartphoto-${t}-title`,b.className=r.smartPhotoCaption,b.setAttribute("tabindex","-1");let I=document.createElement("button");I.className=r.smartPhotoDismiss,I.appendChild(K(s.closeDialog)),I.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(x,b,I);let z=document.createElement("div");z.className=r.smartPhotoContent,z.addEventListener("click",d=>{d.target===z&&i.onBackdropClick()},{signal:o});let y=document.createElement("ul");y.className=r.smartPhotoList,y.setAttribute("role","region"),y.setAttribute("aria-roledescription","carousel"),y.setAttribute("aria-label",s.carouselLabel),y.setAttribute("aria-live","polite"),y.setAttribute("aria-atomic","false"),E.append(v,z,y);let Y=null,L=null,C=null;if(e.arrows){Y=document.createElement("ul"),Y.className=r.smartPhotoArrows,L=document.createElement("li"),L.className=r.smartPhotoArrowLeft;let d=me();d.appendChild(K(s.gotoPrevImage)),d.addEventListener("click",()=>i.onPrev(),{signal:o}),L.appendChild(d),C=document.createElement("li"),C.className=r.smartPhotoArrowRight;let l=me();l.appendChild(K(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),C.appendChild(l),Y.append(L,C),E.appendChild(Y)}let N=null,V=null;e.nav&&(N=document.createElement("nav"),N.className=r.smartPhotoNav,N.setAttribute("aria-label","Choose slide to display"),V=document.createElement("ul"),N.appendChild(V),E.appendChild(N)),p.appendChild(E),c.appendChild(p),n.appendChild(c);let u={dialog:c,count:x,caption:b,dismiss:I,content:z,list:y,arrows:Y,arrowLeft:L,arrowRight:C,nav:N,navList:V,slides:new Map,imgClone:null};function Q(){let d=document.createElement("div");d.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,d.appendChild(l),d}function R(d){var g,w;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let P=document.createElement("img");return P.className=r.smartPhotoImg,P.src=(g=d.src)!=null?g:"",P.alt=(w=d.alt)!=null?w:"",P.addEventListener("dragstart",S=>S.preventDefault(),{signal:o}),l.appendChild(P),{imgWrap:l,img:P}}function $(d,l){var P;u.list.replaceChildren(),(P=u.navList)==null||P.replaceChildren(),u.slides=new Map,d.forEach(g=>{var a,h;let w=document.createElement("li");w.setAttribute("role","group"),w.setAttribute("aria-roledescription","slide"),w.setAttribute("aria-label",`${g.index+1} of ${d.length}`);let S={li:w,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(g.processed){let{imgWrap:f,img:m}=R(g);w.appendChild(f),S.imgWrap=f,S.img=m}else{let f=Q();w.appendChild(f),S.loaderWrap=f}if(u.list.appendChild(w),u.slides.set(g,S),u.navList){let f=document.createElement("li"),m=me();m.style.backgroundImage=`url("${$e((a=g.thumb)!=null?a:"")}")`;let T=g.index;m.addEventListener("click",()=>i.onNavigate(T),{signal:o}),m.appendChild(K(`go to ${(h=g.caption)!=null?h:""}`)),f.appendChild(m),u.navList.appendChild(f),S.navLink=m}}),U(l)}function _(d,l){var w;if(l.imgWrap||!d.processed)return l;let{imgWrap:P,img:g}=R(d);return(w=l.loaderWrap)==null||w.replaceWith(P),l.loaderWrap=null,l.imgWrap=P,l.img=g,l}function B(d){d&&document.activeElement&&d.contains(document.activeElement)&&u.caption.focus()}function U(d){let{viewer:l}=d;u.count.textContent=`${l.currentIndex+1}/${l.total}`,u.slides.forEach((P,g)=>{var a;let w=_(g,P),S=g.index===l.currentIndex;w.li.style.transform=`translate(${g.translateX}px,${g.translateY}px)`,w.li.classList.toggle("current",S),S?w.li.removeAttribute("aria-hidden"):w.li.setAttribute("aria-hidden","true"),S&&(u.caption.textContent=(a=g.caption)!=null?a:""),w.imgWrap&&w.img&&(w.imgWrap.style.transform=`translate(${g.x}px,${g.y}px) scale(${g.scale})`,w.img.style.width=`${g.width}px`,w.img.classList.toggle("active",l.appear),w.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),w.navLink&&(w.navLink.classList.toggle("current",S),S?w.navLink.setAttribute("aria-current","true"):w.navLink.removeAttribute("aria-current"))}),u.arrowLeft&&(l.showPrevArrow?u.arrowLeft.removeAttribute("aria-hidden"):(B(u.arrowLeft),u.arrowLeft.setAttribute("aria-hidden","true"))),u.arrowRight&&(l.showNextArrow?u.arrowRight.removeAttribute("aria-hidden"):(B(u.arrowRight),u.arrowRight.setAttribute("aria-hidden","true"))),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function J(d){for(let[l,P]of u.slides)if(l.index===d.viewer.currentIndex)return P;return null}function Z(d){let{viewer:l}=d,P=J(d),g=P==null?void 0:P.img;g&&(g.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,g.classList.toggle(r.smartPhotoImgOnMove,l.scale),g.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ee(d){let{viewer:l}=d;u.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,u.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function te(d){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=d.img,l.style.width=`${d.width}px`,l.style.height=`${d.height}px`,l.style.transform=`translate(${d.left}px,${d.top}px) scale(1)`,p.appendChild(l),u.imgClone=l}function ie(){var d;(d=u.imgClone)==null||d.remove(),u.imgClone=null}function oe(){n.remove()}return{root:n,refs:u,render:U,syncSlides:$,updatePhotoTransform:Z,updateListTransform:ee,showAppearEffect:te,removeAppearEffect:ie,destroy:oe}}function O(){return document.documentElement.clientWidth}function D(){var t,e;return(e=(t=window.visualViewport)==null?void 0:t.height)!=null?e:document.documentElement.clientHeight}function ke(t){return t.length>0&&t[0]instanceof Element}function We(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function ze(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var F=class{constructor(e,i){this.id=We();this.abortController=new AbortController;this.isSmartPhoneFlag=q();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${D()}px`)};this.handleResize=()=>{H(this.state)&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleKeydown=e=>{if(!this.state.viewer.isOpen)return;let i=e.keyCode||e.which;i===37?this.gotoSlide(this.state.viewer.prev):i===39?this.gotoSlide(this.state.viewer.next):i===27&&this.hidePhoto()};this.handleOrientationChange=()=>{if(!H(this.state))return;this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=O(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==O()?(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.state=Pe(i!=null?i:{}),this.view=Me({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=He({state:this.state,callbacks:this.buildGestureCallbacks()},{signal:this.abortController.signal}),this.gestures.attach(this.view.refs.content,this.view.refs.list),this.view.refs.dialog.addEventListener("close",()=>{!this.isFiringPublicCloseEvent&&this.state.viewer.isOpen&&this.hidePhoto()},{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&(o.element?se(o.element,"click"):this.openPhoto(o,null)),this.updateViewportHeight(),window.visualViewport?window.visualViewport.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}):window.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}),!this.isSmartPhoneFlag){window.addEventListener("resize",this.handleResize,{signal:this.abortController.signal}),window.addEventListener("keydown",this.handleKeydown,{signal:this.abortController.signal});return}window.addEventListener("orientationchange",this.handleOrientationChange,{signal:this.abortController.signal})}on(e,i){let o=this.view.refs.dialog,r=s=>i.call(o,s);o.addEventListener(e,r,{signal:this.abortController.signal})}destroy(){this.state.viewer.isOpen=!1,this.view.refs.dialog.open&&this.view.refs.dialog.close(),this.abortController.abort(),this.timeouts.forEach(e=>{clearTimeout(e)}),this.timeouts=[],this.gestures.detach(),this.view.destroy()}[Symbol.dispose](){this.destroy()}gotoSlide(e){this.state.viewer.currentIndex=Number.parseInt(String(e),10),this.state.viewer.currentIndex||(this.state.viewer.currentIndex=0),this.slideList()}hidePhoto(e="bottom"){var o;if(!this.state.viewer.isOpen)return;this.state.viewer.isOpen=!1,this.state.viewer.appear=!1,this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.scaleSize=1;let i=ze();location.hash&&this.setHash(""),window.scroll(i.x,i.y),this.syncDialog(),(o=this.lastTriggerElement)!=null&&o.isConnected&&this.lastTriggerElement.focus(),this.lastTriggerElement=null,this.doHideEffect(e).then(()=>{this.view.render(this.state),this.isFiringPublicCloseEvent=!0,this.fireEvent("close"),this.isFiringPublicCloseEvent=!1})}zoomPhoto(){let e=M(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=W(e,O(),D(),this.isSmartPhoneFlag),!(this.state.viewer.scaleSize<=1)&&(this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.scheduleTimeout(()=>{this.state.viewer.scale=!0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomin")},300)))}zoomOutPhoto(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomout")}addNewItem(e){return this.addItem(e)}show(e=0,i={}){var p,E,v;let o=(p=i.group)!=null?p:this.state.viewer.currentGroup;if(o===null)return;let r=this.state.groups.get(o);if(!(r!=null&&r.length))return;let s=typeof e=="number"?r[e]:r.find(x=>x.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,c=(v=(E=i.trigger)!=null?E:s.element)!=null?v:n;this.openPhoto(s,c)}hide(){this.hidePhoto()}next(){this.state.viewer.showNextArrow&&this.gotoSlide(this.state.viewer.next)}prev(){this.state.viewer.showPrevArrow&&this.gotoSlide(this.state.viewer.prev)}addItem(e){let i=e instanceof Element?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!ke(e)){e.forEach(o=>{this.addSlideItem(o)});return}Array.from(typeof e=="string"?document.querySelectorAll(e):e).forEach(o=>{this.addElementItem(o)})}addElementItem(e){var s,n;let i=le(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=be(e,this.state.options,o,O());return ue(this.state,r),this.loadAllFired.delete(i),this.bindThumbnailClick(e,r),r}addSlideItem(e){var s,n;let i=he(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=ye(e,o,O());return ue(this.state,r),this.loadAllFired.delete(i),r}bindThumbnailClick(e,i){e.addEventListener("click",o=>{o.preventDefault(),this.openPhoto(i,e)},{signal:this.abortController.signal})}syncCurrentGroupView(){let e=H(this.state);e&&(this.view.syncSlides(e,this.state),this.syncedGroupId=this.state.viewer.currentGroup)}setHash(e){var o;if(!((o=window.history)!=null&&o.pushState)||!this.state.options.useHistoryApi)return;let i=`${location.pathname}${location.search}`;window.history.replaceState(null,"",e?`${i}#${e}`:i)}setHashByCurrentIndex(){let e=ze();this.setHash(Le(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?Ce(this.state,we(e)):null}setPosByCurrentIndex(){let e=M(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=H(this.state);e&&Ie(e,O(),D(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){Se(H(this.state),O())}currentImgElement(){for(let[e,i]of this.view.refs.slides)if(e.index===this.state.viewer.currentIndex)return i.img;return null}syncDialog(){let{dialog:e,caption:i}=this.view.refs;this.state.viewer.isOpen&&!e.open?(e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&e.close()}commit(){this.view.render(this.state),this.syncDialog()}initPhoto(){var i;(i=this.finishHideEffect)==null||i.call(this),this.view.refs.dialog.style.opacity="";let e=H(this.state);if(this.state.viewer.total=e.length,this.state.viewer.isOpen=!0,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.setPosByCurrentIndex(),this.setSizeByScreen(),de(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=M(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=W(o,O(),D(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,c;document.documentElement.style.setProperty("--smartphoto-animation-speed",`${this.state.options.animationSpeed}ms`);let i="smartphoto-hero",o=(n=e==null?void 0:e.querySelector("img"))!=null?n:null;o&&(o.style.viewTransitionName=i);let r=()=>{o&&(o.style.viewTransitionName="");let p=this.currentImgElement();p&&(p.style.viewTransitionName="")},s=(c=document.startViewTransition)==null?void 0:c.call(document,()=>{this.initPhoto(),this.state.viewer.appear=!0,this.commit(),o&&(o.style.viewTransitionName=""),this.currentImgElement().style.viewTransitionName=i});s==null||s.ready.catch(()=>{r()}),s==null||s.finished.then(r,r)}addAppearEffect(e,i){var z;let o=(z=e==null?void 0:e.querySelector("img"))!=null?z:null;if(!o){this.state.viewer.appear=!0;return}let r=ge(o),s=o.offsetWidth,n=o.offsetHeight,c=O(),p=D(),E=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=c/s:(s>=n?i.height<E?v=i.width/s:v=E/n:i.height<E?v=i.height/n:v=E/n,s*v>c&&(v=c/s));let x=(v-1)/2*s+(c-s*v)/2,b=(v-1)/2*n+(p-n*v)/2,I=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:I||i.src||"",afterX:x,afterY:b,scale:v}}runAppearEffect(e){this.view.showAppearEffect(e);let i=this.view.refs.imgClone;return new Promise(o=>{let r=()=>{i.removeEventListener("transitionend",r,!0),o()};i.addEventListener("transitionend",r,!0),this.scheduleTimeout(()=>{i.style.transform=`translate(${e.afterX}px, ${e.afterY}px) scale(${e.scale})`},10)})}doOpen(e,i){if(this.state.options.showAnimation!==!1&&this.supportsViewTransition())this.openPhotoWithViewTransition(e);else if(this.state.options.showAnimation===!1)this.initPhoto(),this.state.viewer.appear=!0,this.commit();else{this.initPhoto(),this.addAppearEffect(e,i),this.commit();let o=this.state.viewer.appearEffect;o&&this.runAppearEffect(o).then(()=>{this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.appear=!0,this.commit()})}this.fireEvent("open"),this.resyncSizeAfterOpen()}resyncSizeAfterOpen(){let e=O(),i=D();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(O()===e&&D()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,this.syncedGroupId!==e.groupId&&this.syncCurrentGroupView(),this.setHashByCurrentIndex(),e.loaded?this.doOpen(i,e):this.loadItem(e).then(()=>{this.doOpen(i,e)})}doHideEffect(e){return new Promise(i=>{let o=this.view.refs.dialog,r=this.currentImgElement(),s=D(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,c=()=>{this.finishHideEffect===c&&(this.finishHideEffect=null,o.removeEventListener("transitionend",c,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=c,r&&(r.style.transform=n),o.addEventListener("transitionend",c,!0),this.scheduleTimeout(c,this.state.options.animationSpeed+100)})}loadItem(e){return new Promise(i=>{var r;let o=new Image;o.onload=()=>{e.width=o.width,e.height=o.height,e.loaded=!0,this.checkLoadAll(e.groupId),i()},o.onerror=()=>i(),o.src=(r=e.src)!=null?r:""})}checkLoadAll(e){if(this.loadAllFired.has(e))return;let i=this.state.groups.get(e);i!=null&&i.length&&i.every(o=>o.loaded)&&(this.loadAllFired.add(e),this.fireEvent("loadall"))}loadNeighborItems(){let e=H(this.state);if(!e)return;let{currentIndex:i}=this.state.viewer,{loadOffset:o}=this.state.options,r=[];for(let s=i-o;s<i+o;s++){let n=e[s];n&&!n.loaded&&r.push(this.loadItem(n))}r.length&&Promise.all(r).then(()=>{this.initPhoto(),this.commit()})}slideList(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.state.viewer.onMove=!0,this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=M(this.state);this.state.viewer.onMove=!1,de(this.state),this.commit(),this.state.viewer.oldIndex!==this.state.viewer.currentIndex&&this.fireEvent("change"),this.state.viewer.oldIndex=this.state.viewer.currentIndex,this.loadNeighborItems(),e&&!e.loaded&&this.loadItem(e).then(()=>{this.initPhoto(),this.commit()})},200)}scheduleTimeout(e,i){let o=window.setTimeout(()=>{this.timeouts=this.timeouts.filter(r=>r!==o),e()},i);return this.timeouts.push(o),o}fireEvent(e){se(this.view.refs.dialog,e)}buildViewHandlers(){return{onDismiss:()=>this.hidePhoto(),onPrev:()=>this.prev(),onNext:()=>this.next(),onNavigate:e=>this.gotoSlide(e),onBackdropClick:()=>this.hidePhoto()}}buildGestureCallbacks(){return{onSwipeStart:()=>this.fireEvent("swipestart"),onSwipeMove:()=>this.view.updateListTransform(this.state),onSwipeEnd:e=>{if(this.fireEvent("swipeend"),e==="close-bottom"){this.hidePhoto("bottom");return}if(e==="close-top"){this.hidePhoto("top");return}e==="prev"?this.state.viewer.currentIndex-=1:e==="next"&&(this.state.viewer.currentIndex+=1),this.slideList()},onTap:()=>this.zoomPhoto(),onGestureStart:()=>{this.fireEvent("gesturestart"),this.view.updatePhotoTransform(this.state)},onGestureMove:()=>this.view.updatePhotoTransform(this.state),onGestureEnd:()=>{this.fireEvent("gestureend"),this.view.updatePhotoTransform(this.state)},onPhotoDragMove:()=>this.view.updatePhotoTransform(this.state),onPhotoDragEnd:e=>{if(e==="zoom-out"){this.zoomOutPhoto();return}if(e==="prev"){this.gotoSlide(this.state.viewer.prev);return}if(e==="next"){this.gotoSlide(this.state.viewer.next);return}this.view.updatePhotoTransform(this.state)}}}};var Fe=F;return De(Re);})();
7
7
  SmartPhoto = SmartPhoto.default;
package/lib/smartphoto.js CHANGED
@@ -1082,7 +1082,7 @@ function getWindowWidth() {
1082
1082
  return document.documentElement.clientWidth;
1083
1083
  }
1084
1084
  function getWindowHeight() {
1085
- return document.documentElement.clientHeight;
1085
+ return window.visualViewport?.height ?? document.documentElement.clientHeight;
1086
1086
  }
1087
1087
  function isElementArray(source) {
1088
1088
  return source.length > 0 && source[0] instanceof Element;
@@ -1114,6 +1114,12 @@ var SmartPhoto = class {
1114
1114
  this.loadAllFired = /* @__PURE__ */ new Set();
1115
1115
  this.syncedGroupId = null;
1116
1116
  // ---- 内部: window イベント ----
1117
+ this.updateViewportHeight = () => {
1118
+ this.view.refs.dialog.style.setProperty(
1119
+ "--smartphoto-vh",
1120
+ `${getWindowHeight()}px`
1121
+ );
1122
+ };
1117
1123
  this.handleResize = () => {
1118
1124
  if (!currentItems(this.state)) {
1119
1125
  return;
@@ -1193,6 +1199,18 @@ var SmartPhoto = class {
1193
1199
  this.openPhoto(restored, null);
1194
1200
  }
1195
1201
  }
1202
+ this.updateViewportHeight();
1203
+ if (window.visualViewport) {
1204
+ window.visualViewport.addEventListener(
1205
+ "resize",
1206
+ this.updateViewportHeight,
1207
+ { signal: this.abortController.signal }
1208
+ );
1209
+ } else {
1210
+ window.addEventListener("resize", this.updateViewportHeight, {
1211
+ signal: this.abortController.signal
1212
+ });
1213
+ }
1196
1214
  if (!this.isSmartPhoneFlag) {
1197
1215
  window.addEventListener("resize", this.handleResize, {
1198
1216
  signal: this.abortController.signal
@@ -1494,6 +1512,10 @@ var SmartPhoto = class {
1494
1512
  return typeof document.startViewTransition === "function";
1495
1513
  }
1496
1514
  openPhotoWithViewTransition(trigger) {
1515
+ document.documentElement.style.setProperty(
1516
+ "--smartphoto-animation-speed",
1517
+ `${this.state.options.animationSpeed}ms`
1518
+ );
1497
1519
  const transitionName = "smartphoto-hero";
1498
1520
  const thumbImg = trigger?.querySelector("img") ?? null;
1499
1521
  if (thumbImg) {
@@ -1056,7 +1056,7 @@ function getWindowWidth() {
1056
1056
  return document.documentElement.clientWidth;
1057
1057
  }
1058
1058
  function getWindowHeight() {
1059
- return document.documentElement.clientHeight;
1059
+ return window.visualViewport?.height ?? document.documentElement.clientHeight;
1060
1060
  }
1061
1061
  function isElementArray(source) {
1062
1062
  return source.length > 0 && source[0] instanceof Element;
@@ -1088,6 +1088,12 @@ var SmartPhoto = class {
1088
1088
  this.loadAllFired = /* @__PURE__ */ new Set();
1089
1089
  this.syncedGroupId = null;
1090
1090
  // ---- 内部: window イベント ----
1091
+ this.updateViewportHeight = () => {
1092
+ this.view.refs.dialog.style.setProperty(
1093
+ "--smartphoto-vh",
1094
+ `${getWindowHeight()}px`
1095
+ );
1096
+ };
1091
1097
  this.handleResize = () => {
1092
1098
  if (!currentItems(this.state)) {
1093
1099
  return;
@@ -1167,6 +1173,18 @@ var SmartPhoto = class {
1167
1173
  this.openPhoto(restored, null);
1168
1174
  }
1169
1175
  }
1176
+ this.updateViewportHeight();
1177
+ if (window.visualViewport) {
1178
+ window.visualViewport.addEventListener(
1179
+ "resize",
1180
+ this.updateViewportHeight,
1181
+ { signal: this.abortController.signal }
1182
+ );
1183
+ } else {
1184
+ window.addEventListener("resize", this.updateViewportHeight, {
1185
+ signal: this.abortController.signal
1186
+ });
1187
+ }
1170
1188
  if (!this.isSmartPhoneFlag) {
1171
1189
  window.addEventListener("resize", this.handleResize, {
1172
1190
  signal: this.abortController.signal
@@ -1468,6 +1486,10 @@ var SmartPhoto = class {
1468
1486
  return typeof document.startViewTransition === "function";
1469
1487
  }
1470
1488
  openPhotoWithViewTransition(trigger) {
1489
+ document.documentElement.style.setProperty(
1490
+ "--smartphoto-animation-speed",
1491
+ `${this.state.options.animationSpeed}ms`
1492
+ );
1471
1493
  const transitionName = "smartphoto-hero";
1472
1494
  const thumbImg = trigger?.querySelector("img") ?? null;
1473
1495
  if (thumbImg) {
@@ -59,6 +59,7 @@ export default class SmartPhoto {
59
59
  private loadNeighborItems;
60
60
  private slideList;
61
61
  private scheduleTimeout;
62
+ private updateViewportHeight;
62
63
  private handleResize;
63
64
  private handleKeydown;
64
65
  private handleOrientationChange;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartphoto",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "smartphoto",
5
5
  "homepage": "https://developer.a-blogcms.jp",
6
6
  "main": "./lib/smartphoto.js",