diff --git a/dist/bigger-picture.cjs b/dist/bigger-picture.cjs index d2e4957..e14d981 100644 --- a/dist/bigger-picture.cjs +++ b/dist/bigger-picture.cjs @@ -15,9 +15,6 @@ function run_all(fns) { function is_function(thing) { return typeof thing === 'function'; } -function safe_not_equal(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} function not_equal(a, b) { return a != a ? b == b : a !== b; } @@ -72,14 +69,6 @@ function loop(callback) { function append(target, node) { target.appendChild(node); } -function append_empty_stylesheet(node) { - const style_element = element('style'); - append_stylesheet(document, style_element); - return style_element.sheet; -} -function append_stylesheet(node, style) { - append(node.head || node, style); -} function insert(target, node, anchor) { target.insertBefore(node, anchor || null); } @@ -121,24 +110,17 @@ function custom_event(type, detail, bubbles = false) { e.initCustomEvent(type, bubbles, false, detail); return e; } - -// we need to store the information for multiple documents because a Svelte application could also contain iframes -// https://github.com/sveltejs/svelte/issues/3624 -const managed_styles = new Map(); +let stylesheet; let active = 0; +let current_rules = {}; // https://github.com/darkskyapp/string-hash/blob/master/index.js -function hash(str) { - let hash = 5381; - let i = str.length; - while (i--) - hash = ((hash << 5) - hash) ^ str.charCodeAt(i); - return hash >>> 0; -} -function create_style_information(doc, node) { - const info = { stylesheet: append_empty_stylesheet(), rules: {} }; - managed_styles.set(doc, info); - return info; -} +// function hash(str) { +// let hash = 5381; +// let i = str.length; +// while (i--) +// hash = ((hash << 5) - hash) ^ str.charCodeAt(i); +// return hash >>> 0; +// } function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { const step = 16.666 / duration; let keyframes = '{\n'; @@ -147,44 +129,40 @@ function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`; } const rule = keyframes + `100% {${fn(b, 1 - b)}}\n}`; - const name = `_bp_${hash(rule)}_${uid}`; - const doc = document; - const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc); - if (!rules[name]) { - rules[name] = true; + const name = `_bp_${Math.round(Math.random() * 1e9)}_${uid}`; + if (!current_rules[name]) { + if (!stylesheet) { + const style = element('style'); + document.head.appendChild(style); + stylesheet = style.sheet; + } + current_rules[name] = true; stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length); } const animation = node.style.animation || ''; - node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`; + node.style.animation = `${animation ? `${animation}, ` : ``}${name} ${duration}ms linear ${delay}ms 1 both`; active += 1; return name; } function delete_rule(node, name) { - const previous = (node.style.animation || '').split(', '); - const next = previous.filter(name + node.style.animation = (node.style.animation || '') + .split(', ') + .filter(name ? anim => anim.indexOf(name) < 0 // remove specific animation : anim => anim.indexOf('_bp') === -1 // remove all Svelte animations - ); - const deleted = previous.length - next.length; - if (deleted) { - node.style.animation = next.join(', '); - active -= deleted; - if (!active) - clear_rules(); - } + ) + .join(', '); + if (name && !--active) + clear_rules(); } function clear_rules() { raf(() => { if (active) return; - managed_styles.forEach(info => { - const { stylesheet } = info; - let i = stylesheet.cssRules.length; - while (i--) - stylesheet.deleteRule(i); - info.rules = {}; - }); - managed_styles.clear(); + let i = stylesheet.cssRules.length; + while (i--) + stylesheet.deleteRule(i); + current_rules = {}; }); } @@ -596,7 +574,7 @@ function writable(value, start = noop) { let stop; const subscribers = new Set(); function set(new_value) { - if (safe_not_equal(value, new_value)) { + if (not_equal(value, new_value)) { value = new_value; if (stop) { // store is ready const run_queue = !subscriber_queue.length; @@ -1898,7 +1876,7 @@ function create_if_block(ctx) { // (319:199) {:else} function create_else_block(ctx) { let div; - let raw_value = /*activeItem*/ ctx[6].html + ""; + let raw_value = (/*activeItem*/ ctx[6].html ?? /*activeItem*/ ctx[6].element.outerHTML) + ""; return { c() { @@ -1910,7 +1888,7 @@ function create_else_block(ctx) { div.innerHTML = raw_value; }, p(ctx, dirty) { - if (dirty[0] & /*activeItem*/ 64 && raw_value !== (raw_value = /*activeItem*/ ctx[6].html + "")) div.innerHTML = raw_value; }, + if (dirty[0] & /*activeItem*/ 64 && raw_value !== (raw_value = (/*activeItem*/ ctx[6].html ?? /*activeItem*/ ctx[6].element.outerHTML) + "")) div.innerHTML = raw_value; }, i: noop, o: noop, d(detaching) { @@ -2025,7 +2003,7 @@ function create_if_block_3(ctx) { }; } -// (319:267) {#if activeItem.caption} +// (319:299) {#if activeItem.caption} function create_if_block_2(ctx) { let div; let raw_value = /*activeItem*/ ctx[6].caption + ""; @@ -2102,8 +2080,8 @@ function create_key_block(ctx) { if (!mounted) { dispose = [ - listen(div, "pointerdown", /*pointerdown_handler*/ ctx[21]), - listen(div, "pointerup", /*pointerup_handler*/ ctx[22]) + listen(div, "pointerdown", /*pointerdown_handler*/ ctx[20]), + listen(div, "pointerup", /*pointerup_handler*/ ctx[21]) ]; mounted = true; @@ -2191,7 +2169,7 @@ function create_key_block(ctx) { }; } -// (319:522) {#if items.length > 1} +// (319:554) {#if items.length > 1} function create_if_block_1(ctx) { let div; let raw_value = `${/*position*/ ctx[4] + 1} / ${/*items*/ ctx[0].length}` + ""; @@ -2328,8 +2306,8 @@ function instance($$self, $$props, $$invalidate) { /** active item object */ let activeItem; - /** true if activeItem is html */ - let activeItemIsHtml; + /** returns true if `activeItem` is html */ + const activeItemIsHtml = () => !activeItem.img && !activeItem.sources && !activeItem.iframe; /** function set by child component to run when container resized */ let resizeFunc; @@ -2358,10 +2336,10 @@ function instance($$self, $$props, $$invalidate) { // update trigger element to restore focus focusTrigger = document.activeElement; - $$invalidate(20, container.w = target.offsetWidth, container); + $$invalidate(19, container.w = target.offsetWidth, container); $$invalidate( - 20, + 19, container.h = target === document.body ? globalThis.innerHeight : target.clientHeight, @@ -2390,12 +2368,7 @@ function instance($$self, $$props, $$invalidate) { $$invalidate(4, position = i); } - return { - element, - html: element.outerHTML, - i, - ...element.dataset - }; + return { element, i, ...element.dataset }; })); } }; @@ -2507,7 +2480,7 @@ function instance($$self, $$props, $$invalidate) { const scaleIn = node => { let dimensions; - if (activeItemIsHtml) { + if (activeItemIsHtml()) { const bpItem = node.firstChild.firstChild; dimensions = [bpItem.clientWidth, bpItem.clientHeight]; } else { @@ -2548,7 +2521,7 @@ function instance($$self, $$props, $$invalidate) { /** code to run on mount / destroy */ const containerActions = node => { - $$invalidate(20, container.el = node, container); + $$invalidate(19, container.el = node, container); let removeKeydownListener; let roActive; opts.onOpen?.(container.el, activeItem); @@ -2562,12 +2535,14 @@ function instance($$self, $$props, $$invalidate) { const ro = new ResizeObserver(entries => { // use roActive to avoid running on initial open if (roActive) { - $$invalidate(20, container.w = entries[0].contentRect.width, container); - $$invalidate(20, container.h = entries[0].contentRect.height, container); + $$invalidate(19, container.w = entries[0].contentRect.width, container); + $$invalidate(19, container.h = entries[0].contentRect.height, container); $$invalidate(7, smallScreen = container.w < 769); // run child component resize function - resizeFunc?.(); + if (!activeItemIsHtml()) { + resizeFunc?.(); + } // run user defined onResize function opts.onResize?.(container.el, activeItem); @@ -2607,17 +2582,12 @@ function instance($$self, $$props, $$invalidate) { }; $$self.$$.update = () => { - if ($$self.$$.dirty[0] & /*items, position, activeItem, isOpen, activeItemIsHtml, opts, container*/ 1835121) { + if ($$self.$$.dirty[0] & /*items, position, isOpen, opts, container, activeItem*/ 786545) { if (items) { // update active item when position changes $$invalidate(6, activeItem = items[position]); - $$invalidate(19, activeItemIsHtml = activeItem.hasOwnProperty('html')); - if (isOpen) { - // clear child resize function if html - activeItemIsHtml && setResizeFunc(null); - // run onUpdate when items updated opts.onUpdate?.(container.el, activeItem); } @@ -2645,7 +2615,6 @@ function instance($$self, $$props, $$invalidate) { open, setPosition, isOpen, - activeItemIsHtml, container, pointerdown_handler, pointerup_handler diff --git a/dist/bigger-picture.min.js b/dist/bigger-picture.min.js index 5bae3a6..60b5cc1 100644 --- a/dist/bigger-picture.min.js +++ b/dist/bigger-picture.min.js @@ -1 +1 @@ -var BiggerPicture=function(){function t(){}const n=t=>t;function e(t,n){for(const e in n)t[e]=n[e];return t}function o(t){return t()}function r(t){t.forEach(o)}function s(t){return"function"==typeof t}function i(t,n){return t!=t?n==n:t!==n}function c(n,e,o){n.$$.on_destroy.push(((n,...e)=>{if(null==n)return t;const o=n.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o})(e,o))}function u(n){return n&&s(n.destroy)?n.destroy:t}let l=()=>globalThis.performance.now(),a=t=>requestAnimationFrame(t);const p=new Set;function f(t){p.forEach((n=>{n.c(t)||(p.delete(n),n.f())})),0!==p.size&&a(f)}function d(t){let n;return 0===p.size&&a(f),{promise:new Promise((e=>{p.add(n={c:t,f:e})})),abort(){p.delete(n)}}}function m(t,n){t.appendChild(n)}function h(t){const n=x("style");return((t,n)=>{m(t.head||t,n)})(document,n),n.sheet}function b(t,n,e){t.insertBefore(n,e||null)}function g(t){t.parentNode.removeChild(t)}function x(t){return document.createElement(t)}function y(){return document.createTextNode("")}function v(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}function w(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function $(t,n,e,o){null===e?t.style.removeProperty(n):t.style.setProperty(n,e)}function k(t,n,e){t.classList[e?"add":"remove"](n)}const _=new Map;let z,M=0;function S(t,n,e,o,r,s,i,c=0){const u=16.666/o;let l="{\n";for(let t=0;1>=t;t+=u){const o=n+(e-n)*s(t);l+=100*t+`%{${i(o,1-o)}}\n`}const a=l+`100% {${i(e,1-e)}}\n}`,p=`_bp_${(t=>{let n=5381,e=t.length;for(;e--;)n=(n<<5)-n^t.charCodeAt(e);return n>>>0})(a)}_${c}`,f=document,{stylesheet:d,rules:m}=_.get(f)||((t,n)=>{const e={stylesheet:h(),rules:{}};return _.set(t,e),e})(f);m[p]||(m[p]=1,d.insertRule(`@keyframes ${p} ${a}`,d.cssRules.length));const b=t.style.animation||"";return t.style.animation=`${b?b+", ":""}${p} ${o}ms linear ${r}ms 1 both`,M+=1,p}function P(t,n){const e=(t.style.animation||"").split(", "),o=e.filter(n?t=>0>t.indexOf(n):t=>-1===t.indexOf("_bp")),r=e.length-o.length;r&&(t.style.animation=o.join(", "),M-=r,M||a((()=>{M||(_.forEach((t=>{const{stylesheet:n}=t;let e=n.cssRules.length;for(;e--;)n.deleteRule(e);t.rules={}})),_.clear())})))}function A(t){z=t}const T=[],I=[],C=[],N=[],O=Promise.resolve();let j=0;function E(t){C.push(t)}const R=new Set;let q,F=0;function B(){const t=z;do{for(;T.length>F;){const t=T[F];F++,A(t),D(t.$$)}for(A(null),T.length=0,F=0;I.length;)I.pop()();for(let t=0;C.length>t;t+=1){const n=C[t];R.has(n)||(R.add(n),n())}C.length=0}while(T.length);for(;N.length;)N.pop()();j=0,R.clear(),A(t)}function D(t){if(null!==t.t){t.update(),r(t.before_update);const n=t.u;t.u=[-1],t.t&&t.t.p(t.ctx,n),t.after_update.forEach(E)}}function J(){return q||(q=Promise.resolve(),q.then((()=>{q=null}))),q}function K(t,n,e){t.dispatchEvent(((t,n,e=0)=>{const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,e,0,n),o})(`${n?"intro":"outro"}${e}`))}const L=new Set;let W;function X(){W={r:0,c:[],p:W}}function Y(){W.r||r(W.c),W=W.p}function G(t,n){t&&t.i&&(L.delete(t),t.i(n))}function H(t,n,e,o){if(t&&t.o){if(L.has(t))return;L.add(t),W.c.push((()=>{L.delete(t),o&&(e&&t.d(1),o())})),t.o(n)}}const Q={duration:0};function U(e,o,r){let i,c,u=o(e,r),a=0,p=0;function f(){i&&P(e,i)}function m(){const{delay:o=0,duration:r=300,l:s=n,g:m=t,css:h}=u||Q;h&&(i=S(e,0,1,r,o,s,h,p++)),m(0,1);const b=l()+o,g=b+r;c&&c.abort(),a=1,E((()=>K(e,1,"start"))),c=d((t=>{if(a){if(t>=g)return m(1,0),K(e,1,"end"),f(),a=0;if(t>=b){const n=s((t-b)/r);m(n,1-n)}}return a}))}let h=0;return{start(){h||(h=1,P(e),s(u)?(u=u(),J().then(m)):m())},invalidate(){h=0},end(){a&&(f(),a=0)}}}function V(e,o,i){let c,u=o(e,i),a=1;const p=W;function f(){const{delay:o=0,duration:s=300,l:i=n,g:f=t,css:m}=u||Q;m&&(c=S(e,1,0,s,o,i,m));const h=l()+o,b=h+s;E((()=>K(e,0,"start"))),d((t=>{if(a){if(t>=b)return f(0,1),K(e,0,"end"),--p.r||r(p.c),0;if(t>=h){const n=i((t-h)/s);f(1-n,n)}}return a}))}return p.r+=1,s(u)?J().then((()=>{u=u(),f()})):f(),{end(t){t&&u.g&&u.g(1,0),a&&(c&&P(e,c),a=0)}}}function Z(t){t&&t.c()}function tt(t,n,e,i){const{t:c,on_mount:u,on_destroy:l,after_update:a}=t.$$;c&&c.m(n,e),i||E((()=>{const n=u.map(o).filter(s);l?l.push(...n):r(n),t.$$.on_mount=[]})),a.forEach(E)}function nt(t,n){const e=t.$$;null!==e.t&&(r(e.on_destroy),e.t&&e.t.d(n),e.on_destroy=e.t=null,e.ctx=[])}function et(n,e,o,s,i,c,u,l=[-1]){const a=z;A(n);const p=n.$$={t:null,ctx:null,v:c,update:t,not_equal:i,bound:{},on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:{},u:l,skip_bound:0,root:e.target||a.$$.root};u&&u(p.root);let f=0;p.ctx=o?o(n,e.v||{},((t,e,...o)=>{const r=o.length?o[0]:e;return p.ctx&&i(p.ctx[t],p.ctx[t]=r)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](r),f&&((t,n)=>{-1===t.$$.u[0]&&(T.push(t),j||(j=1,O.then(B)),t.$$.u.fill(0)),t.$$.u[n/31|0]|=1<{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}$set(t){this.$$set&&0!==Object.keys(t).length&&(this.$$.skip_bound=1,this.$$set(t),this.$$.skip_bound=0)}}function rt(t){const n=t-1;return n*n*n+1}function st(t,{delay:n=0,duration:e=400,l:o=rt,x:r=0,y:s=0,opacity:i=0}={}){const c=getComputedStyle(t),u=+c.opacity,l="none"===c.transform?"":c.transform,a=u*(1-i);return{delay:n,duration:e,l:o,css(t,n){return`\n\t\t\ttransform: ${l} translate(${(1-t)*r}px, ${(1-t)*s}px);\n\t\t\topacity: ${u-a*n}`}}}const it=[];function ct(n,e=t){let o;const r=new Set;function s(t){if(s=t,((e=n)!=e?s==s:e!==s||e&&"object"==typeof e||"function"==typeof e)&&(n=t,o)){const t=!it.length;for(const t of r)t[1](),it.push(t,n);if(t){for(let t=0;it.length>t;t+=2)it[t][0](it[t+1]);it.length=0}}var e,s}return{set:s,update(t){s(t(n))},subscribe(i,c=t){const u=[i,c];return r.add(u),1===r.size&&(o=e(s)||t),i(n),()=>{r.delete(u),0===r.size&&(o(),o=null)}}}}function ut(t,n){if(t===n||t!=t)return()=>t;const e=typeof t;if(Array.isArray(t)){const e=n.map(((n,e)=>ut(t[e],n)));return t=>e.map((n=>n(t)))}if("number"===e){const e=n-t;return n=>t+n*e}}function lt(t,o={}){const r=ct(t);let s,i=t;function c(c,u){if(null==t)return r.set(t=c),Promise.resolve();i=c;let a=s,p=0,{delay:f=0,duration:m=400,l:h=n,interpolate:b=ut}=e(e({},o),u);if(0===m)return a&&(a.abort(),a=null),r.set(t=i),Promise.resolve();const g=l()+f;let x;return s=d((n=>{if(g>n)return 1;p||(x=b(t,c),"function"==typeof m&&(m=m(t,c)),p=1),a&&(a.abort(),a=null);const e=n-g;return e>m?(r.set(t=c),0):(r.set(t=x(h(e/m))),1)})),s.promise}return{set:c,update(n,e){return c(n(i,t),e)},subscribe:r.subscribe}}const at=ct(0),pt=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches,ft=t=>({l:rt,duration:pt?0:t});function dt(n){let e,o,r,s,i;return{c(){e=x("div"),o=x("span"),r=x("span"),w(o,"class","bp-bar"),w(r,"class","bp-o"),w(e,"class","bp-load"),w(e,"style",n[2])},m(t,n){b(t,e,n),m(e,o),m(e,r),i=1},p:t,i(t){i||(s&&s.end(1),i=1)},o(t){t&&(s=V(e,st,{duration:480})),i=0},d(t){t&&g(e),t&&s&&s.end()}}}function mt(n){let e,o;return{c(){e=x("div"),w(e,"class","bp-load"),w(e,"style",n[2])},m(t,n){b(t,e,n)},p:t,i(t){o||E((()=>{o=U(e,st,{duration:480}),o.start()}))},o:t,d(t){t&&g(e)}}}function ht(t){let n,e,o=!t[0]&&dt(t),r=t[1]&&mt(t);return{c(){o&&o.c(),n=y(),r&&r.c(),e=y()},m(t,s){o&&o.m(t,s),b(t,n,s),r&&r.m(t,s),b(t,e,s)},p(t,[s]){t[0]?o&&(X(),H(o,1,1,(()=>{o=null})),Y()):o?(o.p(t,s),1&s&&G(o,1)):(o=dt(t),o.c(),G(o,1),o.m(n.parentNode,n)),t[1]?r?(r.p(t,s),2&s&&G(r,1)):(r=mt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},i(t){G(o),G(r)},o(t){H(o)},d(t){o&&o.d(t),t&&g(n),r&&r.d(t),t&&g(e)}}}function bt(t,n,e){let o;c(t,at,(t=>e(1,o=t)));let{thumb:r}=n,{loaded:s}=n;const i=`background-image:url(${r})`;return t.$$set=t=>{"thumb"in t&&e(3,r=t.thumb),"loaded"in t&&e(0,s=t.loaded)},[s,o,i,r]}class gt extends ot{constructor(t){super(),et(this,t,bt,ht,i,{thumb:3,loaded:0})}}function xt(t){let n,e,o,r,s,i,c,u;return{c(){n=x("img"),w(n,"srcset",e=t[7].img),w(n,"sizes",o=t[8].sizes||t[1]+"px"),w(n,"alt",r=t[7].alt)},m(e,o){b(e,n,o),i=1,c||(u=v(n,"error",t[26]),c=1)},p(t,e){(!i||2&e[0]&&o!==(o=t[8].sizes||t[1]+"px"))&&w(n,"sizes",o)},i(t){i||(s&&s.end(1),i=1)},o(t){s=V(n,st,{}),i=0},d(t){t&&g(n),t&&s&&s.end(),c=0,u()}}}function yt(t){let n,e;return n=new gt({v:{thumb:t[7].thumb,loaded:t[2]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};4&e[0]&&(o.loaded=t[2]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function vt(t){let n,e,o,s,i,c,l=t[2]&&xt(t),a=t[3]&&yt(t);return{c(){n=x("div"),e=x("div"),l&&l.c(),o=y(),a&&a.c(),w(e,"class","bp-img"),$(e,"background-image","url("+t[7].thumb+")"),$(e,"width",t[0][0]+"px"),$(e,"height",t[0][1]+"px"),$(e,"transform","translate3d("+(t[0][0]/-2+t[6][0])+"px, "+(t[0][1]/-2+t[6][1])+"px, 0)"),k(e,"bp-drag",t[4]),k(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),w(n,"class","bp-img-wrap"),k(n,"bp-close",t[5])},m(r,p){b(r,n,p),m(n,e),l&&l.m(e,null),m(e,o),a&&a.m(e,null),s=1,i||(c=[u(t[20].call(null,e)),v(n,"wheel",t[15]),v(n,"pointerdown",t[16]),v(n,"pointermove",t[17]),v(n,"pointerup",t[19]),v(n,"pointercancel",t[18])],i=1)},p(t,r){t[2]?l?(l.p(t,r),4&r[0]&&G(l,1)):(l=xt(t),l.c(),G(l,1),l.m(e,o)):l&&(X(),H(l,1,1,(()=>{l=null})),Y()),t[3]?a?(a.p(t,r),8&r[0]&&G(a,1)):(a=yt(t),a.c(),G(a,1),a.m(e,null)):a&&(X(),H(a,1,1,(()=>{a=null})),Y()),(!s||1&r[0])&&$(e,"width",t[0][0]+"px"),(!s||1&r[0])&&$(e,"height",t[0][1]+"px"),(!s||65&r[0])&&$(e,"transform","translate3d("+(t[0][0]/-2+t[6][0])+"px, "+(t[0][1]/-2+t[6][1])+"px, 0)"),16&r[0]&&k(e,"bp-drag",t[4]),6145&r[0]&&k(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),32&r[0]&&k(n,"bp-close",t[5])},i(t){s||(G(l),G(a),s=1)},o(t){H(l),H(a),s=0},d(t){t&&g(n),l&&l.d(),a&&a.d(),i=0,r(c)}}}function wt(t,n,e){let o,r,s,i;c(t,at,(t=>e(25,s=t)));let{v:u}=n,{$:l}=n,{k:a,_:p,M:f,next:d,zoomed:m,container:h}=u;c(t,m,(t=>e(24,o=t)));let b,g,x,y,v,w,$,k,_,z,M,S=a.maxZoom||p.maxZoom||10,P=u.S(a),A=P[0],T=0;const I=+a.width,C=[],N=new Map,O=lt(P,ft(400));c(t,O,(t=>e(0,i=t)));const j=lt([0,0],ft(400));c(t,j,(t=>e(6,r=t)));const E=([t,n],o=i)=>{const r=(o[0]-h.w)/2,s=(o[1]-h.h)/2;return 0>r?t=0:t>r?l?(t=v?r+(t-r)/10:r)>r+20&&e(4,v=f()):t=r:-r>t&&(l?-r-20>(t=v?-r-(-r-t)/10:-r)&&e(4,v=d()):t=-r),0>s?n=0:n>s?n=s:-s>n&&(n=-s),[t,n]};function R(t=S,n){if(s)return;const o=P[0]*S;let c=i[0]+i[0]*t,u=i[1]+i[1]*t;if(t>0)c>o&&(c=o,u=P[1]*S),c>I&&(c=I,u=+a.height);else if(P[0]>c)return O.set(P),j.set([0,0]);let{x:l,y:p,width:f,height:d}=y.getBoundingClientRect();const m=n?n.clientX-l-f/2:0,h=n?n.clientY-p-d/2:0;l=c/f*-m+m,p=u/d*-h+h;const b=[c,u];O.set(b).then((()=>{e(1,A=Math.round(Math.max(A,c)))})),j.set(E([r[0]+l,r[1]+p],b))}Object.defineProperty(a,"zoom",{configurable:1,get(){return o},set(t){return R(t?S:-S)}});const q=t=>N.delete(t.pointerId);return t.$$set=t=>{"$"in t&&e(22,l=t.$)},t.$$.update=()=>{if(8388609&t.$$.u[0]&&m.set(i[0]-10>P[0]),58720256&t.$$.u[0]&&s&&o&&!p.intro){const t=ft(480);j.set([0,0],t),O.set(P,t),e(5,M=1)}},[i,A,b,g,v,M,r,a,p,m,h,S,I,O,j,t=>{p.inline&&!o||(t.preventDefault(),R(t.deltaY/-300,t))},t=>{2!==t.button&&(t.preventDefault(),e(4,v=1),N.set(t.pointerId,t),$=t.clientX,k=t.clientY,_=r[0],z=r[1])},t=>{if(N.size>1)return e(4,v=0),p.noPinch?.(h.el)||(t=>{const[n,e]=N.set(t.pointerId,t).values(),o=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY);x=x||{clientX:(n.clientX+e.clientX)/2,clientY:(n.clientY+e.clientY)/2},R(((T||o)-o)/-35,x),T=o})(t);if(!v)return;let n=t.clientX,r=t.clientY;w=C.push({x:n,y:r})>2,n-=$,r-=k,o||(-90>r&&e(4,v=!p.noClose&&u.close()),30>Math.abs(r)&&(n>40&&e(4,v=f()),-40>n&&e(4,v=d()))),o&&w&&!s&&j.set(E([_+n,z+r]),{duration:0})},q,function(t){if(q(t),x&&(e(4,v=T=0),x=N.size?x:null),v){if(e(4,v=0),t.target===this&&!p.noClose)return u.close();if(w){const[t,n,e]=C.slice(-3);Math.hypot(n.x-e.x,n.y-e.y)>5&&j.set(E([r[0]-5*(t.x-e.x),r[1]-5*(t.y-e.y)]))}else p.onImageClick?.(h.el,a)||R(o?-S:S,t);w=0,C.length=0}},t=>{y=t,u.P((()=>{e(23,P=u.S(a)),!p.inline&&l||(O.set(P),j.set([0,0]))})),u.A(a).then((()=>{e(2,b=1),u.T()})),setTimeout((()=>{e(3,g=!b)}),250)},u,l,P,o,s,t=>p.onError?.(h,a,t)]}class $t extends ot{constructor(t){super(),et(this,t,wt,vt,i,{v:21,$:22},null,[-1,-1])}}function kt(t){let n,e,o,s,i,c;return o=new gt({v:{thumb:t[2].thumb,loaded:t[0]}}),{c(){n=x("div"),e=x("iframe"),Z(o.$$.t),w(e,"allow","autoplay; fullscreen"),w(e,"title",t[2].title),w(n,"class","bp-if"),$(n,"width",t[1][0]+"px"),$(n,"height",t[1][1]+"px")},m(r,l){b(r,n,l),m(n,e),tt(o,n,null),s=1,i||(c=[u(t[3].call(null,e)),v(e,"load",t[5])],i=1)},p(t,[e]){const r={};1&e&&(r.loaded=t[0]),o.$set(r),(!s||2&e)&&$(n,"width",t[1][0]+"px"),(!s||2&e)&&$(n,"height",t[1][1]+"px")},i(t){s||(G(o.$$.t,t),s=1)},o(t){H(o.$$.t,t),s=0},d(t){t&&g(n),nt(o),i=0,r(c)}}}function _t(t,n,e){let o,r,{v:s}=n;const{k:i}=s,c=()=>e(1,r=s.S(i));return c(),s.P(c),[o,r,i,t=>t.src=i.iframe,s,()=>e(0,o=1)]}class zt extends ot{constructor(t){super(),et(this,t,_t,kt,i,{v:4})}}function Mt(t){let n,e,o,r,s;return e=new gt({v:{thumb:t[2].thumb,loaded:t[0]}}),{c(){n=x("div"),Z(e.$$.t),w(n,"class","bp-vid"),$(n,"width",t[1][0]+"px"),$(n,"height",t[1][1]+"px"),$(n,"background-image","url("+t[2].thumb+")")},m(i,c){b(i,n,c),tt(e,n,null),o=1,r||(s=u(t[3].call(null,n)),r=1)},p(t,[r]){const s={};1&r&&(s.loaded=t[0]),e.$set(s),(!o||2&r)&&$(n,"width",t[1][0]+"px"),(!o||2&r)&&$(n,"height",t[1][1]+"px")},i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){t&&g(n),nt(e),r=0,s()}}}function St(t,n,e){let o,r,{v:s}=n;const{k:i,_:c,container:u}=s,l=()=>e(1,r=s.S(i));l(),s.P(l);const a=(t,n)=>{for(const e in n)w(t,e,n[e])};return[o,r,i,t=>{let n;const r=(t,e)=>{Array.isArray(e)||(e=JSON.parse(e));for(const o of e){n||(n=x(o.type?.includes("audio")?"audio":"video"),a(n,{controls:1,autoplay:1,playsinline:1,tabindex:"0"}));const e=x(t);a(e,o),"source"==t&&v(e,"error",(t=>c.onError?.(u,i,t))),m(n,e)}};r("source",i.sources),r("track",i.tracks||[]),v(n,"canplay",(()=>e(0,o=1))),m(t,n)},s]}class Pt extends ot{constructor(t){super(),et(this,t,St,Mt,i,{v:4})}}function At(n){let e,o,s,c,l,a,p,f,d,h,y=n[6].i,$=jt(n),_=n[0].length>1&&Et(n);return{c(){e=x("div"),o=x("div"),$.c(),c=x("div"),l=x("button"),_&&_.c(),w(l,"class","bp-x"),w(l,"title","Close"),w(l,"aria-label","Close"),w(c,"class","bp-controls"),w(e,"class","bp-wrap"),k(e,"bp-zoomed",n[10]),k(e,"bp-inline",n[8]),k(e,"bp-small",n[7]),k(e,"bp-noclose",n[5].noClose)},m(t,r){b(t,e,r),m(e,o),$.m(e,null),m(e,c),m(c,l),_&&_.m(c,null),f=1,d||(h=[v(l,"click",n[1]),u(p=n[14].call(null,e))],d=1)},p(n,o){64&o[0]&&i(y,y=n[6].i)?(X(),H($,1,1,t),Y(),$=jt(n),$.c(),G($),$.m(e,c)):$.p(n,o),n[0].length>1?_?_.p(n,o):(_=Et(n),_.c(),_.m(c,null)):_&&(_.d(1),_=null),1024&o[0]&&k(e,"bp-zoomed",n[10]),256&o[0]&&k(e,"bp-inline",n[8]),128&o[0]&&k(e,"bp-small",n[7]),32&o[0]&&k(e,"bp-noclose",n[5].noClose)},i(t){f||(s&&s.end(1),G($),a&&a.end(1),f=1)},o(t){t&&(s=V(o,st,{duration:480})),H($),t&&(a=V(c,st,{})),f=0},d(t){t&&g(e),t&&s&&s.end(),$.d(t),_&&_.d(),t&&a&&a.end(),d=0,r(h)}}}function Tt(n){let e,o=n[6].html+"";return{c(){e=x("div"),w(e,"class","bp-html")},m(t,n){b(t,e,n),e.innerHTML=o},p(t,n){64&n[0]&&o!==(o=t[6].html+"")&&(e.innerHTML=o)},i:t,o:t,d(t){t&&g(e)}}}function It(n){let e,o;return e=new zt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Ct(n){let e,o;return e=new Pt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Nt(t){let n,e;return n=new $t({v:{v:t[13](),$:t[7]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};128&e[0]&&(o.$=t[7]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function Ot(t){let n,e,o,r=t[6].caption+"";return{c(){n=x("div"),w(n,"class","bp-cap")},m(t,e){b(t,n,e),n.innerHTML=r,o=1},p(t,e){(!o||64&e[0])&&r!==(r=t[6].caption+"")&&(n.innerHTML=r)},i(t){o||(e&&e.end(1),o=1)},o(t){e=V(n,st,{duration:200}),o=0},d(t){t&&g(n),t&&e&&e.end()}}}function jt(t){let n,e,o,s,i,c,u,l,a;const p=[Nt,Ct,It,Tt],f=[];function d(t,n){return t[6].img?0:t[6].sources?1:t[6].iframe?2:3}e=d(t),o=f[e]=p[e](t);let m=t[6].caption&&Ot(t);return{c(){n=x("div"),o.c(),m&&m.c(),c=y(),w(n,"class","bp-inner")},m(o,r){b(o,n,r),f[e].m(n,null),m&&m.m(o,r),b(o,c,r),u=1,l||(a=[v(n,"pointerdown",t[21]),v(n,"pointerup",t[22])],l=1)},p(t,r){let s=e;e=d(t),e===s?f[e].p(t,r):(X(),H(f[s],1,1,(()=>{f[s]=null})),Y(),o=f[e],o?o.p(t,r):(o=f[e]=p[e](t),o.c()),G(o,1),o.m(n,null)),t[6].caption?m?(m.p(t,r),64&r[0]&&G(m,1)):(m=Ot(t),m.c(),G(m,1),m.m(c.parentNode,c)):m&&(X(),H(m,1,1,(()=>{m=null})),Y())},i(e){u||(G(o),E((()=>{i&&i.end(1),s=U(n,t[12],1),s.start()})),G(m),u=1)},o(e){H(o),s&&s.invalidate(),i=V(n,t[12],0),H(m),u=0},d(t){t&&g(n),f[e].d(),t&&i&&i.end(),m&&m.d(t),t&&g(c),l=0,r(a)}}}function Et(t){let n,e,o,s,i,c=`${t[4]+1} / ${t[0].length}`;return{c(){n=x("div"),e=x("button"),o=x("button"),w(n,"class","bp-count"),w(e,"class","bp-prev"),w(e,"title","Previous"),w(e,"aria-label","Previous"),w(o,"class","bp-next"),w(o,"title","Next"),w(o,"aria-label","Next")},m(r,u){b(r,n,u),n.innerHTML=c,b(r,e,u),b(r,o,u),s||(i=[v(e,"click",t[2]),v(o,"click",t[3])],s=1)},p(t,e){17&e[0]&&c!==(c=`${t[4]+1} / ${t[0].length}`)&&(n.innerHTML=c)},d(t){t&&g(n),t&&g(e),t&&g(o),s=0,r(i)}}}function Rt(t){let n,e,o=t[0]&&At(t);return{c(){o&&o.c(),n=y()},m(t,r){o&&o.m(t,r),b(t,n,r),e=1},p(t,e){t[0]?o?(o.p(t,e),1&e[0]&&G(o,1)):(o=At(t),o.c(),G(o,1),o.m(n.parentNode,n)):o&&(X(),H(o,1,1,(()=>{o=null})),Y())},i(t){e||(G(o),e=1)},o(t){H(o),e=0},d(t){o&&o.d(t),t&&g(n)}}}function qt(t,n,e){let o,{items:r}=n,{target:s}=n;const i=document.documentElement;let u,l,a,p,f,d,m,h,b,g,y;const w=t=>y=t,$={},k=ct(0);c(t,k,(t=>e(10,o=t)));const _=()=>{l.onClose?.($.el,b),at.set(1),e(0,r=null),p?.focus({preventScroll:1})},z=()=>S(u-1),M=()=>S(u+1),S=t=>{m=t-u,e(4,u=P(t))},P=t=>(t+r.length)%r.length,A=t=>{const{key:n,shiftKey:e}=t;if("Escape"===n)!l.noClose&&_();else if("ArrowRight"===n)M();else if("ArrowLeft"===n)z();else if("Tab"===n){const{activeElement:n}=document;if(e||!n.controls){t.preventDefault();const{focusWrap:o=$.el}=l,r=[...o.querySelectorAll("*")].filter((t=>t.tabIndex>=0));let s=r.indexOf(n);s+=r.length+(e?-1:1),r[s%r.length].focus()}}},T=({width:t=1920,height:n=1080})=>{const{scale:e=.99}=l,o=Math.min(1,$.w/t*e,$.h/n*e);return[Math.round(t*o),Math.round(n*o)]},I=()=>{if(r){const t=r[P(u+1)],n=r[P(u-1)];!t.preload&&C(t),!n.preload&&C(n)}},C=t=>{if(t.img){const n=x("img");return n.sizes=l.sizes||T(t)[0]+"px",n.srcset=t.img,t.preload=1,n.decode().catch((t=>{}))}};return t.$$set=t=>{"items"in t&&e(0,r=t.items),"target"in t&&e(15,s=t.target)},t.$$.update=()=>{1835121&t.$$.u[0]&&r&&(e(6,b=r[u]),e(19,g=b.hasOwnProperty("html")),a&&(g&&w(null),l.onUpdate?.($.el,b)))},[r,_,z,M,u,l,b,f,d,h,o,k,(t,n)=>a&&r?st(t,{x:(m>0?20:-20)*(n?1:-1),duration:250}):(e(18,a=n),l.intro?st(t,{y:n?10:-10}):(t=>{let n;if(g){const e=t.firstChild.firstChild;n=[e.clientWidth,e.clientHeight]}else n=T(b);const e=(b.element||p).getBoundingClientRect(),o=e.left-($.w-e.width)/2,r=e.top-($.h-e.height)/2,s=e.width/n[0],i=e.height/n[1];return{duration:480,l:rt,css:(t,n)=>`transform:translate3d(${o*n}px, ${r*n}px, 0) scale3d(${s+t*(1-s)}, ${i+t*(1-i)}, 1)`}})(t)),()=>({k:b,S:T,A:C,T:I,_:l,M:z,next:M,close:_,P:w,zoomed:k,container:$}),t=>{let n,o;e(20,$.el=t,$),l.onOpen?.($.el,b),d||(n=v(globalThis,"keydown",A));const r=new ResizeObserver((t=>{o&&(e(20,$.w=t[0].contentRect.width,$),e(20,$.h=t[0].contentRect.height,$),e(7,f=769>$.w),y?.(),l.onResize?.($.el,b)),o=1}));return r.observe(t),{destroy(){r.disconnect(),n?.(),at.set(0),i.classList.remove("bp-lock"),l.onClosed?.()}}},s,t=>{e(5,l=t),e(8,d=l.inline);const n=l.items;!d&&i.scrollHeight>i.clientHeight&&i.classList.add("bp-lock"),p=document.activeElement,e(20,$.w=s.offsetWidth,$),e(20,$.h=s===document.body?globalThis.innerHeight:s.clientHeight,$),e(7,f=769>$.w),e(4,u=l.position||0),e(0,r=Array.isArray(n)?n.map(((t,n)=>(l.el&&l.el===t.element&&e(4,u=n),{i:n,...t}))):(n.length?[...n]:[n]).map(((t,n)=>(l.el===t&&e(4,u=n),{element:t,html:t.outerHTML,i:n,...t.dataset}))))},S,a,g,$,t=>e(9,h=t.target),function(t){2!==t.button&&t.target===this&&h===this&&!l.noClose&&_()}]}class Ft extends ot{constructor(t){super(),et(this,t,qt,Rt,i,{items:0,target:15,open:16,close:1,M:2,next:3,setPosition:17},null,[-1,-1])}get items(){return this.$$.ctx[0]}get target(){return this.$$.ctx[15]}get open(){return this.$$.ctx[16]}get close(){return this.$$.ctx[1]}get M(){return this.$$.ctx[2]}get next(){return this.$$.ctx[3]}get setPosition(){return this.$$.ctx[17]}}return t=>new Ft({...t,v:t})}(); +var BiggerPicture=function(){function t(){}const n=t=>t;function e(t,n){for(const e in n)t[e]=n[e];return t}function o(t){return t()}function r(t){t.forEach(o)}function i(t){return"function"==typeof t}function s(t,n){return t!=t?n==n:t!==n}function c(n,e,o){n.$$.on_destroy.push(((n,...e)=>{if(null==n)return t;const o=n.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o})(e,o))}function u(n){return n&&i(n.destroy)?n.destroy:t}let l=()=>globalThis.performance.now(),a=t=>requestAnimationFrame(t);const p=new Set;function f(t){p.forEach((n=>{n.c(t)||(p.delete(n),n.f())})),0!==p.size&&a(f)}function d(t){let n;return 0===p.size&&a(f),{promise:new Promise((e=>{p.add(n={c:t,f:e})})),abort(){p.delete(n)}}}function m(t,n){t.appendChild(n)}function h(t,n,e){t.insertBefore(n,e||null)}function b(t){t.parentNode.removeChild(t)}function g(t){return document.createElement(t)}function x(){return document.createTextNode("")}function y(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}function v(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function w(t,n,e,o){null===e?t.style.removeProperty(n):t.style.setProperty(n,e)}function $(t,n,e){t.classList[e?"add":"remove"](n)}let k,_,M=0,z={};function S(t,n,e,o,r,i,s,c=0){const u=16.666/o;let l="{\n";for(let t=0;1>=t;t+=u){const o=n+(e-n)*i(t);l+=100*t+`%{${s(o,1-o)}}\n`}const a=l+`100% {${s(e,1-e)}}\n}`,p=`_bp_${Math.round(1e9*Math.random())}_${c}`;if(!z[p]){if(!k){const t=g("style");document.head.appendChild(t),k=t.sheet}z[p]=1,k.insertRule(`@keyframes ${p} ${a}`,k.cssRules.length)}const f=t.style.animation||"";return t.style.animation=`${f?f+", ":""}${p} ${o}ms linear ${r}ms 1 both`,M+=1,p}function P(t,n){t.style.animation=(t.style.animation||"").split(", ").filter(n?t=>0>t.indexOf(n):t=>-1===t.indexOf("_bp")).join(", "),n&&!--M&&a((()=>{if(M)return;let t=k.cssRules.length;for(;t--;)k.deleteRule(t);z={}}))}function A(t){_=t}const T=[],I=[],C=[],N=[],O=Promise.resolve();let E=0;function R(t){C.push(t)}const j=new Set;let q,F=0;function B(){const t=_;do{for(;T.length>F;){const t=T[F];F++,A(t),D(t.$$)}for(A(null),T.length=0,F=0;I.length;)I.pop()();for(let t=0;C.length>t;t+=1){const n=C[t];j.has(n)||(j.add(n),n())}C.length=0}while(T.length);for(;N.length;)N.pop()();E=0,j.clear(),A(t)}function D(t){if(null!==t.t){t.update(),r(t.before_update);const n=t.u;t.u=[-1],t.t&&t.t.p(t.ctx,n),t.after_update.forEach(R)}}function J(){return q||(q=Promise.resolve(),q.then((()=>{q=null}))),q}function K(t,n,e){t.dispatchEvent(((t,n,e=0)=>{const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,e,0,n),o})(`${n?"intro":"outro"}${e}`))}const L=new Set;let W;function X(){W={r:0,c:[],p:W}}function Y(){W.r||r(W.c),W=W.p}function G(t,n){t&&t.i&&(L.delete(t),t.i(n))}function H(t,n,e,o){if(t&&t.o){if(L.has(t))return;L.add(t),W.c.push((()=>{L.delete(t),o&&(e&&t.d(1),o())})),t.o(n)}}const Q={duration:0};function U(e,o,r){let s,c,u=o(e,r),a=0,p=0;function f(){s&&P(e,s)}function m(){const{delay:o=0,duration:r=300,l:i=n,g:m=t,css:h}=u||Q;h&&(s=S(e,0,1,r,o,i,h,p++)),m(0,1);const b=l()+o,g=b+r;c&&c.abort(),a=1,R((()=>K(e,1,"start"))),c=d((t=>{if(a){if(t>=g)return m(1,0),K(e,1,"end"),f(),a=0;if(t>=b){const n=i((t-b)/r);m(n,1-n)}}return a}))}let h=0;return{start(){h||(h=1,P(e),i(u)?(u=u(),J().then(m)):m())},invalidate(){h=0},end(){a&&(f(),a=0)}}}function V(e,o,s){let c,u=o(e,s),a=1;const p=W;function f(){const{delay:o=0,duration:i=300,l:s=n,g:f=t,css:m}=u||Q;m&&(c=S(e,1,0,i,o,s,m));const h=l()+o,b=h+i;R((()=>K(e,0,"start"))),d((t=>{if(a){if(t>=b)return f(0,1),K(e,0,"end"),--p.r||r(p.c),0;if(t>=h){const n=s((t-h)/i);f(1-n,n)}}return a}))}return p.r+=1,i(u)?J().then((()=>{u=u(),f()})):f(),{end(t){t&&u.g&&u.g(1,0),a&&(c&&P(e,c),a=0)}}}function Z(t){t&&t.c()}function tt(t,n,e,s){const{t:c,on_mount:u,on_destroy:l,after_update:a}=t.$$;c&&c.m(n,e),s||R((()=>{const n=u.map(o).filter(i);l?l.push(...n):r(n),t.$$.on_mount=[]})),a.forEach(R)}function nt(t,n){const e=t.$$;null!==e.t&&(r(e.on_destroy),e.t&&e.t.d(n),e.on_destroy=e.t=null,e.ctx=[])}function et(n,e,o,i,s,c,u,l=[-1]){const a=_;A(n);const p=n.$$={t:null,ctx:null,v:c,update:t,not_equal:s,bound:{},on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:{},u:l,skip_bound:0,root:e.target||a.$$.root};u&&u(p.root);let f=0;p.ctx=o?o(n,e.v||{},((t,e,...o)=>{const r=o.length?o[0]:e;return p.ctx&&s(p.ctx[t],p.ctx[t]=r)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](r),f&&((t,n)=>{-1===t.$$.u[0]&&(T.push(t),E||(E=1,O.then(B)),t.$$.u.fill(0)),t.$$.u[n/31|0]|=1<{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}$set(t){this.$$set&&0!==Object.keys(t).length&&(this.$$.skip_bound=1,this.$$set(t),this.$$.skip_bound=0)}}function rt(t){const n=t-1;return n*n*n+1}function it(t,{delay:n=0,duration:e=400,l:o=rt,x:r=0,y:i=0,opacity:s=0}={}){const c=getComputedStyle(t),u=+c.opacity,l="none"===c.transform?"":c.transform,a=u*(1-s);return{delay:n,duration:e,l:o,css(t,n){return`\n\t\t\ttransform: ${l} translate(${(1-t)*r}px, ${(1-t)*i}px);\n\t\t\topacity: ${u-a*n}`}}}const st=[];function ct(n,e=t){let o;const r=new Set;function i(t){if(s(n,t)&&(n=t,o)){const t=!st.length;for(const t of r)t[1](),st.push(t,n);if(t){for(let t=0;st.length>t;t+=2)st[t][0](st[t+1]);st.length=0}}}return{set:i,update(t){i(t(n))},subscribe(s,c=t){const u=[s,c];return r.add(u),1===r.size&&(o=e(i)||t),s(n),()=>{r.delete(u),0===r.size&&(o(),o=null)}}}}function ut(t,n){if(t===n||t!=t)return()=>t;const e=typeof t;if(Array.isArray(t)){const e=n.map(((n,e)=>ut(t[e],n)));return t=>e.map((n=>n(t)))}if("number"===e){const e=n-t;return n=>t+n*e}}function lt(t,o={}){const r=ct(t);let i,s=t;function c(c,u){if(null==t)return r.set(t=c),Promise.resolve();s=c;let a=i,p=0,{delay:f=0,duration:m=400,l:h=n,interpolate:b=ut}=e(e({},o),u);if(0===m)return a&&(a.abort(),a=null),r.set(t=s),Promise.resolve();const g=l()+f;let x;return i=d((n=>{if(g>n)return 1;p||(x=b(t,c),"function"==typeof m&&(m=m(t,c)),p=1),a&&(a.abort(),a=null);const e=n-g;return e>m?(r.set(t=c),0):(r.set(t=x(h(e/m))),1)})),i.promise}return{set:c,update(n,e){return c(n(s,t),e)},subscribe:r.subscribe}}const at=ct(0),pt=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches,ft=t=>({l:rt,duration:pt?0:t});function dt(n){let e,o,r,i,s;return{c(){e=g("div"),o=g("span"),r=g("span"),v(o,"class","bp-bar"),v(r,"class","bp-o"),v(e,"class","bp-load"),v(e,"style",n[2])},m(t,n){h(t,e,n),m(e,o),m(e,r),s=1},p:t,i(t){s||(i&&i.end(1),s=1)},o(t){t&&(i=V(e,it,{duration:480})),s=0},d(t){t&&b(e),t&&i&&i.end()}}}function mt(n){let e,o;return{c(){e=g("div"),v(e,"class","bp-load"),v(e,"style",n[2])},m(t,n){h(t,e,n)},p:t,i(t){o||R((()=>{o=U(e,it,{duration:480}),o.start()}))},o:t,d(t){t&&b(e)}}}function ht(t){let n,e,o=!t[0]&&dt(t),r=t[1]&&mt(t);return{c(){o&&o.c(),n=x(),r&&r.c(),e=x()},m(t,i){o&&o.m(t,i),h(t,n,i),r&&r.m(t,i),h(t,e,i)},p(t,[i]){t[0]?o&&(X(),H(o,1,1,(()=>{o=null})),Y()):o?(o.p(t,i),1&i&&G(o,1)):(o=dt(t),o.c(),G(o,1),o.m(n.parentNode,n)),t[1]?r?(r.p(t,i),2&i&&G(r,1)):(r=mt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},i(t){G(o),G(r)},o(t){H(o)},d(t){o&&o.d(t),t&&b(n),r&&r.d(t),t&&b(e)}}}function bt(t,n,e){let o;c(t,at,(t=>e(1,o=t)));let{thumb:r}=n,{loaded:i}=n;const s=`background-image:url(${r})`;return t.$$set=t=>{"thumb"in t&&e(3,r=t.thumb),"loaded"in t&&e(0,i=t.loaded)},[i,o,s,r]}class gt extends ot{constructor(t){super(),et(this,t,bt,ht,s,{thumb:3,loaded:0})}}function xt(t){let n,e,o,r,i,s,c,u;return{c(){n=g("img"),v(n,"srcset",e=t[7].img),v(n,"sizes",o=t[8].sizes||t[1]+"px"),v(n,"alt",r=t[7].alt)},m(e,o){h(e,n,o),s=1,c||(u=y(n,"error",t[26]),c=1)},p(t,e){(!s||2&e[0]&&o!==(o=t[8].sizes||t[1]+"px"))&&v(n,"sizes",o)},i(t){s||(i&&i.end(1),s=1)},o(t){i=V(n,it,{}),s=0},d(t){t&&b(n),t&&i&&i.end(),c=0,u()}}}function yt(t){let n,e;return n=new gt({v:{thumb:t[7].thumb,loaded:t[2]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};4&e[0]&&(o.loaded=t[2]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function vt(t){let n,e,o,i,s,c,l=t[2]&&xt(t),a=t[3]&&yt(t);return{c(){n=g("div"),e=g("div"),l&&l.c(),o=x(),a&&a.c(),v(e,"class","bp-img"),w(e,"background-image","url("+t[7].thumb+")"),w(e,"width",t[0][0]+"px"),w(e,"height",t[0][1]+"px"),w(e,"transform","translate3d("+(t[0][0]/-2+t[6][0])+"px, "+(t[0][1]/-2+t[6][1])+"px, 0)"),$(e,"bp-drag",t[4]),$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),v(n,"class","bp-img-wrap"),$(n,"bp-close",t[5])},m(r,p){h(r,n,p),m(n,e),l&&l.m(e,null),m(e,o),a&&a.m(e,null),i=1,s||(c=[u(t[20].call(null,e)),y(n,"wheel",t[15]),y(n,"pointerdown",t[16]),y(n,"pointermove",t[17]),y(n,"pointerup",t[19]),y(n,"pointercancel",t[18])],s=1)},p(t,r){t[2]?l?(l.p(t,r),4&r[0]&&G(l,1)):(l=xt(t),l.c(),G(l,1),l.m(e,o)):l&&(X(),H(l,1,1,(()=>{l=null})),Y()),t[3]?a?(a.p(t,r),8&r[0]&&G(a,1)):(a=yt(t),a.c(),G(a,1),a.m(e,null)):a&&(X(),H(a,1,1,(()=>{a=null})),Y()),(!i||1&r[0])&&w(e,"width",t[0][0]+"px"),(!i||1&r[0])&&w(e,"height",t[0][1]+"px"),(!i||65&r[0])&&w(e,"transform","translate3d("+(t[0][0]/-2+t[6][0])+"px, "+(t[0][1]/-2+t[6][1])+"px, 0)"),16&r[0]&&$(e,"bp-drag",t[4]),6145&r[0]&&$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),32&r[0]&&$(n,"bp-close",t[5])},i(t){i||(G(l),G(a),i=1)},o(t){H(l),H(a),i=0},d(t){t&&b(n),l&&l.d(),a&&a.d(),s=0,r(c)}}}function wt(t,n,e){let o,r,i,s;c(t,at,(t=>e(25,i=t)));let{v:u}=n,{$:l}=n,{k:a,_:p,M:f,next:d,zoomed:m,container:h}=u;c(t,m,(t=>e(24,o=t)));let b,g,x,y,v,w,$,k,_,M,z,S=a.maxZoom||p.maxZoom||10,P=u.S(a),A=P[0],T=0;const I=+a.width,C=[],N=new Map,O=lt(P,ft(400));c(t,O,(t=>e(0,s=t)));const E=lt([0,0],ft(400));c(t,E,(t=>e(6,r=t)));const R=([t,n],o=s)=>{const r=(o[0]-h.w)/2,i=(o[1]-h.h)/2;return 0>r?t=0:t>r?l?(t=v?r+(t-r)/10:r)>r+20&&e(4,v=f()):t=r:-r>t&&(l?-r-20>(t=v?-r-(-r-t)/10:-r)&&e(4,v=d()):t=-r),0>i?n=0:n>i?n=i:-i>n&&(n=-i),[t,n]};function j(t=S,n){if(i)return;const o=P[0]*S;let c=s[0]+s[0]*t,u=s[1]+s[1]*t;if(t>0)c>o&&(c=o,u=P[1]*S),c>I&&(c=I,u=+a.height);else if(P[0]>c)return O.set(P),E.set([0,0]);let{x:l,y:p,width:f,height:d}=y.getBoundingClientRect();const m=n?n.clientX-l-f/2:0,h=n?n.clientY-p-d/2:0;l=c/f*-m+m,p=u/d*-h+h;const b=[c,u];O.set(b).then((()=>{e(1,A=Math.round(Math.max(A,c)))})),E.set(R([r[0]+l,r[1]+p],b))}Object.defineProperty(a,"zoom",{configurable:1,get(){return o},set(t){return j(t?S:-S)}});const q=t=>N.delete(t.pointerId);return t.$$set=t=>{"$"in t&&e(22,l=t.$)},t.$$.update=()=>{if(8388609&t.$$.u[0]&&m.set(s[0]-10>P[0]),58720256&t.$$.u[0]&&i&&o&&!p.intro){const t=ft(480);E.set([0,0],t),O.set(P,t),e(5,z=1)}},[s,A,b,g,v,z,r,a,p,m,h,S,I,O,E,t=>{p.inline&&!o||(t.preventDefault(),j(t.deltaY/-300,t))},t=>{2!==t.button&&(t.preventDefault(),e(4,v=1),N.set(t.pointerId,t),$=t.clientX,k=t.clientY,_=r[0],M=r[1])},t=>{if(N.size>1)return e(4,v=0),p.noPinch?.(h.el)||(t=>{const[n,e]=N.set(t.pointerId,t).values(),o=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY);x=x||{clientX:(n.clientX+e.clientX)/2,clientY:(n.clientY+e.clientY)/2},j(((T||o)-o)/-35,x),T=o})(t);if(!v)return;let n=t.clientX,r=t.clientY;w=C.push({x:n,y:r})>2,n-=$,r-=k,o||(-90>r&&e(4,v=!p.noClose&&u.close()),30>Math.abs(r)&&(n>40&&e(4,v=f()),-40>n&&e(4,v=d()))),o&&w&&!i&&E.set(R([_+n,M+r]),{duration:0})},q,function(t){if(q(t),x&&(e(4,v=T=0),x=N.size?x:null),v){if(e(4,v=0),t.target===this&&!p.noClose)return u.close();if(w){const[t,n,e]=C.slice(-3);Math.hypot(n.x-e.x,n.y-e.y)>5&&E.set(R([r[0]-5*(t.x-e.x),r[1]-5*(t.y-e.y)]))}else p.onImageClick?.(h.el,a)||j(o?-S:S,t);w=0,C.length=0}},t=>{y=t,u.P((()=>{e(23,P=u.S(a)),!p.inline&&l||(O.set(P),E.set([0,0]))})),u.A(a).then((()=>{e(2,b=1),u.T()})),setTimeout((()=>{e(3,g=!b)}),250)},u,l,P,o,i,t=>p.onError?.(h,a,t)]}class $t extends ot{constructor(t){super(),et(this,t,wt,vt,s,{v:21,$:22},null,[-1,-1])}}function kt(t){let n,e,o,i,s,c;return o=new gt({v:{thumb:t[2].thumb,loaded:t[0]}}),{c(){n=g("div"),e=g("iframe"),Z(o.$$.t),v(e,"allow","autoplay; fullscreen"),v(e,"title",t[2].title),v(n,"class","bp-if"),w(n,"width",t[1][0]+"px"),w(n,"height",t[1][1]+"px")},m(r,l){h(r,n,l),m(n,e),tt(o,n,null),i=1,s||(c=[u(t[3].call(null,e)),y(e,"load",t[5])],s=1)},p(t,[e]){const r={};1&e&&(r.loaded=t[0]),o.$set(r),(!i||2&e)&&w(n,"width",t[1][0]+"px"),(!i||2&e)&&w(n,"height",t[1][1]+"px")},i(t){i||(G(o.$$.t,t),i=1)},o(t){H(o.$$.t,t),i=0},d(t){t&&b(n),nt(o),s=0,r(c)}}}function _t(t,n,e){let o,r,{v:i}=n;const{k:s}=i,c=()=>e(1,r=i.S(s));return c(),i.P(c),[o,r,s,t=>t.src=s.iframe,i,()=>e(0,o=1)]}class Mt extends ot{constructor(t){super(),et(this,t,_t,kt,s,{v:4})}}function zt(t){let n,e,o,r,i;return e=new gt({v:{thumb:t[2].thumb,loaded:t[0]}}),{c(){n=g("div"),Z(e.$$.t),v(n,"class","bp-vid"),w(n,"width",t[1][0]+"px"),w(n,"height",t[1][1]+"px"),w(n,"background-image","url("+t[2].thumb+")")},m(s,c){h(s,n,c),tt(e,n,null),o=1,r||(i=u(t[3].call(null,n)),r=1)},p(t,[r]){const i={};1&r&&(i.loaded=t[0]),e.$set(i),(!o||2&r)&&w(n,"width",t[1][0]+"px"),(!o||2&r)&&w(n,"height",t[1][1]+"px")},i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){t&&b(n),nt(e),r=0,i()}}}function St(t,n,e){let o,r,{v:i}=n;const{k:s,_:c,container:u}=i,l=()=>e(1,r=i.S(s));l(),i.P(l);const a=(t,n)=>{for(const e in n)v(t,e,n[e])};return[o,r,s,t=>{let n;const r=(t,e)=>{Array.isArray(e)||(e=JSON.parse(e));for(const o of e){n||(n=g(o.type?.includes("audio")?"audio":"video"),a(n,{controls:1,autoplay:1,playsinline:1,tabindex:"0"}));const e=g(t);a(e,o),"source"==t&&y(e,"error",(t=>c.onError?.(u,s,t))),m(n,e)}};r("source",s.sources),r("track",s.tracks||[]),y(n,"canplay",(()=>e(0,o=1))),m(t,n)},i]}class Pt extends ot{constructor(t){super(),et(this,t,St,zt,s,{v:4})}}function At(n){let e,o,i,c,l,a,p,f,d,x,w=n[6].i,k=Et(n),_=n[0].length>1&&Rt(n);return{c(){e=g("div"),o=g("div"),k.c(),c=g("div"),l=g("button"),_&&_.c(),v(l,"class","bp-x"),v(l,"title","Close"),v(l,"aria-label","Close"),v(c,"class","bp-controls"),v(e,"class","bp-wrap"),$(e,"bp-zoomed",n[10]),$(e,"bp-inline",n[8]),$(e,"bp-small",n[7]),$(e,"bp-noclose",n[5].noClose)},m(t,r){h(t,e,r),m(e,o),k.m(e,null),m(e,c),m(c,l),_&&_.m(c,null),f=1,d||(x=[y(l,"click",n[1]),u(p=n[14].call(null,e))],d=1)},p(n,o){64&o[0]&&s(w,w=n[6].i)?(X(),H(k,1,1,t),Y(),k=Et(n),k.c(),G(k),k.m(e,c)):k.p(n,o),n[0].length>1?_?_.p(n,o):(_=Rt(n),_.c(),_.m(c,null)):_&&(_.d(1),_=null),1024&o[0]&&$(e,"bp-zoomed",n[10]),256&o[0]&&$(e,"bp-inline",n[8]),128&o[0]&&$(e,"bp-small",n[7]),32&o[0]&&$(e,"bp-noclose",n[5].noClose)},i(t){f||(i&&i.end(1),G(k),a&&a.end(1),f=1)},o(t){t&&(i=V(o,it,{duration:480})),H(k),t&&(a=V(c,it,{})),f=0},d(t){t&&b(e),t&&i&&i.end(),k.d(t),_&&_.d(),t&&a&&a.end(),d=0,r(x)}}}function Tt(n){let e,o=(n[6].html??n[6].element.outerHTML)+"";return{c(){e=g("div"),v(e,"class","bp-html")},m(t,n){h(t,e,n),e.innerHTML=o},p(t,n){64&n[0]&&o!==(o=(t[6].html??t[6].element.outerHTML)+"")&&(e.innerHTML=o)},i:t,o:t,d(t){t&&b(e)}}}function It(n){let e,o;return e=new Mt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Ct(n){let e,o;return e=new Pt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Nt(t){let n,e;return n=new $t({v:{v:t[13](),$:t[7]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};128&e[0]&&(o.$=t[7]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function Ot(t){let n,e,o,r=t[6].caption+"";return{c(){n=g("div"),v(n,"class","bp-cap")},m(t,e){h(t,n,e),n.innerHTML=r,o=1},p(t,e){(!o||64&e[0])&&r!==(r=t[6].caption+"")&&(n.innerHTML=r)},i(t){o||(e&&e.end(1),o=1)},o(t){e=V(n,it,{duration:200}),o=0},d(t){t&&b(n),t&&e&&e.end()}}}function Et(t){let n,e,o,i,s,c,u,l,a;const p=[Nt,Ct,It,Tt],f=[];function d(t,n){return t[6].img?0:t[6].sources?1:t[6].iframe?2:3}e=d(t),o=f[e]=p[e](t);let m=t[6].caption&&Ot(t);return{c(){n=g("div"),o.c(),m&&m.c(),c=x(),v(n,"class","bp-inner")},m(o,r){h(o,n,r),f[e].m(n,null),m&&m.m(o,r),h(o,c,r),u=1,l||(a=[y(n,"pointerdown",t[20]),y(n,"pointerup",t[21])],l=1)},p(t,r){let i=e;e=d(t),e===i?f[e].p(t,r):(X(),H(f[i],1,1,(()=>{f[i]=null})),Y(),o=f[e],o?o.p(t,r):(o=f[e]=p[e](t),o.c()),G(o,1),o.m(n,null)),t[6].caption?m?(m.p(t,r),64&r[0]&&G(m,1)):(m=Ot(t),m.c(),G(m,1),m.m(c.parentNode,c)):m&&(X(),H(m,1,1,(()=>{m=null})),Y())},i(e){u||(G(o),R((()=>{s&&s.end(1),i=U(n,t[12],1),i.start()})),G(m),u=1)},o(e){H(o),i&&i.invalidate(),s=V(n,t[12],0),H(m),u=0},d(t){t&&b(n),f[e].d(),t&&s&&s.end(),m&&m.d(t),t&&b(c),l=0,r(a)}}}function Rt(t){let n,e,o,i,s,c=`${t[4]+1} / ${t[0].length}`;return{c(){n=g("div"),e=g("button"),o=g("button"),v(n,"class","bp-count"),v(e,"class","bp-prev"),v(e,"title","Previous"),v(e,"aria-label","Previous"),v(o,"class","bp-next"),v(o,"title","Next"),v(o,"aria-label","Next")},m(r,u){h(r,n,u),n.innerHTML=c,h(r,e,u),h(r,o,u),i||(s=[y(e,"click",t[2]),y(o,"click",t[3])],i=1)},p(t,e){17&e[0]&&c!==(c=`${t[4]+1} / ${t[0].length}`)&&(n.innerHTML=c)},d(t){t&&b(n),t&&b(e),t&&b(o),i=0,r(s)}}}function jt(t){let n,e,o=t[0]&&At(t);return{c(){o&&o.c(),n=x()},m(t,r){o&&o.m(t,r),h(t,n,r),e=1},p(t,e){t[0]?o?(o.p(t,e),1&e[0]&&G(o,1)):(o=At(t),o.c(),G(o,1),o.m(n.parentNode,n)):o&&(X(),H(o,1,1,(()=>{o=null})),Y())},i(t){e||(G(o),e=1)},o(t){H(o),e=0},d(t){o&&o.d(t),t&&b(n)}}}function qt(t,n,e){let o,{items:r}=n,{target:i}=n;const s=document.documentElement;let u,l,a,p,f,d,m,h,b;const x=()=>!b.img&&!b.sources&&!b.iframe;let v;const w=t=>v=t,$={},k=ct(0);c(t,k,(t=>e(10,o=t)));const _=()=>{l.onClose?.($.el,b),at.set(1),e(0,r=null),p?.focus({preventScroll:1})},M=()=>S(u-1),z=()=>S(u+1),S=t=>{m=t-u,e(4,u=P(t))},P=t=>(t+r.length)%r.length,A=t=>{const{key:n,shiftKey:e}=t;if("Escape"===n)!l.noClose&&_();else if("ArrowRight"===n)z();else if("ArrowLeft"===n)M();else if("Tab"===n){const{activeElement:n}=document;if(e||!n.controls){t.preventDefault();const{focusWrap:o=$.el}=l,r=[...o.querySelectorAll("*")].filter((t=>t.tabIndex>=0));let i=r.indexOf(n);i+=r.length+(e?-1:1),r[i%r.length].focus()}}},T=({width:t=1920,height:n=1080})=>{const{scale:e=.99}=l,o=Math.min(1,$.w/t*e,$.h/n*e);return[Math.round(t*o),Math.round(n*o)]},I=()=>{if(r){const t=r[P(u+1)],n=r[P(u-1)];!t.preload&&C(t),!n.preload&&C(n)}},C=t=>{if(t.img){const n=g("img");return n.sizes=l.sizes||T(t)[0]+"px",n.srcset=t.img,t.preload=1,n.decode().catch((t=>{}))}};return t.$$set=t=>{"items"in t&&e(0,r=t.items),"target"in t&&e(15,i=t.target)},t.$$.update=()=>{786545&t.$$.u[0]&&r&&(e(6,b=r[u]),a&&l.onUpdate?.($.el,b))},[r,_,M,z,u,l,b,f,d,h,o,k,(t,n)=>a&&r?it(t,{x:(m>0?20:-20)*(n?1:-1),duration:250}):(e(18,a=n),l.intro?it(t,{y:n?10:-10}):(t=>{let n;if(x()){const e=t.firstChild.firstChild;n=[e.clientWidth,e.clientHeight]}else n=T(b);const e=(b.element||p).getBoundingClientRect(),o=e.left-($.w-e.width)/2,r=e.top-($.h-e.height)/2,i=e.width/n[0],s=e.height/n[1];return{duration:480,l:rt,css:(t,n)=>`transform:translate3d(${o*n}px, ${r*n}px, 0) scale3d(${i+t*(1-i)}, ${s+t*(1-s)}, 1)`}})(t)),()=>({k:b,S:T,A:C,T:I,_:l,M,next:z,close:_,P:w,zoomed:k,container:$}),t=>{let n,o;e(19,$.el=t,$),l.onOpen?.($.el,b),d||(n=y(globalThis,"keydown",A));const r=new ResizeObserver((t=>{o&&(e(19,$.w=t[0].contentRect.width,$),e(19,$.h=t[0].contentRect.height,$),e(7,f=769>$.w),x()||v?.(),l.onResize?.($.el,b)),o=1}));return r.observe(t),{destroy(){r.disconnect(),n?.(),at.set(0),s.classList.remove("bp-lock"),l.onClosed?.()}}},i,t=>{e(5,l=t),e(8,d=l.inline);const n=l.items;!d&&s.scrollHeight>s.clientHeight&&s.classList.add("bp-lock"),p=document.activeElement,e(19,$.w=i.offsetWidth,$),e(19,$.h=i===document.body?globalThis.innerHeight:i.clientHeight,$),e(7,f=769>$.w),e(4,u=l.position||0),e(0,r=Array.isArray(n)?n.map(((t,n)=>(l.el&&l.el===t.element&&e(4,u=n),{i:n,...t}))):(n.length?[...n]:[n]).map(((t,n)=>(l.el===t&&e(4,u=n),{element:t,i:n,...t.dataset}))))},S,a,$,t=>e(9,h=t.target),function(t){2!==t.button&&t.target===this&&h===this&&!l.noClose&&_()}]}class Ft extends ot{constructor(t){super(),et(this,t,qt,jt,s,{items:0,target:15,open:16,close:1,M:2,next:3,setPosition:17},null,[-1,-1])}get items(){return this.$$.ctx[0]}get target(){return this.$$.ctx[15]}get open(){return this.$$.ctx[16]}get close(){return this.$$.ctx[1]}get M(){return this.$$.ctx[2]}get next(){return this.$$.ctx[3]}get setPosition(){return this.$$.ctx[17]}}return t=>new Ft({...t,v:t})}(); diff --git a/dist/bigger-picture.min.mjs b/dist/bigger-picture.min.mjs index 4029e5d..e39c44e 100644 --- a/dist/bigger-picture.min.mjs +++ b/dist/bigger-picture.min.mjs @@ -1 +1 @@ -function t(){}const n=t=>t;function e(t,n){for(const e in n)t[e]=n[e];return t}function o(t){return t()}function r(t){t.forEach(o)}function s(t){return"function"==typeof t}function i(t,n){return t!=t?n==n:t!==n}function c(n,e,o){n.$$.on_destroy.push(((n,...e)=>{if(null==n)return t;const o=n.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o})(e,o))}function u(n){return n&&s(n.destroy)?n.destroy:t}let l=()=>globalThis.performance.now(),a=t=>requestAnimationFrame(t);const p=new Set;function f(t){p.forEach((n=>{n.c(t)||(p.delete(n),n.f())})),0!==p.size&&a(f)}function d(t){let n;return 0===p.size&&a(f),{promise:new Promise((e=>{p.add(n={c:t,f:e})})),abort(){p.delete(n)}}}function m(t,n){t.appendChild(n)}function h(t){const n=x("style");return((t,n)=>{m(t.head||t,n)})(document,n),n.sheet}function b(t,n,e){t.insertBefore(n,e||null)}function g(t){t.parentNode.removeChild(t)}function x(t){return document.createElement(t)}function y(){return document.createTextNode("")}function w(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}function v(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function $(t,n,e,o){null===e?t.style.removeProperty(n):t.style.setProperty(n,e)}function k(t,n,e){t.classList[e?"add":"remove"](n)}const _=new Map;let z,M=0;function S(t,n,e,o,r,s,i,c=0){const u=16.666/o;let l="{\n";for(let t=0;1>=t;t+=u){const o=n+(e-n)*s(t);l+=100*t+`%{${i(o,1-o)}}\n`}const a=l+`100% {${i(e,1-e)}}\n}`,p=`_bp_${(t=>{let n=5381,e=t.length;for(;e--;)n=(n<<5)-n^t.charCodeAt(e);return n>>>0})(a)}_${c}`,f=document,{stylesheet:d,rules:m}=_.get(f)||((t,n)=>{const e={stylesheet:h(),rules:{}};return _.set(t,e),e})(f);m[p]||(m[p]=1,d.insertRule(`@keyframes ${p} ${a}`,d.cssRules.length));const b=t.style.animation||"";return t.style.animation=`${b?b+", ":""}${p} ${o}ms linear ${r}ms 1 both`,M+=1,p}function P(t,n){const e=(t.style.animation||"").split(", "),o=e.filter(n?t=>0>t.indexOf(n):t=>-1===t.indexOf("_bp")),r=e.length-o.length;r&&(t.style.animation=o.join(", "),M-=r,M||a((()=>{M||(_.forEach((t=>{const{stylesheet:n}=t;let e=n.cssRules.length;for(;e--;)n.deleteRule(e);t.rules={}})),_.clear())})))}function A(t){z=t}const T=[],I=[],C=[],N=[],O=Promise.resolve();let j=0;function E(t){C.push(t)}const R=new Set;let q,F=0;function D(){const t=z;do{for(;T.length>F;){const t=T[F];F++,A(t),J(t.$$)}for(A(null),T.length=0,F=0;I.length;)I.pop()();for(let t=0;C.length>t;t+=1){const n=C[t];R.has(n)||(R.add(n),n())}C.length=0}while(T.length);for(;N.length;)N.pop()();j=0,R.clear(),A(t)}function J(t){if(null!==t.t){t.update(),r(t.before_update);const n=t.u;t.u=[-1],t.t&&t.t.p(t.ctx,n),t.after_update.forEach(E)}}function K(){return q||(q=Promise.resolve(),q.then((()=>{q=null}))),q}function L(t,n,e){t.dispatchEvent(((t,n,e=0)=>{const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,e,0,n),o})(`${n?"intro":"outro"}${e}`))}const W=new Set;let X;function Y(){X={r:0,c:[],p:X}}function B(){X.r||r(X.c),X=X.p}function G(t,n){t&&t.i&&(W.delete(t),t.i(n))}function H(t,n,e,o){if(t&&t.o){if(W.has(t))return;W.add(t),X.c.push((()=>{W.delete(t),o&&(e&&t.d(1),o())})),t.o(n)}}const Q={duration:0};function U(e,o,r){let i,c,u=o(e,r),a=0,p=0;function f(){i&&P(e,i)}function m(){const{delay:o=0,duration:r=300,l:s=n,g:m=t,css:h}=u||Q;h&&(i=S(e,0,1,r,o,s,h,p++)),m(0,1);const b=l()+o,g=b+r;c&&c.abort(),a=1,E((()=>L(e,1,"start"))),c=d((t=>{if(a){if(t>=g)return m(1,0),L(e,1,"end"),f(),a=0;if(t>=b){const n=s((t-b)/r);m(n,1-n)}}return a}))}let h=0;return{start(){h||(h=1,P(e),s(u)?(u=u(),K().then(m)):m())},invalidate(){h=0},end(){a&&(f(),a=0)}}}function V(e,o,i){let c,u=o(e,i),a=1;const p=X;function f(){const{delay:o=0,duration:s=300,l:i=n,g:f=t,css:m}=u||Q;m&&(c=S(e,1,0,s,o,i,m));const h=l()+o,b=h+s;E((()=>L(e,0,"start"))),d((t=>{if(a){if(t>=b)return f(0,1),L(e,0,"end"),--p.r||r(p.c),0;if(t>=h){const n=i((t-h)/s);f(1-n,n)}}return a}))}return p.r+=1,s(u)?K().then((()=>{u=u(),f()})):f(),{end(t){t&&u.g&&u.g(1,0),a&&(c&&P(e,c),a=0)}}}function Z(t){t&&t.c()}function tt(t,n,e,i){const{t:c,on_mount:u,on_destroy:l,after_update:a}=t.$$;c&&c.m(n,e),i||E((()=>{const n=u.map(o).filter(s);l?l.push(...n):r(n),t.$$.on_mount=[]})),a.forEach(E)}function nt(t,n){const e=t.$$;null!==e.t&&(r(e.on_destroy),e.t&&e.t.d(n),e.on_destroy=e.t=null,e.ctx=[])}function et(n,e,o,s,i,c,u,l=[-1]){const a=z;A(n);const p=n.$$={t:null,ctx:null,v:c,update:t,not_equal:i,bound:{},on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:{},u:l,skip_bound:0,root:e.target||a.$$.root};u&&u(p.root);let f=0;p.ctx=o?o(n,e.v||{},((t,e,...o)=>{const r=o.length?o[0]:e;return p.ctx&&i(p.ctx[t],p.ctx[t]=r)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](r),f&&((t,n)=>{-1===t.$$.u[0]&&(T.push(t),j||(j=1,O.then(D)),t.$$.u.fill(0)),t.$$.u[n/31|0]|=1<{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}$set(t){this.$$set&&0!==Object.keys(t).length&&(this.$$.skip_bound=1,this.$$set(t),this.$$.skip_bound=0)}}function rt(t){const n=t-1;return n*n*n+1}function st(t,{delay:n=0,duration:e=400,l:o=rt,x:r=0,y:s=0,opacity:i=0}={}){const c=getComputedStyle(t),u=+c.opacity,l="none"===c.transform?"":c.transform,a=u*(1-i);return{delay:n,duration:e,l:o,css(t,n){return`\n\t\t\ttransform: ${l} translate(${(1-t)*r}px, ${(1-t)*s}px);\n\t\t\topacity: ${u-a*n}`}}}const it=[];function ct(n,e=t){let o;const r=new Set;function s(t){if(s=t,((e=n)!=e?s==s:e!==s||e&&"object"==typeof e||"function"==typeof e)&&(n=t,o)){const t=!it.length;for(const t of r)t[1](),it.push(t,n);if(t){for(let t=0;it.length>t;t+=2)it[t][0](it[t+1]);it.length=0}}var e,s}return{set:s,update(t){s(t(n))},subscribe(i,c=t){const u=[i,c];return r.add(u),1===r.size&&(o=e(s)||t),i(n),()=>{r.delete(u),0===r.size&&(o(),o=null)}}}}function ut(t,n){if(t===n||t!=t)return()=>t;const e=typeof t;if(Array.isArray(t)){const e=n.map(((n,e)=>ut(t[e],n)));return t=>e.map((n=>n(t)))}if("number"===e){const e=n-t;return n=>t+n*e}}function lt(t,o={}){const r=ct(t);let s,i=t;function c(c,u){if(null==t)return r.set(t=c),Promise.resolve();i=c;let a=s,p=0,{delay:f=0,duration:m=400,l:h=n,interpolate:b=ut}=e(e({},o),u);if(0===m)return a&&(a.abort(),a=null),r.set(t=i),Promise.resolve();const g=l()+f;let x;return s=d((n=>{if(g>n)return 1;p||(x=b(t,c),"function"==typeof m&&(m=m(t,c)),p=1),a&&(a.abort(),a=null);const e=n-g;return e>m?(r.set(t=c),0):(r.set(t=x(h(e/m))),1)})),s.promise}return{set:c,update(n,e){return c(n(i,t),e)},subscribe:r.subscribe}}const at=ct(0),pt=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches,ft=t=>({l:rt,duration:pt?0:t});function dt(n){let e,o,r,s,i;return{c(){e=x("div"),o=x("span"),r=x("span"),v(o,"class","bp-bar"),v(r,"class","bp-o"),v(e,"class","bp-load"),v(e,"style",n[2])},m(t,n){b(t,e,n),m(e,o),m(e,r),i=1},p:t,i(t){i||(s&&s.end(1),i=1)},o(t){t&&(s=V(e,st,{duration:480})),i=0},d(t){t&&g(e),t&&s&&s.end()}}}function mt(n){let e,o;return{c(){e=x("div"),v(e,"class","bp-load"),v(e,"style",n[2])},m(t,n){b(t,e,n)},p:t,i(t){o||E((()=>{o=U(e,st,{duration:480}),o.start()}))},o:t,d(t){t&&g(e)}}}function ht(t){let n,e,o=!t[0]&&dt(t),r=t[1]&&mt(t);return{c(){o&&o.c(),n=y(),r&&r.c(),e=y()},m(t,s){o&&o.m(t,s),b(t,n,s),r&&r.m(t,s),b(t,e,s)},p(t,[s]){t[0]?o&&(Y(),H(o,1,1,(()=>{o=null})),B()):o?(o.p(t,s),1&s&&G(o,1)):(o=dt(t),o.c(),G(o,1),o.m(n.parentNode,n)),t[1]?r?(r.p(t,s),2&s&&G(r,1)):(r=mt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},i(t){G(o),G(r)},o(t){H(o)},d(t){o&&o.d(t),t&&g(n),r&&r.d(t),t&&g(e)}}}function bt(t,n,e){let o;c(t,at,(t=>e(1,o=t)));let{thumb:r}=n,{loaded:s}=n;const i=`background-image:url(${r})`;return t.$$set=t=>{"thumb"in t&&e(3,r=t.thumb),"loaded"in t&&e(0,s=t.loaded)},[s,o,i,r]}class gt extends ot{constructor(t){super(),et(this,t,bt,ht,i,{thumb:3,loaded:0})}}function xt(t){let n,e,o,r,s,i,c,u;return{c(){n=x("img"),v(n,"srcset",e=t[7].img),v(n,"sizes",o=t[8].sizes||t[1]+"px"),v(n,"alt",r=t[7].alt)},m(e,o){b(e,n,o),i=1,c||(u=w(n,"error",t[26]),c=1)},p(t,e){(!i||2&e[0]&&o!==(o=t[8].sizes||t[1]+"px"))&&v(n,"sizes",o)},i(t){i||(s&&s.end(1),i=1)},o(t){s=V(n,st,{}),i=0},d(t){t&&g(n),t&&s&&s.end(),c=0,u()}}}function yt(t){let n,e;return n=new gt({v:{thumb:t[7].thumb,loaded:t[2]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};4&e[0]&&(o.loaded=t[2]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function wt(t){let n,e,o,s,i,c,l=t[2]&&xt(t),a=t[3]&&yt(t);return{c(){n=x("div"),e=x("div"),l&&l.c(),o=y(),a&&a.c(),v(e,"class","bp-img"),$(e,"background-image","url("+t[7].thumb+")"),$(e,"width",t[0][0]+"px"),$(e,"height",t[0][1]+"px"),$(e,"transform","translate3d("+(t[0][0]/-2+t[6][0])+"px, "+(t[0][1]/-2+t[6][1])+"px, 0)"),k(e,"bp-drag",t[4]),k(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),v(n,"class","bp-img-wrap"),k(n,"bp-close",t[5])},m(r,p){b(r,n,p),m(n,e),l&&l.m(e,null),m(e,o),a&&a.m(e,null),s=1,i||(c=[u(t[20].call(null,e)),w(n,"wheel",t[15]),w(n,"pointerdown",t[16]),w(n,"pointermove",t[17]),w(n,"pointerup",t[19]),w(n,"pointercancel",t[18])],i=1)},p(t,r){t[2]?l?(l.p(t,r),4&r[0]&&G(l,1)):(l=xt(t),l.c(),G(l,1),l.m(e,o)):l&&(Y(),H(l,1,1,(()=>{l=null})),B()),t[3]?a?(a.p(t,r),8&r[0]&&G(a,1)):(a=yt(t),a.c(),G(a,1),a.m(e,null)):a&&(Y(),H(a,1,1,(()=>{a=null})),B()),(!s||1&r[0])&&$(e,"width",t[0][0]+"px"),(!s||1&r[0])&&$(e,"height",t[0][1]+"px"),(!s||65&r[0])&&$(e,"transform","translate3d("+(t[0][0]/-2+t[6][0])+"px, "+(t[0][1]/-2+t[6][1])+"px, 0)"),16&r[0]&&k(e,"bp-drag",t[4]),6145&r[0]&&k(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),32&r[0]&&k(n,"bp-close",t[5])},i(t){s||(G(l),G(a),s=1)},o(t){H(l),H(a),s=0},d(t){t&&g(n),l&&l.d(),a&&a.d(),i=0,r(c)}}}function vt(t,n,e){let o,r,s,i;c(t,at,(t=>e(25,s=t)));let{v:u}=n,{$:l}=n,{k:a,_:p,M:f,next:d,zoomed:m,container:h}=u;c(t,m,(t=>e(24,o=t)));let b,g,x,y,w,v,$,k,_,z,M,S=a.maxZoom||p.maxZoom||10,P=u.S(a),A=P[0],T=0;const I=+a.width,C=[],N=new Map,O=lt(P,ft(400));c(t,O,(t=>e(0,i=t)));const j=lt([0,0],ft(400));c(t,j,(t=>e(6,r=t)));const E=([t,n],o=i)=>{const r=(o[0]-h.w)/2,s=(o[1]-h.h)/2;return 0>r?t=0:t>r?l?(t=w?r+(t-r)/10:r)>r+20&&e(4,w=f()):t=r:-r>t&&(l?-r-20>(t=w?-r-(-r-t)/10:-r)&&e(4,w=d()):t=-r),0>s?n=0:n>s?n=s:-s>n&&(n=-s),[t,n]};function R(t=S,n){if(s)return;const o=P[0]*S;let c=i[0]+i[0]*t,u=i[1]+i[1]*t;if(t>0)c>o&&(c=o,u=P[1]*S),c>I&&(c=I,u=+a.height);else if(P[0]>c)return O.set(P),j.set([0,0]);let{x:l,y:p,width:f,height:d}=y.getBoundingClientRect();const m=n?n.clientX-l-f/2:0,h=n?n.clientY-p-d/2:0;l=c/f*-m+m,p=u/d*-h+h;const b=[c,u];O.set(b).then((()=>{e(1,A=Math.round(Math.max(A,c)))})),j.set(E([r[0]+l,r[1]+p],b))}Object.defineProperty(a,"zoom",{configurable:1,get(){return o},set(t){return R(t?S:-S)}});const q=t=>N.delete(t.pointerId);return t.$$set=t=>{"$"in t&&e(22,l=t.$)},t.$$.update=()=>{if(8388609&t.$$.u[0]&&m.set(i[0]-10>P[0]),58720256&t.$$.u[0]&&s&&o&&!p.intro){const t=ft(480);j.set([0,0],t),O.set(P,t),e(5,M=1)}},[i,A,b,g,w,M,r,a,p,m,h,S,I,O,j,t=>{p.inline&&!o||(t.preventDefault(),R(t.deltaY/-300,t))},t=>{2!==t.button&&(t.preventDefault(),e(4,w=1),N.set(t.pointerId,t),$=t.clientX,k=t.clientY,_=r[0],z=r[1])},t=>{if(N.size>1)return e(4,w=0),p.noPinch?.(h.el)||(t=>{const[n,e]=N.set(t.pointerId,t).values(),o=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY);x=x||{clientX:(n.clientX+e.clientX)/2,clientY:(n.clientY+e.clientY)/2},R(((T||o)-o)/-35,x),T=o})(t);if(!w)return;let n=t.clientX,r=t.clientY;v=C.push({x:n,y:r})>2,n-=$,r-=k,o||(-90>r&&e(4,w=!p.noClose&&u.close()),30>Math.abs(r)&&(n>40&&e(4,w=f()),-40>n&&e(4,w=d()))),o&&v&&!s&&j.set(E([_+n,z+r]),{duration:0})},q,function(t){if(q(t),x&&(e(4,w=T=0),x=N.size?x:null),w){if(e(4,w=0),t.target===this&&!p.noClose)return u.close();if(v){const[t,n,e]=C.slice(-3);Math.hypot(n.x-e.x,n.y-e.y)>5&&j.set(E([r[0]-5*(t.x-e.x),r[1]-5*(t.y-e.y)]))}else p.onImageClick?.(h.el,a)||R(o?-S:S,t);v=0,C.length=0}},t=>{y=t,u.P((()=>{e(23,P=u.S(a)),!p.inline&&l||(O.set(P),j.set([0,0]))})),u.A(a).then((()=>{e(2,b=1),u.T()})),setTimeout((()=>{e(3,g=!b)}),250)},u,l,P,o,s,t=>p.onError?.(h,a,t)]}class $t extends ot{constructor(t){super(),et(this,t,vt,wt,i,{v:21,$:22},null,[-1,-1])}}function kt(t){let n,e,o,s,i,c;return o=new gt({v:{thumb:t[2].thumb,loaded:t[0]}}),{c(){n=x("div"),e=x("iframe"),Z(o.$$.t),v(e,"allow","autoplay; fullscreen"),v(e,"title",t[2].title),v(n,"class","bp-if"),$(n,"width",t[1][0]+"px"),$(n,"height",t[1][1]+"px")},m(r,l){b(r,n,l),m(n,e),tt(o,n,null),s=1,i||(c=[u(t[3].call(null,e)),w(e,"load",t[5])],i=1)},p(t,[e]){const r={};1&e&&(r.loaded=t[0]),o.$set(r),(!s||2&e)&&$(n,"width",t[1][0]+"px"),(!s||2&e)&&$(n,"height",t[1][1]+"px")},i(t){s||(G(o.$$.t,t),s=1)},o(t){H(o.$$.t,t),s=0},d(t){t&&g(n),nt(o),i=0,r(c)}}}function _t(t,n,e){let o,r,{v:s}=n;const{k:i}=s,c=()=>e(1,r=s.S(i));return c(),s.P(c),[o,r,i,t=>t.src=i.iframe,s,()=>e(0,o=1)]}class zt extends ot{constructor(t){super(),et(this,t,_t,kt,i,{v:4})}}function Mt(t){let n,e,o,r,s;return e=new gt({v:{thumb:t[2].thumb,loaded:t[0]}}),{c(){n=x("div"),Z(e.$$.t),v(n,"class","bp-vid"),$(n,"width",t[1][0]+"px"),$(n,"height",t[1][1]+"px"),$(n,"background-image","url("+t[2].thumb+")")},m(i,c){b(i,n,c),tt(e,n,null),o=1,r||(s=u(t[3].call(null,n)),r=1)},p(t,[r]){const s={};1&r&&(s.loaded=t[0]),e.$set(s),(!o||2&r)&&$(n,"width",t[1][0]+"px"),(!o||2&r)&&$(n,"height",t[1][1]+"px")},i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){t&&g(n),nt(e),r=0,s()}}}function St(t,n,e){let o,r,{v:s}=n;const{k:i,_:c,container:u}=s,l=()=>e(1,r=s.S(i));l(),s.P(l);const a=(t,n)=>{for(const e in n)v(t,e,n[e])};return[o,r,i,t=>{let n;const r=(t,e)=>{Array.isArray(e)||(e=JSON.parse(e));for(const o of e){n||(n=x(o.type?.includes("audio")?"audio":"video"),a(n,{controls:1,autoplay:1,playsinline:1,tabindex:"0"}));const e=x(t);a(e,o),"source"==t&&w(e,"error",(t=>c.onError?.(u,i,t))),m(n,e)}};r("source",i.sources),r("track",i.tracks||[]),w(n,"canplay",(()=>e(0,o=1))),m(t,n)},s]}class Pt extends ot{constructor(t){super(),et(this,t,St,Mt,i,{v:4})}}function At(n){let e,o,s,c,l,a,p,f,d,h,y=n[6].i,$=jt(n),_=n[0].length>1&&Et(n);return{c(){e=x("div"),o=x("div"),$.c(),c=x("div"),l=x("button"),_&&_.c(),v(l,"class","bp-x"),v(l,"title","Close"),v(l,"aria-label","Close"),v(c,"class","bp-controls"),v(e,"class","bp-wrap"),k(e,"bp-zoomed",n[10]),k(e,"bp-inline",n[8]),k(e,"bp-small",n[7]),k(e,"bp-noclose",n[5].noClose)},m(t,r){b(t,e,r),m(e,o),$.m(e,null),m(e,c),m(c,l),_&&_.m(c,null),f=1,d||(h=[w(l,"click",n[1]),u(p=n[14].call(null,e))],d=1)},p(n,o){64&o[0]&&i(y,y=n[6].i)?(Y(),H($,1,1,t),B(),$=jt(n),$.c(),G($),$.m(e,c)):$.p(n,o),n[0].length>1?_?_.p(n,o):(_=Et(n),_.c(),_.m(c,null)):_&&(_.d(1),_=null),1024&o[0]&&k(e,"bp-zoomed",n[10]),256&o[0]&&k(e,"bp-inline",n[8]),128&o[0]&&k(e,"bp-small",n[7]),32&o[0]&&k(e,"bp-noclose",n[5].noClose)},i(t){f||(s&&s.end(1),G($),a&&a.end(1),f=1)},o(t){t&&(s=V(o,st,{duration:480})),H($),t&&(a=V(c,st,{})),f=0},d(t){t&&g(e),t&&s&&s.end(),$.d(t),_&&_.d(),t&&a&&a.end(),d=0,r(h)}}}function Tt(n){let e,o=n[6].html+"";return{c(){e=x("div"),v(e,"class","bp-html")},m(t,n){b(t,e,n),e.innerHTML=o},p(t,n){64&n[0]&&o!==(o=t[6].html+"")&&(e.innerHTML=o)},i:t,o:t,d(t){t&&g(e)}}}function It(n){let e,o;return e=new zt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Ct(n){let e,o;return e=new Pt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Nt(t){let n,e;return n=new $t({v:{v:t[13](),$:t[7]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};128&e[0]&&(o.$=t[7]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function Ot(t){let n,e,o,r=t[6].caption+"";return{c(){n=x("div"),v(n,"class","bp-cap")},m(t,e){b(t,n,e),n.innerHTML=r,o=1},p(t,e){(!o||64&e[0])&&r!==(r=t[6].caption+"")&&(n.innerHTML=r)},i(t){o||(e&&e.end(1),o=1)},o(t){e=V(n,st,{duration:200}),o=0},d(t){t&&g(n),t&&e&&e.end()}}}function jt(t){let n,e,o,s,i,c,u,l,a;const p=[Nt,Ct,It,Tt],f=[];function d(t,n){return t[6].img?0:t[6].sources?1:t[6].iframe?2:3}e=d(t),o=f[e]=p[e](t);let m=t[6].caption&&Ot(t);return{c(){n=x("div"),o.c(),m&&m.c(),c=y(),v(n,"class","bp-inner")},m(o,r){b(o,n,r),f[e].m(n,null),m&&m.m(o,r),b(o,c,r),u=1,l||(a=[w(n,"pointerdown",t[21]),w(n,"pointerup",t[22])],l=1)},p(t,r){let s=e;e=d(t),e===s?f[e].p(t,r):(Y(),H(f[s],1,1,(()=>{f[s]=null})),B(),o=f[e],o?o.p(t,r):(o=f[e]=p[e](t),o.c()),G(o,1),o.m(n,null)),t[6].caption?m?(m.p(t,r),64&r[0]&&G(m,1)):(m=Ot(t),m.c(),G(m,1),m.m(c.parentNode,c)):m&&(Y(),H(m,1,1,(()=>{m=null})),B())},i(e){u||(G(o),E((()=>{i&&i.end(1),s=U(n,t[12],1),s.start()})),G(m),u=1)},o(e){H(o),s&&s.invalidate(),i=V(n,t[12],0),H(m),u=0},d(t){t&&g(n),f[e].d(),t&&i&&i.end(),m&&m.d(t),t&&g(c),l=0,r(a)}}}function Et(t){let n,e,o,s,i,c=`${t[4]+1} / ${t[0].length}`;return{c(){n=x("div"),e=x("button"),o=x("button"),v(n,"class","bp-count"),v(e,"class","bp-prev"),v(e,"title","Previous"),v(e,"aria-label","Previous"),v(o,"class","bp-next"),v(o,"title","Next"),v(o,"aria-label","Next")},m(r,u){b(r,n,u),n.innerHTML=c,b(r,e,u),b(r,o,u),s||(i=[w(e,"click",t[2]),w(o,"click",t[3])],s=1)},p(t,e){17&e[0]&&c!==(c=`${t[4]+1} / ${t[0].length}`)&&(n.innerHTML=c)},d(t){t&&g(n),t&&g(e),t&&g(o),s=0,r(i)}}}function Rt(t){let n,e,o=t[0]&&At(t);return{c(){o&&o.c(),n=y()},m(t,r){o&&o.m(t,r),b(t,n,r),e=1},p(t,e){t[0]?o?(o.p(t,e),1&e[0]&&G(o,1)):(o=At(t),o.c(),G(o,1),o.m(n.parentNode,n)):o&&(Y(),H(o,1,1,(()=>{o=null})),B())},i(t){e||(G(o),e=1)},o(t){H(o),e=0},d(t){o&&o.d(t),t&&g(n)}}}function qt(t,n,e){let o,{items:r}=n,{target:s}=n;const i=document.documentElement;let u,l,a,p,f,d,m,h,b,g,y;const v=t=>y=t,$={},k=ct(0);c(t,k,(t=>e(10,o=t)));const _=()=>{l.onClose?.($.el,b),at.set(1),e(0,r=null),p?.focus({preventScroll:1})},z=()=>S(u-1),M=()=>S(u+1),S=t=>{m=t-u,e(4,u=P(t))},P=t=>(t+r.length)%r.length,A=t=>{const{key:n,shiftKey:e}=t;if("Escape"===n)!l.noClose&&_();else if("ArrowRight"===n)M();else if("ArrowLeft"===n)z();else if("Tab"===n){const{activeElement:n}=document;if(e||!n.controls){t.preventDefault();const{focusWrap:o=$.el}=l,r=[...o.querySelectorAll("*")].filter((t=>t.tabIndex>=0));let s=r.indexOf(n);s+=r.length+(e?-1:1),r[s%r.length].focus()}}},T=({width:t=1920,height:n=1080})=>{const{scale:e=.99}=l,o=Math.min(1,$.w/t*e,$.h/n*e);return[Math.round(t*o),Math.round(n*o)]},I=()=>{if(r){const t=r[P(u+1)],n=r[P(u-1)];!t.preload&&C(t),!n.preload&&C(n)}},C=t=>{if(t.img){const n=x("img");return n.sizes=l.sizes||T(t)[0]+"px",n.srcset=t.img,t.preload=1,n.decode().catch((t=>{}))}};return t.$$set=t=>{"items"in t&&e(0,r=t.items),"target"in t&&e(15,s=t.target)},t.$$.update=()=>{1835121&t.$$.u[0]&&r&&(e(6,b=r[u]),e(19,g=b.hasOwnProperty("html")),a&&(g&&v(null),l.onUpdate?.($.el,b)))},[r,_,z,M,u,l,b,f,d,h,o,k,(t,n)=>a&&r?st(t,{x:(m>0?20:-20)*(n?1:-1),duration:250}):(e(18,a=n),l.intro?st(t,{y:n?10:-10}):(t=>{let n;if(g){const e=t.firstChild.firstChild;n=[e.clientWidth,e.clientHeight]}else n=T(b);const e=(b.element||p).getBoundingClientRect(),o=e.left-($.w-e.width)/2,r=e.top-($.h-e.height)/2,s=e.width/n[0],i=e.height/n[1];return{duration:480,l:rt,css:(t,n)=>`transform:translate3d(${o*n}px, ${r*n}px, 0) scale3d(${s+t*(1-s)}, ${i+t*(1-i)}, 1)`}})(t)),()=>({k:b,S:T,A:C,T:I,_:l,M:z,next:M,close:_,P:v,zoomed:k,container:$}),t=>{let n,o;e(20,$.el=t,$),l.onOpen?.($.el,b),d||(n=w(globalThis,"keydown",A));const r=new ResizeObserver((t=>{o&&(e(20,$.w=t[0].contentRect.width,$),e(20,$.h=t[0].contentRect.height,$),e(7,f=769>$.w),y?.(),l.onResize?.($.el,b)),o=1}));return r.observe(t),{destroy(){r.disconnect(),n?.(),at.set(0),i.classList.remove("bp-lock"),l.onClosed?.()}}},s,t=>{e(5,l=t),e(8,d=l.inline);const n=l.items;!d&&i.scrollHeight>i.clientHeight&&i.classList.add("bp-lock"),p=document.activeElement,e(20,$.w=s.offsetWidth,$),e(20,$.h=s===document.body?globalThis.innerHeight:s.clientHeight,$),e(7,f=769>$.w),e(4,u=l.position||0),e(0,r=Array.isArray(n)?n.map(((t,n)=>(l.el&&l.el===t.element&&e(4,u=n),{i:n,...t}))):(n.length?[...n]:[n]).map(((t,n)=>(l.el===t&&e(4,u=n),{element:t,html:t.outerHTML,i:n,...t.dataset}))))},S,a,g,$,t=>e(9,h=t.target),function(t){2!==t.button&&t.target===this&&h===this&&!l.noClose&&_()}]}class Ft extends ot{constructor(t){super(),et(this,t,qt,Rt,i,{items:0,target:15,open:16,close:1,M:2,next:3,setPosition:17},null,[-1,-1])}get items(){return this.$$.ctx[0]}get target(){return this.$$.ctx[15]}get open(){return this.$$.ctx[16]}get close(){return this.$$.ctx[1]}get M(){return this.$$.ctx[2]}get next(){return this.$$.ctx[3]}get setPosition(){return this.$$.ctx[17]}}function Dt(t){return new Ft({...t,v:t})}export{Dt as default}; +function t(){}const n=t=>t;function e(t,n){for(const e in n)t[e]=n[e];return t}function o(t){return t()}function r(t){t.forEach(o)}function i(t){return"function"==typeof t}function s(t,n){return t!=t?n==n:t!==n}function c(n,e,o){n.$$.on_destroy.push(((n,...e)=>{if(null==n)return t;const o=n.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o})(e,o))}function u(n){return n&&i(n.destroy)?n.destroy:t}let l=()=>globalThis.performance.now(),a=t=>requestAnimationFrame(t);const p=new Set;function f(t){p.forEach((n=>{n.c(t)||(p.delete(n),n.f())})),0!==p.size&&a(f)}function d(t){let n;return 0===p.size&&a(f),{promise:new Promise((e=>{p.add(n={c:t,f:e})})),abort(){p.delete(n)}}}function m(t,n){t.appendChild(n)}function h(t,n,e){t.insertBefore(n,e||null)}function b(t){t.parentNode.removeChild(t)}function g(t){return document.createElement(t)}function x(){return document.createTextNode("")}function y(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}function w(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function v(t,n,e,o){null===e?t.style.removeProperty(n):t.style.setProperty(n,e)}function $(t,n,e){t.classList[e?"add":"remove"](n)}let k,_,M=0,z={};function S(t,n,e,o,r,i,s,c=0){const u=16.666/o;let l="{\n";for(let t=0;1>=t;t+=u){const o=n+(e-n)*i(t);l+=100*t+`%{${s(o,1-o)}}\n`}const a=l+`100% {${s(e,1-e)}}\n}`,p=`_bp_${Math.round(1e9*Math.random())}_${c}`;if(!z[p]){if(!k){const t=g("style");document.head.appendChild(t),k=t.sheet}z[p]=1,k.insertRule(`@keyframes ${p} ${a}`,k.cssRules.length)}const f=t.style.animation||"";return t.style.animation=`${f?f+", ":""}${p} ${o}ms linear ${r}ms 1 both`,M+=1,p}function P(t,n){t.style.animation=(t.style.animation||"").split(", ").filter(n?t=>0>t.indexOf(n):t=>-1===t.indexOf("_bp")).join(", "),n&&!--M&&a((()=>{if(M)return;let t=k.cssRules.length;for(;t--;)k.deleteRule(t);z={}}))}function A(t){_=t}const T=[],I=[],C=[],N=[],O=Promise.resolve();let E=0;function R(t){C.push(t)}const j=new Set;let q,F=0;function D(){const t=_;do{for(;T.length>F;){const t=T[F];F++,A(t),J(t.$$)}for(A(null),T.length=0,F=0;I.length;)I.pop()();for(let t=0;C.length>t;t+=1){const n=C[t];j.has(n)||(j.add(n),n())}C.length=0}while(T.length);for(;N.length;)N.pop()();E=0,j.clear(),A(t)}function J(t){if(null!==t.t){t.update(),r(t.before_update);const n=t.u;t.u=[-1],t.t&&t.t.p(t.ctx,n),t.after_update.forEach(R)}}function K(){return q||(q=Promise.resolve(),q.then((()=>{q=null}))),q}function L(t,n,e){t.dispatchEvent(((t,n,e=0)=>{const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,e,0,n),o})(`${n?"intro":"outro"}${e}`))}const W=new Set;let X;function Y(){X={r:0,c:[],p:X}}function B(){X.r||r(X.c),X=X.p}function G(t,n){t&&t.i&&(W.delete(t),t.i(n))}function H(t,n,e,o){if(t&&t.o){if(W.has(t))return;W.add(t),X.c.push((()=>{W.delete(t),o&&(e&&t.d(1),o())})),t.o(n)}}const Q={duration:0};function U(e,o,r){let s,c,u=o(e,r),a=0,p=0;function f(){s&&P(e,s)}function m(){const{delay:o=0,duration:r=300,l:i=n,g:m=t,css:h}=u||Q;h&&(s=S(e,0,1,r,o,i,h,p++)),m(0,1);const b=l()+o,g=b+r;c&&c.abort(),a=1,R((()=>L(e,1,"start"))),c=d((t=>{if(a){if(t>=g)return m(1,0),L(e,1,"end"),f(),a=0;if(t>=b){const n=i((t-b)/r);m(n,1-n)}}return a}))}let h=0;return{start(){h||(h=1,P(e),i(u)?(u=u(),K().then(m)):m())},invalidate(){h=0},end(){a&&(f(),a=0)}}}function V(e,o,s){let c,u=o(e,s),a=1;const p=X;function f(){const{delay:o=0,duration:i=300,l:s=n,g:f=t,css:m}=u||Q;m&&(c=S(e,1,0,i,o,s,m));const h=l()+o,b=h+i;R((()=>L(e,0,"start"))),d((t=>{if(a){if(t>=b)return f(0,1),L(e,0,"end"),--p.r||r(p.c),0;if(t>=h){const n=s((t-h)/i);f(1-n,n)}}return a}))}return p.r+=1,i(u)?K().then((()=>{u=u(),f()})):f(),{end(t){t&&u.g&&u.g(1,0),a&&(c&&P(e,c),a=0)}}}function Z(t){t&&t.c()}function tt(t,n,e,s){const{t:c,on_mount:u,on_destroy:l,after_update:a}=t.$$;c&&c.m(n,e),s||R((()=>{const n=u.map(o).filter(i);l?l.push(...n):r(n),t.$$.on_mount=[]})),a.forEach(R)}function nt(t,n){const e=t.$$;null!==e.t&&(r(e.on_destroy),e.t&&e.t.d(n),e.on_destroy=e.t=null,e.ctx=[])}function et(n,e,o,i,s,c,u,l=[-1]){const a=_;A(n);const p=n.$$={t:null,ctx:null,v:c,update:t,not_equal:s,bound:{},on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:{},u:l,skip_bound:0,root:e.target||a.$$.root};u&&u(p.root);let f=0;p.ctx=o?o(n,e.v||{},((t,e,...o)=>{const r=o.length?o[0]:e;return p.ctx&&s(p.ctx[t],p.ctx[t]=r)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](r),f&&((t,n)=>{-1===t.$$.u[0]&&(T.push(t),E||(E=1,O.then(D)),t.$$.u.fill(0)),t.$$.u[n/31|0]|=1<{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}$set(t){this.$$set&&0!==Object.keys(t).length&&(this.$$.skip_bound=1,this.$$set(t),this.$$.skip_bound=0)}}function rt(t){const n=t-1;return n*n*n+1}function it(t,{delay:n=0,duration:e=400,l:o=rt,x:r=0,y:i=0,opacity:s=0}={}){const c=getComputedStyle(t),u=+c.opacity,l="none"===c.transform?"":c.transform,a=u*(1-s);return{delay:n,duration:e,l:o,css(t,n){return`\n\t\t\ttransform: ${l} translate(${(1-t)*r}px, ${(1-t)*i}px);\n\t\t\topacity: ${u-a*n}`}}}const st=[];function ct(n,e=t){let o;const r=new Set;function i(t){if(s(n,t)&&(n=t,o)){const t=!st.length;for(const t of r)t[1](),st.push(t,n);if(t){for(let t=0;st.length>t;t+=2)st[t][0](st[t+1]);st.length=0}}}return{set:i,update(t){i(t(n))},subscribe(s,c=t){const u=[s,c];return r.add(u),1===r.size&&(o=e(i)||t),s(n),()=>{r.delete(u),0===r.size&&(o(),o=null)}}}}function ut(t,n){if(t===n||t!=t)return()=>t;const e=typeof t;if(Array.isArray(t)){const e=n.map(((n,e)=>ut(t[e],n)));return t=>e.map((n=>n(t)))}if("number"===e){const e=n-t;return n=>t+n*e}}function lt(t,o={}){const r=ct(t);let i,s=t;function c(c,u){if(null==t)return r.set(t=c),Promise.resolve();s=c;let a=i,p=0,{delay:f=0,duration:m=400,l:h=n,interpolate:b=ut}=e(e({},o),u);if(0===m)return a&&(a.abort(),a=null),r.set(t=s),Promise.resolve();const g=l()+f;let x;return i=d((n=>{if(g>n)return 1;p||(x=b(t,c),"function"==typeof m&&(m=m(t,c)),p=1),a&&(a.abort(),a=null);const e=n-g;return e>m?(r.set(t=c),0):(r.set(t=x(h(e/m))),1)})),i.promise}return{set:c,update(n,e){return c(n(s,t),e)},subscribe:r.subscribe}}const at=ct(0),pt=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches,ft=t=>({l:rt,duration:pt?0:t});function dt(n){let e,o,r,i,s;return{c(){e=g("div"),o=g("span"),r=g("span"),w(o,"class","bp-bar"),w(r,"class","bp-o"),w(e,"class","bp-load"),w(e,"style",n[2])},m(t,n){h(t,e,n),m(e,o),m(e,r),s=1},p:t,i(t){s||(i&&i.end(1),s=1)},o(t){t&&(i=V(e,it,{duration:480})),s=0},d(t){t&&b(e),t&&i&&i.end()}}}function mt(n){let e,o;return{c(){e=g("div"),w(e,"class","bp-load"),w(e,"style",n[2])},m(t,n){h(t,e,n)},p:t,i(t){o||R((()=>{o=U(e,it,{duration:480}),o.start()}))},o:t,d(t){t&&b(e)}}}function ht(t){let n,e,o=!t[0]&&dt(t),r=t[1]&&mt(t);return{c(){o&&o.c(),n=x(),r&&r.c(),e=x()},m(t,i){o&&o.m(t,i),h(t,n,i),r&&r.m(t,i),h(t,e,i)},p(t,[i]){t[0]?o&&(Y(),H(o,1,1,(()=>{o=null})),B()):o?(o.p(t,i),1&i&&G(o,1)):(o=dt(t),o.c(),G(o,1),o.m(n.parentNode,n)),t[1]?r?(r.p(t,i),2&i&&G(r,1)):(r=mt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},i(t){G(o),G(r)},o(t){H(o)},d(t){o&&o.d(t),t&&b(n),r&&r.d(t),t&&b(e)}}}function bt(t,n,e){let o;c(t,at,(t=>e(1,o=t)));let{thumb:r}=n,{loaded:i}=n;const s=`background-image:url(${r})`;return t.$$set=t=>{"thumb"in t&&e(3,r=t.thumb),"loaded"in t&&e(0,i=t.loaded)},[i,o,s,r]}class gt extends ot{constructor(t){super(),et(this,t,bt,ht,s,{thumb:3,loaded:0})}}function xt(t){let n,e,o,r,i,s,c,u;return{c(){n=g("img"),w(n,"srcset",e=t[7].img),w(n,"sizes",o=t[8].sizes||t[1]+"px"),w(n,"alt",r=t[7].alt)},m(e,o){h(e,n,o),s=1,c||(u=y(n,"error",t[26]),c=1)},p(t,e){(!s||2&e[0]&&o!==(o=t[8].sizes||t[1]+"px"))&&w(n,"sizes",o)},i(t){s||(i&&i.end(1),s=1)},o(t){i=V(n,it,{}),s=0},d(t){t&&b(n),t&&i&&i.end(),c=0,u()}}}function yt(t){let n,e;return n=new gt({v:{thumb:t[7].thumb,loaded:t[2]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};4&e[0]&&(o.loaded=t[2]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function wt(t){let n,e,o,i,s,c,l=t[2]&&xt(t),a=t[3]&&yt(t);return{c(){n=g("div"),e=g("div"),l&&l.c(),o=x(),a&&a.c(),w(e,"class","bp-img"),v(e,"background-image","url("+t[7].thumb+")"),v(e,"width",t[0][0]+"px"),v(e,"height",t[0][1]+"px"),v(e,"transform","translate3d("+(t[0][0]/-2+t[6][0])+"px, "+(t[0][1]/-2+t[6][1])+"px, 0)"),$(e,"bp-drag",t[4]),$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),w(n,"class","bp-img-wrap"),$(n,"bp-close",t[5])},m(r,p){h(r,n,p),m(n,e),l&&l.m(e,null),m(e,o),a&&a.m(e,null),i=1,s||(c=[u(t[20].call(null,e)),y(n,"wheel",t[15]),y(n,"pointerdown",t[16]),y(n,"pointermove",t[17]),y(n,"pointerup",t[19]),y(n,"pointercancel",t[18])],s=1)},p(t,r){t[2]?l?(l.p(t,r),4&r[0]&&G(l,1)):(l=xt(t),l.c(),G(l,1),l.m(e,o)):l&&(Y(),H(l,1,1,(()=>{l=null})),B()),t[3]?a?(a.p(t,r),8&r[0]&&G(a,1)):(a=yt(t),a.c(),G(a,1),a.m(e,null)):a&&(Y(),H(a,1,1,(()=>{a=null})),B()),(!i||1&r[0])&&v(e,"width",t[0][0]+"px"),(!i||1&r[0])&&v(e,"height",t[0][1]+"px"),(!i||65&r[0])&&v(e,"transform","translate3d("+(t[0][0]/-2+t[6][0])+"px, "+(t[0][1]/-2+t[6][1])+"px, 0)"),16&r[0]&&$(e,"bp-drag",t[4]),6145&r[0]&&$(e,"bp-canzoom",t[11]>1&&t[12]>t[0][0]),32&r[0]&&$(n,"bp-close",t[5])},i(t){i||(G(l),G(a),i=1)},o(t){H(l),H(a),i=0},d(t){t&&b(n),l&&l.d(),a&&a.d(),s=0,r(c)}}}function vt(t,n,e){let o,r,i,s;c(t,at,(t=>e(25,i=t)));let{v:u}=n,{$:l}=n,{k:a,_:p,M:f,next:d,zoomed:m,container:h}=u;c(t,m,(t=>e(24,o=t)));let b,g,x,y,w,v,$,k,_,M,z,S=a.maxZoom||p.maxZoom||10,P=u.S(a),A=P[0],T=0;const I=+a.width,C=[],N=new Map,O=lt(P,ft(400));c(t,O,(t=>e(0,s=t)));const E=lt([0,0],ft(400));c(t,E,(t=>e(6,r=t)));const R=([t,n],o=s)=>{const r=(o[0]-h.w)/2,i=(o[1]-h.h)/2;return 0>r?t=0:t>r?l?(t=w?r+(t-r)/10:r)>r+20&&e(4,w=f()):t=r:-r>t&&(l?-r-20>(t=w?-r-(-r-t)/10:-r)&&e(4,w=d()):t=-r),0>i?n=0:n>i?n=i:-i>n&&(n=-i),[t,n]};function j(t=S,n){if(i)return;const o=P[0]*S;let c=s[0]+s[0]*t,u=s[1]+s[1]*t;if(t>0)c>o&&(c=o,u=P[1]*S),c>I&&(c=I,u=+a.height);else if(P[0]>c)return O.set(P),E.set([0,0]);let{x:l,y:p,width:f,height:d}=y.getBoundingClientRect();const m=n?n.clientX-l-f/2:0,h=n?n.clientY-p-d/2:0;l=c/f*-m+m,p=u/d*-h+h;const b=[c,u];O.set(b).then((()=>{e(1,A=Math.round(Math.max(A,c)))})),E.set(R([r[0]+l,r[1]+p],b))}Object.defineProperty(a,"zoom",{configurable:1,get(){return o},set(t){return j(t?S:-S)}});const q=t=>N.delete(t.pointerId);return t.$$set=t=>{"$"in t&&e(22,l=t.$)},t.$$.update=()=>{if(8388609&t.$$.u[0]&&m.set(s[0]-10>P[0]),58720256&t.$$.u[0]&&i&&o&&!p.intro){const t=ft(480);E.set([0,0],t),O.set(P,t),e(5,z=1)}},[s,A,b,g,w,z,r,a,p,m,h,S,I,O,E,t=>{p.inline&&!o||(t.preventDefault(),j(t.deltaY/-300,t))},t=>{2!==t.button&&(t.preventDefault(),e(4,w=1),N.set(t.pointerId,t),$=t.clientX,k=t.clientY,_=r[0],M=r[1])},t=>{if(N.size>1)return e(4,w=0),p.noPinch?.(h.el)||(t=>{const[n,e]=N.set(t.pointerId,t).values(),o=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY);x=x||{clientX:(n.clientX+e.clientX)/2,clientY:(n.clientY+e.clientY)/2},j(((T||o)-o)/-35,x),T=o})(t);if(!w)return;let n=t.clientX,r=t.clientY;v=C.push({x:n,y:r})>2,n-=$,r-=k,o||(-90>r&&e(4,w=!p.noClose&&u.close()),30>Math.abs(r)&&(n>40&&e(4,w=f()),-40>n&&e(4,w=d()))),o&&v&&!i&&E.set(R([_+n,M+r]),{duration:0})},q,function(t){if(q(t),x&&(e(4,w=T=0),x=N.size?x:null),w){if(e(4,w=0),t.target===this&&!p.noClose)return u.close();if(v){const[t,n,e]=C.slice(-3);Math.hypot(n.x-e.x,n.y-e.y)>5&&E.set(R([r[0]-5*(t.x-e.x),r[1]-5*(t.y-e.y)]))}else p.onImageClick?.(h.el,a)||j(o?-S:S,t);v=0,C.length=0}},t=>{y=t,u.P((()=>{e(23,P=u.S(a)),!p.inline&&l||(O.set(P),E.set([0,0]))})),u.A(a).then((()=>{e(2,b=1),u.T()})),setTimeout((()=>{e(3,g=!b)}),250)},u,l,P,o,i,t=>p.onError?.(h,a,t)]}class $t extends ot{constructor(t){super(),et(this,t,vt,wt,s,{v:21,$:22},null,[-1,-1])}}function kt(t){let n,e,o,i,s,c;return o=new gt({v:{thumb:t[2].thumb,loaded:t[0]}}),{c(){n=g("div"),e=g("iframe"),Z(o.$$.t),w(e,"allow","autoplay; fullscreen"),w(e,"title",t[2].title),w(n,"class","bp-if"),v(n,"width",t[1][0]+"px"),v(n,"height",t[1][1]+"px")},m(r,l){h(r,n,l),m(n,e),tt(o,n,null),i=1,s||(c=[u(t[3].call(null,e)),y(e,"load",t[5])],s=1)},p(t,[e]){const r={};1&e&&(r.loaded=t[0]),o.$set(r),(!i||2&e)&&v(n,"width",t[1][0]+"px"),(!i||2&e)&&v(n,"height",t[1][1]+"px")},i(t){i||(G(o.$$.t,t),i=1)},o(t){H(o.$$.t,t),i=0},d(t){t&&b(n),nt(o),s=0,r(c)}}}function _t(t,n,e){let o,r,{v:i}=n;const{k:s}=i,c=()=>e(1,r=i.S(s));return c(),i.P(c),[o,r,s,t=>t.src=s.iframe,i,()=>e(0,o=1)]}class Mt extends ot{constructor(t){super(),et(this,t,_t,kt,s,{v:4})}}function zt(t){let n,e,o,r,i;return e=new gt({v:{thumb:t[2].thumb,loaded:t[0]}}),{c(){n=g("div"),Z(e.$$.t),w(n,"class","bp-vid"),v(n,"width",t[1][0]+"px"),v(n,"height",t[1][1]+"px"),v(n,"background-image","url("+t[2].thumb+")")},m(s,c){h(s,n,c),tt(e,n,null),o=1,r||(i=u(t[3].call(null,n)),r=1)},p(t,[r]){const i={};1&r&&(i.loaded=t[0]),e.$set(i),(!o||2&r)&&v(n,"width",t[1][0]+"px"),(!o||2&r)&&v(n,"height",t[1][1]+"px")},i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){t&&b(n),nt(e),r=0,i()}}}function St(t,n,e){let o,r,{v:i}=n;const{k:s,_:c,container:u}=i,l=()=>e(1,r=i.S(s));l(),i.P(l);const a=(t,n)=>{for(const e in n)w(t,e,n[e])};return[o,r,s,t=>{let n;const r=(t,e)=>{Array.isArray(e)||(e=JSON.parse(e));for(const o of e){n||(n=g(o.type?.includes("audio")?"audio":"video"),a(n,{controls:1,autoplay:1,playsinline:1,tabindex:"0"}));const e=g(t);a(e,o),"source"==t&&y(e,"error",(t=>c.onError?.(u,s,t))),m(n,e)}};r("source",s.sources),r("track",s.tracks||[]),y(n,"canplay",(()=>e(0,o=1))),m(t,n)},i]}class Pt extends ot{constructor(t){super(),et(this,t,St,zt,s,{v:4})}}function At(n){let e,o,i,c,l,a,p,f,d,x,v=n[6].i,k=Et(n),_=n[0].length>1&&Rt(n);return{c(){e=g("div"),o=g("div"),k.c(),c=g("div"),l=g("button"),_&&_.c(),w(l,"class","bp-x"),w(l,"title","Close"),w(l,"aria-label","Close"),w(c,"class","bp-controls"),w(e,"class","bp-wrap"),$(e,"bp-zoomed",n[10]),$(e,"bp-inline",n[8]),$(e,"bp-small",n[7]),$(e,"bp-noclose",n[5].noClose)},m(t,r){h(t,e,r),m(e,o),k.m(e,null),m(e,c),m(c,l),_&&_.m(c,null),f=1,d||(x=[y(l,"click",n[1]),u(p=n[14].call(null,e))],d=1)},p(n,o){64&o[0]&&s(v,v=n[6].i)?(Y(),H(k,1,1,t),B(),k=Et(n),k.c(),G(k),k.m(e,c)):k.p(n,o),n[0].length>1?_?_.p(n,o):(_=Rt(n),_.c(),_.m(c,null)):_&&(_.d(1),_=null),1024&o[0]&&$(e,"bp-zoomed",n[10]),256&o[0]&&$(e,"bp-inline",n[8]),128&o[0]&&$(e,"bp-small",n[7]),32&o[0]&&$(e,"bp-noclose",n[5].noClose)},i(t){f||(i&&i.end(1),G(k),a&&a.end(1),f=1)},o(t){t&&(i=V(o,it,{duration:480})),H(k),t&&(a=V(c,it,{})),f=0},d(t){t&&b(e),t&&i&&i.end(),k.d(t),_&&_.d(),t&&a&&a.end(),d=0,r(x)}}}function Tt(n){let e,o=(n[6].html??n[6].element.outerHTML)+"";return{c(){e=g("div"),w(e,"class","bp-html")},m(t,n){h(t,e,n),e.innerHTML=o},p(t,n){64&n[0]&&o!==(o=(t[6].html??t[6].element.outerHTML)+"")&&(e.innerHTML=o)},i:t,o:t,d(t){t&&b(e)}}}function It(n){let e,o;return e=new Mt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Ct(n){let e,o;return e=new Pt({v:{v:n[13]()}}),{c(){Z(e.$$.t)},m(t,n){tt(e,t,n),o=1},p:t,i(t){o||(G(e.$$.t,t),o=1)},o(t){H(e.$$.t,t),o=0},d(t){nt(e,t)}}}function Nt(t){let n,e;return n=new $t({v:{v:t[13](),$:t[7]}}),{c(){Z(n.$$.t)},m(t,o){tt(n,t,o),e=1},p(t,e){const o={};128&e[0]&&(o.$=t[7]),n.$set(o)},i(t){e||(G(n.$$.t,t),e=1)},o(t){H(n.$$.t,t),e=0},d(t){nt(n,t)}}}function Ot(t){let n,e,o,r=t[6].caption+"";return{c(){n=g("div"),w(n,"class","bp-cap")},m(t,e){h(t,n,e),n.innerHTML=r,o=1},p(t,e){(!o||64&e[0])&&r!==(r=t[6].caption+"")&&(n.innerHTML=r)},i(t){o||(e&&e.end(1),o=1)},o(t){e=V(n,it,{duration:200}),o=0},d(t){t&&b(n),t&&e&&e.end()}}}function Et(t){let n,e,o,i,s,c,u,l,a;const p=[Nt,Ct,It,Tt],f=[];function d(t,n){return t[6].img?0:t[6].sources?1:t[6].iframe?2:3}e=d(t),o=f[e]=p[e](t);let m=t[6].caption&&Ot(t);return{c(){n=g("div"),o.c(),m&&m.c(),c=x(),w(n,"class","bp-inner")},m(o,r){h(o,n,r),f[e].m(n,null),m&&m.m(o,r),h(o,c,r),u=1,l||(a=[y(n,"pointerdown",t[20]),y(n,"pointerup",t[21])],l=1)},p(t,r){let i=e;e=d(t),e===i?f[e].p(t,r):(Y(),H(f[i],1,1,(()=>{f[i]=null})),B(),o=f[e],o?o.p(t,r):(o=f[e]=p[e](t),o.c()),G(o,1),o.m(n,null)),t[6].caption?m?(m.p(t,r),64&r[0]&&G(m,1)):(m=Ot(t),m.c(),G(m,1),m.m(c.parentNode,c)):m&&(Y(),H(m,1,1,(()=>{m=null})),B())},i(e){u||(G(o),R((()=>{s&&s.end(1),i=U(n,t[12],1),i.start()})),G(m),u=1)},o(e){H(o),i&&i.invalidate(),s=V(n,t[12],0),H(m),u=0},d(t){t&&b(n),f[e].d(),t&&s&&s.end(),m&&m.d(t),t&&b(c),l=0,r(a)}}}function Rt(t){let n,e,o,i,s,c=`${t[4]+1} / ${t[0].length}`;return{c(){n=g("div"),e=g("button"),o=g("button"),w(n,"class","bp-count"),w(e,"class","bp-prev"),w(e,"title","Previous"),w(e,"aria-label","Previous"),w(o,"class","bp-next"),w(o,"title","Next"),w(o,"aria-label","Next")},m(r,u){h(r,n,u),n.innerHTML=c,h(r,e,u),h(r,o,u),i||(s=[y(e,"click",t[2]),y(o,"click",t[3])],i=1)},p(t,e){17&e[0]&&c!==(c=`${t[4]+1} / ${t[0].length}`)&&(n.innerHTML=c)},d(t){t&&b(n),t&&b(e),t&&b(o),i=0,r(s)}}}function jt(t){let n,e,o=t[0]&&At(t);return{c(){o&&o.c(),n=x()},m(t,r){o&&o.m(t,r),h(t,n,r),e=1},p(t,e){t[0]?o?(o.p(t,e),1&e[0]&&G(o,1)):(o=At(t),o.c(),G(o,1),o.m(n.parentNode,n)):o&&(Y(),H(o,1,1,(()=>{o=null})),B())},i(t){e||(G(o),e=1)},o(t){H(o),e=0},d(t){o&&o.d(t),t&&b(n)}}}function qt(t,n,e){let o,{items:r}=n,{target:i}=n;const s=document.documentElement;let u,l,a,p,f,d,m,h,b;const x=()=>!b.img&&!b.sources&&!b.iframe;let w;const v=t=>w=t,$={},k=ct(0);c(t,k,(t=>e(10,o=t)));const _=()=>{l.onClose?.($.el,b),at.set(1),e(0,r=null),p?.focus({preventScroll:1})},M=()=>S(u-1),z=()=>S(u+1),S=t=>{m=t-u,e(4,u=P(t))},P=t=>(t+r.length)%r.length,A=t=>{const{key:n,shiftKey:e}=t;if("Escape"===n)!l.noClose&&_();else if("ArrowRight"===n)z();else if("ArrowLeft"===n)M();else if("Tab"===n){const{activeElement:n}=document;if(e||!n.controls){t.preventDefault();const{focusWrap:o=$.el}=l,r=[...o.querySelectorAll("*")].filter((t=>t.tabIndex>=0));let i=r.indexOf(n);i+=r.length+(e?-1:1),r[i%r.length].focus()}}},T=({width:t=1920,height:n=1080})=>{const{scale:e=.99}=l,o=Math.min(1,$.w/t*e,$.h/n*e);return[Math.round(t*o),Math.round(n*o)]},I=()=>{if(r){const t=r[P(u+1)],n=r[P(u-1)];!t.preload&&C(t),!n.preload&&C(n)}},C=t=>{if(t.img){const n=g("img");return n.sizes=l.sizes||T(t)[0]+"px",n.srcset=t.img,t.preload=1,n.decode().catch((t=>{}))}};return t.$$set=t=>{"items"in t&&e(0,r=t.items),"target"in t&&e(15,i=t.target)},t.$$.update=()=>{786545&t.$$.u[0]&&r&&(e(6,b=r[u]),a&&l.onUpdate?.($.el,b))},[r,_,M,z,u,l,b,f,d,h,o,k,(t,n)=>a&&r?it(t,{x:(m>0?20:-20)*(n?1:-1),duration:250}):(e(18,a=n),l.intro?it(t,{y:n?10:-10}):(t=>{let n;if(x()){const e=t.firstChild.firstChild;n=[e.clientWidth,e.clientHeight]}else n=T(b);const e=(b.element||p).getBoundingClientRect(),o=e.left-($.w-e.width)/2,r=e.top-($.h-e.height)/2,i=e.width/n[0],s=e.height/n[1];return{duration:480,l:rt,css:(t,n)=>`transform:translate3d(${o*n}px, ${r*n}px, 0) scale3d(${i+t*(1-i)}, ${s+t*(1-s)}, 1)`}})(t)),()=>({k:b,S:T,A:C,T:I,_:l,M,next:z,close:_,P:v,zoomed:k,container:$}),t=>{let n,o;e(19,$.el=t,$),l.onOpen?.($.el,b),d||(n=y(globalThis,"keydown",A));const r=new ResizeObserver((t=>{o&&(e(19,$.w=t[0].contentRect.width,$),e(19,$.h=t[0].contentRect.height,$),e(7,f=769>$.w),x()||w?.(),l.onResize?.($.el,b)),o=1}));return r.observe(t),{destroy(){r.disconnect(),n?.(),at.set(0),s.classList.remove("bp-lock"),l.onClosed?.()}}},i,t=>{e(5,l=t),e(8,d=l.inline);const n=l.items;!d&&s.scrollHeight>s.clientHeight&&s.classList.add("bp-lock"),p=document.activeElement,e(19,$.w=i.offsetWidth,$),e(19,$.h=i===document.body?globalThis.innerHeight:i.clientHeight,$),e(7,f=769>$.w),e(4,u=l.position||0),e(0,r=Array.isArray(n)?n.map(((t,n)=>(l.el&&l.el===t.element&&e(4,u=n),{i:n,...t}))):(n.length?[...n]:[n]).map(((t,n)=>(l.el===t&&e(4,u=n),{element:t,i:n,...t.dataset}))))},S,a,$,t=>e(9,h=t.target),function(t){2!==t.button&&t.target===this&&h===this&&!l.noClose&&_()}]}class Ft extends ot{constructor(t){super(),et(this,t,qt,jt,s,{items:0,target:15,open:16,close:1,M:2,next:3,setPosition:17},null,[-1,-1])}get items(){return this.$$.ctx[0]}get target(){return this.$$.ctx[15]}get open(){return this.$$.ctx[16]}get close(){return this.$$.ctx[1]}get M(){return this.$$.ctx[2]}get next(){return this.$$.ctx[3]}get setPosition(){return this.$$.ctx[17]}}function Dt(t){return new Ft({...t,v:t})}export{Dt as default}; diff --git a/dist/bigger-picture.mjs b/dist/bigger-picture.mjs index 0ab464b..8994797 100644 --- a/dist/bigger-picture.mjs +++ b/dist/bigger-picture.mjs @@ -15,9 +15,6 @@ function run_all(fns) { function is_function(thing) { return typeof thing === 'function'; } -function safe_not_equal(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} function not_equal(a, b) { return a != a ? b == b : a !== b; } @@ -72,14 +69,6 @@ function loop(callback) { function append(target, node) { target.appendChild(node); } -function append_empty_stylesheet(node) { - const style_element = element('style'); - append_stylesheet(document, style_element); - return style_element.sheet; -} -function append_stylesheet(node, style) { - append(node.head || node, style); -} function insert(target, node, anchor) { target.insertBefore(node, anchor || null); } @@ -121,24 +110,17 @@ function custom_event(type, detail, bubbles = false) { e.initCustomEvent(type, bubbles, false, detail); return e; } - -// we need to store the information for multiple documents because a Svelte application could also contain iframes -// https://github.com/sveltejs/svelte/issues/3624 -const managed_styles = new Map(); +let stylesheet; let active = 0; +let current_rules = {}; // https://github.com/darkskyapp/string-hash/blob/master/index.js -function hash(str) { - let hash = 5381; - let i = str.length; - while (i--) - hash = ((hash << 5) - hash) ^ str.charCodeAt(i); - return hash >>> 0; -} -function create_style_information(doc, node) { - const info = { stylesheet: append_empty_stylesheet(), rules: {} }; - managed_styles.set(doc, info); - return info; -} +// function hash(str) { +// let hash = 5381; +// let i = str.length; +// while (i--) +// hash = ((hash << 5) - hash) ^ str.charCodeAt(i); +// return hash >>> 0; +// } function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { const step = 16.666 / duration; let keyframes = '{\n'; @@ -147,44 +129,40 @@ function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`; } const rule = keyframes + `100% {${fn(b, 1 - b)}}\n}`; - const name = `_bp_${hash(rule)}_${uid}`; - const doc = document; - const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc); - if (!rules[name]) { - rules[name] = true; + const name = `_bp_${Math.round(Math.random() * 1e9)}_${uid}`; + if (!current_rules[name]) { + if (!stylesheet) { + const style = element('style'); + document.head.appendChild(style); + stylesheet = style.sheet; + } + current_rules[name] = true; stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length); } const animation = node.style.animation || ''; - node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`; + node.style.animation = `${animation ? `${animation}, ` : ``}${name} ${duration}ms linear ${delay}ms 1 both`; active += 1; return name; } function delete_rule(node, name) { - const previous = (node.style.animation || '').split(', '); - const next = previous.filter(name + node.style.animation = (node.style.animation || '') + .split(', ') + .filter(name ? anim => anim.indexOf(name) < 0 // remove specific animation : anim => anim.indexOf('_bp') === -1 // remove all Svelte animations - ); - const deleted = previous.length - next.length; - if (deleted) { - node.style.animation = next.join(', '); - active -= deleted; - if (!active) - clear_rules(); - } + ) + .join(', '); + if (name && !--active) + clear_rules(); } function clear_rules() { raf(() => { if (active) return; - managed_styles.forEach(info => { - const { stylesheet } = info; - let i = stylesheet.cssRules.length; - while (i--) - stylesheet.deleteRule(i); - info.rules = {}; - }); - managed_styles.clear(); + let i = stylesheet.cssRules.length; + while (i--) + stylesheet.deleteRule(i); + current_rules = {}; }); } @@ -596,7 +574,7 @@ function writable(value, start = noop) { let stop; const subscribers = new Set(); function set(new_value) { - if (safe_not_equal(value, new_value)) { + if (not_equal(value, new_value)) { value = new_value; if (stop) { // store is ready const run_queue = !subscriber_queue.length; @@ -1898,7 +1876,7 @@ function create_if_block(ctx) { // (319:199) {:else} function create_else_block(ctx) { let div; - let raw_value = /*activeItem*/ ctx[6].html + ""; + let raw_value = (/*activeItem*/ ctx[6].html ?? /*activeItem*/ ctx[6].element.outerHTML) + ""; return { c() { @@ -1910,7 +1888,7 @@ function create_else_block(ctx) { div.innerHTML = raw_value; }, p(ctx, dirty) { - if (dirty[0] & /*activeItem*/ 64 && raw_value !== (raw_value = /*activeItem*/ ctx[6].html + "")) div.innerHTML = raw_value; }, + if (dirty[0] & /*activeItem*/ 64 && raw_value !== (raw_value = (/*activeItem*/ ctx[6].html ?? /*activeItem*/ ctx[6].element.outerHTML) + "")) div.innerHTML = raw_value; }, i: noop, o: noop, d(detaching) { @@ -2025,7 +2003,7 @@ function create_if_block_3(ctx) { }; } -// (319:267) {#if activeItem.caption} +// (319:299) {#if activeItem.caption} function create_if_block_2(ctx) { let div; let raw_value = /*activeItem*/ ctx[6].caption + ""; @@ -2102,8 +2080,8 @@ function create_key_block(ctx) { if (!mounted) { dispose = [ - listen(div, "pointerdown", /*pointerdown_handler*/ ctx[21]), - listen(div, "pointerup", /*pointerup_handler*/ ctx[22]) + listen(div, "pointerdown", /*pointerdown_handler*/ ctx[20]), + listen(div, "pointerup", /*pointerup_handler*/ ctx[21]) ]; mounted = true; @@ -2191,7 +2169,7 @@ function create_key_block(ctx) { }; } -// (319:522) {#if items.length > 1} +// (319:554) {#if items.length > 1} function create_if_block_1(ctx) { let div; let raw_value = `${/*position*/ ctx[4] + 1} / ${/*items*/ ctx[0].length}` + ""; @@ -2328,8 +2306,8 @@ function instance($$self, $$props, $$invalidate) { /** active item object */ let activeItem; - /** true if activeItem is html */ - let activeItemIsHtml; + /** returns true if `activeItem` is html */ + const activeItemIsHtml = () => !activeItem.img && !activeItem.sources && !activeItem.iframe; /** function set by child component to run when container resized */ let resizeFunc; @@ -2358,10 +2336,10 @@ function instance($$self, $$props, $$invalidate) { // update trigger element to restore focus focusTrigger = document.activeElement; - $$invalidate(20, container.w = target.offsetWidth, container); + $$invalidate(19, container.w = target.offsetWidth, container); $$invalidate( - 20, + 19, container.h = target === document.body ? globalThis.innerHeight : target.clientHeight, @@ -2390,12 +2368,7 @@ function instance($$self, $$props, $$invalidate) { $$invalidate(4, position = i); } - return { - element, - html: element.outerHTML, - i, - ...element.dataset - }; + return { element, i, ...element.dataset }; })); } }; @@ -2507,7 +2480,7 @@ function instance($$self, $$props, $$invalidate) { const scaleIn = node => { let dimensions; - if (activeItemIsHtml) { + if (activeItemIsHtml()) { const bpItem = node.firstChild.firstChild; dimensions = [bpItem.clientWidth, bpItem.clientHeight]; } else { @@ -2548,7 +2521,7 @@ function instance($$self, $$props, $$invalidate) { /** code to run on mount / destroy */ const containerActions = node => { - $$invalidate(20, container.el = node, container); + $$invalidate(19, container.el = node, container); let removeKeydownListener; let roActive; opts.onOpen?.(container.el, activeItem); @@ -2562,12 +2535,14 @@ function instance($$self, $$props, $$invalidate) { const ro = new ResizeObserver(entries => { // use roActive to avoid running on initial open if (roActive) { - $$invalidate(20, container.w = entries[0].contentRect.width, container); - $$invalidate(20, container.h = entries[0].contentRect.height, container); + $$invalidate(19, container.w = entries[0].contentRect.width, container); + $$invalidate(19, container.h = entries[0].contentRect.height, container); $$invalidate(7, smallScreen = container.w < 769); // run child component resize function - resizeFunc?.(); + if (!activeItemIsHtml()) { + resizeFunc?.(); + } // run user defined onResize function opts.onResize?.(container.el, activeItem); @@ -2607,17 +2582,12 @@ function instance($$self, $$props, $$invalidate) { }; $$self.$$.update = () => { - if ($$self.$$.dirty[0] & /*items, position, activeItem, isOpen, activeItemIsHtml, opts, container*/ 1835121) { + if ($$self.$$.dirty[0] & /*items, position, isOpen, opts, container, activeItem*/ 786545) { if (items) { // update active item when position changes $$invalidate(6, activeItem = items[position]); - $$invalidate(19, activeItemIsHtml = activeItem.hasOwnProperty('html')); - if (isOpen) { - // clear child resize function if html - activeItemIsHtml && setResizeFunc(null); - // run onUpdate when items updated opts.onUpdate?.(container.el, activeItem); } @@ -2645,7 +2615,6 @@ function instance($$self, $$props, $$invalidate) { open, setPosition, isOpen, - activeItemIsHtml, container, pointerdown_handler, pointerup_handler diff --git a/dist/bigger-picture.umd.js b/dist/bigger-picture.umd.js index da76259..f325d56 100644 --- a/dist/bigger-picture.umd.js +++ b/dist/bigger-picture.umd.js @@ -20,9 +20,6 @@ function is_function(thing) { return typeof thing === 'function'; } - function safe_not_equal(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); - } function not_equal(a, b) { return a != a ? b == b : a !== b; } @@ -77,14 +74,6 @@ function append(target, node) { target.appendChild(node); } - function append_empty_stylesheet(node) { - const style_element = element('style'); - append_stylesheet(document, style_element); - return style_element.sheet; - } - function append_stylesheet(node, style) { - append(node.head || node, style); - } function insert(target, node, anchor) { target.insertBefore(node, anchor || null); } @@ -126,24 +115,17 @@ e.initCustomEvent(type, bubbles, false, detail); return e; } - - // we need to store the information for multiple documents because a Svelte application could also contain iframes - // https://github.com/sveltejs/svelte/issues/3624 - const managed_styles = new Map(); + let stylesheet; let active = 0; + let current_rules = {}; // https://github.com/darkskyapp/string-hash/blob/master/index.js - function hash(str) { - let hash = 5381; - let i = str.length; - while (i--) - hash = ((hash << 5) - hash) ^ str.charCodeAt(i); - return hash >>> 0; - } - function create_style_information(doc, node) { - const info = { stylesheet: append_empty_stylesheet(), rules: {} }; - managed_styles.set(doc, info); - return info; - } + // function hash(str) { + // let hash = 5381; + // let i = str.length; + // while (i--) + // hash = ((hash << 5) - hash) ^ str.charCodeAt(i); + // return hash >>> 0; + // } function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { const step = 16.666 / duration; let keyframes = '{\n'; @@ -152,44 +134,40 @@ keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`; } const rule = keyframes + `100% {${fn(b, 1 - b)}}\n}`; - const name = `_bp_${hash(rule)}_${uid}`; - const doc = document; - const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc); - if (!rules[name]) { - rules[name] = true; + const name = `_bp_${Math.round(Math.random() * 1e9)}_${uid}`; + if (!current_rules[name]) { + if (!stylesheet) { + const style = element('style'); + document.head.appendChild(style); + stylesheet = style.sheet; + } + current_rules[name] = true; stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length); } const animation = node.style.animation || ''; - node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`; + node.style.animation = `${animation ? `${animation}, ` : ``}${name} ${duration}ms linear ${delay}ms 1 both`; active += 1; return name; } function delete_rule(node, name) { - const previous = (node.style.animation || '').split(', '); - const next = previous.filter(name + node.style.animation = (node.style.animation || '') + .split(', ') + .filter(name ? anim => anim.indexOf(name) < 0 // remove specific animation : anim => anim.indexOf('_bp') === -1 // remove all Svelte animations - ); - const deleted = previous.length - next.length; - if (deleted) { - node.style.animation = next.join(', '); - active -= deleted; - if (!active) - clear_rules(); - } + ) + .join(', '); + if (name && !--active) + clear_rules(); } function clear_rules() { raf(() => { if (active) return; - managed_styles.forEach(info => { - const { stylesheet } = info; - let i = stylesheet.cssRules.length; - while (i--) - stylesheet.deleteRule(i); - info.rules = {}; - }); - managed_styles.clear(); + let i = stylesheet.cssRules.length; + while (i--) + stylesheet.deleteRule(i); + current_rules = {}; }); } @@ -601,7 +579,7 @@ let stop; const subscribers = new Set(); function set(new_value) { - if (safe_not_equal(value, new_value)) { + if (not_equal(value, new_value)) { value = new_value; if (stop) { // store is ready const run_queue = !subscriber_queue.length; @@ -1903,7 +1881,7 @@ // (319:199) {:else} function create_else_block(ctx) { let div; - let raw_value = /*activeItem*/ ctx[6].html + ""; + let raw_value = (/*activeItem*/ ctx[6].html ?? /*activeItem*/ ctx[6].element.outerHTML) + ""; return { c() { @@ -1915,7 +1893,7 @@ div.innerHTML = raw_value; }, p(ctx, dirty) { - if (dirty[0] & /*activeItem*/ 64 && raw_value !== (raw_value = /*activeItem*/ ctx[6].html + "")) div.innerHTML = raw_value; }, + if (dirty[0] & /*activeItem*/ 64 && raw_value !== (raw_value = (/*activeItem*/ ctx[6].html ?? /*activeItem*/ ctx[6].element.outerHTML) + "")) div.innerHTML = raw_value; }, i: noop, o: noop, d(detaching) { @@ -2030,7 +2008,7 @@ }; } - // (319:267) {#if activeItem.caption} + // (319:299) {#if activeItem.caption} function create_if_block_2(ctx) { let div; let raw_value = /*activeItem*/ ctx[6].caption + ""; @@ -2107,8 +2085,8 @@ if (!mounted) { dispose = [ - listen(div, "pointerdown", /*pointerdown_handler*/ ctx[21]), - listen(div, "pointerup", /*pointerup_handler*/ ctx[22]) + listen(div, "pointerdown", /*pointerdown_handler*/ ctx[20]), + listen(div, "pointerup", /*pointerup_handler*/ ctx[21]) ]; mounted = true; @@ -2196,7 +2174,7 @@ }; } - // (319:522) {#if items.length > 1} + // (319:554) {#if items.length > 1} function create_if_block_1(ctx) { let div; let raw_value = `${/*position*/ ctx[4] + 1} / ${/*items*/ ctx[0].length}` + ""; @@ -2333,8 +2311,8 @@ /** active item object */ let activeItem; - /** true if activeItem is html */ - let activeItemIsHtml; + /** returns true if `activeItem` is html */ + const activeItemIsHtml = () => !activeItem.img && !activeItem.sources && !activeItem.iframe; /** function set by child component to run when container resized */ let resizeFunc; @@ -2363,10 +2341,10 @@ // update trigger element to restore focus focusTrigger = document.activeElement; - $$invalidate(20, container.w = target.offsetWidth, container); + $$invalidate(19, container.w = target.offsetWidth, container); $$invalidate( - 20, + 19, container.h = target === document.body ? globalThis.innerHeight : target.clientHeight, @@ -2395,12 +2373,7 @@ $$invalidate(4, position = i); } - return { - element, - html: element.outerHTML, - i, - ...element.dataset - }; + return { element, i, ...element.dataset }; })); } }; @@ -2512,7 +2485,7 @@ const scaleIn = node => { let dimensions; - if (activeItemIsHtml) { + if (activeItemIsHtml()) { const bpItem = node.firstChild.firstChild; dimensions = [bpItem.clientWidth, bpItem.clientHeight]; } else { @@ -2553,7 +2526,7 @@ /** code to run on mount / destroy */ const containerActions = node => { - $$invalidate(20, container.el = node, container); + $$invalidate(19, container.el = node, container); let removeKeydownListener; let roActive; opts.onOpen?.(container.el, activeItem); @@ -2567,12 +2540,14 @@ const ro = new ResizeObserver(entries => { // use roActive to avoid running on initial open if (roActive) { - $$invalidate(20, container.w = entries[0].contentRect.width, container); - $$invalidate(20, container.h = entries[0].contentRect.height, container); + $$invalidate(19, container.w = entries[0].contentRect.width, container); + $$invalidate(19, container.h = entries[0].contentRect.height, container); $$invalidate(7, smallScreen = container.w < 769); // run child component resize function - resizeFunc?.(); + if (!activeItemIsHtml()) { + resizeFunc?.(); + } // run user defined onResize function opts.onResize?.(container.el, activeItem); @@ -2612,17 +2587,12 @@ }; $$self.$$.update = () => { - if ($$self.$$.dirty[0] & /*items, position, activeItem, isOpen, activeItemIsHtml, opts, container*/ 1835121) { + if ($$self.$$.dirty[0] & /*items, position, isOpen, opts, container, activeItem*/ 786545) { if (items) { // update active item when position changes $$invalidate(6, activeItem = items[position]); - $$invalidate(19, activeItemIsHtml = activeItem.hasOwnProperty('html')); - if (isOpen) { - // clear child resize function if html - activeItemIsHtml && setResizeFunc(null); - // run onUpdate when items updated opts.onUpdate?.(container.el, activeItem); } @@ -2650,7 +2620,6 @@ open, setPosition, isOpen, - activeItemIsHtml, container, pointerdown_handler, pointerup_handler diff --git a/package.json b/package.json index 4628109..b493d12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bigger-picture", - "version": "1.1.12", + "version": "1.1.13", "type": "module", "exports": { ".": {