smartphoto 2.1.7 → 2.1.8

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
@@ -397,6 +397,11 @@ photo.on('zoomout',function(){
397
397
  <td>header color</td>
398
398
  <td>rgba(0, 0, 0, .2)</td>
399
399
  </tr>
400
+ <tr>
401
+ <td>--smartphoto-arrow-top</td>
402
+ <td>vertical position of the prev/next arrows, e.g. move them off the image on narrow screens with a media query</td>
403
+ <td>50%</td>
404
+ </tr>
400
405
  </table>
401
406
 
402
407
  Set these on `.smartphoto` (or `:root`) to override the defaults, no rebuild required:
@@ -408,8 +413,16 @@ Set these on `.smartphoto` (or `:root`) to override the defaults, no rebuild req
408
413
  --smartphoto-backdrop-color: rgba(0, 0, 0, 0.9);
409
414
  --smartphoto-header-color: rgba(0, 0, 0, 0.4);
410
415
  }
416
+
417
+ @media (max-width: 480px) {
418
+ .smartphoto {
419
+ --smartphoto-arrow-top: 85%;
420
+ }
421
+ }
411
422
  ```
412
423
 
424
+ The bottom thumbnail nav (`.smartphoto-nav`) also reserves `env(safe-area-inset-bottom)` automatically so it isn't hidden behind the iOS home indicator/toolbar.
425
+
413
426
 
414
427
  ## Download
415
428
  [Download ZIP](https://github.com/appleple/SmartPhoto/archive/master.zip)
@@ -288,7 +288,7 @@ dialog.smartphoto:not([open]) {
288
288
  .smartphoto-arrows li {
289
289
  display: block;
290
290
  position: absolute;
291
- top: 50%;
291
+ top: var(--smartphoto-arrow-top, 50%);
292
292
  width: 30px;
293
293
  height: 30px;
294
294
  margin-top: -20px;
@@ -350,6 +350,10 @@ dialog.smartphoto:not([open]) {
350
350
  bottom: 0;
351
351
  left: 0;
352
352
  width: 100%;
353
+ /* iOS Safari 等ではホームインジケーター/ツールバーの分だけ底面が隠れる
354
+ * ため、その領域を避けてサムネイルを表示する(§Issue #96) */
355
+ padding-bottom: env(safe-area-inset-bottom, 0px);
356
+ box-sizing: border-box;
353
357
  opacity: 1;
354
358
  animation-name: smartphoto-appear;
355
359
  animation-duration: var(--smartphoto-animation-speed, 0.45s);
@@ -1 +1 @@
1
- @keyframes smartphoto{0%{opacity:0}to{opacity:1}}@keyframes smartphoto-img-wrap{0%{opacity:0}to{opacity:1}}@keyframes smartphoto-inner{0%{transform:translateY(100px)}to{transform:translate(0)}}@keyframes smartphoto-loader{0%{opacity:.4;transform:rotate(0deg)}50%{opacity:1;transform:rotate(180deg)}to{opacity:.4;transform:rotate(1turn)}}@keyframes smartphoto-appear{0%{opacity:0}to{opacity:1}}@keyframes smartphoto-hide{0%{opacity:1}to{opacity:0}}:root:has(dialog.smartphoto[open]){overflow:hidden}.smartphoto{border:none;background:transparent;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,#000);opacity:1;font-family:sans-serif;cursor:pointer;transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out),display var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out) allow-discrete,overlay var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out) allow-discrete}.smartphoto:not([open]){opacity:0}dialog.smartphoto:not([open]){display:none!important}.smartphoto::backdrop{background-color:var(--smartphoto-backdrop-color,#000)}::view-transition-group(smartphoto-hero),::view-transition-new(smartphoto-hero),::view-transition-old(smartphoto-hero){animation-duration:var(--smartphoto-animation-speed,.45s);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,.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:transparent;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHZpZXdCb3g9IjAgMCAyODM0LjY1IDI4MzQuNjUiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNMTU3Ni40MiAxNDA2Ljc2IDI3ODQgMTk5LjE5YTU2Ljg2IDU2Ljg2IDAgMCAwIDAtODAuMThsLTc4LjkyLTc4LjkyYTU2Ljg2IDU2Ljg2IDAgMCAwLTgwLjE4IDBMMTQxNy4zMiAxMjQ3LjY2IDIwOS43NSA0MC4wOWE1Ni44NiA1Ni44NiAwIDAgMC04MC4xOCAwTDUwLjY1IDExOWE1Ni44NiA1Ni44NiAwIDAgMCAwIDgwLjE4bDEyMDcuNTggMTIwNy41OEw1MC42NSAyNjE0LjM0YTU2Ljg2IDU2Ljg2IDAgMCAwIDAgODAuMThsNzguOTIgNzguOTJhNTYuODYgNTYuODYgMCAwIDAgODAuMTggMGwxMjA3LjU3LTEyMDcuNThMMjYyNC45IDI3NzMuNDRhNTYuODYgNTYuODYgMCAwIDAgODAuMTggMGw3OC45Mi03OC45MmE1Ni44NiA1Ni44NiAwIDAgMCAwLTgwLjE4WiIvPjwvc3ZnPg==);text-shadow:0 1px 0 #fff;color:#fff;font-size:30px;text-decoration:none;cursor:pointer;line-height:1}.smartphoto-body{z-index:102;margin:0 auto}.smartphoto-body,.smartphoto-inner{position:relative;width:100%;height:100%}.smartphoto-inner{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,.45s) 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,.45s) var(--smartphoto-animation-function,ease-out)}.smartphoto-img-wrap{display:inline-block;opacity:1;touch-action:none;-webkit-transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);-moz-transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);-ms-transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);-o-transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);animation-name:smartphoto-img-wrap;animation-duration:var(--smartphoto-animation-speed,.45s);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,.45s);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,.45s);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:transparent;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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHZpZXdCb3g9IjAgMCAyODM0LjY1IDI4MzQuNjUiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNMTgzNy44OCAxNDE3LjMyIDY0My41OSAyMjNhNzIuMjEgNzIuMjEgMCAwIDEgMC0xMDEuODJMNzQzLjgyIDIxYTcyLjIxIDcyLjIxIDAgMCAxIDEwMS44MiAwbDEyNDUuMTkgMTI0NS4xOSAxMDAuMjMgMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAxIDAgMTAxLjgyTDg0NS42NCAyODEzLjY1YTcyLjIxIDcyLjIxIDAgMCAxLTEwMS44MiAwbC0xMDAuMjMtMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAxIDAtMTAxLjgyWiIvPjwvc3ZnPg==)}.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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHZpZXdCb3g9IjAgMCAyODM0LjY1IDI4MzQuNjUiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNOTk2Ljc3IDE0MTcuMzIgMjE5MS4wNiAyMjNhNzIuMjEgNzIuMjEgMCAwIDAgMC0xMDEuODJMMjA5MC44MyAyMUE3Mi4yMSA3Mi4yMSAwIDAgMCAxOTg5IDIxTDc0My44MiAxMjY2LjE5bC0xMDAuMjMgMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAwIDAgMTAxLjgyTDE5ODkgMjgxMy42NWE3Mi4yMSA3Mi4yMSAwIDAgMCAxMDEuODIgMGwxMDAuMjMtMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAwIDAtMTAxLjgyWiIvPjwvc3ZnPg==)}.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,.45s);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:50%;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,.45s) 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:400}.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:transparent;border-radius:50%;animation:smartphoto-loader .5s linear infinite}.smartphoto-img-clone{position:fixed;z-index:100;top:0;left:0;transition:all var(--smartphoto-animation-speed,.45s) 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{0%{opacity:0}to{opacity:1}}@keyframes smartphoto-img-wrap{0%{opacity:0}to{opacity:1}}@keyframes smartphoto-inner{0%{transform:translateY(100px)}to{transform:translate(0)}}@keyframes smartphoto-loader{0%{opacity:.4;transform:rotate(0deg)}50%{opacity:1;transform:rotate(180deg)}to{opacity:.4;transform:rotate(1turn)}}@keyframes smartphoto-appear{0%{opacity:0}to{opacity:1}}@keyframes smartphoto-hide{0%{opacity:1}to{opacity:0}}:root:has(dialog.smartphoto[open]){overflow:hidden}.smartphoto{border:none;background:transparent;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,#000);opacity:1;font-family:sans-serif;cursor:pointer;transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out),display var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out) allow-discrete,overlay var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out) allow-discrete}.smartphoto:not([open]){opacity:0}dialog.smartphoto:not([open]){display:none!important}.smartphoto::backdrop{background-color:var(--smartphoto-backdrop-color,#000)}::view-transition-group(smartphoto-hero),::view-transition-new(smartphoto-hero),::view-transition-old(smartphoto-hero){animation-duration:var(--smartphoto-animation-speed,.45s);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,.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:transparent;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHZpZXdCb3g9IjAgMCAyODM0LjY1IDI4MzQuNjUiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNMTU3Ni40MiAxNDA2Ljc2IDI3ODQgMTk5LjE5YTU2Ljg2IDU2Ljg2IDAgMCAwIDAtODAuMThsLTc4LjkyLTc4LjkyYTU2Ljg2IDU2Ljg2IDAgMCAwLTgwLjE4IDBMMTQxNy4zMiAxMjQ3LjY2IDIwOS43NSA0MC4wOWE1Ni44NiA1Ni44NiAwIDAgMC04MC4xOCAwTDUwLjY1IDExOWE1Ni44NiA1Ni44NiAwIDAgMCAwIDgwLjE4bDEyMDcuNTggMTIwNy41OEw1MC42NSAyNjE0LjM0YTU2Ljg2IDU2Ljg2IDAgMCAwIDAgODAuMThsNzguOTIgNzguOTJhNTYuODYgNTYuODYgMCAwIDAgODAuMTggMGwxMjA3LjU3LTEyMDcuNThMMjYyNC45IDI3NzMuNDRhNTYuODYgNTYuODYgMCAwIDAgODAuMTggMGw3OC45Mi03OC45MmE1Ni44NiA1Ni44NiAwIDAgMCAwLTgwLjE4WiIvPjwvc3ZnPg==);text-shadow:0 1px 0 #fff;color:#fff;font-size:30px;text-decoration:none;cursor:pointer;line-height:1}.smartphoto-body{z-index:102;margin:0 auto}.smartphoto-body,.smartphoto-inner{position:relative;width:100%;height:100%}.smartphoto-inner{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,.45s) 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,.45s) var(--smartphoto-animation-function,ease-out)}.smartphoto-img-wrap{display:inline-block;opacity:1;touch-action:none;-webkit-transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);-moz-transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);-ms-transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);-o-transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);transition:opacity var(--smartphoto-animation-speed,.45s) var(--smartphoto-animation-function,ease-out);animation-name:smartphoto-img-wrap;animation-duration:var(--smartphoto-animation-speed,.45s);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,.45s);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:var(--smartphoto-arrow-top,50%);width:30px;height:30px;margin-top:-20px;box-sizing:content-box;animation-duration:var(--smartphoto-animation-speed,.45s);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:transparent;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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHZpZXdCb3g9IjAgMCAyODM0LjY1IDI4MzQuNjUiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNMTgzNy44OCAxNDE3LjMyIDY0My41OSAyMjNhNzIuMjEgNzIuMjEgMCAwIDEgMC0xMDEuODJMNzQzLjgyIDIxYTcyLjIxIDcyLjIxIDAgMCAxIDEwMS44MiAwbDEyNDUuMTkgMTI0NS4xOSAxMDAuMjMgMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAxIDAgMTAxLjgyTDg0NS42NCAyODEzLjY1YTcyLjIxIDcyLjIxIDAgMCAxLTEwMS44MiAwbC0xMDAuMjMtMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAxIDAtMTAxLjgyWiIvPjwvc3ZnPg==)}.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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHZpZXdCb3g9IjAgMCAyODM0LjY1IDI4MzQuNjUiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNOTk2Ljc3IDE0MTcuMzIgMjE5MS4wNiAyMjNhNzIuMjEgNzIuMjEgMCAwIDAgMC0xMDEuODJMMjA5MC44MyAyMUE3Mi4yMSA3Mi4yMSAwIDAgMCAxOTg5IDIxTDc0My44MiAxMjY2LjE5bC0xMDAuMjMgMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAwIDAgMTAxLjgyTDE5ODkgMjgxMy42NWE3Mi4yMSA3Mi4yMSAwIDAgMCAxMDEuODIgMGwxMDAuMjMtMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAwIDAtMTAxLjgyWiIvPjwvc3ZnPg==)}.smartPhotoArrowHideIcon{display:none}.smartphoto-nav{position:absolute;bottom:0;left:0;width:100%;padding-bottom:env(safe-area-inset-bottom,0);box-sizing:border-box;opacity:1;animation-name:smartphoto-appear;animation-duration:var(--smartphoto-animation-speed,.45s);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:50%;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,.45s) 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:400}.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:transparent;border-radius:50%;animation:smartphoto-loader .5s linear infinite}.smartphoto-img-clone{position:fixed;z-index:100;top:0;left:0;transition:all var(--smartphoto-animation-speed,.45s) 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.7
2
+ * SmartPhoto v2.1.8
3
3
  * (c) appleple
4
4
  * Released under the MIT License.
5
5
  */
@@ -1189,6 +1189,22 @@
1189
1189
  `${getWindowHeight()}px`
1190
1190
  );
1191
1191
  };
1192
+ // iOS Safari 等ではアドレスバーの表示/非表示に伴う visualViewport の変化が
1193
+ // orientationchange を伴わず resize としてのみ発火する。スマートフォンでは
1194
+ // window の resize を購読していない(§コンストラクタ)ため、ここで拾わないと
1195
+ // 開いている間ずっと古い高さで計算された item.x/y がインラインスタイルに
1196
+ // 残り続け、表示中のスライドだけ位置がずれて見える(§Issue #95: スワイプ
1197
+ // ダウンで閉じて再度開いた際、閉じた瞬間表示していたスライドだけ縦位置がずれる)
1198
+ this.handleVisualViewportResize = () => {
1199
+ this.updateViewportHeight();
1200
+ if (!this.isSmartPhoneFlag || !this.state.viewer.isOpen || !currentItems(this.state)) {
1201
+ return;
1202
+ }
1203
+ this.resetTranslateCurrent();
1204
+ this.setPosByCurrentIndex();
1205
+ this.setSizeByScreen();
1206
+ this.commit();
1207
+ };
1192
1208
  this.handleResize = () => {
1193
1209
  if (!currentItems(this.state)) {
1194
1210
  return;
@@ -1275,7 +1291,7 @@
1275
1291
  if (window.visualViewport) {
1276
1292
  window.visualViewport.addEventListener(
1277
1293
  "resize",
1278
- this.updateViewportHeight,
1294
+ this.handleVisualViewportResize,
1279
1295
  { signal: this.abortController.signal }
1280
1296
  );
1281
1297
  } else {
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * SmartPhoto v2.1.7
2
+ * SmartPhoto v2.1.8
3
3
  * (c) appleple
4
4
  * Released under the MIT License.
5
5
  */
6
- "use strict";(()=>{var K=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function ye(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]=ye((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var be=ye,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)},xe=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},Ie=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,swipeVelocity:.5,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:450};function Le(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Le(i)}),Object.freeze(t)}function Ce(t){return{options:Le(be({},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 q(t){return t.getAttribute("data-group")||"nogroup"}function de(t){return t.group||"nogroup"}function ce(t,e,i,o){let r=q(t),s=t.getAttribute("href"),n=t.querySelector("img"),d=s;n&&(n.getAttribute(e.lazyAttribute)?d=n.getAttribute(e.lazyAttribute):n.currentSrc?d=n.currentSrc:d=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 u=t.getAttribute("data-id");return{src:s,thumb:d,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:u||i,loaded:!1,processed:!1,element:t}}function Te(t,e,i){var u,v,P,b,S;let o=de(t),r=t.src,s=(u=t.thumb)!=null?u:r,n=(v=t.caption)!=null?v:null,d=(b=(P=t.alt)!=null?P:n)!=null?b:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:d,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:(S=t.id)!=null?S:e,loaded:p,processed:!1,element:null}}function me(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 z(t){var i;let e=H(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function pe(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 fe(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function Z(t,e){let i=10**e;return Math.round(t*i)/i}function Q(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function Ae(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,d,p,u;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(u=(o-s)/2,d=-1*u):(u=(s-o)/2,d=-1*u),{minX:Z(n,6)*e.scaleSize,minY:Z(d,6)*e.scaleSize,maxX:Z(p,6)*e.scaleSize,maxY:Z(u,6)*e.scaleSize}}function Me(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 He(t){let e=z(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function ze(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 ve(t,e){let i=10**e;return Math.round(t*i)/i}function R(t){return{x:t.pageX,y:t.pageY}}function Oe(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}var ke=10;function Fe(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function De(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function Be({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,d=null,p=null,u=null,v=0,P=!1,b=null,S=null,O=0,D=0,M=!1,V=0,x=null,C=0,B=0;function c(){return K()}function W(a){let{width:h,height:E}=De();return Ae(a,t.viewer,h,E)}function U(a){let{width:h,height:E}=De();return Q(a,h,E,c())}function te(a,h){let E=z(t),g=W(E);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=g.minX:a===-1&&(t.viewer.photoPosX=g.maxX),h===1?t.viewer.photoPosY=g.minY:h===-1&&(t.viewer.photoPosY=g.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let ie=setInterval(()=>{if(M||s||P||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=C,t.viewer.photoPosY+=B;let a=z(t);if(!a)return;let h=W(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,C*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,C*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,B*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,B*=-.2);let E=Fe(C,B),g=E.force-t.options.registance;Math.abs(g)<.5||(C=Math.cos(E.theta)*g,B=Math.sin(E.theta)*g,e.onPhotoDragMove())},t.options.forceInterval);function X(a,h){(a>5||a<-5)&&(C+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(B+=h*.05)}function J(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||M||s||P||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?X(a.gamma,a.beta):h===90?X(a.beta,a.gamma):h===-90?X(-a.beta,-a.gamma):h===180&&X(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",J,{signal:i});function oe(){M=!0,s=!1,P=!1;let a=Array.from(o.values());V=Oe(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function re(a){let h=R(a);s=!0,n=!0,d=h,p=h,v=Date.now()}function ne(a){P=!0;let h=R(a);S=h,b=h}function se(a){var h,E;try{(E=(h=a.currentTarget).setPointerCapture)==null||E.call(h,a.pointerId)}catch(g){}if(o.set(a.pointerId,R(a)),o.size>1){oe();return}if(t.viewer.scale){ne(a);return}re(a)}function ae(){x===null&&(x=requestAnimationFrame(()=>{x=null,e.onGestureMove()}))}function le(){x!==null&&(cancelAnimationFrame(x),x=null,e.onGestureMove())}function m(){let a=Array.from(o.values()),h=Oe(a[0],a[1]),E=(h-V)/100,g=t.viewer.scaleSize,L=t.viewer.photoPosX,T=t.viewer.photoPosY;t.viewer.scaleSize+=ve(E,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<g&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-g)*L,t.viewer.photoPosY=(1+t.viewer.scaleSize-g)*T);let Y=z(t);if(Y){let he=U(Y);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>he}V=h,ae()}function l(a){let h=R(a),E=h.x-p.x,g=h.y-d.y;n&&(e.onSwipeStart(),n=!1,u=Math.abs(E)>Math.abs(g)?"horizontal":"vertical"),u==="horizontal"?t.viewer.translateX+=E:t.viewer.translateY=g,p=h,e.onSwipeMove()}function y(a){let h=R(a),E=h.x-S.x,g=h.y-S.y,L=ve(t.viewer.scaleSize*E,6),T=ve(t.viewer.scaleSize*g,6);t.viewer.photoPosX+=L,O=L,t.viewer.photoPosY+=T,D=T,S=h,e.onPhotoDragMove()}function w(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,R(a)),M){m();return}if(P){y(a);return}l(a)}}function f(){M=!1,le();let a=z(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 I(){var Ee;s=!1;let a=d,h=p,E=Date.now(),g=r-E,L=h.x-a.x,T=h.y-a.y,Y=L===0&&T===0;if(!c()&&Y){e.onTap();return}if(Math.abs(g)<=500&&Y){e.onTap();return}r=E;let he=(Ee=H(t))!=null?Ee:[];if(u==="horizontal"){let $="stay",Ve=Math.max(E-v,1),Pe=Math.abs(L)>=ke&&Math.abs(L)/Ve>=t.options.swipeVelocity;(L>=t.options.swipeOffset||Pe&&L>0)&&t.viewer.currentIndex!==0?$="prev":(L<=-t.options.swipeOffset||Pe&&L<0)&&t.viewer.currentIndex!==he.length-1&&($="next"),e.onSwipeEnd($)}else{let $="stay";t.options.swipeBottomToClose&&T>=t.options.swipeOffset?$="close-bottom":t.options.swipeTopToClose&&T<=-t.options.swipeOffset&&($="close-top"),e.onSwipeEnd($)}}function F(){P=!1;let a=S,h=b;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let E=z(t);if(!E){e.onPhotoDragEnd(null);return}let g=W(E),L=t.options.swipeOffset*t.viewer.scaleSize,T=0,Y=0;if(t.viewer.photoPosX>g.maxX?T=-1:t.viewer.photoPosX<g.minX&&(T=1),t.viewer.photoPosY>g.maxY?Y=-1:t.viewer.photoPosY<g.minY&&(Y=1),t.viewer.photoPosX-g.maxX>L&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(g.minX-t.viewer.photoPosX>L&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}T===0&&Y===0?(C=O/5,B=D/5):te(T,Y),e.onPhotoDragEnd(null)}function j(a){if(o.delete(a.pointerId),M){o.size<2&&f();return}if(P){F();return}s&&I()}function N(...a){for(let h of a)h.addEventListener("pointerdown",se,{signal:i}),h.addEventListener("pointermove",w,{signal:i}),h.addEventListener("pointerup",j,{signal:i}),h.addEventListener("pointercancel",j,{signal:i})}function G(){clearInterval(ie),x!==null&&(cancelAnimationFrame(x),x=null)}return{attach:N,detach:G}}function ee(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function we(){let t=document.createElement("button");return t.type="button",t}function $e(t){return t.replace(/"/g,'\\"')}function Xe({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let d=document.createElement("dialog");d.className=r.smartPhoto,d.setAttribute("aria-labelledby",`smartphoto-${t}-title`),d.style.display="none",d.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let u=document.createElement("div");u.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let P=document.createElement("span");P.className=r.smartPhotoCount;let b=document.createElement("h1");b.id=`smartphoto-${t}-title`,b.className=r.smartPhotoCaption,b.setAttribute("tabindex","-1");let S=document.createElement("button");S.className=r.smartPhotoDismiss,S.appendChild(ee(s.closeDialog)),S.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(P,b,S);let O=document.createElement("div");O.className=r.smartPhotoContent,O.addEventListener("click",m=>{m.target===O&&i.onBackdropClick()},{signal:o});let D=document.createElement("ul");D.className=r.smartPhotoList,D.setAttribute("role","region"),D.setAttribute("aria-roledescription","carousel"),D.setAttribute("aria-label",s.carouselLabel),D.setAttribute("aria-live","polite"),D.setAttribute("aria-atomic","false"),u.append(v,O,D);let M=null,V=null,x=null;if(e.arrows){M=document.createElement("ul"),M.className=r.smartPhotoArrows,V=document.createElement("li"),V.className=r.smartPhotoArrowLeft;let m=we();m.appendChild(ee(s.gotoPrevImage)),m.addEventListener("click",()=>i.onPrev(),{signal:o}),V.appendChild(m),x=document.createElement("li"),x.className=r.smartPhotoArrowRight;let l=we();l.appendChild(ee(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),x.appendChild(l),M.append(V,x),u.appendChild(M)}let C=null,B=null;e.nav&&(C=document.createElement("nav"),C.className=r.smartPhotoNav,C.setAttribute("aria-label","Choose slide to display"),B=document.createElement("ul"),C.appendChild(B),u.appendChild(C)),p.appendChild(u),d.appendChild(p),n.appendChild(d);let c={dialog:d,count:P,caption:b,dismiss:S,content:O,list:D,arrows:M,arrowLeft:V,arrowRight:x,nav:C,navList:B,slides:new Map,imgClone:null};function W(){let m=document.createElement("div");m.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,m.appendChild(l),m}function U(m){var w,f;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let y=document.createElement("img");return y.className=r.smartPhotoImg,y.src=(w=m.src)!=null?w:"",y.alt=(f=m.alt)!=null?f:"",y.addEventListener("dragstart",I=>I.preventDefault(),{signal:o}),l.appendChild(y),{imgWrap:l,img:y}}function te(m,l){var y;c.list.replaceChildren(),(y=c.navList)==null||y.replaceChildren(),c.slides=new Map,m.forEach(w=>{var F,j;let f=document.createElement("li");f.setAttribute("role","group"),f.setAttribute("aria-roledescription","slide"),f.setAttribute("aria-label",`${w.index+1} of ${m.length}`);let I={li:f,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(w.processed){let{imgWrap:N,img:G}=U(w);f.appendChild(N),I.imgWrap=N,I.img=G}else{let N=W();f.appendChild(N),I.loaderWrap=N}if(c.list.appendChild(f),c.slides.set(w,I),c.navList){let N=document.createElement("li"),G=we();G.style.backgroundImage=`url("${$e((F=w.thumb)!=null?F:"")}")`;let a=w.index;G.addEventListener("click",()=>i.onNavigate(a),{signal:o}),G.appendChild(ee(`go to ${(j=w.caption)!=null?j:""}`)),N.appendChild(G),c.navList.appendChild(N),I.navLink=G}}),J(l)}function ie(m,l){var f;if(l.imgWrap||!m.processed)return l;let{imgWrap:y,img:w}=U(m);return(f=l.loaderWrap)==null||f.replaceWith(y),l.loaderWrap=null,l.imgWrap=y,l.img=w,l}function X(m){m&&document.activeElement&&m.contains(document.activeElement)&&c.caption.focus()}function J(m){let{viewer:l}=m;c.count.textContent=`${l.currentIndex+1}/${l.total}`,c.slides.forEach((y,w)=>{var F;let f=ie(w,y),I=w.index===l.currentIndex;f.li.style.transform=`translate(${w.translateX}px,${w.translateY}px)`,f.li.classList.toggle("current",I),I?f.li.removeAttribute("aria-hidden"):f.li.setAttribute("aria-hidden","true"),I&&(c.caption.textContent=(F=w.caption)!=null?F:""),f.imgWrap&&f.img&&(f.imgWrap.style.transform=`translate(${w.x}px,${w.y}px) scale(${w.scale})`,f.img.style.width=`${w.width}px`,f.img.classList.toggle("active",l.appear),f.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),f.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),f.navLink&&(f.navLink.classList.toggle("current",I),I?f.navLink.setAttribute("aria-current","true"):f.navLink.removeAttribute("aria-current"))}),c.arrowLeft&&(l.showPrevArrow?c.arrowLeft.removeAttribute("aria-hidden"):(X(c.arrowLeft),c.arrowLeft.setAttribute("aria-hidden","true"))),c.arrowRight&&(l.showNextArrow?c.arrowRight.removeAttribute("aria-hidden"):(X(c.arrowRight),c.arrowRight.setAttribute("aria-hidden","true"))),c.arrows&&(l.hideUi&&X(c.arrows),c.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),c.nav&&(l.hideUi&&X(c.nav),c.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function oe(m){for(let[l,y]of c.slides)if(l.index===m.viewer.currentIndex)return y;return null}function re(m){let{viewer:l}=m,y=oe(m),w=y==null?void 0:y.img;w&&(w.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,w.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),c.nav&&(l.hideUi&&X(c.nav),c.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),c.arrows&&(l.hideUi&&X(c.arrows),c.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ne(m){let{viewer:l}=m;c.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,c.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function se(m){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=m.img,l.style.width=`${m.width}px`,l.style.height=`${m.height}px`,l.style.transform=`translate(${m.left}px,${m.top}px) scale(1)`,p.appendChild(l),c.imgClone=l}function ae(){var m;(m=c.imgClone)==null||m.remove(),c.imgClone=null}function le(){n.remove()}return{root:n,refs:c,render:J,syncSlides:te,updatePhotoTransform:re,updateListTransform:ne,showAppearEffect:se,removeAppearEffect:ae,destroy:le}}function A(){return document.documentElement.clientWidth}function k(){let t=window.visualViewport;return t?t.height*t.scale:document.documentElement.clientHeight}function Re(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 Ne(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var _=class{constructor(e,i){this.id=We();this.abortController=new AbortController;this.isSmartPhoneFlag=K();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.rootSelector=null;this.itemsByElement=new Map;this.handleDocumentClick=e=>{if(!(e.target instanceof Element))return;let i=e;if(i.__smartphotoClaimed)return;let o=this.findRegisteredAncestor(e.target);if(!o&&this.rootSelector&&(o=e.target.closest(this.rootSelector)),!o)return;if(e.preventDefault(),i.__smartphotoClaimed=!0,!this.itemsByElement.has(o)&&this.rootSelector){let s=q(o);this.resyncGroupFromDom(s)&&this.syncCurrentGroupView()}let r=this.itemsByElement.get(o);r&&this.openPhoto(r,o)};this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${k()}px`)};this.handleResize=()=>{H(this.state)&&(this.updateViewportHeight(),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.updateViewportHeight(),this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=A(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==A()?(this.updateViewportHeight(),this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.rootSelector=typeof e=="string"?e:null,this.state=Ce(i!=null?i:{}),this.view=Xe({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=Be({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}),document.addEventListener("click",this.handleDocumentClick,{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&this.openPhoto(o,o.element),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.itemsByElement.clear(),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=Ne();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=z(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=Q(e,A(),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,u,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(P=>P.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,d=(v=(u=i.trigger)!=null?u:s.element)!=null?v:n;this.openPhoto(s,d)}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 HTMLElement?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!Re(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=q(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=ce(e,this.state.options,o,A());return me(this.state,r),this.loadAllFired.delete(i),this.itemsByElement.set(e,r),r}addSlideItem(e){var s,n;let i=de(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=Te(e,o,A());return me(this.state,r),this.loadAllFired.delete(i),r}findRegisteredAncestor(e){let i=e;for(;i;){if(this.itemsByElement.has(i))return i;i=i.parentElement}return null}resyncGroupFromDom(e){var p;if(!this.rootSelector)return!1;let i=Array.from(document.querySelectorAll(this.rootSelector)).filter(u=>q(u)===e),o=new Set(i),r=(p=this.state.groups.get(e))!=null?p:[],s=new Map;r.forEach(u=>{u.element&&s.set(u.element,u)});let n=i.length!==r.length,d=i.map((u,v)=>{let P=s.get(u);if(P)return P.index!==v&&(n=!0,P.index=v),P;n=!0;let b=ce(u,this.state.options,v,A());return this.itemsByElement.set(u,b),b});return r.forEach(u=>{u.element&&!o.has(u.element)&&this.itemsByElement.delete(u.element)}),fe(d,A()),this.state.groups.set(e,d),n&&this.loadAllFired.delete(e),n}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=Ne();this.setHash(He(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?ze(this.state,xe(e)):null}setPosByCurrentIndex(){let e=z(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&&Me(e,A(),k(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){fe(H(this.state),A())}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.style.removeProperty("display"),e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&(e.close(),e.style.display="none")}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(),pe(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=z(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=Q(o,A(),k(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,d;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=(d=document.startViewTransition)==null?void 0:d.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 O;let o=(O=e==null?void 0:e.querySelector("img"))!=null?O:null;if(!o){this.state.viewer.appear=!0;return}let r=Ie(o),s=o.offsetWidth,n=o.offsetHeight,d=A(),p=k(),u=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=d/s:(s>=n?i.height<u?v=i.width/s:v=u/n:i.height<u?v=i.height/n:v=u/n,s*v>d&&(v=d/s));let P=(v-1)/2*s+(d-s*v)/2,b=(v-1)/2*n+(p-n*v)/2,S=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:S||i.src||"",afterX:P,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=A(),i=k();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(A()===e&&k()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){let o=this.rootSelector?this.resyncGroupFromDom(e.groupId):!1;this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,(this.syncedGroupId!==e.groupId||o)&&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)`,d=()=>{this.finishHideEffect===d&&(this.finishHideEffect=null,o.removeEventListener("transitionend",d,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=d,r&&(r.style.transform=n),o.addEventListener("transitionend",d,!0),this.scheduleTimeout(d,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.updateViewportHeight(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=z(this.state);this.state.viewer.onMove=!1,pe(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 Ye=_;var ge=t=>{t.fn.SmartPhoto=function(e){return typeof e=="string"||new Ye(this,e),this}};if(typeof define=="function"&&define.amd)define(["jquery"],ge);else{let t=window,e=t.jQuery?t.jQuery:t.$;typeof e!="undefined"&&ge(e)}var ot=ge;})();
6
+ "use strict";(()=>{var K=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function ye(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]=ye((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var be=ye,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)},xe=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},Ie=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,swipeVelocity:.5,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:450};function Le(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Le(i)}),Object.freeze(t)}function Ce(t){return{options:Le(be({},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 q(t){return t.getAttribute("data-group")||"nogroup"}function de(t){return t.group||"nogroup"}function ce(t,e,i,o){let r=q(t),s=t.getAttribute("href"),n=t.querySelector("img"),d=s;n&&(n.getAttribute(e.lazyAttribute)?d=n.getAttribute(e.lazyAttribute):n.currentSrc?d=n.currentSrc:d=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 u=t.getAttribute("data-id");return{src:s,thumb:d,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:u||i,loaded:!1,processed:!1,element:t}}function Te(t,e,i){var u,v,P,b,S;let o=de(t),r=t.src,s=(u=t.thumb)!=null?u:r,n=(v=t.caption)!=null?v:null,d=(b=(P=t.alt)!=null?P:n)!=null?b:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:d,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:(S=t.id)!=null?S:e,loaded:p,processed:!1,element:null}}function me(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 A(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function z(t){var i;let e=A(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function pe(t){let e=A(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 fe(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function Z(t,e){let i=10**e;return Math.round(t*i)/i}function Q(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function Ae(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,d,p,u;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(u=(o-s)/2,d=-1*u):(u=(s-o)/2,d=-1*u),{minX:Z(n,6)*e.scaleSize,minY:Z(d,6)*e.scaleSize,maxX:Z(p,6)*e.scaleSize,maxY:Z(u,6)*e.scaleSize}}function Me(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 He(t){let e=z(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function ze(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 ve(t,e){let i=10**e;return Math.round(t*i)/i}function $(t){return{x:t.pageX,y:t.pageY}}function Oe(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}var Fe=10;function ke(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function De(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function Be({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,d=null,p=null,u=null,v=0,P=!1,b=null,S=null,O=0,D=0,H=!1,Y=0,x=null,C=0,B=0;function c(){return K()}function W(a){let{width:h,height:E}=De();return Ae(a,t.viewer,h,E)}function U(a){let{width:h,height:E}=De();return Q(a,h,E,c())}function te(a,h){let E=z(t),g=W(E);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=g.minX:a===-1&&(t.viewer.photoPosX=g.maxX),h===1?t.viewer.photoPosY=g.minY:h===-1&&(t.viewer.photoPosY=g.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let ie=setInterval(()=>{if(H||s||P||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=C,t.viewer.photoPosY+=B;let a=z(t);if(!a)return;let h=W(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,C*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,C*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,B*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,B*=-.2);let E=ke(C,B),g=E.force-t.options.registance;Math.abs(g)<.5||(C=Math.cos(E.theta)*g,B=Math.sin(E.theta)*g,e.onPhotoDragMove())},t.options.forceInterval);function V(a,h){(a>5||a<-5)&&(C+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(B+=h*.05)}function J(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||H||s||P||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?V(a.gamma,a.beta):h===90?V(a.beta,a.gamma):h===-90?V(-a.beta,-a.gamma):h===180&&V(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",J,{signal:i});function oe(){H=!0,s=!1,P=!1;let a=Array.from(o.values());Y=Oe(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function re(a){let h=$(a);s=!0,n=!0,d=h,p=h,v=Date.now()}function ne(a){P=!0;let h=$(a);S=h,b=h}function se(a){var h,E;try{(E=(h=a.currentTarget).setPointerCapture)==null||E.call(h,a.pointerId)}catch(g){}if(o.set(a.pointerId,$(a)),o.size>1){oe();return}if(t.viewer.scale){ne(a);return}re(a)}function ae(){x===null&&(x=requestAnimationFrame(()=>{x=null,e.onGestureMove()}))}function le(){x!==null&&(cancelAnimationFrame(x),x=null,e.onGestureMove())}function m(){let a=Array.from(o.values()),h=Oe(a[0],a[1]),E=(h-Y)/100,g=t.viewer.scaleSize,L=t.viewer.photoPosX,T=t.viewer.photoPosY;t.viewer.scaleSize+=ve(E,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<g&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-g)*L,t.viewer.photoPosY=(1+t.viewer.scaleSize-g)*T);let N=z(t);if(N){let he=U(N);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>he}Y=h,ae()}function l(a){let h=$(a),E=h.x-p.x,g=h.y-d.y;n&&(e.onSwipeStart(),n=!1,u=Math.abs(E)>Math.abs(g)?"horizontal":"vertical"),u==="horizontal"?t.viewer.translateX+=E:t.viewer.translateY=g,p=h,e.onSwipeMove()}function y(a){let h=$(a),E=h.x-S.x,g=h.y-S.y,L=ve(t.viewer.scaleSize*E,6),T=ve(t.viewer.scaleSize*g,6);t.viewer.photoPosX+=L,O=L,t.viewer.photoPosY+=T,D=T,S=h,e.onPhotoDragMove()}function w(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,$(a)),H){m();return}if(P){y(a);return}l(a)}}function f(){H=!1,le();let a=z(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 I(){var Ee;s=!1;let a=d,h=p,E=Date.now(),g=r-E,L=h.x-a.x,T=h.y-a.y,N=L===0&&T===0;if(!c()&&N){e.onTap();return}if(Math.abs(g)<=500&&N){e.onTap();return}r=E;let he=(Ee=A(t))!=null?Ee:[];if(u==="horizontal"){let R="stay",Ye=Math.max(E-v,1),Pe=Math.abs(L)>=Fe&&Math.abs(L)/Ye>=t.options.swipeVelocity;(L>=t.options.swipeOffset||Pe&&L>0)&&t.viewer.currentIndex!==0?R="prev":(L<=-t.options.swipeOffset||Pe&&L<0)&&t.viewer.currentIndex!==he.length-1&&(R="next"),e.onSwipeEnd(R)}else{let R="stay";t.options.swipeBottomToClose&&T>=t.options.swipeOffset?R="close-bottom":t.options.swipeTopToClose&&T<=-t.options.swipeOffset&&(R="close-top"),e.onSwipeEnd(R)}}function k(){P=!1;let a=S,h=b;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let E=z(t);if(!E){e.onPhotoDragEnd(null);return}let g=W(E),L=t.options.swipeOffset*t.viewer.scaleSize,T=0,N=0;if(t.viewer.photoPosX>g.maxX?T=-1:t.viewer.photoPosX<g.minX&&(T=1),t.viewer.photoPosY>g.maxY?N=-1:t.viewer.photoPosY<g.minY&&(N=1),t.viewer.photoPosX-g.maxX>L&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(g.minX-t.viewer.photoPosX>L&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}T===0&&N===0?(C=O/5,B=D/5):te(T,N),e.onPhotoDragEnd(null)}function j(a){if(o.delete(a.pointerId),H){o.size<2&&f();return}if(P){k();return}s&&I()}function X(...a){for(let h of a)h.addEventListener("pointerdown",se,{signal:i}),h.addEventListener("pointermove",w,{signal:i}),h.addEventListener("pointerup",j,{signal:i}),h.addEventListener("pointercancel",j,{signal:i})}function G(){clearInterval(ie),x!==null&&(cancelAnimationFrame(x),x=null)}return{attach:X,detach:G}}function ee(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function we(){let t=document.createElement("button");return t.type="button",t}function Re(t){return t.replace(/"/g,'\\"')}function Ve({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let d=document.createElement("dialog");d.className=r.smartPhoto,d.setAttribute("aria-labelledby",`smartphoto-${t}-title`),d.style.display="none",d.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let u=document.createElement("div");u.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let P=document.createElement("span");P.className=r.smartPhotoCount;let b=document.createElement("h1");b.id=`smartphoto-${t}-title`,b.className=r.smartPhotoCaption,b.setAttribute("tabindex","-1");let S=document.createElement("button");S.className=r.smartPhotoDismiss,S.appendChild(ee(s.closeDialog)),S.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(P,b,S);let O=document.createElement("div");O.className=r.smartPhotoContent,O.addEventListener("click",m=>{m.target===O&&i.onBackdropClick()},{signal:o});let D=document.createElement("ul");D.className=r.smartPhotoList,D.setAttribute("role","region"),D.setAttribute("aria-roledescription","carousel"),D.setAttribute("aria-label",s.carouselLabel),D.setAttribute("aria-live","polite"),D.setAttribute("aria-atomic","false"),u.append(v,O,D);let H=null,Y=null,x=null;if(e.arrows){H=document.createElement("ul"),H.className=r.smartPhotoArrows,Y=document.createElement("li"),Y.className=r.smartPhotoArrowLeft;let m=we();m.appendChild(ee(s.gotoPrevImage)),m.addEventListener("click",()=>i.onPrev(),{signal:o}),Y.appendChild(m),x=document.createElement("li"),x.className=r.smartPhotoArrowRight;let l=we();l.appendChild(ee(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),x.appendChild(l),H.append(Y,x),u.appendChild(H)}let C=null,B=null;e.nav&&(C=document.createElement("nav"),C.className=r.smartPhotoNav,C.setAttribute("aria-label","Choose slide to display"),B=document.createElement("ul"),C.appendChild(B),u.appendChild(C)),p.appendChild(u),d.appendChild(p),n.appendChild(d);let c={dialog:d,count:P,caption:b,dismiss:S,content:O,list:D,arrows:H,arrowLeft:Y,arrowRight:x,nav:C,navList:B,slides:new Map,imgClone:null};function W(){let m=document.createElement("div");m.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,m.appendChild(l),m}function U(m){var w,f;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let y=document.createElement("img");return y.className=r.smartPhotoImg,y.src=(w=m.src)!=null?w:"",y.alt=(f=m.alt)!=null?f:"",y.addEventListener("dragstart",I=>I.preventDefault(),{signal:o}),l.appendChild(y),{imgWrap:l,img:y}}function te(m,l){var y;c.list.replaceChildren(),(y=c.navList)==null||y.replaceChildren(),c.slides=new Map,m.forEach(w=>{var k,j;let f=document.createElement("li");f.setAttribute("role","group"),f.setAttribute("aria-roledescription","slide"),f.setAttribute("aria-label",`${w.index+1} of ${m.length}`);let I={li:f,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(w.processed){let{imgWrap:X,img:G}=U(w);f.appendChild(X),I.imgWrap=X,I.img=G}else{let X=W();f.appendChild(X),I.loaderWrap=X}if(c.list.appendChild(f),c.slides.set(w,I),c.navList){let X=document.createElement("li"),G=we();G.style.backgroundImage=`url("${Re((k=w.thumb)!=null?k:"")}")`;let a=w.index;G.addEventListener("click",()=>i.onNavigate(a),{signal:o}),G.appendChild(ee(`go to ${(j=w.caption)!=null?j:""}`)),X.appendChild(G),c.navList.appendChild(X),I.navLink=G}}),J(l)}function ie(m,l){var f;if(l.imgWrap||!m.processed)return l;let{imgWrap:y,img:w}=U(m);return(f=l.loaderWrap)==null||f.replaceWith(y),l.loaderWrap=null,l.imgWrap=y,l.img=w,l}function V(m){m&&document.activeElement&&m.contains(document.activeElement)&&c.caption.focus()}function J(m){let{viewer:l}=m;c.count.textContent=`${l.currentIndex+1}/${l.total}`,c.slides.forEach((y,w)=>{var k;let f=ie(w,y),I=w.index===l.currentIndex;f.li.style.transform=`translate(${w.translateX}px,${w.translateY}px)`,f.li.classList.toggle("current",I),I?f.li.removeAttribute("aria-hidden"):f.li.setAttribute("aria-hidden","true"),I&&(c.caption.textContent=(k=w.caption)!=null?k:""),f.imgWrap&&f.img&&(f.imgWrap.style.transform=`translate(${w.x}px,${w.y}px) scale(${w.scale})`,f.img.style.width=`${w.width}px`,f.img.classList.toggle("active",l.appear),f.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),f.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),f.navLink&&(f.navLink.classList.toggle("current",I),I?f.navLink.setAttribute("aria-current","true"):f.navLink.removeAttribute("aria-current"))}),c.arrowLeft&&(l.showPrevArrow?c.arrowLeft.removeAttribute("aria-hidden"):(V(c.arrowLeft),c.arrowLeft.setAttribute("aria-hidden","true"))),c.arrowRight&&(l.showNextArrow?c.arrowRight.removeAttribute("aria-hidden"):(V(c.arrowRight),c.arrowRight.setAttribute("aria-hidden","true"))),c.arrows&&(l.hideUi&&V(c.arrows),c.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),c.nav&&(l.hideUi&&V(c.nav),c.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function oe(m){for(let[l,y]of c.slides)if(l.index===m.viewer.currentIndex)return y;return null}function re(m){let{viewer:l}=m,y=oe(m),w=y==null?void 0:y.img;w&&(w.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,w.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),c.nav&&(l.hideUi&&V(c.nav),c.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),c.arrows&&(l.hideUi&&V(c.arrows),c.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ne(m){let{viewer:l}=m;c.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,c.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function se(m){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=m.img,l.style.width=`${m.width}px`,l.style.height=`${m.height}px`,l.style.transform=`translate(${m.left}px,${m.top}px) scale(1)`,p.appendChild(l),c.imgClone=l}function ae(){var m;(m=c.imgClone)==null||m.remove(),c.imgClone=null}function le(){n.remove()}return{root:n,refs:c,render:J,syncSlides:te,updatePhotoTransform:re,updateListTransform:ne,showAppearEffect:se,removeAppearEffect:ae,destroy:le}}function M(){return document.documentElement.clientWidth}function F(){let t=window.visualViewport;return t?t.height*t.scale:document.documentElement.clientHeight}function $e(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 Xe(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var _=class{constructor(e,i){this.id=We();this.abortController=new AbortController;this.isSmartPhoneFlag=K();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.rootSelector=null;this.itemsByElement=new Map;this.handleDocumentClick=e=>{if(!(e.target instanceof Element))return;let i=e;if(i.__smartphotoClaimed)return;let o=this.findRegisteredAncestor(e.target);if(!o&&this.rootSelector&&(o=e.target.closest(this.rootSelector)),!o)return;if(e.preventDefault(),i.__smartphotoClaimed=!0,!this.itemsByElement.has(o)&&this.rootSelector){let s=q(o);this.resyncGroupFromDom(s)&&this.syncCurrentGroupView()}let r=this.itemsByElement.get(o);r&&this.openPhoto(r,o)};this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${F()}px`)};this.handleVisualViewportResize=()=>{this.updateViewportHeight(),!(!this.isSmartPhoneFlag||!this.state.viewer.isOpen||!A(this.state))&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleResize=()=>{A(this.state)&&(this.updateViewportHeight(),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(!A(this.state))return;this.updateViewportHeight(),this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=M(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==M()?(this.updateViewportHeight(),this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.rootSelector=typeof e=="string"?e:null,this.state=Ce(i!=null?i:{}),this.view=Ve({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=Be({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}),document.addEventListener("click",this.handleDocumentClick,{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&this.openPhoto(o,o.element),this.updateViewportHeight(),window.visualViewport?window.visualViewport.addEventListener("resize",this.handleVisualViewportResize,{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.itemsByElement.clear(),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=Xe();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=z(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=Q(e,M(),F(),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,u,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(P=>P.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,d=(v=(u=i.trigger)!=null?u:s.element)!=null?v:n;this.openPhoto(s,d)}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 HTMLElement?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!$e(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=q(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=ce(e,this.state.options,o,M());return me(this.state,r),this.loadAllFired.delete(i),this.itemsByElement.set(e,r),r}addSlideItem(e){var s,n;let i=de(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=Te(e,o,M());return me(this.state,r),this.loadAllFired.delete(i),r}findRegisteredAncestor(e){let i=e;for(;i;){if(this.itemsByElement.has(i))return i;i=i.parentElement}return null}resyncGroupFromDom(e){var p;if(!this.rootSelector)return!1;let i=Array.from(document.querySelectorAll(this.rootSelector)).filter(u=>q(u)===e),o=new Set(i),r=(p=this.state.groups.get(e))!=null?p:[],s=new Map;r.forEach(u=>{u.element&&s.set(u.element,u)});let n=i.length!==r.length,d=i.map((u,v)=>{let P=s.get(u);if(P)return P.index!==v&&(n=!0,P.index=v),P;n=!0;let b=ce(u,this.state.options,v,M());return this.itemsByElement.set(u,b),b});return r.forEach(u=>{u.element&&!o.has(u.element)&&this.itemsByElement.delete(u.element)}),fe(d,M()),this.state.groups.set(e,d),n&&this.loadAllFired.delete(e),n}syncCurrentGroupView(){let e=A(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=Xe();this.setHash(He(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?ze(this.state,xe(e)):null}setPosByCurrentIndex(){let e=z(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=A(this.state);e&&Me(e,M(),F(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){fe(A(this.state),M())}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.style.removeProperty("display"),e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&(e.close(),e.style.display="none")}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=A(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(),pe(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=z(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=Q(o,M(),F(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,d;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=(d=document.startViewTransition)==null?void 0:d.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 O;let o=(O=e==null?void 0:e.querySelector("img"))!=null?O:null;if(!o){this.state.viewer.appear=!0;return}let r=Ie(o),s=o.offsetWidth,n=o.offsetHeight,d=M(),p=F(),u=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=d/s:(s>=n?i.height<u?v=i.width/s:v=u/n:i.height<u?v=i.height/n:v=u/n,s*v>d&&(v=d/s));let P=(v-1)/2*s+(d-s*v)/2,b=(v-1)/2*n+(p-n*v)/2,S=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:S||i.src||"",afterX:P,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=M(),i=F();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(M()===e&&F()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){let o=this.rootSelector?this.resyncGroupFromDom(e.groupId):!1;this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,(this.syncedGroupId!==e.groupId||o)&&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=F(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,d=()=>{this.finishHideEffect===d&&(this.finishHideEffect=null,o.removeEventListener("transitionend",d,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=d,r&&(r.style.transform=n),o.addEventListener("transitionend",d,!0),this.scheduleTimeout(d,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=A(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.updateViewportHeight(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=z(this.state);this.state.viewer.onMove=!1,pe(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 Ne=_;var ge=t=>{t.fn.SmartPhoto=function(e){return typeof e=="string"||new Ne(this,e),this}};if(typeof define=="function"&&define.amd)define(["jquery"],ge);else{let t=window,e=t.jQuery?t.jQuery:t.$;typeof e!="undefined"&&ge(e)}var ot=ge;})();
package/js/smartphoto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SmartPhoto v2.1.7
2
+ * SmartPhoto v2.1.8
3
3
  * (c) appleple
4
4
  * Released under the MIT License.
5
5
  */
@@ -1213,6 +1213,22 @@ var SmartPhoto = (() => {
1213
1213
  `${getWindowHeight()}px`
1214
1214
  );
1215
1215
  };
1216
+ // iOS Safari 等ではアドレスバーの表示/非表示に伴う visualViewport の変化が
1217
+ // orientationchange を伴わず resize としてのみ発火する。スマートフォンでは
1218
+ // window の resize を購読していない(§コンストラクタ)ため、ここで拾わないと
1219
+ // 開いている間ずっと古い高さで計算された item.x/y がインラインスタイルに
1220
+ // 残り続け、表示中のスライドだけ位置がずれて見える(§Issue #95: スワイプ
1221
+ // ダウンで閉じて再度開いた際、閉じた瞬間表示していたスライドだけ縦位置がずれる)
1222
+ this.handleVisualViewportResize = () => {
1223
+ this.updateViewportHeight();
1224
+ if (!this.isSmartPhoneFlag || !this.state.viewer.isOpen || !currentItems(this.state)) {
1225
+ return;
1226
+ }
1227
+ this.resetTranslateCurrent();
1228
+ this.setPosByCurrentIndex();
1229
+ this.setSizeByScreen();
1230
+ this.commit();
1231
+ };
1216
1232
  this.handleResize = () => {
1217
1233
  if (!currentItems(this.state)) {
1218
1234
  return;
@@ -1299,7 +1315,7 @@ var SmartPhoto = (() => {
1299
1315
  if (window.visualViewport) {
1300
1316
  window.visualViewport.addEventListener(
1301
1317
  "resize",
1302
- this.updateViewportHeight,
1318
+ this.handleVisualViewportResize,
1303
1319
  { signal: this.abortController.signal }
1304
1320
  );
1305
1321
  } else {
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * SmartPhoto v2.1.7
2
+ * SmartPhoto v2.1.8
3
3
  * (c) appleple
4
4
  * Released under the MIT License.
5
5
  */
6
- "use strict";var SmartPhoto=(()=>{var ue=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Fe=Object.prototype.hasOwnProperty;var Re=(t,e)=>{for(var i in e)ue(t,i,{get:e[i],enumerable:!0})},$e=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ge(e))!Fe.call(t,r)&&r!==i&&ue(t,r,{get:()=>e[r],enumerable:!(o=Ve(e,r))||o.enumerable});return t};var ke=t=>$e(ue({},"__esModule",{value:!0}),t);var Je={};Re(Je,{default:()=>Qe});var J=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function be(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]=be((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var ye=be,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)},xe=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},Ie=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var We={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,swipeVelocity:.5,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:450};function Le(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Le(i)}),Object.freeze(t)}function Ce(t){return{options:Le(ye({},We,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 _(t){return t.getAttribute("data-group")||"nogroup"}function ce(t){return t.group||"nogroup"}function me(t,e,i,o){let r=_(t),s=t.getAttribute("href"),n=t.querySelector("img"),d=s;n&&(n.getAttribute(e.lazyAttribute)?d=n.getAttribute(e.lazyAttribute):n.currentSrc?d=n.currentSrc:d=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 u=t.getAttribute("data-id");return{src:s,thumb:d,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:u||i,loaded:!1,processed:!1,element:t}}function Te(t,e,i){var u,v,P,y,S;let o=ce(t),r=t.src,s=(u=t.thumb)!=null?u:r,n=(v=t.caption)!=null?v:null,d=(y=(P=t.alt)!=null?P:n)!=null?y:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:d,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:(S=t.id)!=null?S:e,loaded:p,processed:!1,element:null}}function pe(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 z(t){var i;let e=H(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function fe(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 ve(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function Z(t,e){let i=10**e;return Math.round(t*i)/i}function j(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function Ae(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,d,p,u;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(u=(o-s)/2,d=-1*u):(u=(s-o)/2,d=-1*u),{minX:Z(n,6)*e.scaleSize,minY:Z(d,6)*e.scaleSize,maxX:Z(p,6)*e.scaleSize,maxY:Z(u,6)*e.scaleSize}}function Me(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 He(t){let e=z(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function ze(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 we(t,e){let i=10**e;return Math.round(t*i)/i}function k(t){return{x:t.pageX,y:t.pageY}}function Oe(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}var Ue=10;function qe(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function De(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function Be({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,d=null,p=null,u=null,v=0,P=!1,y=null,S=null,O=0,D=0,M=!1,V=0,x=null,C=0,B=0;function c(){return J()}function W(a){let{width:h,height:E}=De();return Ae(a,t.viewer,h,E)}function U(a){let{width:h,height:E}=De();return j(a,h,E,c())}function te(a,h){let E=z(t),g=W(E);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=g.minX:a===-1&&(t.viewer.photoPosX=g.maxX),h===1?t.viewer.photoPosY=g.minY:h===-1&&(t.viewer.photoPosY=g.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let ie=setInterval(()=>{if(M||s||P||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=C,t.viewer.photoPosY+=B;let a=z(t);if(!a)return;let h=W(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,C*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,C*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,B*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,B*=-.2);let E=qe(C,B),g=E.force-t.options.registance;Math.abs(g)<.5||(C=Math.cos(E.theta)*g,B=Math.sin(E.theta)*g,e.onPhotoDragMove())},t.options.forceInterval);function X(a,h){(a>5||a<-5)&&(C+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(B+=h*.05)}function Q(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||M||s||P||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?X(a.gamma,a.beta):h===90?X(a.beta,a.gamma):h===-90?X(-a.beta,-a.gamma):h===180&&X(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",Q,{signal:i});function oe(){M=!0,s=!1,P=!1;let a=Array.from(o.values());V=Oe(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function re(a){let h=k(a);s=!0,n=!0,d=h,p=h,v=Date.now()}function ne(a){P=!0;let h=k(a);S=h,y=h}function se(a){var h,E;try{(E=(h=a.currentTarget).setPointerCapture)==null||E.call(h,a.pointerId)}catch(g){}if(o.set(a.pointerId,k(a)),o.size>1){oe();return}if(t.viewer.scale){ne(a);return}re(a)}function ae(){x===null&&(x=requestAnimationFrame(()=>{x=null,e.onGestureMove()}))}function le(){x!==null&&(cancelAnimationFrame(x),x=null,e.onGestureMove())}function m(){let a=Array.from(o.values()),h=Oe(a[0],a[1]),E=(h-V)/100,g=t.viewer.scaleSize,L=t.viewer.photoPosX,T=t.viewer.photoPosY;t.viewer.scaleSize+=we(E,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<g&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-g)*L,t.viewer.photoPosY=(1+t.viewer.scaleSize-g)*T);let Y=z(t);if(Y){let he=U(Y);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>he}V=h,ae()}function l(a){let h=k(a),E=h.x-p.x,g=h.y-d.y;n&&(e.onSwipeStart(),n=!1,u=Math.abs(E)>Math.abs(g)?"horizontal":"vertical"),u==="horizontal"?t.viewer.translateX+=E:t.viewer.translateY=g,p=h,e.onSwipeMove()}function b(a){let h=k(a),E=h.x-S.x,g=h.y-S.y,L=we(t.viewer.scaleSize*E,6),T=we(t.viewer.scaleSize*g,6);t.viewer.photoPosX+=L,O=L,t.viewer.photoPosY+=T,D=T,S=h,e.onPhotoDragMove()}function w(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,k(a)),M){m();return}if(P){b(a);return}l(a)}}function f(){M=!1,le();let a=z(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 I(){var Ee;s=!1;let a=d,h=p,E=Date.now(),g=r-E,L=h.x-a.x,T=h.y-a.y,Y=L===0&&T===0;if(!c()&&Y){e.onTap();return}if(Math.abs(g)<=500&&Y){e.onTap();return}r=E;let he=(Ee=H(t))!=null?Ee:[];if(u==="horizontal"){let $="stay",Ye=Math.max(E-v,1),Pe=Math.abs(L)>=Ue&&Math.abs(L)/Ye>=t.options.swipeVelocity;(L>=t.options.swipeOffset||Pe&&L>0)&&t.viewer.currentIndex!==0?$="prev":(L<=-t.options.swipeOffset||Pe&&L<0)&&t.viewer.currentIndex!==he.length-1&&($="next"),e.onSwipeEnd($)}else{let $="stay";t.options.swipeBottomToClose&&T>=t.options.swipeOffset?$="close-bottom":t.options.swipeTopToClose&&T<=-t.options.swipeOffset&&($="close-top"),e.onSwipeEnd($)}}function R(){P=!1;let a=S,h=y;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let E=z(t);if(!E){e.onPhotoDragEnd(null);return}let g=W(E),L=t.options.swipeOffset*t.viewer.scaleSize,T=0,Y=0;if(t.viewer.photoPosX>g.maxX?T=-1:t.viewer.photoPosX<g.minX&&(T=1),t.viewer.photoPosY>g.maxY?Y=-1:t.viewer.photoPosY<g.minY&&(Y=1),t.viewer.photoPosX-g.maxX>L&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(g.minX-t.viewer.photoPosX>L&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}T===0&&Y===0?(C=O/5,B=D/5):te(T,Y),e.onPhotoDragEnd(null)}function q(a){if(o.delete(a.pointerId),M){o.size<2&&f();return}if(P){R();return}s&&I()}function N(...a){for(let h of a)h.addEventListener("pointerdown",se,{signal:i}),h.addEventListener("pointermove",w,{signal:i}),h.addEventListener("pointerup",q,{signal:i}),h.addEventListener("pointercancel",q,{signal:i})}function G(){clearInterval(ie),x!==null&&(cancelAnimationFrame(x),x=null)}return{attach:N,detach:G}}function ee(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function ge(){let t=document.createElement("button");return t.type="button",t}function _e(t){return t.replace(/"/g,'\\"')}function Xe({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let d=document.createElement("dialog");d.className=r.smartPhoto,d.setAttribute("aria-labelledby",`smartphoto-${t}-title`),d.style.display="none",d.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let u=document.createElement("div");u.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let P=document.createElement("span");P.className=r.smartPhotoCount;let y=document.createElement("h1");y.id=`smartphoto-${t}-title`,y.className=r.smartPhotoCaption,y.setAttribute("tabindex","-1");let S=document.createElement("button");S.className=r.smartPhotoDismiss,S.appendChild(ee(s.closeDialog)),S.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(P,y,S);let O=document.createElement("div");O.className=r.smartPhotoContent,O.addEventListener("click",m=>{m.target===O&&i.onBackdropClick()},{signal:o});let D=document.createElement("ul");D.className=r.smartPhotoList,D.setAttribute("role","region"),D.setAttribute("aria-roledescription","carousel"),D.setAttribute("aria-label",s.carouselLabel),D.setAttribute("aria-live","polite"),D.setAttribute("aria-atomic","false"),u.append(v,O,D);let M=null,V=null,x=null;if(e.arrows){M=document.createElement("ul"),M.className=r.smartPhotoArrows,V=document.createElement("li"),V.className=r.smartPhotoArrowLeft;let m=ge();m.appendChild(ee(s.gotoPrevImage)),m.addEventListener("click",()=>i.onPrev(),{signal:o}),V.appendChild(m),x=document.createElement("li"),x.className=r.smartPhotoArrowRight;let l=ge();l.appendChild(ee(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),x.appendChild(l),M.append(V,x),u.appendChild(M)}let C=null,B=null;e.nav&&(C=document.createElement("nav"),C.className=r.smartPhotoNav,C.setAttribute("aria-label","Choose slide to display"),B=document.createElement("ul"),C.appendChild(B),u.appendChild(C)),p.appendChild(u),d.appendChild(p),n.appendChild(d);let c={dialog:d,count:P,caption:y,dismiss:S,content:O,list:D,arrows:M,arrowLeft:V,arrowRight:x,nav:C,navList:B,slides:new Map,imgClone:null};function W(){let m=document.createElement("div");m.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,m.appendChild(l),m}function U(m){var w,f;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let b=document.createElement("img");return b.className=r.smartPhotoImg,b.src=(w=m.src)!=null?w:"",b.alt=(f=m.alt)!=null?f:"",b.addEventListener("dragstart",I=>I.preventDefault(),{signal:o}),l.appendChild(b),{imgWrap:l,img:b}}function te(m,l){var b;c.list.replaceChildren(),(b=c.navList)==null||b.replaceChildren(),c.slides=new Map,m.forEach(w=>{var R,q;let f=document.createElement("li");f.setAttribute("role","group"),f.setAttribute("aria-roledescription","slide"),f.setAttribute("aria-label",`${w.index+1} of ${m.length}`);let I={li:f,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(w.processed){let{imgWrap:N,img:G}=U(w);f.appendChild(N),I.imgWrap=N,I.img=G}else{let N=W();f.appendChild(N),I.loaderWrap=N}if(c.list.appendChild(f),c.slides.set(w,I),c.navList){let N=document.createElement("li"),G=ge();G.style.backgroundImage=`url("${_e((R=w.thumb)!=null?R:"")}")`;let a=w.index;G.addEventListener("click",()=>i.onNavigate(a),{signal:o}),G.appendChild(ee(`go to ${(q=w.caption)!=null?q:""}`)),N.appendChild(G),c.navList.appendChild(N),I.navLink=G}}),Q(l)}function ie(m,l){var f;if(l.imgWrap||!m.processed)return l;let{imgWrap:b,img:w}=U(m);return(f=l.loaderWrap)==null||f.replaceWith(b),l.loaderWrap=null,l.imgWrap=b,l.img=w,l}function X(m){m&&document.activeElement&&m.contains(document.activeElement)&&c.caption.focus()}function Q(m){let{viewer:l}=m;c.count.textContent=`${l.currentIndex+1}/${l.total}`,c.slides.forEach((b,w)=>{var R;let f=ie(w,b),I=w.index===l.currentIndex;f.li.style.transform=`translate(${w.translateX}px,${w.translateY}px)`,f.li.classList.toggle("current",I),I?f.li.removeAttribute("aria-hidden"):f.li.setAttribute("aria-hidden","true"),I&&(c.caption.textContent=(R=w.caption)!=null?R:""),f.imgWrap&&f.img&&(f.imgWrap.style.transform=`translate(${w.x}px,${w.y}px) scale(${w.scale})`,f.img.style.width=`${w.width}px`,f.img.classList.toggle("active",l.appear),f.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),f.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),f.navLink&&(f.navLink.classList.toggle("current",I),I?f.navLink.setAttribute("aria-current","true"):f.navLink.removeAttribute("aria-current"))}),c.arrowLeft&&(l.showPrevArrow?c.arrowLeft.removeAttribute("aria-hidden"):(X(c.arrowLeft),c.arrowLeft.setAttribute("aria-hidden","true"))),c.arrowRight&&(l.showNextArrow?c.arrowRight.removeAttribute("aria-hidden"):(X(c.arrowRight),c.arrowRight.setAttribute("aria-hidden","true"))),c.arrows&&(l.hideUi&&X(c.arrows),c.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),c.nav&&(l.hideUi&&X(c.nav),c.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function oe(m){for(let[l,b]of c.slides)if(l.index===m.viewer.currentIndex)return b;return null}function re(m){let{viewer:l}=m,b=oe(m),w=b==null?void 0:b.img;w&&(w.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,w.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),c.nav&&(l.hideUi&&X(c.nav),c.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),c.arrows&&(l.hideUi&&X(c.arrows),c.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ne(m){let{viewer:l}=m;c.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,c.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function se(m){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=m.img,l.style.width=`${m.width}px`,l.style.height=`${m.height}px`,l.style.transform=`translate(${m.left}px,${m.top}px) scale(1)`,p.appendChild(l),c.imgClone=l}function ae(){var m;(m=c.imgClone)==null||m.remove(),c.imgClone=null}function le(){n.remove()}return{root:n,refs:c,render:Q,syncSlides:te,updatePhotoTransform:re,updateListTransform:ne,showAppearEffect:se,removeAppearEffect:ae,destroy:le}}function A(){return document.documentElement.clientWidth}function F(){let t=window.visualViewport;return t?t.height*t.scale:document.documentElement.clientHeight}function je(t){return t.length>0&&t[0]instanceof Element}function Ke(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function Ne(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var K=class{constructor(e,i){this.id=Ke();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.rootSelector=null;this.itemsByElement=new Map;this.handleDocumentClick=e=>{if(!(e.target instanceof Element))return;let i=e;if(i.__smartphotoClaimed)return;let o=this.findRegisteredAncestor(e.target);if(!o&&this.rootSelector&&(o=e.target.closest(this.rootSelector)),!o)return;if(e.preventDefault(),i.__smartphotoClaimed=!0,!this.itemsByElement.has(o)&&this.rootSelector){let s=_(o);this.resyncGroupFromDom(s)&&this.syncCurrentGroupView()}let r=this.itemsByElement.get(o);r&&this.openPhoto(r,o)};this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${F()}px`)};this.handleResize=()=>{H(this.state)&&(this.updateViewportHeight(),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.updateViewportHeight(),this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=A(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==A()?(this.updateViewportHeight(),this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.rootSelector=typeof e=="string"?e:null,this.state=Ce(i!=null?i:{}),this.view=Xe({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=Be({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}),document.addEventListener("click",this.handleDocumentClick,{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&this.openPhoto(o,o.element),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.itemsByElement.clear(),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=Ne();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=z(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=j(e,A(),F(),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,u,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(P=>P.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,d=(v=(u=i.trigger)!=null?u:s.element)!=null?v:n;this.openPhoto(s,d)}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 HTMLElement?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!je(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=_(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=me(e,this.state.options,o,A());return pe(this.state,r),this.loadAllFired.delete(i),this.itemsByElement.set(e,r),r}addSlideItem(e){var s,n;let i=ce(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=Te(e,o,A());return pe(this.state,r),this.loadAllFired.delete(i),r}findRegisteredAncestor(e){let i=e;for(;i;){if(this.itemsByElement.has(i))return i;i=i.parentElement}return null}resyncGroupFromDom(e){var p;if(!this.rootSelector)return!1;let i=Array.from(document.querySelectorAll(this.rootSelector)).filter(u=>_(u)===e),o=new Set(i),r=(p=this.state.groups.get(e))!=null?p:[],s=new Map;r.forEach(u=>{u.element&&s.set(u.element,u)});let n=i.length!==r.length,d=i.map((u,v)=>{let P=s.get(u);if(P)return P.index!==v&&(n=!0,P.index=v),P;n=!0;let y=me(u,this.state.options,v,A());return this.itemsByElement.set(u,y),y});return r.forEach(u=>{u.element&&!o.has(u.element)&&this.itemsByElement.delete(u.element)}),ve(d,A()),this.state.groups.set(e,d),n&&this.loadAllFired.delete(e),n}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=Ne();this.setHash(He(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?ze(this.state,xe(e)):null}setPosByCurrentIndex(){let e=z(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&&Me(e,A(),F(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){ve(H(this.state),A())}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.style.removeProperty("display"),e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&(e.close(),e.style.display="none")}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(),fe(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=z(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=j(o,A(),F(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,d;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=(d=document.startViewTransition)==null?void 0:d.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 O;let o=(O=e==null?void 0:e.querySelector("img"))!=null?O:null;if(!o){this.state.viewer.appear=!0;return}let r=Ie(o),s=o.offsetWidth,n=o.offsetHeight,d=A(),p=F(),u=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=d/s:(s>=n?i.height<u?v=i.width/s:v=u/n:i.height<u?v=i.height/n:v=u/n,s*v>d&&(v=d/s));let P=(v-1)/2*s+(d-s*v)/2,y=(v-1)/2*n+(p-n*v)/2,S=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:S||i.src||"",afterX:P,afterY:y,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=A(),i=F();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(A()===e&&F()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){let o=this.rootSelector?this.resyncGroupFromDom(e.groupId):!1;this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,(this.syncedGroupId!==e.groupId||o)&&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=F(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,d=()=>{this.finishHideEffect===d&&(this.finishHideEffect=null,o.removeEventListener("transitionend",d,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=d,r&&(r.style.transform=n),o.addEventListener("transitionend",d,!0),this.scheduleTimeout(d,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.updateViewportHeight(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=z(this.state);this.state.viewer.onMove=!1,fe(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 Qe=K;return ke(Je);})();
6
+ "use strict";var SmartPhoto=(()=>{var ue=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Fe=Object.prototype.hasOwnProperty;var Re=(t,e)=>{for(var i in e)ue(t,i,{get:e[i],enumerable:!0})},$e=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ge(e))!Fe.call(t,r)&&r!==i&&ue(t,r,{get:()=>e[r],enumerable:!(o=Ye(e,r))||o.enumerable});return t};var ke=t=>$e(ue({},"__esModule",{value:!0}),t);var Je={};Re(Je,{default:()=>Qe});var J=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function be(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]=be((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var ye=be,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)},xe=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},Ie=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var We={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,swipeVelocity:.5,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:450};function Le(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Le(i)}),Object.freeze(t)}function Ce(t){return{options:Le(ye({},We,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 _(t){return t.getAttribute("data-group")||"nogroup"}function ce(t){return t.group||"nogroup"}function me(t,e,i,o){let r=_(t),s=t.getAttribute("href"),n=t.querySelector("img"),d=s;n&&(n.getAttribute(e.lazyAttribute)?d=n.getAttribute(e.lazyAttribute):n.currentSrc?d=n.currentSrc:d=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 u=t.getAttribute("data-id");return{src:s,thumb:d,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:u||i,loaded:!1,processed:!1,element:t}}function Te(t,e,i){var u,v,P,y,S;let o=ce(t),r=t.src,s=(u=t.thumb)!=null?u:r,n=(v=t.caption)!=null?v:null,d=(y=(P=t.alt)!=null?P:n)!=null?y:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:d,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:(S=t.id)!=null?S:e,loaded:p,processed:!1,element:null}}function pe(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 A(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function z(t){var i;let e=A(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function fe(t){let e=A(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 ve(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function Z(t,e){let i=10**e;return Math.round(t*i)/i}function j(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function Ae(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,d,p,u;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(u=(o-s)/2,d=-1*u):(u=(s-o)/2,d=-1*u),{minX:Z(n,6)*e.scaleSize,minY:Z(d,6)*e.scaleSize,maxX:Z(p,6)*e.scaleSize,maxY:Z(u,6)*e.scaleSize}}function Me(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 He(t){let e=z(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function ze(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 we(t,e){let i=10**e;return Math.round(t*i)/i}function k(t){return{x:t.pageX,y:t.pageY}}function Oe(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}var Ue=10;function qe(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function De(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function Be({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,d=null,p=null,u=null,v=0,P=!1,y=null,S=null,O=0,D=0,H=!1,Y=0,x=null,C=0,B=0;function c(){return J()}function W(a){let{width:h,height:E}=De();return Ae(a,t.viewer,h,E)}function U(a){let{width:h,height:E}=De();return j(a,h,E,c())}function te(a,h){let E=z(t),g=W(E);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=g.minX:a===-1&&(t.viewer.photoPosX=g.maxX),h===1?t.viewer.photoPosY=g.minY:h===-1&&(t.viewer.photoPosY=g.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let ie=setInterval(()=>{if(H||s||P||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=C,t.viewer.photoPosY+=B;let a=z(t);if(!a)return;let h=W(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,C*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,C*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,B*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,B*=-.2);let E=qe(C,B),g=E.force-t.options.registance;Math.abs(g)<.5||(C=Math.cos(E.theta)*g,B=Math.sin(E.theta)*g,e.onPhotoDragMove())},t.options.forceInterval);function V(a,h){(a>5||a<-5)&&(C+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(B+=h*.05)}function Q(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||H||s||P||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?V(a.gamma,a.beta):h===90?V(a.beta,a.gamma):h===-90?V(-a.beta,-a.gamma):h===180&&V(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",Q,{signal:i});function oe(){H=!0,s=!1,P=!1;let a=Array.from(o.values());Y=Oe(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function re(a){let h=k(a);s=!0,n=!0,d=h,p=h,v=Date.now()}function ne(a){P=!0;let h=k(a);S=h,y=h}function se(a){var h,E;try{(E=(h=a.currentTarget).setPointerCapture)==null||E.call(h,a.pointerId)}catch(g){}if(o.set(a.pointerId,k(a)),o.size>1){oe();return}if(t.viewer.scale){ne(a);return}re(a)}function ae(){x===null&&(x=requestAnimationFrame(()=>{x=null,e.onGestureMove()}))}function le(){x!==null&&(cancelAnimationFrame(x),x=null,e.onGestureMove())}function m(){let a=Array.from(o.values()),h=Oe(a[0],a[1]),E=(h-Y)/100,g=t.viewer.scaleSize,L=t.viewer.photoPosX,T=t.viewer.photoPosY;t.viewer.scaleSize+=we(E,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<g&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-g)*L,t.viewer.photoPosY=(1+t.viewer.scaleSize-g)*T);let N=z(t);if(N){let he=U(N);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>he}Y=h,ae()}function l(a){let h=k(a),E=h.x-p.x,g=h.y-d.y;n&&(e.onSwipeStart(),n=!1,u=Math.abs(E)>Math.abs(g)?"horizontal":"vertical"),u==="horizontal"?t.viewer.translateX+=E:t.viewer.translateY=g,p=h,e.onSwipeMove()}function b(a){let h=k(a),E=h.x-S.x,g=h.y-S.y,L=we(t.viewer.scaleSize*E,6),T=we(t.viewer.scaleSize*g,6);t.viewer.photoPosX+=L,O=L,t.viewer.photoPosY+=T,D=T,S=h,e.onPhotoDragMove()}function w(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,k(a)),H){m();return}if(P){b(a);return}l(a)}}function f(){H=!1,le();let a=z(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 I(){var Ee;s=!1;let a=d,h=p,E=Date.now(),g=r-E,L=h.x-a.x,T=h.y-a.y,N=L===0&&T===0;if(!c()&&N){e.onTap();return}if(Math.abs(g)<=500&&N){e.onTap();return}r=E;let he=(Ee=A(t))!=null?Ee:[];if(u==="horizontal"){let $="stay",Ne=Math.max(E-v,1),Pe=Math.abs(L)>=Ue&&Math.abs(L)/Ne>=t.options.swipeVelocity;(L>=t.options.swipeOffset||Pe&&L>0)&&t.viewer.currentIndex!==0?$="prev":(L<=-t.options.swipeOffset||Pe&&L<0)&&t.viewer.currentIndex!==he.length-1&&($="next"),e.onSwipeEnd($)}else{let $="stay";t.options.swipeBottomToClose&&T>=t.options.swipeOffset?$="close-bottom":t.options.swipeTopToClose&&T<=-t.options.swipeOffset&&($="close-top"),e.onSwipeEnd($)}}function R(){P=!1;let a=S,h=y;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let E=z(t);if(!E){e.onPhotoDragEnd(null);return}let g=W(E),L=t.options.swipeOffset*t.viewer.scaleSize,T=0,N=0;if(t.viewer.photoPosX>g.maxX?T=-1:t.viewer.photoPosX<g.minX&&(T=1),t.viewer.photoPosY>g.maxY?N=-1:t.viewer.photoPosY<g.minY&&(N=1),t.viewer.photoPosX-g.maxX>L&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(g.minX-t.viewer.photoPosX>L&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}T===0&&N===0?(C=O/5,B=D/5):te(T,N),e.onPhotoDragEnd(null)}function q(a){if(o.delete(a.pointerId),H){o.size<2&&f();return}if(P){R();return}s&&I()}function X(...a){for(let h of a)h.addEventListener("pointerdown",se,{signal:i}),h.addEventListener("pointermove",w,{signal:i}),h.addEventListener("pointerup",q,{signal:i}),h.addEventListener("pointercancel",q,{signal:i})}function G(){clearInterval(ie),x!==null&&(cancelAnimationFrame(x),x=null)}return{attach:X,detach:G}}function ee(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function ge(){let t=document.createElement("button");return t.type="button",t}function _e(t){return t.replace(/"/g,'\\"')}function Ve({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let d=document.createElement("dialog");d.className=r.smartPhoto,d.setAttribute("aria-labelledby",`smartphoto-${t}-title`),d.style.display="none",d.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let u=document.createElement("div");u.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let P=document.createElement("span");P.className=r.smartPhotoCount;let y=document.createElement("h1");y.id=`smartphoto-${t}-title`,y.className=r.smartPhotoCaption,y.setAttribute("tabindex","-1");let S=document.createElement("button");S.className=r.smartPhotoDismiss,S.appendChild(ee(s.closeDialog)),S.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(P,y,S);let O=document.createElement("div");O.className=r.smartPhotoContent,O.addEventListener("click",m=>{m.target===O&&i.onBackdropClick()},{signal:o});let D=document.createElement("ul");D.className=r.smartPhotoList,D.setAttribute("role","region"),D.setAttribute("aria-roledescription","carousel"),D.setAttribute("aria-label",s.carouselLabel),D.setAttribute("aria-live","polite"),D.setAttribute("aria-atomic","false"),u.append(v,O,D);let H=null,Y=null,x=null;if(e.arrows){H=document.createElement("ul"),H.className=r.smartPhotoArrows,Y=document.createElement("li"),Y.className=r.smartPhotoArrowLeft;let m=ge();m.appendChild(ee(s.gotoPrevImage)),m.addEventListener("click",()=>i.onPrev(),{signal:o}),Y.appendChild(m),x=document.createElement("li"),x.className=r.smartPhotoArrowRight;let l=ge();l.appendChild(ee(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),x.appendChild(l),H.append(Y,x),u.appendChild(H)}let C=null,B=null;e.nav&&(C=document.createElement("nav"),C.className=r.smartPhotoNav,C.setAttribute("aria-label","Choose slide to display"),B=document.createElement("ul"),C.appendChild(B),u.appendChild(C)),p.appendChild(u),d.appendChild(p),n.appendChild(d);let c={dialog:d,count:P,caption:y,dismiss:S,content:O,list:D,arrows:H,arrowLeft:Y,arrowRight:x,nav:C,navList:B,slides:new Map,imgClone:null};function W(){let m=document.createElement("div");m.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,m.appendChild(l),m}function U(m){var w,f;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let b=document.createElement("img");return b.className=r.smartPhotoImg,b.src=(w=m.src)!=null?w:"",b.alt=(f=m.alt)!=null?f:"",b.addEventListener("dragstart",I=>I.preventDefault(),{signal:o}),l.appendChild(b),{imgWrap:l,img:b}}function te(m,l){var b;c.list.replaceChildren(),(b=c.navList)==null||b.replaceChildren(),c.slides=new Map,m.forEach(w=>{var R,q;let f=document.createElement("li");f.setAttribute("role","group"),f.setAttribute("aria-roledescription","slide"),f.setAttribute("aria-label",`${w.index+1} of ${m.length}`);let I={li:f,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(w.processed){let{imgWrap:X,img:G}=U(w);f.appendChild(X),I.imgWrap=X,I.img=G}else{let X=W();f.appendChild(X),I.loaderWrap=X}if(c.list.appendChild(f),c.slides.set(w,I),c.navList){let X=document.createElement("li"),G=ge();G.style.backgroundImage=`url("${_e((R=w.thumb)!=null?R:"")}")`;let a=w.index;G.addEventListener("click",()=>i.onNavigate(a),{signal:o}),G.appendChild(ee(`go to ${(q=w.caption)!=null?q:""}`)),X.appendChild(G),c.navList.appendChild(X),I.navLink=G}}),Q(l)}function ie(m,l){var f;if(l.imgWrap||!m.processed)return l;let{imgWrap:b,img:w}=U(m);return(f=l.loaderWrap)==null||f.replaceWith(b),l.loaderWrap=null,l.imgWrap=b,l.img=w,l}function V(m){m&&document.activeElement&&m.contains(document.activeElement)&&c.caption.focus()}function Q(m){let{viewer:l}=m;c.count.textContent=`${l.currentIndex+1}/${l.total}`,c.slides.forEach((b,w)=>{var R;let f=ie(w,b),I=w.index===l.currentIndex;f.li.style.transform=`translate(${w.translateX}px,${w.translateY}px)`,f.li.classList.toggle("current",I),I?f.li.removeAttribute("aria-hidden"):f.li.setAttribute("aria-hidden","true"),I&&(c.caption.textContent=(R=w.caption)!=null?R:""),f.imgWrap&&f.img&&(f.imgWrap.style.transform=`translate(${w.x}px,${w.y}px) scale(${w.scale})`,f.img.style.width=`${w.width}px`,f.img.classList.toggle("active",l.appear),f.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),f.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),f.navLink&&(f.navLink.classList.toggle("current",I),I?f.navLink.setAttribute("aria-current","true"):f.navLink.removeAttribute("aria-current"))}),c.arrowLeft&&(l.showPrevArrow?c.arrowLeft.removeAttribute("aria-hidden"):(V(c.arrowLeft),c.arrowLeft.setAttribute("aria-hidden","true"))),c.arrowRight&&(l.showNextArrow?c.arrowRight.removeAttribute("aria-hidden"):(V(c.arrowRight),c.arrowRight.setAttribute("aria-hidden","true"))),c.arrows&&(l.hideUi&&V(c.arrows),c.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),c.nav&&(l.hideUi&&V(c.nav),c.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function oe(m){for(let[l,b]of c.slides)if(l.index===m.viewer.currentIndex)return b;return null}function re(m){let{viewer:l}=m,b=oe(m),w=b==null?void 0:b.img;w&&(w.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,w.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),c.nav&&(l.hideUi&&V(c.nav),c.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),c.arrows&&(l.hideUi&&V(c.arrows),c.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ne(m){let{viewer:l}=m;c.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,c.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function se(m){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=m.img,l.style.width=`${m.width}px`,l.style.height=`${m.height}px`,l.style.transform=`translate(${m.left}px,${m.top}px) scale(1)`,p.appendChild(l),c.imgClone=l}function ae(){var m;(m=c.imgClone)==null||m.remove(),c.imgClone=null}function le(){n.remove()}return{root:n,refs:c,render:Q,syncSlides:te,updatePhotoTransform:re,updateListTransform:ne,showAppearEffect:se,removeAppearEffect:ae,destroy:le}}function M(){return document.documentElement.clientWidth}function F(){let t=window.visualViewport;return t?t.height*t.scale:document.documentElement.clientHeight}function je(t){return t.length>0&&t[0]instanceof Element}function Ke(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function Xe(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var K=class{constructor(e,i){this.id=Ke();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.rootSelector=null;this.itemsByElement=new Map;this.handleDocumentClick=e=>{if(!(e.target instanceof Element))return;let i=e;if(i.__smartphotoClaimed)return;let o=this.findRegisteredAncestor(e.target);if(!o&&this.rootSelector&&(o=e.target.closest(this.rootSelector)),!o)return;if(e.preventDefault(),i.__smartphotoClaimed=!0,!this.itemsByElement.has(o)&&this.rootSelector){let s=_(o);this.resyncGroupFromDom(s)&&this.syncCurrentGroupView()}let r=this.itemsByElement.get(o);r&&this.openPhoto(r,o)};this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${F()}px`)};this.handleVisualViewportResize=()=>{this.updateViewportHeight(),!(!this.isSmartPhoneFlag||!this.state.viewer.isOpen||!A(this.state))&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleResize=()=>{A(this.state)&&(this.updateViewportHeight(),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(!A(this.state))return;this.updateViewportHeight(),this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=M(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==M()?(this.updateViewportHeight(),this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.rootSelector=typeof e=="string"?e:null,this.state=Ce(i!=null?i:{}),this.view=Ve({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=Be({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}),document.addEventListener("click",this.handleDocumentClick,{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&this.openPhoto(o,o.element),this.updateViewportHeight(),window.visualViewport?window.visualViewport.addEventListener("resize",this.handleVisualViewportResize,{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.itemsByElement.clear(),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=Xe();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=z(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=j(e,M(),F(),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,u,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(P=>P.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,d=(v=(u=i.trigger)!=null?u:s.element)!=null?v:n;this.openPhoto(s,d)}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 HTMLElement?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!je(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=_(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=me(e,this.state.options,o,M());return pe(this.state,r),this.loadAllFired.delete(i),this.itemsByElement.set(e,r),r}addSlideItem(e){var s,n;let i=ce(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=Te(e,o,M());return pe(this.state,r),this.loadAllFired.delete(i),r}findRegisteredAncestor(e){let i=e;for(;i;){if(this.itemsByElement.has(i))return i;i=i.parentElement}return null}resyncGroupFromDom(e){var p;if(!this.rootSelector)return!1;let i=Array.from(document.querySelectorAll(this.rootSelector)).filter(u=>_(u)===e),o=new Set(i),r=(p=this.state.groups.get(e))!=null?p:[],s=new Map;r.forEach(u=>{u.element&&s.set(u.element,u)});let n=i.length!==r.length,d=i.map((u,v)=>{let P=s.get(u);if(P)return P.index!==v&&(n=!0,P.index=v),P;n=!0;let y=me(u,this.state.options,v,M());return this.itemsByElement.set(u,y),y});return r.forEach(u=>{u.element&&!o.has(u.element)&&this.itemsByElement.delete(u.element)}),ve(d,M()),this.state.groups.set(e,d),n&&this.loadAllFired.delete(e),n}syncCurrentGroupView(){let e=A(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=Xe();this.setHash(He(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?ze(this.state,xe(e)):null}setPosByCurrentIndex(){let e=z(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=A(this.state);e&&Me(e,M(),F(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){ve(A(this.state),M())}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.style.removeProperty("display"),e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&(e.close(),e.style.display="none")}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=A(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(),fe(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=z(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=j(o,M(),F(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,d;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=(d=document.startViewTransition)==null?void 0:d.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 O;let o=(O=e==null?void 0:e.querySelector("img"))!=null?O:null;if(!o){this.state.viewer.appear=!0;return}let r=Ie(o),s=o.offsetWidth,n=o.offsetHeight,d=M(),p=F(),u=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=d/s:(s>=n?i.height<u?v=i.width/s:v=u/n:i.height<u?v=i.height/n:v=u/n,s*v>d&&(v=d/s));let P=(v-1)/2*s+(d-s*v)/2,y=(v-1)/2*n+(p-n*v)/2,S=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:S||i.src||"",afterX:P,afterY:y,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=M(),i=F();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(M()===e&&F()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){let o=this.rootSelector?this.resyncGroupFromDom(e.groupId):!1;this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,(this.syncedGroupId!==e.groupId||o)&&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=F(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,d=()=>{this.finishHideEffect===d&&(this.finishHideEffect=null,o.removeEventListener("transitionend",d,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=d,r&&(r.style.transform=n),o.addEventListener("transitionend",d,!0),this.scheduleTimeout(d,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=A(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.updateViewportHeight(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=z(this.state);this.state.viewer.onMove=!1,fe(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 Qe=K;return ke(Je);})();
7
7
  SmartPhoto = SmartPhoto.default;
package/lib/smartphoto.js CHANGED
@@ -1196,6 +1196,22 @@ var SmartPhoto = class {
1196
1196
  `${getWindowHeight()}px`
1197
1197
  );
1198
1198
  };
1199
+ // iOS Safari 等ではアドレスバーの表示/非表示に伴う visualViewport の変化が
1200
+ // orientationchange を伴わず resize としてのみ発火する。スマートフォンでは
1201
+ // window の resize を購読していない(§コンストラクタ)ため、ここで拾わないと
1202
+ // 開いている間ずっと古い高さで計算された item.x/y がインラインスタイルに
1203
+ // 残り続け、表示中のスライドだけ位置がずれて見える(§Issue #95: スワイプ
1204
+ // ダウンで閉じて再度開いた際、閉じた瞬間表示していたスライドだけ縦位置がずれる)
1205
+ this.handleVisualViewportResize = () => {
1206
+ this.updateViewportHeight();
1207
+ if (!this.isSmartPhoneFlag || !this.state.viewer.isOpen || !currentItems(this.state)) {
1208
+ return;
1209
+ }
1210
+ this.resetTranslateCurrent();
1211
+ this.setPosByCurrentIndex();
1212
+ this.setSizeByScreen();
1213
+ this.commit();
1214
+ };
1199
1215
  this.handleResize = () => {
1200
1216
  if (!currentItems(this.state)) {
1201
1217
  return;
@@ -1282,7 +1298,7 @@ var SmartPhoto = class {
1282
1298
  if (window.visualViewport) {
1283
1299
  window.visualViewport.addEventListener(
1284
1300
  "resize",
1285
- this.updateViewportHeight,
1301
+ this.handleVisualViewportResize,
1286
1302
  { signal: this.abortController.signal }
1287
1303
  );
1288
1304
  } else {
@@ -1170,6 +1170,22 @@ var SmartPhoto = class {
1170
1170
  `${getWindowHeight()}px`
1171
1171
  );
1172
1172
  };
1173
+ // iOS Safari 等ではアドレスバーの表示/非表示に伴う visualViewport の変化が
1174
+ // orientationchange を伴わず resize としてのみ発火する。スマートフォンでは
1175
+ // window の resize を購読していない(§コンストラクタ)ため、ここで拾わないと
1176
+ // 開いている間ずっと古い高さで計算された item.x/y がインラインスタイルに
1177
+ // 残り続け、表示中のスライドだけ位置がずれて見える(§Issue #95: スワイプ
1178
+ // ダウンで閉じて再度開いた際、閉じた瞬間表示していたスライドだけ縦位置がずれる)
1179
+ this.handleVisualViewportResize = () => {
1180
+ this.updateViewportHeight();
1181
+ if (!this.isSmartPhoneFlag || !this.state.viewer.isOpen || !currentItems(this.state)) {
1182
+ return;
1183
+ }
1184
+ this.resetTranslateCurrent();
1185
+ this.setPosByCurrentIndex();
1186
+ this.setSizeByScreen();
1187
+ this.commit();
1188
+ };
1173
1189
  this.handleResize = () => {
1174
1190
  if (!currentItems(this.state)) {
1175
1191
  return;
@@ -1256,7 +1272,7 @@ var SmartPhoto = class {
1256
1272
  if (window.visualViewport) {
1257
1273
  window.visualViewport.addEventListener(
1258
1274
  "resize",
1259
- this.updateViewportHeight,
1275
+ this.handleVisualViewportResize,
1260
1276
  { signal: this.abortController.signal }
1261
1277
  );
1262
1278
  } else {
@@ -64,6 +64,7 @@ export default class SmartPhoto {
64
64
  private slideList;
65
65
  private scheduleTimeout;
66
66
  private updateViewportHeight;
67
+ private handleVisualViewportResize;
67
68
  private handleResize;
68
69
  private handleKeydown;
69
70
  private handleOrientationChange;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartphoto",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "smartphoto",
5
5
  "homepage": "https://developer.a-blogcms.jp",
6
6
  "main": "./lib/smartphoto.js",