@automattic/jetpack-image-guide 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/build/guide.css +1 -1
- package/build/index.d.ts +4 -5
- package/build/index.js +1 -1
- package/build/src/MeasurableImage.d.ts +59 -0
- package/build/src/_unused-image-observer.d.ts +15 -0
- package/build/src/analytics.d.ts +46 -0
- package/build/src/find-image-elements.d.ts +31 -0
- package/build/src/index.d.ts +24 -0
- package/build/src/initialize.d.ts +22 -0
- package/build/src/stores/GuideState.d.ts +12 -0
- package/build/src/stores/MeasurableImageStore.d.ts +32 -0
- package/build/src/types.d.ts +9 -0
- package/build/types.d.ts +2 -2
- package/package.json +15 -15
- package/rollup.config.js +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.14] - 2026-04-13
|
|
9
|
+
### Changed
|
|
10
|
+
- Update package dependencies. [#47610]
|
|
11
|
+
- Update package dependencies. [#47799]
|
|
12
|
+
- Update package dependencies. [#47998]
|
|
13
|
+
|
|
14
|
+
## [1.0.13] - 2026-03-09
|
|
15
|
+
### Changed
|
|
16
|
+
- Set `.repository.url` in `package.json` to the mirror repo rather than the monorepo. Required for enabling provenance. [#47149]
|
|
17
|
+
- Switch to Native TypeScript compiler based on Go. [#47375]
|
|
18
|
+
- Update package dependencies. [#47002] [#47099] [#47173] [#47229] [#47337] [#47498]
|
|
19
|
+
|
|
8
20
|
## [1.0.12] - 2026-01-26
|
|
9
21
|
### Changed
|
|
10
22
|
- Update package dependencies. [#46552]
|
|
@@ -226,6 +238,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
226
238
|
### Removed
|
|
227
239
|
- Minor package.json change - removing private entry.
|
|
228
240
|
|
|
241
|
+
[1.0.14]: https://github.com/Automattic/jetpack-image-guide/compare/v1.0.13...v1.0.14
|
|
242
|
+
[1.0.13]: https://github.com/Automattic/jetpack-image-guide/compare/v1.0.12...v1.0.13
|
|
229
243
|
[1.0.12]: https://github.com/Automattic/jetpack-image-guide/compare/v1.0.11...v1.0.12
|
|
230
244
|
[1.0.11]: https://github.com/Automattic/jetpack-image-guide/compare/v1.0.10...v1.0.11
|
|
231
245
|
[1.0.10]: https://github.com/Automattic/jetpack-image-guide/compare/v1.0.9...v1.0.10
|
package/build/guide.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
div.svelte-
|
|
1
|
+
div.svelte-1yjr9q3{align-items:center;display:flex;justify-content:center}.spinner.svelte-q7ue1b{animation:svelte-q7ue1b-pulse 1.25s ease-in-out infinite reverse}@keyframes svelte-q7ue1b-pulse{0%{transform:scale(1) rotate(0deg)}70%{transform:scale(1.4) rotate(30deg)}to{transform:scale(.9) rotate(-190deg)}}svg.svelte-qy5udj{transform:translateY(2px)}.interaction-area.svelte-1vido64{margin-bottom:-15px;margin-left:-15px;margin-top:-15px;padding:15px}.bubble.svelte-1vido64{background-color:#069e08;border:1px solid hsla(0,0%,100%,.05);border-radius:50%;color:#fff;cursor:default;font-family:sans-serif;font-size:.8em;font-weight:600;height:32px;position:relative;text-align:center;text-shadow:0 0 1px rgba(0,0,0,.15);transition:background-color .3s ease;width:32px}.high.svelte-1vido64 .bubble:where(.svelte-1vido64){background-color:#e52e00}.medium.svelte-1vido64 .bubble:where(.svelte-1vido64){background-color:#e98800}.bubble-inner.svelte-1vido64{align-items:center;bottom:0;display:flex;height:100%;justify-content:center;left:0;margin:auto;position:absolute;right:0;top:0;width:100%}.guide.small .interaction-area.svelte-1vido64{padding:15px}.guide.small .bubble.svelte-1vido64{font-size:10px;height:28px;width:28px}.guide.micro .interaction-area.svelte-1vido64{margin-left:-10px;margin-top:-10px;padding:10px}.guide.micro .bubble.svelte-1vido64{border:1px solid hsla(0,0%,100%,.3);font-size:0;height:10px;width:10px}.guide.micro .bubble.svelte-1vido64 svg{display:none}svg.svelte-1b220d7{fill:currentcolor;height:1em;margin:0;vertical-align:middle;width:1em}a.svelte-1okxgd8{color:#3c434a!important;font-weight:600!important}a.documentation.svelte-1okxgd8{color:#3c434a!important;font-weight:500!important}.preview.svelte-1okxgd8{align-items:flex-start;display:flex;gap:15px;margin-bottom:15px;max-width:360px;width:100%}.preview.svelte-1okxgd8 img:where(.svelte-1okxgd8){border-radius:3px;box-shadow:0 0 2px 1px #f2f2f2}.info.svelte-1okxgd8{font-size:.9em;margin-top:15px}.jetpack-boost-guide-popup.svelte-1okxgd8{background-color:#fff;background:linear-gradient(159.87deg,#f6f6f4 7.24%,#f7f4ea 64.73%,#ddedd5 116.53%);border-radius:6px;color:#3c434a;font-family:sans-serif;margin-bottom:10px;min-width:320px;overflow:hidden;padding:25px;position:fixed;text-align:left;width:fit-content;z-index:90000}.title.svelte-1okxgd8{font-weight:600;overflow-wrap:anywhere}.explanation.svelte-1okxgd8{margin-top:5px}.description.svelte-1okxgd8{font-size:.9em}.row.svelte-1okxgd8{border-bottom:1px dotted #d9d9d9;display:flex;font-size:14px;gap:10px;justify-content:space-between;margin-bottom:5px}.row.svelte-1okxgd8:last-child{border-bottom:none}.logo.svelte-1okxgd8{bottom:-25px;opacity:.04;pointer-events:none;position:absolute;right:-50px;transform:rotate(15deg)}.guide.small .preview.svelte-1okxgd8{gap:8px}.jetpack-boost-guide:not(.relative){left:0;position:absolute;top:0}.jetpack-boost-guide.relative{position:relative}.guide.svelte-6tsow1{left:0;line-height:1.55;padding:20px;position:absolute;top:0;z-index:8000}.guide.small.svelte-6tsow1{font-size:13px}.guide.micro.svelte-6tsow1{font-size:13px;padding:10px}.guide.show.svelte-6tsow1{z-index:9000}.guide.svelte-6tsow1{font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif!important;font-size:15px!important}.previews.svelte-6tsow1{display:flex;flex-wrap:wrap;gap:15px;margin-bottom:15px;width:100%}.jetpack-boost-guide__backdrop{filter:brightness(.3);transition:opacity .2s ease-in-out,filter .2s ease-in-out}#jetpack-boost-guide-bar.ab-item.svelte-1km5e3e{align-items:center;display:flex;gap:10px}#jetpack-boost-guide-bar.ab-item.paused.svelte-1km5e3e svg{filter:grayscale(100%) contrast(1.7)}
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MeasurableImage, type Dimensions, type FetchFn, type Weight } from './MeasurableImage.ts';
|
|
2
2
|
import { type TracksCallback } from './analytics.ts';
|
|
3
3
|
import { getMeasurableImages } from './find-image-elements.ts';
|
|
4
|
-
import AdminBarToggle from './ui/AdminBarToggle.svelte';
|
|
5
4
|
export { MeasurableImage, getMeasurableImages };
|
|
6
5
|
export type { Weight, Dimensions };
|
|
7
6
|
type ImageGuideUIOptions = {
|
|
@@ -19,7 +18,7 @@ type ImageGuideUIOptions = {
|
|
|
19
18
|
* @param {Function} args.fetchFunction - The function to use to fetch the image weight.
|
|
20
19
|
* @return {object} The Svelte component instance.
|
|
21
20
|
*/
|
|
22
|
-
export declare function setupImageGuideUI(target: HTMLElement, { href, tracksCallback, fetchFunction }: ImageGuideUIOptions):
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
21
|
+
export declare function setupImageGuideUI(target: HTMLElement, { href, tracksCallback, fetchFunction }: ImageGuideUIOptions): {
|
|
22
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
23
|
+
$set?(props: Partial<Record<string, any>>): void;
|
|
24
|
+
} & Record<string, any>;
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class t{constructor(t,e,n=null){this.node=t,this.getURLCallback=e,this.fetch=null!=n?n:window.fetch.bind(window)}getURL(){return this.getURLCallback(this.node)}getSizeOnPage(){const{width:t,height:e}=this.node.getBoundingClientRect();return{width:Math.round(t),height:Math.round(e)}}async getFileSize(t){const{width:e,height:n}=await this.fetchFileDimensions(t);return{width:e,height:n}}async getWeight(t){return await this.fetchFileWeight(t)}getPotentialSavings(t,e,n){const i=this.getOversizedRatio(t,n);return i<=1?null:Math.round(e.weight-e.weight/i)}getExpectedSize(t){const e=window.devicePixelRatio||1;return{width:Math.round(t.width*e),height:Math.round(t.height*e)}}getOversizedRatio(t,e){if(0===t.width||0===t.height)return 1;const{width:n,height:i}=this.getExpectedSize(e);return 0===n||0===i?1:t.width*t.height/(n*i)}async fetchFileWeight(t){const e=await this.fetch(t);return e.ok?parseInt(e.headers.get("content-length"),10)/1024:(console.log(`Can't get image size for ${t} likely due to a CORS error.`),-1)}async fetchFileDimensions(t){const e=new Image;return e.src=t,new Promise((t,n)=>{e.onload=()=>{t({width:Math.round(e.width),height:Math.round(e.height)})},e.onerror=()=>{n("Unable to load image.")}})}async isImageTiny(){try{const t=65,e=await this.fetchFileDimensions(this.getURL());return e.width<t||e.height<t}catch{return!0}}}function e(){}const n=t=>t;function i(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(i)}function s(t){return"function"==typeof t}function c(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let a;function l(t,e){return t===e||(a||(a=document.createElement("a")),a.href=e,t===a.href)}function u(t,...n){if(null==t){for(const t of n)t(void 0);return e}const i=t.subscribe(...n);return i.unsubscribe?()=>i.unsubscribe():i}function d(t){let e;return u(t,t=>e=t)(),e}function h(t,e,n){t.$$.on_destroy.push(u(e,n))}function f(t,e,n,i){return t[1]&&i?function(t,e){for(const n in e)t[n]=e[n];return t}(n.ctx.slice(),t[1](i(e))):n.ctx}function p(t){const e="string"==typeof t&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}const g="undefined"!=typeof window;let m=g?()=>window.performance.now():()=>Date.now(),$=g?t=>requestAnimationFrame(t):e;const v=new Set;function w(t){v.forEach(e=>{e.c(t)||(v.delete(e),e.f())}),0!==v.size&&$(w)}function y(t){let e;return 0===v.size&&$(w),{promise:new Promise(n=>{v.add(e={c:t,f:n})}),abort(){v.delete(e)}}}function b(t,e){t.appendChild(e)}function x(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function k(t){const e=S("style");return e.textContent="/* empty */",function(t,e){b(t.head||t,e),e.sheet}(x(t),e),e.sheet}function _(t,e,n){t.insertBefore(e,n||null)}function z(t){t.parentNode&&t.parentNode.removeChild(t)}function S(t){return document.createElement(t)}function C(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function E(t){return document.createTextNode(t)}function L(){return E(" ")}function M(){return E("")}function P(t,e,n,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}function O(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function T(t,e){e=""+e,t.data!==e&&(t.data=e)}function j(t,e,n,i){null==n?t.style.removeProperty(e):t.style.setProperty(e,n,i?"important":"")}function I(t,e,n){t.classList.toggle(e,!!n)}function R(t,e,{bubbles:n=!1,cancelable:i=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:i})}const F=new Map;let W,U=0;function A(t,e,n,i,o,r,s,c=0){const a=16.666/i;let l="{\n";for(let t=0;t<=1;t+=a){const i=e+(n-e)*r(t);l+=100*t+`%{${s(i,1-i)}}\n`}const u=l+`100% {${s(n,1-n)}}\n}`,d=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(u)}_${c}`,h=x(t),{stylesheet:f,rules:p}=F.get(h)||function(t,e){const n={stylesheet:k(e),rules:{}};return F.set(t,n),n}(h,t);p[d]||(p[d]=!0,f.insertRule(`@keyframes ${d} ${u}`,f.cssRules.length));const g=t.style.animation||"";return t.style.animation=`${g?`${g}, `:""}${d} ${i}ms linear ${o}ms 1 both`,U+=1,d}function B(t,e){const n=(t.style.animation||"").split(", "),i=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),o=n.length-i.length;o&&(t.style.animation=i.join(", "),U-=o,U||$(()=>{U||(F.forEach(t=>{const{ownerNode:e}=t.stylesheet;e&&z(e)}),F.clear())}))}function D(t){W=t}function H(){if(!W)throw new Error("Function called outside component initialization");return W}function N(t){H().$$.on_mount.push(t)}function q(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(t=>t.call(this,e))}const V=[],G=[];let Z=[];const K=[],X=Promise.resolve();let Y=!1;function J(t){Z.push(t)}const Q=new Set;let tt,et=0;function nt(){if(0!==et)return;const t=W;do{try{for(;et<V.length;){const t=V[et];et++,D(t),it(t.$$)}}catch(t){throw V.length=0,et=0,t}for(D(null),V.length=0,et=0;G.length;)G.pop()();for(let t=0;t<Z.length;t+=1){const e=Z[t];Q.has(e)||(Q.add(e),e())}Z.length=0}while(V.length);for(;K.length;)K.pop()();Y=!1,Q.clear(),D(t)}function it(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(J)}}function ot(){return tt||(tt=Promise.resolve(),tt.then(()=>{tt=null})),tt}function rt(t,e,n){t.dispatchEvent(R(`${e?"intro":"outro"}${n}`))}const st=new Set;let ct;function at(){ct={r:0,c:[],p:ct}}function lt(){ct.r||r(ct.c),ct=ct.p}function ut(t,e){t&&t.i&&(st.delete(t),t.i(e))}function dt(t,e,n,i){if(t&&t.o){if(st.has(t))return;st.add(t),ct.c.push(()=>{st.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}else i&&i()}const ht={duration:0};function ft(t,i,o){const r={direction:"in"};let c,a,l=i(t,o,r),u=!1,d=0;function h(){c&&B(t,c)}function f(){const{delay:i=0,duration:o=300,easing:r=n,tick:s=e,css:f}=l||ht;f&&(c=A(t,0,1,o,i,r,f,d++)),s(0,1);const p=m()+i,g=p+o;a&&a.abort(),u=!0,J(()=>rt(t,!0,"start")),a=y(e=>{if(u){if(e>=g)return s(1,0),rt(t,!0,"end"),h(),u=!1;if(e>=p){const t=r((e-p)/o);s(t,1-t)}}return u})}let p=!1;return{start(){p||(p=!0,B(t),s(l)?(l=l(r),ot().then(f)):f())},invalidate(){p=!1},end(){u&&(h(),u=!1)}}}function pt(t,i,o,c){let a,l=i(t,o,{direction:"both"}),u=c?0:1,d=null,h=null,f=null;function p(){f&&B(t,f)}function g(t,e){const n=t.b-u;return e*=Math.abs(n),{a:u,b:t.b,d:n,duration:e,start:t.start,end:t.start+e,group:t.group}}function $(i){const{delay:o=0,duration:s=300,easing:c=n,tick:$=e,css:v}=l||ht,w={start:m()+o,b:i};i||(w.group=ct,ct.r+=1),"inert"in t&&(i?void 0!==a&&(t.inert=a):(a=t.inert,t.inert=!0)),d||h?h=w:(v&&(p(),f=A(t,u,i,s,o,c,v)),i&&$(0,1),d=g(w,s),J(()=>rt(t,i,"start")),y(e=>{if(h&&e>h.start&&(d=g(h,s),h=null,rt(t,d.b,"start"),v&&(p(),f=A(t,u,d.b,d.duration,0,c,l.css))),d)if(e>=d.end)$(u=d.b,1-u),rt(t,d.b,"end"),h||(d.b?p():--d.group.r||r(d.group.c)),d=null;else if(e>=d.start){const t=e-d.start;u=d.a+d.d*c(t/d.duration),$(u,1-u)}return!(!d&&!h)}))}return{run(t){s(l)?ot().then(()=>{l=l({direction:t?"in":"out"}),$(t)}):$(t)},end(){p(),d=h=null}}}function gt(t){return void 0!==t?.length?t:Array.from(t)}function mt(t){t&&t.c()}function $t(t,e,n){const{fragment:o,after_update:c}=t.$$;o&&o.m(e,n),J(()=>{const e=t.$$.on_mount.map(i).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...e):r(e),t.$$.on_mount=[]}),c.forEach(J)}function vt(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];Z.forEach(i=>-1===t.indexOf(i)?e.push(i):n.push(i)),n.forEach(t=>t()),Z=e}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function wt(t,e){-1===t.$$.dirty[0]&&(V.push(t),Y||(Y=!0,X.then(nt)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function yt(t,n,i,s,c,a,l=null,u=[-1]){const d=W;D(t);const h=t.$$={fragment:null,ctx:[],props:a,update:e,not_equal:c,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(d?d.$$.context:[])),callbacks:o(),dirty:u,skip_bound:!1,root:n.target||d.$$.root};l&&l(h.root);let f=!1;if(h.ctx=i?i(t,n.props||{},(e,n,...i)=>{const o=i.length?i[0]:n;return h.ctx&&c(h.ctx[e],h.ctx[e]=o)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](o),f&&wt(t,e)),n}):[],h.update(),f=!0,r(h.before_update),h.fragment=!!s&&s(h.ctx),n.target){if(n.hydrate){const t=function(t){return Array.from(t.childNodes)}(n.target);h.fragment&&h.fragment.l(t),t.forEach(z)}else h.fragment&&h.fragment.c();n.intro&&ut(t.$$.fragment),$t(t,n.target,n.anchor),nt()}D(d)}class bt{$$=void 0;$$set=void 0;$destroy(){vt(this,1),this.$destroy=e}$on(t,n){if(!s(n))return e;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const t=i.indexOf(n);-1!==t&&i.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const xt=[];function kt(t,n=e){let i;const o=new Set;function r(e){if(c(t,e)&&(t=e,i)){const e=!xt.length;for(const e of o)e[1](),xt.push(e,t);if(e){for(let t=0;t<xt.length;t+=2)xt[t][0](xt[t+1]);xt.length=0}}}function s(e){r(e(t))}return{set:r,update:s,subscribe:function(c,a=e){const l=[c,a];return o.add(l),1===o.size&&(i=n(r,s)||e),c(t),()=>{o.delete(l),0===o.size&&i&&(i(),i=null)}}}}function _t(t,n,i){const o=!Array.isArray(t),c=o?[t]:t;if(!c.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const a=n.length<2;return l=(t,i)=>{let l=!1;const d=[];let h=0,f=e;const p=()=>{if(h)return;f();const r=n(o?d[0]:d,t,i);a?t(r):f=s(r)?r:e},g=c.map((t,e)=>u(t,t=>{d[e]=t,h&=~(1<<e),l&&p()},()=>{h|=1<<e}));return l=!0,p(),function(){r(g),f(),l=!1}},{subscribe:kt(i,l).subscribe};var l}const zt="jetpack-boost-guide",St={active:"Active",paused:"Paused"};let Ct=localStorage.getItem(zt);Ct&&St[Ct]||(localStorage.setItem(zt,"Active"),Ct="active");const{set:Et,update:Lt,subscribe:Mt}=kt(Ct);Mt(t=>{localStorage.setItem(zt,t)});const Pt={subscribe:Mt,set:Et,update:Lt,cycle:()=>{Lt(t=>{const e=Object.keys(St),n=e.indexOf(t);return e[(n+1)%e.length]})}},Ot=_t(Pt,t=>St[t]);class Tt{constructor(t){this.loading=kt(!0),this.weightMap={},this.currentSrc="",this.image=t,this.node=t.node;this.url=kt(t.getURL()),this.fileSize=kt({width:0,height:0}),this.fileWeight=kt({weight:-1},()=>{this.maybeUpdateWeight()}),this.sizeOnPage=kt({width:0,height:0}),this.potentialSavings=this.derivePotentialSavings(),this.oversizedRatio=this.deriveOversizedRatio(),this.expectedSize=this.deriveExpectedSize()}deriveOversizedRatio(){return _t([this.fileSize,this.sizeOnPage],([t,e])=>this.image.getOversizedRatio(t,e))}deriveExpectedSize(){return _t(this.sizeOnPage,t=>this.image.getExpectedSize(t))}derivePotentialSavings(){return _t([this.fileSize,this.fileWeight,this.sizeOnPage],([t,e,n])=>this.image.getPotentialSavings(t,e,n))}async updateDimensions(){const t=this.image.getSizeOnPage();this.sizeOnPage.set(t),await this.updateFileDimensions()}async updateFileDimensions(){if(this.image.getURL()===this.currentSrc)return;let t;this.currentSrc=this.image.getURL();try{t=await this.image.getFileSize(this.currentSrc)}catch{t={height:-1,width:-1}}this.url.set(this.currentSrc),this.fileSize.set(t)}async maybeUpdateWeight(){const t=this.currentSrc;if(void 0===this.weightMap[t]){this.loading.set(!0);try{const e=await this.image.getWeight(t);this.weightMap[t]=e,this.fileWeight.set({weight:e})}catch{this.fileWeight.set({weight:-1})}this.loading.set(!1)}else this.fileWeight.set({weight:this.weightMap[t]})}}class jt{static setTracksCallback(t){jt.tracksCallback=t}static async trackImageOutcome(t){return new Promise(e=>{t.loading.subscribe(n=>{if(!n){const n=d(t.oversizedRatio),i=function(t){return t>4?"red":t>2.5?"yellow":"green"}(n),o=d(t.fileSize),r=d(t.sizeOnPage),s=d(t.expectedSize),c=d(t.potentialSavings),a=d(t.url),l={severity:i,oversized_ratio:n,file_width:o.width,file_height:o.height,size_on_page_width:r.width,size_on_page_height:r.height,expected_width:s.width,expected_height:s.height,potential_savings:c,image_url:a};jt.tracksCallback("image_guide_image_outcome",{...l,window_width:window.innerWidth,window_height:window.innerHeight,device_pixel_ratio:window.devicePixelRatio}),e(l)}})})}static async trackPage(t){if(!t.length||jt.trackingComplete)return;jt.trackingComplete=!0;const e=t.map(jt.trackImageOutcome),n=await Promise.all(e),i=n.reduce((t,e)=>t+(e.potential_savings||0),0);jt.tracksCallback("image_guide_page_outcome",{total_potential_savings:i,red_severity_count:n.filter(t=>"red"===t.severity).length,yellow_severity_count:n.filter(t=>"yellow"===t.severity).length,green_severity_count:n.filter(t=>"green"===t.severity).length,window_width:window.innerWidth,window_height:window.innerHeight,device_pixel_ratio:window.devicePixelRatio})}static trackInitialState(){jt.tracksCallback("image_guide_initial_ui_state",{image_guide_state:d(Pt)})}static trackUIStateChange(){jt.tracksCallback("image_guide_ui_state_change",{image_guide_state:d(Pt)})}}function It(t){return t.filter(t=>{if(t instanceof HTMLImageElement){if(!t.src.trim())return!1;try{if(e=t.src,new URL(e).pathname.toLowerCase().endsWith(".svg"))return!1}catch{return!1}return!0}var e;if(t instanceof HTMLElement){return"none"!==getComputedStyle(t).backgroundImage}return!1})}function Rt(t){return Ut(t.currentSrc)?t.currentSrc:Ut(t.src)?t.src:null}function Ft(t){const e=getComputedStyle(t).backgroundImage.match(/url\(\s*(['"])(.*?)\1\s*\)/i),n=window.location.href.split("#")[0];return e&&e[2]&&e[2]!==n&&Ut(e[2])?e[2]:null}async function Wt(e,n=null){return It(e).map(e=>e instanceof HTMLImageElement?new t(e,Rt,n):e instanceof HTMLElement&&Ft(e)?new t(e,Ft):null).filter(t=>null!==t)}function Ut(t){if(t.startsWith("/")){return!t.split("?")[0].endsWith(".svg")}try{const e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol}catch{return!1}}function At(t){const e=1.70158;return--t*t*((e+1)*t+e)+1}function Bt(t){const e=t-1;return e*e*e+1}function Dt(t,{delay:e=0,duration:i=400,easing:o=n}={}){const r=+getComputedStyle(t).opacity;return{delay:e,duration:i,easing:o,css:t=>"opacity: "+t*r}}function Ht(t,{delay:e=0,duration:n=400,easing:i=Bt,x:o=0,y:r=0,opacity:s=0}={}){const c=getComputedStyle(t),a=+c.opacity,l="none"===c.transform?"":c.transform,u=a*(1-s),[d,h]=p(o),[f,g]=p(r);return{delay:e,duration:n,easing:i,css:(t,e)=>`\n\t\t\ttransform: ${l} translate(${(1-t)*d}${h}, ${(1-t)*f}${g});\n\t\t\topacity: ${a-u*e}`}}function Nt(t){let n,i,o,r,s;return{c(){n=S("div"),i=C("svg"),o=C("path"),r=C("path"),s=C("path"),O(o,"d","M55.4 107.8C84.3397 107.8 107.8 84.3397 107.8 55.4C107.8 26.4603 84.3397 3 55.4 3C26.4603 3 3 26.4603 3 55.4C3 84.3397 26.4603 107.8 55.4 107.8Z"),O(o,"fill",t[1]),O(r,"d","M58 46.6V97.4L84.2 46.6H58Z"),O(r,"fill","white"),O(s,"d","M52.7 64.1V13.4L26.6 64.1H52.7Z"),O(s,"fill","white"),O(i,"viewBox","0 0 110 110"),O(i,"fill","none"),O(i,"xmlns","http://www.w3.org/2000/svg"),j(n,"width",t[0]+"px"),j(n,"height",t[0]+"px"),O(n,"class","svelte-f6jc8")},m(t,e){_(t,n,e),b(n,i),b(i,o),b(i,r),b(i,s)},p(t,[e]){2&e&&O(o,"fill",t[1]),1&e&&j(n,"width",t[0]+"px"),1&e&&j(n,"height",t[0]+"px")},i:e,o:e,d(t){t&&z(n)}}}function qt(t,e,n){let{size:i=16}=e,{bg:o="#069E08"}=e;return t.$$set=t=>{"size"in t&&n(0,i=t.size),"bg"in t&&n(1,o=t.bg)},[i,o]}jt.trackingComplete=!1,"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class Vt extends bt{constructor(t){super(),yt(this,t,qt,Nt,c,{size:0,bg:1})}}function Gt(t){let i,o,c,a;return o=new Vt({props:{size:12,bg:"transparent"}}),{c(){i=S("div"),mt(o.$$.fragment),O(i,"class","spinner svelte-2eb8gc")},m(t,e){_(t,i,e),$t(o,i,null),a=!0},p:e,i(t){a||(ut(o.$$.fragment,t),c&&c.end(1),a=!0)},o(t){dt(o.$$.fragment,t),t&&(c=function(t,i,o){const c={direction:"out"};let a,l=i(t,o,c),u=!0;const d=ct;let h;function f(){const{delay:i=0,duration:o=300,easing:s=n,tick:c=e,css:f}=l||ht;f&&(a=A(t,1,0,o,i,s,f));const p=m()+i,g=p+o;J(()=>rt(t,!1,"start")),"inert"in t&&(h=t.inert,t.inert=!0),y(e=>{if(u){if(e>=g)return c(0,1),rt(t,!1,"end"),--d.r||r(d.c),!1;if(e>=p){const t=s((e-p)/o);c(1-t,t)}}return u})}return d.r+=1,s(l)?ot().then(()=>{l=l(c),f()}):f(),{end(e){e&&"inert"in t&&(t.inert=h),e&&l.tick&&l.tick(1,0),u&&(a&&B(t,a),u=!1)}}}(i,Dt,{duration:300})),a=!1},d(t){t&&z(i),vt(o),t&&c&&c.end()}}}class Zt extends bt{constructor(t){super(),yt(this,t,null,Gt,c,{})}}function Kt(t){let n,i;return{c(){n=C("svg"),i=C("path"),O(i,"stroke-linecap","round"),O(i,"stroke-linejoin","round"),O(i,"stroke-width","2"),O(i,"d","M5 13l4 4L19 7"),O(n,"class","w-6 h-6 svelte-jkeb2"),O(n,"fill","none"),O(n,"stroke","white"),O(n,"width","18"),O(n,"height","18"),O(n,"viewBox","0 0 24 24"),O(n,"xmlns","http://www.w3.org/2000/svg")},m(t,e){_(t,n,e),b(n,i)},p:e,i:e,o:e,d(t){t&&z(n)}}}class Xt extends bt{constructor(t){super(),yt(this,t,null,Kt,c,{})}}function Yt(t){let n,i,o;return i=new Zt({}),{c(){n=S("div"),mt(i.$$.fragment),O(n,"class","bubble-inner svelte-1qopaii")},m(t,e){_(t,n,e),$t(i,n,null),o=!0},p:e,i(t){o||(ut(i.$$.fragment,t),o=!0)},o(t){dt(i.$$.fragment,t),o=!1},d(t){t&&z(n),vt(i)}}}function Jt(t){let e,n,i,o,r,s;const c=[ee,te,Qt],a=[];function l(t,e){return t[0]>9?0:t[0]>.99?1:2}return i=l(t),o=a[i]=c[i](t),{c(){e=S("div"),n=S("div"),o.c(),O(n,"class","label"),O(e,"class","bubble-inner svelte-1qopaii")},m(t,o){_(t,e,o),b(e,n),a[i].m(n,null),s=!0},p(t,e){let r=i;i=l(t),i===r?a[i].p(t,e):(at(),dt(a[r],1,1,()=>{a[r]=null}),lt(),o=a[i],o?o.p(t,e):(o=a[i]=c[i](t),o.c()),ut(o,1),o.m(n,null))},i(t){s||(ut(o),t&&(r||J(()=>{r=ft(n,Dt,{delay:200,duration:300}),r.start()})),s=!0)},o(t){dt(o),s=!1},d(t){t&&z(e),a[i].d()}}}function Qt(t){let n,i;return{c(){n=S("span"),n.textContent="<",i=E(" 1x"),j(n,"font-size","0.75em")},m(t,e){_(t,n,e),_(t,i,e)},p:e,i:e,o:e,d(t){t&&(z(n),z(i))}}}function te(t){let e,n,i,o;const r=[ie,ne],s=[];function c(t,e){return"normal"===t[1]?0:1}return e=c(t),n=s[e]=r[e](t),{c(){n.c(),i=M()},m(t,n){s[e].m(t,n),_(t,i,n),o=!0},p(t,o){let a=e;e=c(t),e===a?s[e].p(t,o):(at(),dt(s[a],1,1,()=>{s[a]=null}),lt(),n=s[e],n?n.p(t,o):(n=s[e]=r[e](t),n.c()),ut(n,1),n.m(i.parentNode,i))},i(t){o||(ut(n),o=!0)},o(t){dt(n),o=!1},d(t){t&&z(i),s[e].d(t)}}}function ee(t){let n,i,o=Math.floor(t[0])+"";return{c(){n=E(o),i=E("x")},m(t,e){_(t,n,e),_(t,i,e)},p(t,e){1&e&&o!==(o=Math.floor(t[0])+"")&&T(n,o)},i:e,o:e,d(t){t&&(z(n),z(i))}}}function ne(t){let n,i,o=t[0].toFixed(1)+"";return{c(){n=E(o),i=E("x")},m(t,e){_(t,n,e),_(t,i,e)},p(t,e){1&e&&o!==(o=t[0].toFixed(1)+"")&&T(n,o)},i:e,o:e,d(t){t&&(z(n),z(i))}}}function ie(t){let n,i;return n=new Xt({}),{c(){mt(n.$$.fragment)},m(t,e){$t(n,t,e),i=!0},p:e,i(t){i||(ut(n.$$.fragment,t),i=!0)},o(t){dt(n.$$.fragment,t),i=!1},d(t){vt(n,t)}}}function oe(t){let e,n,i,o,r,s,c,a,l;const u=[Jt,Yt],d=[];function h(t,e){return!1===t[3]?0:1}return i=h(t),o=d[i]=u[i](t),{c(){e=S("div"),n=S("div"),o.c(),O(n,"class","bubble svelte-1qopaii"),O(e,"class",r="interaction-area "+t[1]+" svelte-1qopaii")},m(o,r){_(o,e,r),b(e,n),d[i].m(n,null),t[10](e),c=!0,a||(l=P(e,"mouseenter",t[7]),a=!0)},p(s,[a]){let l=i;i=h(t=s),i===l?d[i].p(t,a):(at(),dt(d[l],1,1,()=>{d[l]=null}),lt(),o=d[i],o?o.p(t,a):(o=d[i]=u[i](t),o.c()),ut(o,1),o.m(n,null)),(!c||2&a&&r!==(r="interaction-area "+t[1]+" svelte-1qopaii"))&&O(e,"class",r)},i(n){c||(ut(o),n&&J(()=>{c&&(s||(s=pt(e,Ht,t[6],!0)),s.run(1))}),c=!0)},o(n){dt(o),n&&(s||(s=pt(e,Ht,t[6],!1)),s.run(0)),c=!1},d(n){n&&z(e),d[i].d(),t[10](null),n&&s&&s.end(),a=!1,l()}}}function re(t,e,n){let i,o,r,{index:s}=e,{store:c}=e;const a=c.oversizedRatio;h(t,a,t=>n(0,i=t));const l=c.loading;h(t,l,t=>n(3,o=t));const u={delay:150+50*s,duration:250,y:2,easing:At};let d;const f=function(){const t=H();return(e,n,{cancelable:i=!1}={})=>{const o=t.$$.callbacks[e];if(o){const r=R(e,n,{cancelable:i});return o.slice().forEach(e=>{e.call(t,r)}),!r.defaultPrevented}return!0}}();return t.$$set=t=>{"index"in t&&n(8,s=t.index),"store"in t&&n(9,c=t.store)},t.$$.update=()=>{1&t.$$.dirty&&n(1,r=i>4?"high":i>2.5?"medium":"normal")},[i,r,d,o,a,l,u,function(){const t=d.getBoundingClientRect();f("hover",{index:s,position:{top:t.top+t.height+10,left:t.left}})},s,c,function(t){G[t?"unshift":"push"](()=>{d=t,n(2,d)})}]}class se extends bt{constructor(t){super(),yt(this,t,re,oe,c,{index:8,store:9})}}function ce(t){let e,n;const i=t[2].default,o=function(t,e,n,i){if(t){const o=f(t,e,n,i);return t[0](o)}}(i,t,t[1],null);return{c(){e=S("div"),o&&o.c(),O(e,"class","jetpack-boost-guide-portal")},m(i,r){_(i,e,r),o&&o.m(e,null),t[3](e),n=!0},p(t,[e]){o&&o.p&&(!n||2&e)&&function(t,e,n,i,o,r){if(o){const s=f(e,n,i,r);t.p(s,o)}}(o,i,t,t[1],n?function(t,e,n,i){if(t[2]&&i){const o=t[2](i(n));if(void 0===e.dirty)return o;if("object"==typeof o){const t=[],n=Math.max(e.dirty.length,o.length);for(let i=0;i<n;i+=1)t[i]=e.dirty[i]|o[i];return t}return e.dirty|o}return e.dirty}(i,t[1],e,null):function(t){if(t.ctx.length>32){const e=[],n=t.ctx.length/32;for(let t=0;t<n;t++)e[t]=-1;return e}return-1}(t[1]),null)},i(t){n||(ut(o,t),n=!0)},o(t){dt(o,t),n=!1},d(n){n&&z(e),o&&o.d(n),t[3](null)}}}function ae(t,e,n){let i,{$$slots:o={},$$scope:r}=e;var s;return N(()=>{document.body.appendChild(i)}),s=()=>{document.body.removeChild(i)},H().$$.on_destroy.push(s),t.$$set=t=>{"$$scope"in t&&n(1,r=t.$$scope)},[i,r,o,function(t){G[t?"unshift":"push"](()=>{i=t,n(0,i)})}]}class le extends bt{constructor(t){super(),yt(this,t,ae,ce,c,{})}}function ue(t){let n,i;return{c(){n=C("svg"),i=C("path"),O(i,"d","M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"),O(n,"xmlns","http://www.w3.org/2000/svg"),O(n,"viewBox","0 0 24 24"),O(n,"class","svelte-1336127")},m(t,e){_(t,n,e),b(n,i)},p:e,i:e,o:e,d(t){t&&z(n)}}}class de extends bt{constructor(t){super(),yt(this,t,null,ue,c,{})}}function he(t){let e,n,i,o,r=t[29]+"";return{c(){e=S("div"),n=E("The image file is "),i=E(r),o=E("x smaller than expected on this screen. This might be\n\t\t\t\t\t\tfine, but you may want to check if the image appears blurry."),O(e,"class","explanation svelte-52p8v6")},m(t,r){_(t,e,r),b(e,n),b(e,i),b(e,o)},p(t,e){8&e&&r!==(r=t[29]+"")&&T(i,r)},d(t){t&&z(e)}}}function fe(t){let e,n,i=t[6]>1&&me(t);return{c(){e=S("div"),n=E("The image size is very close to the size it appears in the browser.\n\t\t\t\t\t\t"),i&&i.c(),O(e,"class","explanation svelte-52p8v6")},m(t,o){_(t,e,o),b(e,n),i&&i.m(e,null)},p(t,n){t[6]>1?i?i.p(t,n):(i=me(t),i.c(),i.m(e,null)):i&&(i.d(1),i=null)},d(t){t&&z(e),i&&i.d()}}}function pe(t){let n;return{c(){n=S("div"),n.textContent="The image is exactly the correct size for this screen.",O(n,"class","explanation svelte-52p8v6")},m(t,e){_(t,n,e)},p:e,d(t){t&&z(n)}}}function ge(t){let e,n,i,o,r,s,c=t[4].weight>450&&$e();return{c(){e=S("div"),n=E("The image loaded is "),i=S("strong"),o=E(t[6]),r=E("x"),s=E(" larger than it appears in the browser.\n\t\t\t\t\t\t"),c&&c.c(),O(e,"class","explanation svelte-52p8v6")},m(t,a){_(t,e,a),b(e,n),b(e,i),b(i,o),b(i,r),b(e,s),c&&c.m(e,null)},p(t,n){64&n&&T(o,t[6]),t[4].weight>450?c||(c=$e(),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},d(t){t&&z(e),c&&c.d()}}}function me(t){let e,n,i,o,r;return{c(){e=E("Because there are various screen sizes, it's okay for the image to be\n\t\t\t\t\t\t\t"),n=S("strong"),i=E(t[6]),o=E("x"),r=E(" than it appears on the page.")},m(t,s){_(t,e,s),_(t,n,s),b(n,i),b(n,o),_(t,r,s)},p(t,e){64&e&&T(i,t[6])},d(t){t&&(z(e),z(n),z(r))}}}function $e(t){let e;return{c(){e=E("Try using a smaller image or reduce the file size by compressing it.")},m(t,n){_(t,e,n)},d(t){t&&z(e)}}}function ve(t){let e,n;return{c(){e=S("img"),l(e.src,n=t[5])||O(e,"src",n),O(e,"alt",t[8]),j(e,"width",t[2]+"px"),j(e,"height",t[7]+"px"),O(e,"width",t[2]),O(e,"height",t[7]),O(e,"class","svelte-52p8v6")},m(t,n){_(t,e,n)},p(t,i){32&i&&!l(e.src,n=t[5])&&O(e,"src",n),256&i&&O(e,"alt",t[8]),4&i&&j(e,"width",t[2]+"px"),128&i&&j(e,"height",t[7]+"px"),4&i&&O(e,"width",t[2]),128&i&&O(e,"height",t[7])},d(t){t&&z(e)}}}function we(t){let e;function n(t,e){return t[17]?xe:be}let i=n(t),o=i(t);return{c(){e=S("div"),o.c(),O(e,"class","value")},m(t,n){_(t,e,n),o.m(e,null)},p(t,r){i!==(i=n(t))&&(o.d(1),o=i(t),o&&(o.c(),o.m(e,null)))},d(t){t&&z(e),o.d()}}}function ye(t){let e,n,i,o,r=t[4].width+"",s=t[4].height+"";return{c(){e=S("div"),n=E(r),i=E(" x "),o=E(s),O(e,"class","value")},m(t,r){_(t,e,r),b(e,n),b(e,i),b(e,o)},p(t,e){16&e&&r!==(r=t[4].width+"")&&T(n,r),16&e&&s!==(s=t[4].height+"")&&T(o,s)},d(t){t&&z(e)}}}function be(t){let e;return{c(){e=S("em"),e.textContent="Unknown"},m(t,n){_(t,e,n)},d(t){t&&z(e)}}}function xe(t){let e;return{c(){e=E("Loading...")},m(t,n){_(t,e,n)},d(t){t&&z(e)}}}function ke(t){let n;return{c(){n=S("em"),n.textContent="Unknown"},m(t,e){_(t,n,e)},p:e,d(t){t&&z(n)}}}function _e(t){let n;return{c(){n=E("Loading...")},m(t,e){_(t,n,e)},p:e,d(t){t&&z(n)}}}function ze(t){let e,n,i=Math.round(t[20].weight)+"";return{c(){e=E(i),n=E(" KB")},m(t,i){_(t,e,i),_(t,n,i)},p(t,n){1048576&n&&i!==(i=Math.round(t[20].weight)+"")&&T(e,i)},d(t){t&&(z(e),z(n))}}}function Se(t){let n;return{c(){n=S("em"),n.textContent="N/A"},m(t,e){_(t,n,e)},p:e,d(t){t&&z(n)}}}function Ce(t){let n;return{c(){n=E("Loading...")},m(t,e){_(t,n,e)},p:e,d(t){t&&z(n)}}}function Ee(t){let e,n,i;return{c(){e=S("strong"),n=E(t[21]),i=E(" KB")},m(t,o){_(t,e,o),b(e,n),b(e,i)},p(t,e){2097152&e&&T(n,t[21])},d(t){t&&z(e)}}}function Le(t){let e,n,i,o,r,s,c,a,l,u,d,h,f,p,g,m,$,v,w,y,x,k,C,M,I,R,F,W,U,A,B,D,H,N,q,V,G,Z,K,X,Y,Q,tt,et,nt,it,ot,rt,st,ct,at,lt=t[18].width+"",ht=t[18].height+"",pt=t[19].width+"",gt=t[19].height+"",wt=`${t[0].top}px`,yt=`${t[0].left}px`;function bt(t,e){return t[6]>=1.3?ge:1===t[6]?pe:t[6]>=.99&&t[6]<1.3?fe:he}function xt(t,e){return e===he?function(t){const e=t.slice(),n=Oe(1/e[3]);return e[29]=n,e}(t):t}i=new Vt({props:{size:250}});let kt=bt(t),_t=kt(xt(t,kt)),zt=t[5]&&ve(t);function St(t,e){return t[4].width>0&&t[4].height>0?ye:we}let Ct=St(t),Et=Ct(t);function Lt(t,e){return t[20].weight>0?ze:t[17]?_e:ke}let Mt=Lt(t),Pt=Mt(t);function Ot(t,e){return t[21]>0?Ee:t[17]?Ce:Se}let Tt=Ot(t),jt=Tt(t);return ot=new de({}),{c(){e=S("div"),n=S("div"),mt(i.$$.fragment),o=L(),r=S("div"),s=S("div"),c=S("div"),a=S("a"),l=E(t[8]),u=L(),_t.c(),d=L(),zt&&zt.c(),h=L(),f=S("div"),p=S("div"),g=S("div"),g.textContent="Image File Dimensions",m=L(),Et.c(),$=L(),v=S("div"),w=S("div"),w.textContent="Expected Dimensions",y=L(),x=S("div"),k=E(lt),C=E(" x "),M=E(ht),I=L(),R=S("div"),F=S("div"),F.textContent="Size on screen",W=L(),U=S("div"),A=E(pt),B=E(" x "),D=E(gt),H=L(),N=S("div"),q=S("div"),q.textContent="Image Size",V=L(),G=S("div"),Pt.c(),Z=L(),K=S("div"),X=S("div"),X.textContent="Potential savings",Y=L(),Q=S("div"),jt.c(),tt=L(),et=S("div"),nt=S("a"),it=E("Learn how to improve site speed by optimizing images "),mt(ot.$$.fragment),O(n,"class","logo svelte-52p8v6"),O(a,"href",t[5]),O(a,"target","_blank noreferrer"),O(a,"class","svelte-52p8v6"),O(c,"class","title svelte-52p8v6"),O(s,"class","description svelte-52p8v6"),O(r,"class","preview svelte-52p8v6"),O(g,"class","label"),O(p,"class","row svelte-52p8v6"),O(w,"class","label"),O(x,"class","value"),O(v,"class","row svelte-52p8v6"),O(F,"class","label"),O(U,"class","value"),O(R,"class","row svelte-52p8v6"),O(q,"class","label"),O(G,"class","value"),O(N,"class","row svelte-52p8v6"),O(X,"class","label"),O(Q,"class","value"),O(K,"class","row svelte-52p8v6"),O(nt,"class","documentation svelte-52p8v6"),O(nt,"href",Pe),O(nt,"target","_blank noreferrer"),O(et,"class","info svelte-52p8v6"),O(f,"class","meta"),O(e,"class","jetpack-boost-guide-popup keep-guide-open svelte-52p8v6"),j(e,"top",wt),j(e,"left",yt)},m(z,S){_(z,e,S),b(e,n),$t(i,n,null),b(e,o),b(e,r),b(r,s),b(s,c),b(c,a),b(a,l),b(s,u),_t.m(s,null),b(r,d),zt&&zt.m(r,null),b(e,h),b(e,f),b(f,p),b(p,g),b(p,m),Et.m(p,null),b(f,$),b(f,v),b(v,w),b(v,y),b(v,x),b(x,k),b(x,C),b(x,M),b(f,I),b(f,R),b(R,F),b(R,W),b(R,U),b(U,A),b(U,B),b(U,D),b(f,H),b(f,N),b(N,q),b(N,V),b(N,G),Pt.m(G,null),b(f,Z),b(f,K),b(K,X),b(K,Y),b(K,Q),jt.m(Q,null),b(f,tt),b(f,et),b(et,nt),b(nt,it),$t(ot,nt,null),st=!0,ct||(at=P(e,"mouseleave",t[24]),ct=!0)},p(t,n){(!st||256&n)&&T(l,t[8]),(!st||32&n)&&O(a,"href",t[5]),kt===(kt=bt(t))&&_t?_t.p(xt(t,kt),n):(_t.d(1),_t=kt(xt(t,kt)),_t&&(_t.c(),_t.m(s,null))),t[5]?zt?zt.p(t,n):(zt=ve(t),zt.c(),zt.m(r,null)):zt&&(zt.d(1),zt=null),Ct===(Ct=St(t))&&Et?Et.p(t,n):(Et.d(1),Et=Ct(t),Et&&(Et.c(),Et.m(p,null))),(!st||262144&n)&<!==(lt=t[18].width+"")&&T(k,lt),(!st||262144&n)&&ht!==(ht=t[18].height+"")&&T(M,ht),(!st||524288&n)&&pt!==(pt=t[19].width+"")&&T(A,pt),(!st||524288&n)&>!==(gt=t[19].height+"")&&T(D,gt),Mt===(Mt=Lt(t))&&Pt?Pt.p(t,n):(Pt.d(1),Pt=Mt(t),Pt&&(Pt.c(),Pt.m(G,null))),Tt===(Tt=Ot(t))&&jt?jt.p(t,n):(jt.d(1),jt=Tt(t),jt&&(jt.c(),jt.m(Q,null))),1&n&&wt!==(wt=`${t[0].top}px`)&&j(e,"top",wt),1&n&&yt!==(yt=`${t[0].left}px`)&&j(e,"left",yt)},i(t){st||(ut(i.$$.fragment,t),ut(ot.$$.fragment,t),t&&(rt||J(()=>{rt=ft(e,Ht,{duration:150,y:4,easing:At}),rt.start()})),st=!0)},o(t){dt(i.$$.fragment,t),dt(ot.$$.fragment,t),st=!1},d(t){t&&z(e),vt(i),_t.d(),zt&&zt.d(),Et.d(),Pt.d(),jt.d(),vt(ot),ct=!1,at()}}}function Me(t){let e,n,i,o,r,s=!1,c=()=>{s=!1};return J(t[25]),n=new le({props:{$$slots:{default:[Le]},$$scope:{ctx:t}}}),{c(){mt(n.$$.fragment)},m(a,l){$t(n,a,l),i=!0,o||(r=P(window,"scroll",()=>{s=!0,clearTimeout(e),e=setTimeout(c,100),t[25]()}),o=!0)},p(t,[i]){2&i&&!s&&(s=!0,clearTimeout(e),scrollTo(window.pageXOffset,t[1]),e=setTimeout(c,100));const o={};1077805565&i&&(o.$$scope={dirty:i,ctx:t}),n.$set(o)},i(t){i||(ut(n.$$.fragment,t),i=!0)},o(t){dt(n.$$.fragment,t),i=!1},d(t){vt(n,t),o=!1,r()}}}const Pe="https://jetpack.com/support/jetpack-boost/image-performance-guide/";function Oe(t){return t%1==0?t:parseFloat(t.toFixed(2))}function Te(t,n,i){let o,r,s,c,a,l,d,h,f,p,g,m,$,v,w,y,b,x,k,_,z=e,S=e,C=e,E=e,L=e,M=e,P=e,O=e;t.$$.on_destroy.push(()=>z()),t.$$.on_destroy.push(()=>S()),t.$$.on_destroy.push(()=>C()),t.$$.on_destroy.push(()=>E()),t.$$.on_destroy.push(()=>L()),t.$$.on_destroy.push(()=>M()),t.$$.on_destroy.push(()=>P()),t.$$.on_destroy.push(()=>O());let{store:T}=n,{size:j}=n,{position:I}=n,R=0,F=0,W=0;return N(()=>{F=R,W=I.top}),t.$$set=t=>{"store"in t&&i(22,T=t.store),"size"in t&&i(23,j=t.size),"position"in t&&i(0,I=t.position)},t.$$.update=()=>{var e;4194304&t.$$.dirty&&(i(16,o=T.loading),E(),E=u(o,t=>i(17,y=t))),4194304&t.$$.dirty&&(i(15,r=T.oversizedRatio),z(),z=u(r,t=>i(3,$=t))),4194304&t.$$.dirty&&(i(14,s=T.fileSize),S(),S=u(s,t=>i(4,v=t))),4194304&t.$$.dirty&&(i(13,c=T.fileWeight),P(),P=u(c,t=>i(20,k=t))),4194304&t.$$.dirty&&(i(12,a=T.sizeOnPage),M(),M=u(a,t=>i(19,x=t))),4194304&t.$$.dirty&&(i(11,l=T.potentialSavings),O(),O=u(l,t=>i(21,_=t))),4194304&t.$$.dirty&&(i(10,d=T.expectedSize),L(),L=u(d,t=>i(18,b=t))),4194304&t.$$.dirty&&(i(9,h=T.url),C(),C=u(h,t=>i(5,w=t))),32&t.$$.dirty&&i(8,f=w.split("/").pop()),8388608&t.$$.dirty&&i(2,p="normal"===j?100:50),20&t.$$.dirty&&i(7,g=Math.floor(p/(v.width/v.height))),8&t.$$.dirty&&i(6,m=Oe($)),2&t.$$.dirty&&0!==(e=R)&&F!==e&&i(0,I.top=W+(F-e),I)},[I,R,p,$,v,w,m,g,f,h,d,l,a,c,s,r,o,y,b,x,k,_,T,j,function(e){q.call(this,t,e)},function(){i(1,R=window.pageYOffset)}]}class je extends bt{constructor(t){super(),yt(this,t,Te,Me,c,{store:22,size:23,position:0})}}function Ie(t,e,n){const i=t.slice();return i[12]=e[n],i[14]=n,i}function Re(t){let e,n,i,o,r,s,c,a=gt(t[0]),l=[];for(let e=0;e<a.length;e+=1)l[e]=Fe(Ie(t,a,e));const u=t=>dt(l[t],1,1,()=>{l[t]=null});let d=!1!==t[1]&&We(t);return{c(){e=S("div"),n=S("div");for(let t=0;t<l.length;t+=1)l[t].c();i=L(),d&&d.c(),O(n,"class","previews svelte-1s5z1op"),O(e,"class",o="guide "+t[3]+" svelte-1s5z1op"),I(e,"show",!1!==t[1]),I(e,"keep-guide-open",!1!==t[1])},m(o,a){_(o,e,a),b(e,n);for(let t=0;t<l.length;t+=1)l[t]&&l[t].m(n,null);b(e,i),d&&d.m(e,null),r=!0,s||(c=P(e,"mouseleave",t[6]),s=!0)},p(t,i){if(257&i){let e;for(a=gt(t[0]),e=0;e<a.length;e+=1){const o=Ie(t,a,e);l[e]?(l[e].p(o,i),ut(l[e],1)):(l[e]=Fe(o),l[e].c(),ut(l[e],1),l[e].m(n,null))}for(at(),e=a.length;e<l.length;e+=1)u(e);lt()}!1!==t[1]?d?(d.p(t,i),2&i&&ut(d,1)):(d=We(t),d.c(),ut(d,1),d.m(e,null)):d&&(at(),dt(d,1,1,()=>{d=null}),lt()),(!r||8&i&&o!==(o="guide "+t[3]+" svelte-1s5z1op"))&&O(e,"class",o),(!r||10&i)&&I(e,"show",!1!==t[1]),(!r||10&i)&&I(e,"keep-guide-open",!1!==t[1])},i(t){if(!r){for(let t=0;t<a.length;t+=1)ut(l[t]);ut(d),r=!0}},o(t){l=l.filter(Boolean);for(let t=0;t<l.length;t+=1)dt(l[t]);dt(d),r=!1},d(t){t&&z(e),function(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}(l,t),d&&d.d(),s=!1,c()}}}function Fe(t){let e,n;return e=new se({props:{index:t[14],store:t[12]}}),e.$on("hover",t[8]),{c(){mt(e.$$.fragment)},m(t,i){$t(e,t,i),n=!0},p(t,n){const i={};1&n&&(i.store=t[12]),e.$set(i)},i(t){n||(ut(e.$$.fragment,t),n=!0)},o(t){dt(e.$$.fragment,t),n=!1},d(t){vt(e,t)}}}function We(t){let e,n;return e=new je({props:{store:t[0][t[1]],size:t[3],position:t[2]}}),e.$on("mouseleave",t[6]),{c(){mt(e.$$.fragment)},m(t,i){$t(e,t,i),n=!0},p(t,n){const i={};3&n&&(i.store=t[0][t[1]]),8&n&&(i.size=t[3]),4&n&&(i.position=t[2]),e.$set(i)},i(t){n||(ut(e.$$.fragment,t),n=!0)},o(t){dt(e.$$.fragment,t),n=!1},d(t){vt(e,t)}}}function Ue(t){let e,n,i="active"===t[4]&&t[5]&&Re(t);return{c(){i&&i.c(),e=M()},m(t,o){i&&i.m(t,o),_(t,e,o),n=!0},p(t,[n]){"active"===t[4]&&t[5]?i?(i.p(t,n),48&n&&ut(i,1)):(i=Re(t),i.c(),ut(i,1),i.m(e.parentNode,e)):i&&(at(),dt(i,1,1,()=>{i=null}),lt())},i(t){n||(ut(i),n=!0)},o(t){dt(i),n=!1},d(t){t&&z(e),i&&i.d(t)}}}function Ae(t,e,n){let i,o,r,s;h(t,Pt,t=>n(4,r=t));let{stores:c}=e,a=!1;N(()=>{c.forEach(t=>t.updateDimensions())});const l=c[0].sizeOnPage;h(t,l,t=>n(10,o=t));let u={top:0,left:0};const d=_t(c.map(t=>t.fileSize),t=>t.some(t=>-1!==t.width&&-1!==t.height));return h(t,d,t=>n(5,s=t)),t.$$set=t=>{"stores"in t&&n(0,c=t.stores)},t.$$.update=()=>{1024&t.$$.dirty&&n(3,i=function(t=-1,e=-1){return t<200||e<200?"micro":t<400||e<400?"small":"normal"}(o.width,o.height)),2&t.$$.dirty&&function(t=!1){t?c.forEach(t=>t.node.classList.add("jetpack-boost-guide__backdrop")):c.forEach(t=>t.node.classList.remove("jetpack-boost-guide__backdrop"))}(!1!==a)},[c,a,u,i,r,s,function(t){t.relatedTarget&&t.relatedTarget.classList.contains("keep-guide-open")||n(1,a=!1)},l,function(t){const e=t.detail,i=e.index;n(2,u=e.position),n(1,a=i)},d,o]}class Be extends bt{constructor(t){super(),yt(this,t,Ae,Ue,c,{stores:0})}}const De=[];let He;function Ne(t){window.frameElement||(He=t,window.addEventListener("load",qe))}function qe(){window.addEventListener("resize",function(){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{De.forEach(t=>{t.updateDimensions()})},500)}}()),jt.trackInitialState(),Pt.subscribe(async t=>{if("paused"===t)return;const e=await Wt(Array.from(document.querySelectorAll("body *:not(.jetpack-boost-guide > *):not(.jetpack-boost-guide):not(#wpadminbar *)")),He),n=await Promise.all(e.map(t=>t.isImageTiny()));De.push(...function(t){const e=t.reduce((t,e)=>{var n;if(!e.node.parentNode)return console.error("Image has no parent",e.node),t;const i=function(t){const e=t.node;if(!(t.node instanceof HTMLImageElement)&&["static","relative"].includes(getComputedStyle(e).position))return e.classList.contains("jetpack-boost-guide")||(e.classList.add("jetpack-boost-guide","relative"),e.dataset.jetpackBoostGuideId=(++Ve).toString()),e;if(!e.parentNode||!e.parentElement)return;const n=function(t){let e,n=t.parentElement;for(;n&&n instanceof HTMLElement&&n!==document.body;){const t=getComputedStyle(n),i="inline"!==t.display,o="static"===t.position,r="relative"===t.position,s="auto"!==t.zIndex;i&&(!e&&(o||r)||r&&s)&&(e=n),n=n.parentElement}return e}(e);if(null==n?void 0:n.classList.contains("jetpack-boost-guide"))return n;if(n){const e=getComputedStyle(n);if("relative"===e.position){const t=Array.from(n.children).find(t=>t.classList.contains("jetpack-boost-guide"));if(t&&t instanceof HTMLElement)return t}const i=document.createElement("div");return i.classList.add("jetpack-boost-guide"),i.dataset.jetpackBoostGuideId=(++Ve).toString(),"static"===e.position&&(n.style.position="relative"),t.node instanceof HTMLImageElement&&(i.style.top=`${t.node.offsetTop}px`),n.prepend(i),i}return e.parentElement}(e);if(!i)return console.error("Could not find a parent for image",e),t;const o=parseInt(i.dataset.jetpackBoostGuideId||""),r=(null===(n=t[o])||void 0===n?void 0:n.props.stores)||[],s=new Tt(e);return r.push(s),1===r.length&&(t[o]={target:i,intro:!0,props:{stores:r}}),t},{});return Object.values(e).map(t=>(new Be(t),t.props.stores)).flat()}(e.filter((t,e)=>!n[e]))),jt.trackPage(De)})}let Ve=0;function Ge(t){let e,n,i,o,r,s,c,a,l,u;return n=new Vt({}),{c(){e=S("a"),mt(n.$$.fragment),i=L(),o=S("span"),r=E("Image Guide: "),s=E(t[2]),O(e,"id","jetpack-boost-guide-bar"),O(e,"href",t[0]),O(e,"class",c="ab-item "+t[1]+" svelte-itog5b")},m(c,d){var h;_(c,e,d),$t(n,e,null),b(e,i),b(e,o),b(o,r),b(o,s),a=!0,l||(u=P(e,"click",(h=t[3],function(t){return t.preventDefault(),h.call(this,t)})),l=!0)},p(t,[n]){(!a||4&n)&&T(s,t[2]),(!a||1&n)&&O(e,"href",t[0]),(!a||2&n&&c!==(c="ab-item "+t[1]+" svelte-itog5b"))&&O(e,"class",c)},i(t){a||(ut(n.$$.fragment,t),a=!0)},o(t){dt(n.$$.fragment,t),a=!1},d(t){t&&z(e),vt(n),l=!1,u()}}}function Ze(t,e,n){let i,o;h(t,Pt,t=>n(1,i=t)),h(t,Ot,t=>n(2,o=t));let{href:r}=e,{tracksCallback:s}=e;return t.$$set=t=>{"href"in t&&n(0,r=t.href),"tracksCallback"in t&&n(4,s=t.tracksCallback)},t.$$.update=()=>{16&t.$$.dirty&&jt.setTracksCallback(s)},[r,i,o,function(){Pt.cycle(),jt.trackUIStateChange()},s]}class Ke extends bt{constructor(t){super(),yt(this,t,Ze,Ge,c,{href:0,tracksCallback:4})}}function Xe(t,{href:e,tracksCallback:n,fetchFunction:i}){return Ne(i),new Ke({target:t,props:{href:e,tracksCallback:n}})}export{t as MeasurableImage,Wt as getMeasurableImages,Xe as setupImageGuideUI};
|
|
1
|
+
const e=globalThis.process?.env?.NODE_ENV;var t=e&&!e.toLowerCase().startsWith("prod"),n=Array.isArray,r=Array.prototype.indexOf,i=Array.prototype.includes,s=Array.from,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyDescriptors,c=Object.prototype,f=Array.prototype,u=Object.getPrototypeOf,d=Object.isExtensible;const h=()=>{};function v(e){return e()}function p(e){for(var t=0;t<e.length;t++)e[t]()}function g(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}const m=16,_=32,w=64,y=512,b=1024,k=2048,x=4096,S=8192,$=16384,E=32768,z=1<<25,M=65536,L=1<<17,T=1<<19,j=1<<25,O=65536,C=1<<21,P=1<<22,A=1<<23,R=Symbol("$state"),I=Symbol("legacy props"),W=Symbol(""),D=Symbol("proxy path"),F=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function q(e){if(t){const t=new Error(`lifecycle_outside_component\n\`${e}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function N(e,n,r){if(t){const t=new Error(`each_key_duplicate\n${r?`Keyed each block has duplicate key \`${r}\` at indexes ${e} and ${n}`:`Keyed each block has duplicate key at indexes ${e} and ${n}`}\nhttps://svelte.dev/e/each_key_duplicate`);throw t.name="Svelte error",t}throw new Error("https://svelte.dev/e/each_key_duplicate")}function U(e,n,r){if(t){const t=new Error(`each_key_volatile\nKeyed each block has key that is not idempotent — the key for item at index ${e} was \`${n}\` but is now \`${r}\`. Keys must be the same each time for a given item\nhttps://svelte.dev/e/each_key_volatile`);throw t.name="Svelte error",t}throw new Error("https://svelte.dev/e/each_key_volatile")}const H=Symbol(),B=Symbol("filename"),V="http://www.w3.org/1999/xhtml";var K="font-weight: bold",Z="font-weight: normal";function G(e){t?console.warn(`%c[svelte] state_proxy_equality_mismatch\n%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${e}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,K,Z):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function X(e){return e===this.v}function Y(e,t){return e!=e?t==t:e!==t||null!==e&&"object"==typeof e||"function"==typeof e}function J(e){return!Y(e,this.v)}let Q=!1;function ee(e,t){return e.label=t,te(e.v,t),e}function te(e,t){return e?.[D]?.(t),e}function ne(e){const t=new Error,n=function(){const e=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const t=(new Error).stack;if(Error.stackTraceLimit=e,!t)return[];const n=t.split("\n"),r=[];for(let e=0;e<n.length;e++){const t=n[e],i=t.replaceAll("\\","/");if("Error"!==t.trim()){if(t.includes("validate_each_keys"))return[];i.includes("svelte/src/internal")||i.includes("node_modules/.vite")||r.push(t)}}return r}();return 0===n.length?null:(n.unshift("\n"),o(t,"stack",{value:n.join("\n")}),o(t,"name",{value:e}),t)}function re(e,n){if(!t)throw new Error("invariant(...) was not guarded by if (DEV)");e||function(e){if(t){const t=new Error(`invariant_violation\nAn invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${e}"\nhttps://svelte.dev/e/invariant_violation`);throw t.name="Svelte error",t}throw new Error("https://svelte.dev/e/invariant_violation")}(n)}let ie=null;function se(e){ie=e}let oe=null;function ae(e){oe=e}let le=null;function ce(e){le=e}function fe(e,n=!1,r){ie={p:ie,i:!1,c:null,e:null,s:e,x:null,r:pn,l:Q&&!n?{s:null,u:null,$:[]}:null},t&&(ie.function=r,le=r)}function ue(e){var n=ie,r=n.e;if(null!==r)for(var i of(n.e=null,r))Bt(i);return void 0!==e&&(n.x=e),n.i=!0,ie=n.p,t&&(le=ie?.function??null),e??{}}function de(){return!Q||null!==ie&&null===ie.l}let he=[];function ve(e){if(0===he.length&&!We){var t=he;queueMicrotask(()=>{t===he&&function(){var e=he;he=[],p(e)}()})}he.push(e)}const pe=new WeakMap;function ge(e){var n=pn;if(null===n)return dn.f|=A,e;if(t&&e instanceof Error&&!pe.has(e)&&pe.set(e,function(e,t){const n=a(e,"message");if(n&&!n.configurable)return;var r=Lt?" ":"\t",i=`\n${r}in ${t.fn?.name||"<unknown>"}`,s=t.ctx;for(;null!==s;)i+=`\n${r}in ${s.function?.[B].split("/").pop()}`,s=s.p;return{message:e.message+`\n${i}\n`,stack:e.stack?.split("\n").filter(e=>!e.includes("svelte/src/internal")).join("\n")}}(e,n)),0===(n.f&E)&&!(4&n.f))throw t&&!n.parent&&e instanceof Error&&_e(e),e;me(e,n)}function me(e,n){for(;null!==n;){if(128&n.f){if(0===(n.f&E))throw e;try{return void n.b.error(e)}catch(t){e=t}}n=n.parent}throw t&&e instanceof Error&&_e(e),e}function _e(e){const t=pe.get(e);t&&(o(e,"message",{value:t.message}),o(e,"stack",{value:t.stack}))}const we=-7169;function ye(e,t){e.f=e.f&we|t}function be(e){0!==(e.f&y)||null===e.deps?ye(e,b):ye(e,x)}function ke(e){if(null!==e)for(const t of e)2&t.f&&0!==(t.f&O)&&(t.f^=O,ke(t.deps))}function xe(e,t,n){0!==(e.f&k)?t.add(e):0!==(e.f&x)&&n.add(e),ke(e.deps),ye(e,b)}function Se(e,t,n){if(null==e)return t(void 0),n&&n(void 0),h;const r=Rn(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}const $e=[];function Ee(e,t=h){let n=null;const r=new Set;function i(t){if(Y(e,t)&&(e=t,n)){const t=!$e.length;for(const t of r)t[1](),$e.push(t,e);if(t){for(let e=0;e<$e.length;e+=2)$e[e][0]($e[e+1]);$e.length=0}}}function s(t){i(t(e))}return{set:i,update:s,subscribe:function(o,a=h){const l=[o,a];return r.add(l),1===r.size&&(n=t(i,s)||h),o(e),()=>{r.delete(l),0===r.size&&n&&(n(),n=null)}}}}function ze(e,t,n){const r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=t.length<2;return o=(e,n)=>{let o=!1;const a=[];let l=0,c=h;const f=()=>{if(l)return;c();const i=t(r?a[0]:a,e,n);s?e(i):c="function"==typeof i?i:h},u=i.map((e,t)=>Se(e,e=>{a[t]=e,l&=~(1<<t),o&&f()},()=>{l|=1<<t}));return o=!0,f(),function(){p(u),c(),o=!1}},{subscribe:Ee(n,o).subscribe};var o}function Me(e){let t;return Se(e,e=>t=e)(),t}let Le=!1,Te=Symbol();function je(e,n,r){const i=r[n]??={store:null,source:mt(void 0),unsubscribe:h};if(t&&(i.source.label=n),i.store!==e&&!(Te in r))if(i.unsubscribe(),i.store=e??null,null==e)i.source.v=void 0,i.unsubscribe=h;else{var s=!0;i.unsubscribe=Se(e,e=>{s?i.source.v=e:_t(i.source,e)}),s=!1}return e&&Te in r?Me(e):Cn(i.source)}function Oe(e,t,n){let r=n[t];return r&&r.store!==e&&(r.unsubscribe(),r.unsubscribe=h),e}function Ce(){const e={};return[e,function(){Ut(()=>{for(var t in e){e[t].unsubscribe()}o(e,Te,{enumerable:!1,value:!0})})}]}const Pe=new Set;let Ae=null,Re=null,Ie=null,We=!1,De=!1,Fe=null,qe=null;var Ne=0,Ue=t?new Set:null;let He=1;class Be{id=He++;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=0;#r=0;#i=null;#s=[];#o=new Set;#a=new Set;#l=new Map;is_fork=!1;#c=!1;#f(){return this.is_fork||this.#r>0}skip_effect(e){this.#l.has(e)||this.#l.set(e,{d:[],m:[]})}unskip_effect(e){var t=this.#l.get(e);if(t){for(var n of(this.#l.delete(e),t.d))ye(n,k),this.schedule(n);for(n of t.m)ye(n,x),this.schedule(n)}}#u(){if(Ne++>1e3&&(Pe.delete(this),function(){if(t){var e=new Map;for(const t of Ae.current.keys())for(const[r,i]of t.updated??[]){var n=e.get(r);n||(n={error:i.error,count:0},e.set(r,n)),n.count+=i.count}for(const t of e.values())t.error&&console.error(t.error)}try{!function(){if(t){const e=new Error("effect_update_depth_exceeded\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\nhttps://svelte.dev/e/effect_update_depth_exceeded");throw e.name="Svelte error",e}throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(e){t&&o(e,"stack",{value:""}),me(e,Ie)}}()),!this.#f()){for(const e of this.#o)this.#a.delete(e),ye(e,k),this.schedule(e);for(const e of this.#a)ye(e,x),this.schedule(e)}const e=this.#s;this.#s=[],this.apply();var n=Fe=[],r=[],i=qe=[];for(const t of e)try{this.#d(t,n,r)}catch(e){throw Je(t),e}if(Ae=null,i.length>0){var s=Be.ensure();for(const e of i)s.schedule(e)}if(Fe=null,qe=null,this.#f()){this.#h(r),this.#h(n);for(const[e,t]of this.#l)Ye(e,t)}else{0===this.#n&&Pe.delete(this),this.#o.clear(),this.#a.clear();for(const e of this.#e)e(this);this.#e.clear(),Ke(r),Ke(n),this.#i?.resolve()}var a=Ae;if(this.#s.length>0){const e=a??=this;e.#s.push(...this.#s.filter(t=>!e.#s.includes(t)))}if(null!==a){if(Pe.add(a),t)for(const e of this.current.keys())Ue.add(e);a.#u()}Pe.has(this)||this.#v()}#d(e,t,n){e.f^=b;for(var r=e.first;null!==r;){var i=r.f,s=!!(96&i);if(!(s&&0!==(i&b)||0!==(i&S)||this.#l.has(r))&&null!==r.fn){s?r.f^=b:4&i?t.push(r):zn(r)&&(0!==(i&m)&&this.#a.add(r),On(r));var o=r.first;if(null!==o){r=o;continue}}for(;null!==r;){var a=r.next;if(null!==a){r=a;break}r=r.parent}}}#h(e){for(var t=0;t<e.length;t+=1)xe(e[t],this.#o,this.#a)}capture(e,t){t===H||this.previous.has(e)||this.previous.set(e,t),0===(e.f&A)&&(this.current.set(e,e.v),Re?.set(e,e.v))}activate(){Ae=this}deactivate(){Ae=null,Re=null}flush(){var e=t?new Set:null;try{De=!0,Ae=this,this.#u()}finally{if(Ne=0,Ie=null,Fe=null,qe=null,De=!1,Ae=null,Re=null,dt.clear(),t)for(const t of e)t.updated=null}}discard(){for(const e of this.#t)e(this);this.#t.clear()}#v(){for(const l of Pe){var e=l.id<this.id,n=[];for(const[t,r]of this.current){if(l.current.has(t)){if(!e||r===l.current.get(t))continue;l.current.set(t,r)}n.push(t)}if(0!==n.length){var r=[...l.current.keys()].filter(e=>!this.current.has(e));if(r.length>0){t&&re(0===l.#s.length,"Batch has scheduled roots"),l.activate();var i=new Set,s=new Map;for(var o of n)Ze(o,r,i,s);if(l.#s.length>0){for(var a of(l.apply(),l.#s))l.#d(a,[],[]);l.#s=[]}l.deactivate()}}}}increment(e){this.#n+=1,e&&(this.#r+=1)}decrement(e,t){this.#n-=1,e&&(this.#r-=1),this.#c||t||(this.#c=!0,ve(()=>{this.#c=!1,this.flush()}))}transfer_effects(e,t){for(const t of e)this.#o.add(t);for(const e of t)this.#a.add(e);e.clear(),t.clear()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#i??=g()).promise}static ensure(){if(null===Ae){const e=Ae=new Be;De||(Pe.add(Ae),ve(()=>{Ae===e&&e.flush()}))}return Ae}apply(){Re=null}schedule(e){if(Ie=e,e.b?.is_pending&&16777228&e.f&&0===(e.f&E))e.b.defer_effect(e);else{for(var t=e;null!==t.parent;){var n=(t=t.parent).f;if(!(null===Fe||t!==pn||null!==dn&&2&dn.f))return;if(96&n){if(0===(n&b))return;t.f^=b}}this.#s.push(t)}}}let Ve=null;function Ke(e){var t=e.length;if(0!==t){for(var n=0;n<t;){var r=e[n++];if(!(24576&r.f)&&zn(r)&&(Ve=new Set,On(r),null===r.deps&&null===r.first&&null===r.nodes&&null===r.teardown&&null===r.ac&&nn(r),Ve?.size>0)){dt.clear();for(const e of Ve){if(24576&e.f)continue;const t=[e];let n=e.parent;for(;null!==n;)Ve.has(n)&&(Ve.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){const n=t[e];24576&n.f||On(n)}}Ve.clear()}}Ve=null}}function Ze(e,t,n,r){if(!n.has(e)&&(n.add(e),null!==e.reactions))for(const i of e.reactions){const e=i.f;2&e?Ze(i,t,n,r):4194320&e&&0===(e&k)&&Ge(i,t,r)&&(ye(i,k),Xe(i))}}function Ge(e,t,n){const r=n.get(e);if(void 0!==r)return r;if(null!==e.deps)for(const r of e.deps){if(i.call(t,r))return!0;if(2&r.f&&Ge(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function Xe(e){Ae.schedule(e)}function Ye(e,t){if(0===(e.f&_)||0===(e.f&b)){0!==(e.f&k)?t.d.push(e):0!==(e.f&x)&&t.m.push(e),ye(e,b);for(var n=e.first;null!==n;)Ye(n,t),n=n.next}}function Je(e){ye(e,b);for(var t=e.first;null!==t;)Je(t),t=t.next}class Qe{parent;is_pending=!1;transform_error;#p;#g=null;#m;#_;#w;#y=null;#b=null;#k=null;#x=null;#S=0;#$=0;#E=!1;#o=new Set;#a=new Set;#z=null;#M=function(e){let n,r=0,i=pt(0);return t&&ee(i,"createSubscriber version"),()=>{Nt()&&(Cn(i),Gt(()=>(0===r&&(n=Rn(()=>e(()=>bt(i)))),r+=1,()=>{ve(()=>{r-=1,0===r&&(n?.(),n=void 0,bt(i))})})))}}(()=>(this.#z=pt(this.#S),t&&ee(this.#z,"$effect.pending()"),()=>{this.#z=null}));constructor(e,t,n,r){this.#p=e,this.#m=t,this.#_=e=>{var t=pn;t.b=this,t.f|=128,n(e)},this.parent=pn.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#w=Yt(()=>{this.#L()},589824)}#T(){try{this.#y=Jt(()=>this.#_(this.#p))}catch(e){this.error(e)}}#j(e){const t=this.#m.failed;t&&(this.#k=Jt(()=>{t(this.#p,()=>e,()=>()=>{})}))}#O(){const e=this.#m.pending;e&&(this.is_pending=!0,this.#b=Jt(()=>e(this.#p)),ve(()=>{var e=this.#x=document.createDocumentFragment(),t=Ct();e.append(t),this.#y=this.#C(()=>Jt(()=>this.#_(t))),0===this.#$&&(this.#p.before(e),this.#x=null,rn(this.#b,()=>{this.#b=null}),this.#P(Ae))}))}#L(){try{if(this.is_pending=this.has_pending_snippet(),this.#$=0,this.#S=0,this.#y=Jt(()=>{this.#_(this.#p)}),this.#$>0){var e=this.#x=document.createDocumentFragment();ln(this.#y,e);const t=this.#m.pending;this.#b=Jt(()=>t(this.#p))}else this.#P(Ae)}catch(e){this.error(e)}}#P(e){this.is_pending=!1,e.transfer_effects(this.#o,this.#a)}defer_effect(e){xe(e,this.#o,this.#a)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#m.pending}#C(e){var t=pn,n=dn,r=ie;gn(this.#w),vn(this.#w),se(this.#w.ctx);try{return Be.ensure(),e()}catch(e){return ge(e),null}finally{gn(t),vn(n),se(r)}}#A(e,t){this.has_pending_snippet()?(this.#$+=e,0===this.#$&&(this.#P(t),this.#b&&rn(this.#b,()=>{this.#b=null}),this.#x&&(this.#p.before(this.#x),this.#x=null))):this.parent&&this.parent.#A(e,t)}update_pending_count(e,t){this.#A(e,t),this.#S+=e,this.#z&&!this.#E&&(this.#E=!0,ve(()=>{this.#E=!1,this.#z&&wt(this.#z,this.#S)}))}get_effect_pending(){return this.#M(),Cn(this.#z)}error(e){var n=this.#m.onerror;let r=this.#m.failed;if(!n&&!r)throw e;this.#y&&(tn(this.#y),this.#y=null),this.#b&&(tn(this.#b),this.#b=null),this.#k&&(tn(this.#k),this.#k=null);var i=!1,s=!1;const o=()=>{i?t?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",K,Z):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop"):(i=!0,s&&function(){if(t){const e=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw e.name="Svelte error",e}throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),null!==this.#k&&rn(this.#k,()=>{this.#k=null}),this.#C(()=>{this.#L()}))},a=e=>{try{s=!0,n?.(e,o),s=!1}catch(e){me(e,this.#w&&this.#w.parent)}r&&(this.#k=this.#C(()=>{try{return Jt(()=>{var t=pn;t.b=this,t.f|=128,r(this.#p,()=>e,()=>o)})}catch(e){return me(e,this.#w.parent),null}}))};ve(()=>{var t;try{t=this.transform_error(e)}catch(e){return void me(e,this.#w&&this.#w.parent)}null!==t&&"object"==typeof t&&"function"==typeof t.then?t.then(a,e=>me(e,this.#w&&this.#w.parent)):a(t)})}}function et(e,n,r,i){const s=de()?it:st;var o=e.filter(e=>!e.settled);if(0!==r.length||0!==o.length){var a=pn,l=function(){var e=pn,n=dn,r=ie,i=Ae;if(t)var s=oe;return function(o=!0){gn(e),vn(n),se(r),o&&0===(e.f&$)&&(i?.activate(),i?.apply()),t&&ae(s)}}(),c=1===o.length?o[0].promise:o.length>1?Promise.all(o.map(e=>e.promise)):null;if(0!==r.length){var f=nt();c?c.then(()=>{l(),d(),tt()}):d()}else c.then(()=>u(n.map(s)))}else i(n.map(s));function u(e){l();try{i(e)}catch(e){0===(a.f&$)&&me(e,a)}tt()}function d(){Promise.all(r.map(e=>function(e,n,r){let i=pn;null===i&&function(){if(t){const e=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw e.name="Svelte error",e}throw new Error("https://svelte.dev/e/async_derived_orphan")}();var s=void 0,o=pt(H);t&&(o.label=n);var a=!dn,l=new Map;(function(e){qt(4718592,e)})(()=>{var n=pn,c=g();s=c.promise;try{Promise.resolve(e()).then(c.resolve,c.reject).finally(tt)}catch(e){c.reject(e),tt()}var f=Ae;if(a){if(0!==(n.f&E))var u=nt();if(i.b.is_rendered())l.get(f)?.reject(F),l.delete(f);else{for(const e of l.values())e.reject(F);l.clear()}l.set(f,c)}const d=(e,i=void 0)=>{u&&u(i===F);if(i!==F&&0===(n.f&$)){if(f.activate(),i)o.f|=A,wt(o,i);else{0!==(o.f&A)&&(o.f^=A),wt(o,e);for(const[e,t]of l){if(l.delete(e),e===f)break;t.reject(F)}t&&void 0!==r&&(rt.add(o),setTimeout(()=>{rt.has(o)&&(!function(e,n){t?console.warn(`%c[svelte] await_waterfall\n%cAn async derived, \`${e}\` (${n}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\nhttps://svelte.dev/e/await_waterfall`,K,Z):console.warn("https://svelte.dev/e/await_waterfall")}(o.label,r),rt.delete(o))}))}f.deactivate()}};c.promise.then(d,e=>d(null,e||"unknown"))}),Ut(()=>{for(const e of l.values())e.reject(F)}),t&&(o.f|=P);return new Promise(e=>{function t(n){function r(){n===s?e(o):t(s)}n.then(r,r)}t(s)})}(e))).then(e=>u([...n.map(s),...e])).catch(e=>me(e,a)).finally(()=>f())}}function tt(e=!0){gn(null),vn(null),se(null),e&&Ae?.deactivate(),t&&ae(null)}function nt(){var e=pn.b,t=Ae,n=e.is_rendered();return e.update_pending_count(1,t),t.increment(n),(r=!1)=>{e.update_pending_count(-1,t),t.decrement(n,r)}}const rt=new Set;function it(e){var t=null!==dn&&2&dn.f?dn:null;null!==pn&&(pn.f|=T);const n={ctx:ie,deps:null,effects:null,equals:X,f:2050,fn:e,reactions:null,rv:0,v:H,wv:0,parent:t??pn,ac:null};return n}function st(e){const t=it(e);return t.equals=J,t}function ot(e){var t=e.effects;if(null!==t){e.effects=null;for(var n=0;n<t.length;n+=1)tn(t[n])}}let at=[];function lt(e){var n,r=pn;if(gn(function(e){for(var t=e.parent;null!==t;){if(!(2&t.f))return 0===(t.f&$)?t:null;t=t.parent}return null}(e)),t){let s=ut;ht(new Set);try{i.call(at,e)&&function(){if(t){const e=new Error("derived_references_self\nA derived value cannot reference itself recursively\nhttps://svelte.dev/e/derived_references_self");throw e.name="Svelte error",e}throw new Error("https://svelte.dev/e/derived_references_self")}(),at.push(e),e.f&=-65537,ot(e),n=Ln(e)}finally{gn(r),ht(s),at.pop()}}else try{e.f&=-65537,ot(e),n=Ln(e)}finally{gn(r)}return n}function ct(e){var t=e.v,n=lt(e);e.equals(n)||(e.wv=En(),Ae?.is_fork&&null!==e.deps||(e.v=n,Ae?.capture(e,t),null!==e.deps))?fn||(null!==Re?(Nt()||Ae?.is_fork)&&Re.set(e,n):be(e)):ye(e,b)}function ft(e){if(null!==e.effects)for(const t of e.effects)t.teardown&&On(t)}let ut=new Set;const dt=new Map;function ht(e){ut=e}let vt=!1;function pt(e,t){var n={f:0,v:e,reactions:null,equals:X,rv:0,wv:0};return n}function gt(e,t){const n=pt(e);var r;return r=n,null!==dn&&(null===mn?mn=[r]:mn.push(r)),n}function mt(e,t=!1,n=!0){const r=pt(e);return t||(r.equals=J),Q&&n&&null!==ie&&null!==ie.l&&(ie.l.s??=[]).push(r),r}function _t(e,n,r=!1){null===dn||hn&&0===(dn.f&L)||!de()||!(4325394&dn.f)||null!==mn&&i.call(mn,e)||function(){if(t){const e=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw e.name="Svelte error",e}throw new Error("https://svelte.dev/e/state_unsafe_mutation")}();let s=r?St(n):n;return t&&te(s,e.label),wt(e,s,qe)}function wt(e,n,r=null){if(!e.equals(n)){var i=e.v;fn?dt.set(e,n):dt.set(e,i),e.v=n;var s=Be.ensure();if(s.capture(e,i),t){if(null!==pn){e.updated??=new Map;const t=(e.updated.get("")?.count??0)+1;if(e.updated.set("",{error:null,count:t}),t>5){const t=ne("updated at");if(null!==t){let n=e.updated.get(t.stack);n||(n={error:t,count:0},e.updated.set(t.stack,n)),n.count++}}}null!==pn&&(e.set_during_effect=!0)}if(2&e.f){const t=e;0!==(e.f&k)&<(t),null===Re&&be(t)}e.wv=En(),kt(e,k,r),!de()||null===pn||0===(pn.f&b)||96&pn.f||(null===bn?function(e){bn=e}([e]):bn.push(e)),!s.is_fork&&ut.size>0&&!vt&&yt()}return n}function yt(){vt=!1;for(const e of ut)0!==(e.f&b)&&ye(e,x),zn(e)&&On(e);ut.clear()}function bt(e){_t(e,e.v+1)}function kt(e,n,r){var i=e.reactions;if(null!==i)for(var s=de(),o=i.length,a=0;a<o;a++){var l=i[a],c=l.f;if(s||l!==pn)if(t&&0!==(c&L))ut.add(l);else{var f=0===(c&k);if(f&&ye(l,n),2&c){var u=l;Re?.delete(u),0===(c&O)&&(c&y&&(l.f|=O),kt(u,x,r))}else if(f){var d=l;0!==(c&m)&&null!==Ve&&Ve.add(d),null!==r?r.push(d):Xe(d)}}}}const xt=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function St(e){if("object"!=typeof e||null===e||R in e)return e;const r=u(e);if(r!==c&&r!==f)return e;var i=new Map,s=n(e),o=gt(0),l=Sn,d=e=>{if(Sn===l)return e();var t=dn,n=Sn;vn(null),$n(l);var r=e();return vn(t),$n(n),r};s&&(i.set("length",gt(e.length)),t&&(e=new Proxy(e,{get(e,t,n){var r=Reflect.get(e,t,n);return zt.has(t)?function(...e){vt=!0;var t=r.apply(this,e);return yt(),t}:r}})));var h="";let v=!1;function p(e){if(!v){v=!0,ee(o,`${h=e} version`);for(const[e,t]of i)ee(t,$t(h,e));v=!1}}return new Proxy(e,{defineProperty(e,n,r){"value"in r&&!1!==r.configurable&&!1!==r.enumerable&&!1!==r.writable||function(){if(t){const e=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw e.name="Svelte error",e}throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var s=i.get(n);return void 0===s?d(()=>{var e=gt(r.value);return i.set(n,e),t&&"string"==typeof n&&ee(e,$t(h,n)),e}):_t(s,r.value,!0),!0},deleteProperty(e,n){var r=i.get(n);if(void 0===r){if(n in e){const e=d(()=>gt(H));i.set(n,e),bt(o),t&&ee(e,$t(h,n))}}else _t(r,H),bt(o);return!0},get(n,r,s){if(r===R)return e;if(t&&r===D)return p;var o=i.get(r),l=r in n;if(void 0!==o||l&&!a(n,r)?.writable||(o=d(()=>{var e=gt(St(l?n[r]:H));return t&&ee(e,$t(h,r)),e}),i.set(r,o)),void 0!==o){var c=Cn(o);return c===H?void 0:c}return Reflect.get(n,r,s)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&"value"in n){var r=i.get(t);r&&(n.value=Cn(r))}else if(void 0===n){var s=i.get(t),o=s?.v;if(void 0!==s&&o!==H)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,n){if(n===R)return!0;var r=i.get(n),s=void 0!==r&&r.v!==H||Reflect.has(e,n);if((void 0!==r||null!==pn&&(!s||a(e,n)?.writable))&&(void 0===r&&(r=d(()=>{var r=gt(s?St(e[n]):H);return t&&ee(r,$t(h,n)),r}),i.set(n,r)),Cn(r)===H))return!1;return s},set(e,n,r,l){var c=i.get(n),f=n in e;if(s&&"length"===n)for(var u=r;u<c.v;u+=1){var v=i.get(u+"");void 0!==v?_t(v,H):u in e&&(v=d(()=>gt(H)),i.set(u+"",v),t&&ee(v,$t(h,u)))}void 0===c?f&&!a(e,n)?.writable||(c=d(()=>gt(void 0)),t&&ee(c,$t(h,n)),_t(c,St(r)),i.set(n,c)):(f=c.v!==H,_t(c,d(()=>St(r))));var p=Reflect.getOwnPropertyDescriptor(e,n);if(p?.set&&p.set.call(l,r),!f){if(s&&"string"==typeof n){var g=i.get("length"),m=Number(n);Number.isInteger(m)&&m>=g.v&&_t(g,m+1)}bt(o)}return!0},ownKeys(e){Cn(o);var t=Reflect.ownKeys(e).filter(e=>{var t=i.get(e);return void 0===t||t.v!==H});for(var[n,r]of i)r.v===H||n in e||t.push(n);return t},setPrototypeOf(){!function(){if(t){const e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function $t(e,t){return"symbol"==typeof t?`${e}[Symbol(${t.description??""})]`:xt.test(t)?`${e}.${t}`:/^\d+$/.test(t)?`${e}[${t}]`:`${e}['${t}']`}function Et(e){try{if(null!==e&&"object"==typeof e&&R in e)return e[R]}catch{}return e}const zt=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);var Mt,Lt,Tt,jt;function Ot(){if(void 0===Mt){Mt=window,Lt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,n=Node.prototype,r=Text.prototype;Tt=a(n,"firstChild").get,jt=a(n,"nextSibling").get,d(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),d(r)&&(r.__t=void 0),t&&(e.__svelte_meta=null,function(){const e=Array.prototype,t=Array.__svelte_cleanup;t&&t();const{indexOf:n,lastIndexOf:r,includes:i}=e;e.indexOf=function(e,t){const r=n.call(this,e,t);if(-1===r)for(let n=t??0;n<this.length;n+=1)if(Et(this[n])===e){G("array.indexOf(...)");break}return r},e.lastIndexOf=function(e,t){const n=r.call(this,e,t??this.length-1);if(-1===n)for(let n=0;n<=(t??this.length-1);n+=1)if(Et(this[n])===e){G("array.lastIndexOf(...)");break}return n},e.includes=function(e,t){const n=i.call(this,e,t);if(!n)for(let t=0;t<this.length;t+=1)if(Et(this[t])===e){G("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{e.indexOf=n,e.lastIndexOf=r,e.includes=i}}())}}function Ct(e=""){return document.createTextNode(e)}function Pt(e){return Tt.call(e)}function At(e){return jt.call(e)}function Rt(e,t){return Pt(e)}function It(e,t=!1){var n=Pt(e);return n instanceof Comment&&""===n.data?At(n):n}function Wt(e,t=1,n=!1){let r=e;for(;t--;)r=At(r);return r}function Dt(e){var t=dn,n=pn;vn(null),gn(null);try{return e()}finally{vn(t),gn(n)}}function Ft(e){null===pn&&(null===dn&&function(e){if(t){const t=new Error(`effect_orphan\n\`${e}\` can only be used inside an effect (e.g. during component initialisation)\nhttps://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}throw new Error("https://svelte.dev/e/effect_orphan")}(e),function(){if(t){const e=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw e.name="Svelte error",e}throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),fn&&function(e){if(t){const t=new Error(`effect_in_teardown\n\`${e}\` cannot be used inside an effect cleanup function\nhttps://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}throw new Error("https://svelte.dev/e/effect_in_teardown")}(e)}function qt(e,n){var r=pn;if(t)for(;null!==r&&0!==(r.f&L);)r=r.parent;null!==r&&0!==(r.f&S)&&(e|=S);var i={ctx:ie,deps:null,nodes:null,f:e|k|y,first:null,fn:n,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};t&&(i.component_function=le);var s=i;if(4&e)null!==Fe?Fe.push(i):Be.ensure().schedule(i);else if(null!==n){try{On(i)}catch(s){throw tn(i),s}null===s.deps&&null===s.teardown&&null===s.nodes&&s.first===s.last&&0===(s.f&T)&&(s=s.first,0!==(e&m)&&0!==(e&M)&&null!==s&&(s.f|=M))}if(null!==s&&(s.parent=r,null!==r&&function(e,t){var n=t.last;null===n?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}(s,r),null!==dn&&2&dn.f&&0===(e&w))){var o=dn;(o.effects??=[]).push(s)}return i}function Nt(){return null!==dn&&!hn}function Ut(e){const t=qt(8,null);return ye(t,b),t.teardown=e,t}function Ht(e){Ft("$effect"),t&&o(e,"name",{value:"$effect"});var n=pn.f;if(!(!dn&&0!==(n&_)&&0===(n&E)))return Bt(e);var r=ie;(r.e??=[]).push(e)}function Bt(e){return qt(1048580,e)}function Vt(e){return qt(4,e)}function Kt(e,t){var n={effect:null,ran:!1,deps:e};ie.l.$.push(n),n.effect=Gt(()=>{if(e(),!n.ran){n.ran=!0;var r=pn;try{gn(r.parent),Rn(t)}finally{gn(r)}}})}function Zt(){var e=ie;Gt(()=>{for(var t of e.l.$){t.deps();var n=t.effect;0!==(n.f&b)&&null!==n.deps&&ye(n,x),zn(n)&&On(n),t.ran=!1}})}function Gt(e,t=0){return qt(8|t,e)}function Xt(e,t=[],n=[],r=[]){et(r,t,n,t=>{qt(8,()=>e(...t.map(Cn)))})}function Yt(e,n=0){var r=qt(m|n,e);return t&&(r.dev_stack=oe),r}function Jt(e){return qt(524320,e)}function Qt(e){var t=e.teardown;if(null!==t){const e=fn,n=dn;un(!0),vn(null);try{t.call(null)}finally{un(e),vn(n)}}}function en(e,t=!1){var n=e.first;for(e.first=e.last=null;null!==n;){const e=n.ac;null!==e&&Dt(()=>{e.abort(F)});var r=n.next;0!==(n.f&w)?n.parent=null:tn(n,t),n=r}}function tn(e,n=!0){var r=!1;(n||262144&e.f)&&null!==e.nodes&&null!==e.nodes.end&&(!function(e,t){for(;null!==e;){var n=e===t?null:At(e);e.remove(),e=n}}(e.nodes.start,e.nodes.end),r=!0),ye(e,z),en(e,n&&!r),jn(e,0);var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)e.stop();Qt(e),e.f^=z,e.f|=$;var s=e.parent;null!==s&&null!==s.first&&nn(e),t&&(e.component_function=null),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function nn(e){var t=e.parent,n=e.prev,r=e.next;null!==n&&(n.next=r),null!==r&&(r.prev=n),null!==t&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function rn(e,t,n=!0){var r=[];sn(e,r,!0);var i=()=>{n&&tn(e),t&&t()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function sn(e,t,n){if(0===(e.f&S)){e.f^=S;var r=e.nodes&&e.nodes.t;if(null!==r)for(const e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;null!==i;){var s=i.next;sn(i,t,!!(0!==(i.f&M)||0!==(i.f&_)&&0!==(e.f&m))&&n),i=s}}}function on(e){an(e,!0)}function an(e,t){if(0!==(e.f&S)){e.f^=S,0===(e.f&b)&&(ye(e,k),Be.ensure().schedule(e));for(var n=e.first;null!==n;){var r=n.next;an(n,!!(0!==(n.f&M)||0!==(n.f&_))&&t),n=r}var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)(e.is_global||t)&&e.in()}}function ln(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;null!==n;){var i=n===r?null:At(n);t.append(n),n=i}}let cn=!1,fn=!1;function un(e){fn=e}let dn=null,hn=!1;function vn(e){dn=e}let pn=null;function gn(e){pn=e}let mn=null;let wn=null,yn=0,bn=null;let kn=1,xn=0,Sn=xn;function $n(e){Sn=e}function En(){return++kn}function zn(e){var t=e.f;if(0!==(t&k))return!0;if(2&t&&(e.f&=-65537),0!==(t&x)){for(var n=e.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(zn(s)&&ct(s),s.wv>e.wv)return!0}0!==(t&y)&&null===Re&&ye(e,b)}return!1}function Mn(e,t,n=!0){var r=e.reactions;if(null!==r&&(null===mn||!i.call(mn,e)))for(var s=0;s<r.length;s++){var o=r[s];2&o.f?Mn(o,t,!1):t===o&&(n?ye(o,k):0!==(o.f&b)&&ye(o,x),Xe(o))}}function Ln(e){var t=wn,n=yn,r=bn,i=dn,s=mn,o=ie,a=hn,l=Sn,c=e.f;wn=null,yn=0,bn=null,dn=96&c?null:e,mn=null,se(e.ctx),hn=!1,Sn=++xn,null!==e.ac&&(Dt(()=>{e.ac.abort(F)}),e.ac=null);try{e.f|=C;var f=(0,e.fn)();e.f|=E;var u=e.deps,d=Ae?.is_fork;if(null!==wn){var h;if(d||jn(e,yn),null!==u&&yn>0)for(u.length=yn+wn.length,h=0;h<wn.length;h++)u[yn+h]=wn[h];else e.deps=u=wn;if(Nt()&&0!==(e.f&y))for(h=yn;h<u.length;h++)(u[h].reactions??=[]).push(e)}else!d&&null!==u&&yn<u.length&&(jn(e,yn),u.length=yn);if(de()&&null!==bn&&!hn&&null!==u&&!(6146&e.f))for(h=0;h<bn.length;h++)Mn(bn[h],e);if(null!==i&&i!==e){if(xn++,null!==i.deps)for(let e=0;e<n;e+=1)i.deps[e].rv=xn;if(null!==t)for(const e of t)e.rv=xn;null!==bn&&(null===r?r=bn:r.push(...bn))}return 0!==(e.f&A)&&(e.f^=A),f}catch(e){return ge(e)}finally{e.f^=C,wn=t,yn=n,bn=r,dn=i,mn=s,se(o),hn=a,Sn=l}}function Tn(e,t){let n=t.reactions;if(null!==n){var s=r.call(n,e);if(-1!==s){var o=n.length-1;0===o?n=t.reactions=null:(n[s]=n[o],n.pop())}}if(null===n&&2&t.f&&(null===wn||!i.call(wn,t))){var a=t;0!==(a.f&y)&&(a.f^=y,a.f&=-65537),be(a),function(e){if(null!==e.effects)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(F),t.teardown=h,t.ac=null,jn(t,0),en(t))}(a),jn(a,0)}}function jn(e,t){var n=e.deps;if(null!==n)for(var r=t;r<n.length;r++)Tn(e,n[r])}function On(e){var n=e.f;if(0===(n&$)){ye(e,b);var r=pn,i=cn;if(pn=e,cn=!0,t){var s=le;ce(e.component_function);var o=oe;ae(e.dev_stack??oe)}try{16777232&n?function(e){for(var t=e.first;null!==t;){var n=t.next;0===(t.f&_)&&tn(t),t=n}}(e):en(e),Qt(e);var a=Ln(e);e.teardown="function"==typeof a?a:null,e.wv=kn}finally{cn=i,pn=r,t&&(ce(s),ae(o))}}}function Cn(e){var n=!!(2&e.f);if(null!==dn&&!hn&&!(null!==pn&&0!==(pn.f&$)||null!==mn&&i.call(mn,e))){var r=dn.deps;if(0!==(dn.f&C))e.rv<xn&&(e.rv=xn,null===wn&&null!==r&&r[yn]===e?yn++:null===wn?wn=[e]:wn.push(e));else{(dn.deps??=[]).push(e);var s=e.reactions;null===s?e.reactions=[dn]:i.call(s,dn)||s.push(dn)}}if(t&&rt.delete(e),fn&&dt.has(e))return dt.get(e);if(n){var o=e;if(fn){var a=o.v;return(0===(o.f&b)&&null!==o.reactions||An(o))&&(a=lt(o)),dt.set(o,a),a}var l=0===(o.f&y)&&!hn&&null!==dn&&(cn||0!==(dn.f&y)),c=0===(o.f&E);zn(o)&&(l&&(o.f|=y),ct(o)),l&&!c&&(ft(o),Pn(o))}if(Re?.has(e))return Re.get(e);if(0!==(e.f&A))throw e.v;return e.v}function Pn(e){if(e.f|=y,null!==e.deps)for(const t of e.deps)(t.reactions??=[]).push(e),2&t.f&&0===(t.f&y)&&(ft(t),Pn(t))}function An(e){if(e.v===H)return!0;if(null===e.deps)return!1;for(const t of e.deps){if(dt.has(t))return!0;if(2&t.f&&An(t))return!0}return!1}function Rn(e){var t=hn;try{return hn=!0,e()}finally{hn=t}}function In(e){if("object"==typeof e&&e&&!(e instanceof EventTarget))if(R in e)Wn(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];"object"==typeof n&&n&&R in n&&Wn(n)}}function Wn(e,t=new Set){if(!("object"!=typeof e||null===e||e instanceof EventTarget||t.has(e))){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{Wn(e[n],t)}catch(e){}const n=u(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const t=l(n);for(let n in t){const r=t[n].get;if(r)try{r.call(e)}catch(e){}}}}}const Dn=["touchstart","touchmove"];function Fn(e){return Dn.includes(e)}const qn=Symbol("events"),Nn=new Set,Un=new Set;function Hn(e,t,n,r,i){var s={capture:r,passive:i},o=function(e,t,n,r={}){function i(e){if(r.capture||Vn.call(t,e),!e.cancelBubble)return Dt(()=>n?.call(this,e))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?ve(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}(e,t,n,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Ut(()=>{t.removeEventListener(e,o,s)})}let Bn=null;function Vn(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],s=i[0]||e.target;Bn=e;var a=0,l=Bn===e&&e[qn];if(l){var c=i.indexOf(l);if(-1!==c&&(t===document||t===window))return void(e[qn]=t);var f=i.indexOf(t);if(-1===f)return;c<=f&&(a=c)}if((s=i[a]||e.target)!==t){o(e,"currentTarget",{configurable:!0,get:()=>s||n});var u=dn,d=pn;vn(null),gn(null);try{for(var h,v=[];null!==s;){var p=s.assignedSlot||s.parentNode||s.host||null;try{var g=s[qn]?.[r];null==g||s.disabled&&e.target!==s||g.call(s,e)}catch(e){h?v.push(e):h=e}if(e.cancelBubble||p===t||null===p)break;s=p}if(h){for(let e of v)queueMicrotask(()=>{throw e});throw h}}finally{e[qn]=t,delete e.currentTarget,vn(u),gn(d)}}}const Kn=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Zn(e){var t=function(e,t,n){let r=n?{is:n}:void 0;return document.createElementNS(t??V,e,r)}("template");return t.innerHTML=function(e){return Kn?.createHTML(e)??e}(e.replaceAll("<!>","\x3c!----\x3e")),t.content}function Gn(e,t){var n=pn;null===n.nodes&&(n.nodes={start:e,end:t,a:null,t:null})}function Xn(e,t){var n,r=!!(1&t),i=!!(2&t),s=!e.startsWith("<!>");return()=>{void 0===n&&(n=Zn(s?e:"<!>"+e),r||(n=Pt(n)));var t=i||Lt?document.importNode(n,!0):n.cloneNode(!0);r?Gn(Pt(t),t.lastChild):Gn(t,t);return t}}function Yn(e,t){return function(e,t,n="svg"){var r,i=!e.startsWith("<!>"),s=!!(1&t),o=`<${n}>${i?e:"<!>"+e}</${n}>`;return()=>{if(!r){var e=Pt(Zn(o));if(s)for(r=document.createDocumentFragment();Pt(e);)r.appendChild(Pt(e));else r=Pt(e)}var t=r.cloneNode(!0);return s?Gn(Pt(t),t.lastChild):Gn(t,t),t}}(e,t,"svg")}function Jn(e=""){var t=Ct(e+"");return Gn(t,t),t}function Qn(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Ct();return e.append(t,n),Gn(t,n),e}function er(e,t){null!==e&&e.before(t)}let tr=!0;function nr(e,t){var n=null==t?"":"object"==typeof t?`${t}`:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=`${n}`)}function rr(e,t){return function(e,{target:t,anchor:n,props:r={},events:i,context:o,intro:a=!0,transformError:l}){Ot();var c=void 0,f=function(e){Be.ensure();const t=qt(524352,e);return(e={})=>new Promise(n=>{e.outro?rn(t,()=>{tn(t),n(void 0)}):(tn(t),n(void 0))})}(()=>{var f=n??t.appendChild(Ct());!function(e,t,n,r){new Qe(e,t,n,r)}(f,{pending:()=>{}},t=>{fe({}),o&&(ie.c=o),i&&(r.$$events=i),tr=a,c=e(t,r)||{},tr=!0,ue()},l);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=Fn(r);for(const e of[t,document]){var s=ir.get(e);void 0===s&&(s=new Map,ir.set(e,s));var o=s.get(r);void 0===o?(e.addEventListener(r,Vn,{passive:i}),s.set(r,1)):s.set(r,o+1)}}}};return d(s(Nn)),Un.add(d),()=>{for(var e of u)for(const n of[t,document]){var r=ir.get(n),i=r.get(e);0==--i?(n.removeEventListener(e,Vn),r.delete(e),0===r.size&&ir.delete(n)):r.set(e,i)}Un.delete(d),f!==n&&f.parentNode?.removeChild(f)}});return sr.set(c,f),c}(e,t)}const ir=new Map;let sr=new WeakMap;class or{anchor;#R=new Map;#I=new Map;#W=new Map;#D=new Set;#F=!0;constructor(e,t=!0){this.anchor=e,this.#F=t}#v=e=>{if(this.#R.has(e)){var t=this.#R.get(e),n=this.#I.get(t);if(n)on(n),this.#D.delete(t);else{var r=this.#W.get(t);r&&(this.#I.set(t,r.effect),this.#W.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(const[t,n]of this.#R){if(this.#R.delete(t),t===e)break;const r=this.#W.get(n);r&&(tn(r.effect),this.#W.delete(n))}for(const[e,r]of this.#I){if(e===t||this.#D.has(e))continue;const i=()=>{if(Array.from(this.#R.values()).includes(e)){var t=document.createDocumentFragment();ln(r,t),t.append(Ct()),this.#W.set(e,{effect:r,fragment:t})}else tn(r);this.#D.delete(e),this.#I.delete(e)};this.#F||!n?(this.#D.add(e),rn(r,i,!1)):i()}}};#q=e=>{this.#R.delete(e);const t=Array.from(this.#R.values());for(const[e,n]of this.#W)t.includes(e)||(tn(n.effect),this.#W.delete(e))};ensure(e,t){var n=Ae;!t||this.#I.has(e)||this.#W.has(e)||this.#I.set(e,Jt(()=>t(this.anchor)));this.#R.set(n,e),this.#v(n)}}function ar(e,t,n=!1){var r=new or(e);function i(e,t){r.ensure(e,t)}Yt(()=>{var e=!1;t((t,n=0)=>{e=!0,i(n,t)}),e||i(-1,null)},n?M:0)}function lr(e,t){return t}function cr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(const t of e.pending.values())for(const n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var s=t[i];if(r?.has(s)){s.f|=j;ln(s,document.createDocumentFragment())}else tn(t[i],n)}}var fr;function ur(e,r,i,o,a,l=null){var c=e,f=new Map;!(4&r)||(c=e.appendChild(Ct()));var u,d=null,h=st(()=>{var e=i();return n(e)?e:null==e?[]:s(e)}),v=new Map,p=!0;function g(e){0===(_.effect.f&$)&&(_.pending.delete(e),_.fallback=d,function(e,t,n,r,i){var o,a,l,c,f,u=!!(8&r),d=t.length,h=e.items,v=dr(e.effect.first),p=null,g=[],m=[];if(u)for(f=0;f<d;f+=1)l=i(t[f],f),0===((c=h.get(l).e).f&j)&&(c.nodes?.a?.measure(),(a??=new Set).add(c));for(f=0;f<d;f+=1){if(l=i(t[f],f),c=h.get(l).e,null!==e.outrogroups)for(const t of e.outrogroups)t.pending.delete(c),t.done.delete(c);if(0!==(c.f&j)){if(c.f^=j,c!==v){var _=p?p.next:v;c===e.effect.last&&(e.effect.last=c.prev),c.prev&&(c.prev.next=c.next),c.next&&(c.next.prev=c.prev),pr(e,p,c),pr(e,c,_),vr(c,_,n),g=[],m=[],v=dr((p=c).next);continue}vr(c,null,n)}if(0!==(c.f&S)&&(on(c),u&&(c.nodes?.a?.unfix(),(a??=new Set).delete(c))),c!==v){if(void 0!==o&&o.has(c)){if(g.length<m.length){var w,y=m[0];p=y.prev;var b=g[0],k=g[g.length-1];for(w=0;w<g.length;w+=1)vr(g[w],y,n);for(w=0;w<m.length;w+=1)o.delete(m[w]);pr(e,b.prev,k.next),pr(e,p,b),pr(e,k,y),v=y,p=k,f-=1,g=[],m=[]}else o.delete(c),vr(c,v,n),pr(e,c.prev,c.next),pr(e,c,null===p?e.effect.first:p.next),pr(e,p,c),p=c;continue}for(g=[],m=[];null!==v&&v!==c;)(o??=new Set).add(v),m.push(v),v=dr(v.next);if(null===v)continue}0===(c.f&j)&&g.push(c),p=c,v=dr(c.next)}if(null!==e.outrogroups){for(const t of e.outrogroups)0===t.pending.size&&(cr(e,s(t.done)),e.outrogroups?.delete(t));0===e.outrogroups.size&&(e.outrogroups=null)}if(null!==v||void 0!==o){var x=[];if(void 0!==o)for(c of o)0===(c.f&S)&&x.push(c);for(;null!==v;)0===(v.f&S)&&v!==e.fallback&&x.push(v),v=dr(v.next);var $=x.length;if($>0){var E=4&r&&0===d?n:null;if(u){for(f=0;f<$;f+=1)x[f].nodes?.a?.measure();for(f=0;f<$;f+=1)x[f].nodes?.a?.fix()}!function(e,t,n){for(var r,i=t.length,o=t.length,a=0;a<i;a++){let n=t[a];rn(n,()=>{if(r){if(r.pending.delete(n),r.done.add(n),0===r.pending.size){var t=e.outrogroups;cr(e,s(r.done)),t.delete(r),0===t.size&&(e.outrogroups=null)}}else o-=1},!1)}if(0===o){var l=null!==n;if(l){var c=n,f=c.parentNode;f.textContent="",f.append(c),e.items.clear()}cr(e,t,!l)}else r={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(r)}(e,x,E)}}u&&ve(()=>{if(void 0!==a)for(c of a)c.nodes?.a?.apply()})}(_,u,c,r,o),null!==d&&(0===u.length?0===(d.f&j)?on(d):(d.f^=j,vr(d,null,c)):rn(d,()=>{d=null})))}var m=Yt(()=>{for(var e=(u=Cn(h)).length,n=new Set,s=Ae,m=0;m<e;m+=1){var _=u[m],w=o(_,m);if(t){var y=o(_,m);w!==y&&U(String(m),String(w),String(y))}var b=p?null:f.get(w);b?(b.v&&wt(b.v,_),b.i&&wt(b.i,m)):(b=hr(f,p?c:fr??=Ct(),_,w,m,a,r,i),p||(b.e.f|=j),f.set(w,b)),n.add(w)}0===e&&l&&!d&&(p?d=Jt(()=>l(c)):(d=Jt(()=>l(fr??=Ct()))).f|=j),e>n.size&&(t?function(e,t){const n=new Map,r=e.length;for(let i=0;i<r;i++){const r=t(e[i],i);if(n.has(r)){const e=String(n.get(r)),t=String(i);let s=String(r);s.startsWith("[object ")&&(s=null),N(e,t,s)}n.set(r,i)}}(u,o):N("","","")),p||(v.set(s,n),g(s)),Cn(h)}),_={effect:m,flags:r,items:f,pending:v,outrogroups:null,fallback:d};p=!1}function dr(e){for(;null!==e&&0===(e.f&_);)e=e.next;return e}function hr(e,n,r,i,s,o,a,l){var c=1&a?16&a?pt(r):mt(r,!1,!1):null,f=2&a?pt(s):null;return t&&c&&(c.trace=()=>{l()[f?.v??s]}),{v:c,i:f,e:Jt(()=>(o(n,c??r,f??s,l),()=>{e.delete(i)}))}}function vr(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,s=t&&0===(t.f&j)?t.nodes.start:n;null!==r;){var o=At(r);if(s.before(r),r===i)return;r=o}}function pr(e,t,n){null===t?e.effect.first=n:t.next=n,null===n?e.effect.last=t:n.prev=t}const gr={tick:e=>requestAnimationFrame(e),now:()=>performance.now(),tasks:new Set};function mr(){const e=gr.now();gr.tasks.forEach(t=>{t.c(e)||(gr.tasks.delete(t),t.f())}),0!==gr.tasks.size&&gr.tick(mr)}function _r(e,t){Dt(()=>{e.dispatchEvent(new CustomEvent(t))})}function wr(e){if("float"===e)return"cssFloat";if("offset"===e)return"cssOffset";if(e.startsWith("--"))return e;const t=e.split("-");return 1===t.length?t[0]:t[0]+t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function yr(e){const t={},n=e.split(";");for(const e of n){const[n,r]=e.split(":");if(!n||void 0===r)break;t[wr(n.trim())]=r.trim()}return t}const br=e=>e;function kr(e,t,n,r){var i,s,o,a=!!(1&e),l=!!(2&e),c=!!(4&e),f=a&&l?"both":a?"in":"out",u=t.inert,d=t.style.overflow;function h(){return Dt(()=>i??=n()(t,r?.()??{},{direction:f}))}var v={is_global:c,in(){if(t.inert=u,!a)return o?.abort(),void o?.reset?.();l||s?.abort(),s=xr(t,h(),o,1,()=>{_r(t,"introend"),s?.abort(),s=i=void 0,t.style.overflow=d})},out(e){if(!l)return e?.(),void(i=void 0);t.inert=!0,o=xr(t,h(),s,0,()=>{_r(t,"outroend"),e?.()})},stop:()=>{s?.abort(),o?.abort()}},p=pn;if((p.nodes.t??=[]).push(v),a&&tr){var g=c;if(!g){for(var _=p.parent;_&&0!==(_.f&M);)for(;(_=_.parent)&&0===(_.f&m););g=!_||0!==(_.f&E)}g&&Vt(()=>{Rn(()=>v.in())})}}function xr(e,t,n,r,i){var s=1===r;if("function"==typeof t){var o,a=!1;return ve(()=>{if(!a){var l=t({direction:s?"in":"out"});o=xr(e,l,n,r,i)}}),{abort:()=>{a=!0,o?.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(n?.deactivate(),!t?.duration&&!t?.delay)return _r(e,s?"introstart":"outrostart"),i(),{abort:h,deactivate:h,reset:h,t:()=>r};const{delay:l=0,css:c,tick:f,easing:u=br}=t;var d=[];if(s&&void 0===n&&(f&&f(0,1),c)){var v=yr(c(0,1));d.push(v,v)}var p=()=>1-r,g=e.animate(d,{duration:l,fill:"forwards"});return g.onfinish=()=>{g.cancel(),_r(e,s?"introstart":"outrostart");var o=n?.t()??1-r;n?.abort();var a=r-o,l=t.duration*Math.abs(a),d=[];if(l>0){var h=!1;if(c)for(var v=Math.ceil(l/(1e3/60)),m=0;m<=v;m+=1){var _=o+a*u(m/v),w=yr(c(_,1-_));d.push(w),h||="hidden"===w.overflow}h&&(e.style.overflow="hidden"),p=()=>{var e=g.currentTime;return o+a*u(e/l)},f&&function(e){let t;0===gr.tasks.size&&gr.tick(mr),new Promise(n=>{gr.tasks.add(t={c:e,f:n})})}(()=>{if("running"!==g.playState)return!1;var e=p();return f(e,1-e),!0})}(g=e.animate(d,{duration:l,fill:"forwards"})).onfinish=()=>{p=()=>r,f?.(r,1-r),i()}},{abort:()=>{g&&(g.cancel(),g.effect=null,g.onfinish=h)},deactivate:()=>{i=h},reset:()=>{0===r&&f?.(1,0)},t:()=>p()}}const Sr=[..." \t\n\r\f \v\ufeff"];function $r(e,t=!1){var n=t?" !important;":";",r="";for(var i of Object.keys(e)){var s=e[i];null!=s&&""!==s&&(r+=" "+i+": "+s+n)}return r}function Er(e){return"-"!==e[0]||"-"!==e[1]?e.toLowerCase():e}function zr(e,t,n,r,i,s){var o=e.__className;if(o!==n||void 0===o){var a=function(e,t,n){var r=null==e?"":""+e;if(t&&(r=r?r+" "+t:t),n)for(var i of Object.keys(n))if(n[i])r=r?r+" "+i:i;else if(r.length)for(var s=i.length,o=0;(o=r.indexOf(i,o))>=0;){var a=o+s;0!==o&&!Sr.includes(r[o-1])||a!==r.length&&!Sr.includes(r[a])?o=a:r=(0===o?"":r.substring(0,o))+r.substring(a+1)}return""===r?null:r}(n,r,s);null==a?e.removeAttribute("class"):t?e.className=a:e.setAttribute("class",a),e.__className=n}else if(s&&i!==s)for(var l in s){var c=!!s[l];null!=i&&c===!!i[l]||e.classList.toggle(l,c)}return s}function Mr(e,t={},n,r){for(var i in n){var s=n[i];t[i]!==s&&(null==n[i]?e.style.removeProperty(i):e.style.setProperty(i,s,r))}}function Lr(e,t,n,r){if(e.__style!==t){var i=function(e,t){if(t){var n,r,i="";if(Array.isArray(t)?(n=t[0],r=t[1]):n=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,o=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(Er)),r&&l.push(...Object.keys(r).map(Er));var c=0,f=-1;const t=e.length;for(var u=0;u<t;u++){var d=e[u];if(a?"/"===d&&"*"===e[u-1]&&(a=!1):s?s===d&&(s=!1):"/"===d&&"*"===e[u+1]?a=!0:'"'===d||"'"===d?s=d:"("===d?o++:")"===d&&o--,!a&&!1===s&&0===o)if(":"===d&&-1===f)f=u;else if(";"===d||u===t-1){if(-1!==f){var h=Er(e.substring(c,f).trim());l.includes(h)||(";"!==d&&u++,i+=" "+e.substring(c,u).trim()+";")}c=u+1,f=-1}}}return n&&(i+=$r(n)),r&&(i+=$r(r,!0)),""===(i=i.trim())?null:i}return null==e?null:String(e)}(t,r);null==i?e.removeAttribute("style"):e.style.cssText=i,e.__style=t}else r&&(Array.isArray(r)?(Mr(e,n?.[0],r[0]),Mr(e,n?.[1],r[1],"important")):Mr(e,n,r));return r}const Tr=Symbol("is custom element"),jr=Symbol("is html");function Or(e,t,n,r){var i=function(e){return e.__attributes??={[Tr]:e.nodeName.includes("-"),[jr]:e.namespaceURI===V}}(e);i[t]!==(i[t]=n)&&("loading"===t&&(e[W]=n),null==n?e.removeAttribute(t):"string"!=typeof n&&function(e){var t,n=e.getAttribute("is")||e.nodeName,r=Cr.get(n);if(r)return r;Cr.set(n,r=[]);var i=e,s=Element.prototype;for(;s!==i;){for(var o in t=l(i))t[o].set&&r.push(o);i=u(i)}return r}(e).includes(t)?e[t]=n:e.setAttribute(t,n))}var Cr=new Map;function Pr(e,t){return e===t||e?.[R]===t}function Ar(e={},t,n,r){var i=ie.r,s=pn;return Vt(()=>{var o,a;return Gt(()=>{o=a,a=r?.()||[],Rn(()=>{e!==n(...a)&&(t(e,...a),o&&Pr(n(...o),e)&&t(null,...o))})}),()=>{let r=s;for(;r!==i&&null!==r.parent&&r.parent.f&z;)r=r.parent;const o=r.teardown;r.teardown=()=>{a&&Pr(n(...a),e)&&t(null,...a),o?.()}}}),e}function Rr(e=!1){const n=ie,r=n.l.u;if(!r)return;let i=()=>In(n.s);if(e){let e=0,t={};const r=it(()=>{let r=!1;const i=n.s;for(const e in i)i[e]!==t[e]&&(t[e]=i[e],r=!0);return r&&e++,e});i=()=>Cn(r)}var s;r.b.length&&(s=()=>{Ir(n,i),p(r.b)},Ft("$effect.pre"),t&&o(s,"name",{value:"$effect.pre"}),qt(1048584,s)),Ht(()=>{const e=Rn(()=>r.m.map(v));return()=>{for(const t of e)"function"==typeof t&&t()}}),r.a.length&&Ht(()=>{Ir(n,i),p(r.a)})}function Ir(e,t){if(e.l.s)for(const t of e.l.s)Cn(t);t()}function Wr(e,t){var r=e.$$events?.[t.type],i=n(r)?r.slice():null==r?[]:[r];for(var s of i)s.call(this,t)}function Dr(e,n,r,i){var s=!Q||!!(2&r),o=!!(8&r),l=!!(16&r),c=i,f=!0,u=()=>(f&&(f=!1,c=l?Rn(i):i),c);let d;if(o){var h=R in e||I in e;d=a(e,n)?.set??(h&&n in e?t=>e[n]=t:void 0)}var v,p,g=!1;if(o?[v,g]=function(e){var t=Le;try{return Le=!1,[e(),Le]}finally{Le=t}}(()=>e[n]):v=e[n],void 0===v&&void 0!==i&&(v=u(),d&&(s&&function(e){if(t){const t=new Error(`props_invalid_value\nCannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value\nhttps://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}throw new Error("https://svelte.dev/e/props_invalid_value")}(n),d(v))),p=s?()=>{var t=e[n];return void 0===t?u():(f=!0,t)}:()=>{var t=e[n];return void 0!==t&&(c=void 0),void 0===t?c:t},s&&!(4&r))return p;if(d){var m=e.$$legacy;return function(e,t){return arguments.length>0?(s&&t&&!m&&!g||d(t?p():e),e):p()}}var _=!1,w=(1&r?it:st)(()=>(_=!1,p()));t&&(w.label=n),o&&Cn(w);var y=pn;return function(e,t){if(arguments.length>0){const n=t?Cn(w):s&&o?St(e):e;return _t(w,n),_=!0,void 0!==c&&(c=n),e}return fn&&_||0!==(y.f&$)?w.v:Cn(w)}}if(t){function Hi(e){if(!(e in globalThis)){let n;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(void 0!==n)return n;!function(e){if(t){const t=new Error(`rune_outside_svelte\nThe \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}throw new Error("https://svelte.dev/e/rune_outside_svelte")}(e)},set:e=>{n=e}})}}Hi("$state"),Hi("$effect"),Hi("$derived"),Hi("$inspect"),Hi("$props"),Hi("$bindable")}function Fr(e){var t,n;null===ie&&q("onMount"),Q&&null!==ie.l?(t=ie,n=t.l,n.u??={a:[],b:[],m:[]}).m.push(e):Ht(()=>{const t=Rn(e);if("function"==typeof t)return t})}function qr(){const e=ie;return null===e&&q("createEventDispatcher"),(t,r,i)=>{const s=e.s.$$events?.[t];if(s){const o=n(s)?s.slice():[s],a=function(e,t,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:r})}(t,r,i);for(const t of o)t.call(e.x,a);return!a.defaultPrevented}return!0}}class Nr{constructor(e,t,n=null){this.node=e,this.getURLCallback=t,this.fetch=null!=n?n:window.fetch.bind(window)}getURL(){return this.getURLCallback(this.node)}getSizeOnPage(){const{width:e,height:t}=this.node.getBoundingClientRect();return{width:Math.round(e),height:Math.round(t)}}async getFileSize(e){const{width:t,height:n}=await this.fetchFileDimensions(e);return{width:t,height:n}}async getWeight(e){return await this.fetchFileWeight(e)}getPotentialSavings(e,t,n){const r=this.getOversizedRatio(e,n);return r<=1?null:Math.round(t.weight-t.weight/r)}getExpectedSize(e){const t=window.devicePixelRatio||1;return{width:Math.round(e.width*t),height:Math.round(e.height*t)}}getOversizedRatio(e,t){if(0===e.width||0===e.height)return 1;const{width:n,height:r}=this.getExpectedSize(t);return 0===n||0===r?1:e.width*e.height/(n*r)}async fetchFileWeight(e){const t=await this.fetch(e);return t.ok?parseInt(t.headers.get("content-length"),10)/1024:(console.log(`Can't get image size for ${e} likely due to a CORS error.`),-1)}async fetchFileDimensions(e){const t=new Image;return t.src=e,new Promise((e,n)=>{t.onload=()=>{e({width:Math.round(t.width),height:Math.round(t.height)})},t.onerror=()=>{n("Unable to load image.")}})}async isImageTiny(){try{const e=65,t=await this.fetchFileDimensions(this.getURL());return t.width<e||t.height<e}catch{return!0}}}const Ur="jetpack-boost-guide",Hr={active:"Active",paused:"Paused"};let Br=localStorage.getItem(Ur);Br&&Hr[Br]||(localStorage.setItem(Ur,"Active"),Br="active");const{set:Vr,update:Kr,subscribe:Zr}=Ee(Br);Zr(e=>{localStorage.setItem(Ur,e)});const Gr={subscribe:Zr,set:Vr,update:Kr,cycle:()=>{Kr(e=>{const t=Object.keys(Hr),n=t.indexOf(e);return t[(n+1)%t.length]})}},Xr=ze(Gr,e=>Hr[e]);class Yr{constructor(e){this.loading=Ee(!0),this.weightMap={},this.currentSrc="",this.image=e,this.node=e.node;this.url=Ee(e.getURL()),this.fileSize=Ee({width:0,height:0}),this.fileWeight=Ee({weight:-1},()=>{this.maybeUpdateWeight()}),this.sizeOnPage=Ee({width:0,height:0}),this.potentialSavings=this.derivePotentialSavings(),this.oversizedRatio=this.deriveOversizedRatio(),this.expectedSize=this.deriveExpectedSize()}deriveOversizedRatio(){return ze([this.fileSize,this.sizeOnPage],([e,t])=>this.image.getOversizedRatio(e,t))}deriveExpectedSize(){return ze(this.sizeOnPage,e=>this.image.getExpectedSize(e))}derivePotentialSavings(){return ze([this.fileSize,this.fileWeight,this.sizeOnPage],([e,t,n])=>this.image.getPotentialSavings(e,t,n))}async updateDimensions(){const e=this.image.getSizeOnPage();this.sizeOnPage.set(e),await this.updateFileDimensions()}async updateFileDimensions(){if(this.image.getURL()===this.currentSrc)return;let e;this.currentSrc=this.image.getURL();try{e=await this.image.getFileSize(this.currentSrc)}catch{e={height:-1,width:-1}}this.url.set(this.currentSrc),this.fileSize.set(e)}async maybeUpdateWeight(){const e=this.currentSrc;if(void 0===this.weightMap[e]){this.loading.set(!0);try{const t=await this.image.getWeight(e);this.weightMap[e]=t,this.fileWeight.set({weight:t})}catch{this.fileWeight.set({weight:-1})}this.loading.set(!1)}else this.fileWeight.set({weight:this.weightMap[e]})}}class Jr{static setTracksCallback(e){Jr.tracksCallback=e}static async trackImageOutcome(e){return new Promise(t=>{e.loading.subscribe(n=>{if(!n){const n=Me(e.oversizedRatio),r=function(e){return e>4?"red":e>2.5?"yellow":"green"}(n),i=Me(e.fileSize),s=Me(e.sizeOnPage),o=Me(e.expectedSize),a=Me(e.potentialSavings),l=Me(e.url),c={severity:r,oversized_ratio:n,file_width:i.width,file_height:i.height,size_on_page_width:s.width,size_on_page_height:s.height,expected_width:o.width,expected_height:o.height,potential_savings:a,image_url:l};Jr.tracksCallback("image_guide_image_outcome",{...c,window_width:window.innerWidth,window_height:window.innerHeight,device_pixel_ratio:window.devicePixelRatio}),t(c)}})})}static async trackPage(e){if(!e.length||Jr.trackingComplete)return;Jr.trackingComplete=!0;const t=e.map(Jr.trackImageOutcome),n=await Promise.all(t),r=n.reduce((e,t)=>e+(t.potential_savings||0),0);Jr.tracksCallback("image_guide_page_outcome",{total_potential_savings:r,red_severity_count:n.filter(e=>"red"===e.severity).length,yellow_severity_count:n.filter(e=>"yellow"===e.severity).length,green_severity_count:n.filter(e=>"green"===e.severity).length,window_width:window.innerWidth,window_height:window.innerHeight,device_pixel_ratio:window.devicePixelRatio})}static trackInitialState(){Jr.tracksCallback("image_guide_initial_ui_state",{image_guide_state:Me(Gr)})}static trackUIStateChange(){Jr.tracksCallback("image_guide_ui_state_change",{image_guide_state:Me(Gr)})}}function Qr(e){return e.filter(e=>{if(e instanceof HTMLImageElement){if(!e.src.trim())return!1;try{if(t=e.src,new URL(t).pathname.toLowerCase().endsWith(".svg"))return!1}catch{return!1}return!0}var t;if(e instanceof HTMLElement){return"none"!==getComputedStyle(e).backgroundImage}return!1})}function ei(e){return ri(e.currentSrc)?e.currentSrc:ri(e.src)?e.src:null}function ti(e){const t=getComputedStyle(e).backgroundImage.match(/url\(\s*(['"])(.*?)\1\s*\)/i),n=window.location.href.split("#")[0];return t&&t[2]&&t[2]!==n&&ri(t[2])?t[2]:null}async function ni(e,t=null){return Qr(e).map(e=>e instanceof HTMLImageElement?new Nr(e,ei,t):e instanceof HTMLElement&&ti(e)?new Nr(e,ti):null).filter(e=>null!==e)}function ri(e){if(e.startsWith("/")){return!e.split("?")[0].endsWith(".svg")}try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}}Jr.trackingComplete=!1;function ii(e){const t=1.70158;return--e*e*((t+1)*e+t)+1}"undefined"!=typeof window&&((window.__svelte??={}).v??=new Set).add("5"),Q=!0;const si=e=>e;function oi(e){const t=e-1;return t*t*t+1}function ai(e){const t="string"==typeof e&&e.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return t?[parseFloat(t[1]),t[2]||"px"]:[e,"px"]}function li(e,{delay:t=0,duration:n=400,easing:r=si}={}){const i=+getComputedStyle(e).opacity;return{delay:t,duration:n,easing:r,css:e=>"opacity: "+e*i}}function ci(e,{delay:t=0,duration:n=400,easing:r=oi,x:i=0,y:s=0,opacity:o=0}={}){const a=getComputedStyle(e),l=+a.opacity,c="none"===a.transform?"":a.transform,f=l*(1-o),[u,d]=ai(i),[h,v]=ai(s);return{delay:t,duration:n,easing:r,css:(e,t)=>`\n\t\t\ttransform: ${c} translate(${(1-e)*u}${d}, ${(1-e)*h}${v});\n\t\t\topacity: ${l-f*t}`}}var fi=Xn('<div class="svelte-1yjr9q3"><svg viewBox="0 0 110 110" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M55.4 107.8C84.3397 107.8 107.8 84.3397 107.8 55.4C107.8 26.4603 84.3397 3 55.4 3C26.4603 3 3 26.4603 3 55.4C3 84.3397 26.4603 107.8 55.4 107.8Z"></path><path d="M58 46.6V97.4L84.2 46.6H58Z" fill="white"></path><path d="M52.7 64.1V13.4L26.6 64.1H52.7Z" fill="white"></path></svg></div>');function ui(e,t){let n=Dr(t,"size",8,16),r=Dr(t,"bg",8,"#069E08");var i=fi(),s=Rt(i),o=Rt(s);Xt(()=>{Lr(i,`width: ${n()??""}px; height: ${n()??""}px;`),Or(o,"fill",r())}),er(e,i)}var di=Xn('<div class="spinner svelte-q7ue1b"><!></div>');var hi=Yn('<svg class="w-6 h-6 svelte-qy5udj" fill="none" stroke="white" width="18" height="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>');var vi=Xn('<span style="font-size: 0.75em;"><</span> 1x',1),pi=Xn('<div class="bubble-inner svelte-1vido64"><div class="label"><!></div></div>'),gi=Xn('<div class="bubble-inner svelte-1vido64"><!></div>'),mi=Xn('<div><div class="bubble svelte-1vido64"><!></div></div>');function _i(e,t){fe(t,!1);const n=()=>je(l,"$oversizedRatio",r),[r,i]=Ce();let s=Dr(t,"index",8),o=Dr(t,"store",8),a=mt();const l=o().oversizedRatio,c=o().loading,f={delay:150+50*s(),duration:250,y:2,easing:ii};let u=mt();const d=qr();Kt(()=>n(),()=>{_t(a,n()>4?"high":n()>2.5?"medium":"normal")}),Zt(),Rr();var h=mi(),v=Rt(h),p=Rt(v),g=e=>{var t=pi(),r=Rt(t),i=Rt(r),s=e=>{var t=Jn();Xt(e=>nr(t,`${e??""}x`),[()=>(n(),Rn(()=>Math.floor(n())))]),er(e,t)},o=e=>{var t=Qn(),r=It(t),i=e=>{!function(e){er(e,hi())}(e)},s=e=>{var t=Jn();Xt(e=>nr(t,`${e??""}x`),[()=>(n(),Rn(()=>n().toFixed(1)))]),er(e,t)};ar(r,e=>{"normal"===Cn(a)?e(i):e(s,-1)}),er(e,t)},l=e=>{er(e,vi())};ar(i,e=>{n()>9?e(s):n()>.99?e(o,1):e(l,-1)}),kr(1,r,()=>li,()=>({delay:200,duration:300})),er(e,t)},m=e=>{var t=gi();!function(e){var t=di();ui(Rt(t),{size:12,bg:"transparent"}),kr(2,t,()=>li,()=>({duration:300})),er(e,t)}(Rt(t)),er(e,t)};ar(p,e=>{!1===je(c,"$isLoading",r)?e(g):e(m,-1)}),Ar(h,e=>_t(u,e),()=>Cn(u)),Xt(()=>zr(h,1,`interaction-area ${Cn(a)??""}`,"svelte-1vido64")),Hn("mouseenter",h,function(){const e=Cn(u).getBoundingClientRect();d("hover",{index:s(),position:{top:e.top+e.height+10,left:e.left}})}),kr(3,h,()=>ci,()=>f),er(e,h),ue(),i()}var wi=Yn('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="svelte-1b220d7"><path d="M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"></path></svg>');var yi=Xn('<div class="explanation svelte-1okxgd8">The image loaded is <strong> </strong> larger than it appears in the browser. <!></div>'),bi=Xn('<div class="explanation svelte-1okxgd8">The image is exactly the correct size for this screen.</div>'),ki=Xn("Because there are various screen sizes, it's okay for the image to be <strong> </strong> than it appears on the page.",1),xi=Xn('<div class="explanation svelte-1okxgd8">The image size is very close to the size it appears in the browser. <!></div>'),Si=Xn('<div class="explanation svelte-1okxgd8"> </div>'),$i=Xn('<img class="svelte-1okxgd8"/>'),Ei=Xn('<div class="value"> </div>'),zi=Xn("<em>Unknown</em>"),Mi=Xn('<div class="value"><!></div>'),Li=Xn("<em>Unknown</em>"),Ti=Xn("<strong> </strong>"),ji=Xn("<em>N/A</em>"),Oi=Xn('<div class="jetpack-boost-guide-popup keep-guide-open svelte-1okxgd8"><div class="logo svelte-1okxgd8"><!></div> <div class="preview svelte-1okxgd8"><div class="description svelte-1okxgd8"><div class="title svelte-1okxgd8"><a target="_blank noreferrer" class="svelte-1okxgd8"> </a></div> <!></div> <!></div> <div class="meta"><div class="row svelte-1okxgd8"><div class="label">Image File Dimensions</div> <!></div> <div class="row svelte-1okxgd8"><div class="label">Expected Dimensions</div> <div class="value"> </div></div> <div class="row svelte-1okxgd8"><div class="label">Size on screen</div> <div class="value"> </div></div> <div class="row svelte-1okxgd8"><div class="label">Image Size</div> <div class="value"><!></div></div> <div class="row svelte-1okxgd8"><div class="label">Potential savings</div> <div class="value"><!></div></div> <div class="info svelte-1okxgd8"><a class="documentation svelte-1okxgd8" target="_blank noreferrer">Learn how to improve site speed by optimizing images <!></a></div></div></div>');function Ci(e,t){fe(t,!1);const n=()=>je(Cn(w),"$imageURL",f),r=()=>je(Cn(v),"$fileSize",f),i=()=>je(Cn(h),"$oversizedRatio",f),s=()=>je(Cn(d),"$isLoading",f),o=()=>je(Cn(_),"$expectedSize",f),a=()=>je(Cn(g),"$sizeOnPage",f),l=()=>je(Cn(p),"$fileWeight",f),c=()=>je(Cn(m),"$potentialSavings",f),[f,u]=Ce(),d=mt(),h=mt(),v=mt(),p=mt(),g=mt(),m=mt(),_=mt(),w=mt(),y=mt(),b=mt(),k=mt(),x=mt();let S=Dr(t,"store",8),$=Dr(t,"size",8),E=Dr(t,"position",8);function z(e){return e%1==0?e:parseFloat(e.toFixed(2))}let M=mt(0),L=0,T=0,j=mt(E().top);Fr(()=>{L=Cn(M),T=E().top,_t(j,E().top)});Kt(()=>In(S()),()=>{Oe(_t(d,S().loading),"$isLoading",f)}),Kt(()=>In(S()),()=>{Oe(_t(h,S().oversizedRatio),"$oversizedRatio",f)}),Kt(()=>In(S()),()=>{Oe(_t(v,S().fileSize),"$fileSize",f)}),Kt(()=>In(S()),()=>{Oe(_t(p,S().fileWeight),"$fileWeight",f)}),Kt(()=>In(S()),()=>{Oe(_t(g,S().sizeOnPage),"$sizeOnPage",f)}),Kt(()=>In(S()),()=>{Oe(_t(m,S().potentialSavings),"$potentialSavings",f)}),Kt(()=>In(S()),()=>{Oe(_t(_,S().expectedSize),"$expectedSize",f)}),Kt(()=>In(S()),()=>{Oe(_t(w,S().url),"$imageURL",f)}),Kt(()=>n(),()=>{_t(y,n().split("/").pop())}),Kt(()=>In($()),()=>{_t(b,"normal"===$()?100:50)}),Kt(()=>(Cn(b),r()),()=>{_t(k,Math.floor(Cn(b)/(r().width/r().height)))}),Kt(()=>i(),()=>{_t(x,z(i()))}),Kt(()=>Cn(M),()=>{var e;0!==(e=Cn(M))&&L!==e&&_t(j,T+(L-e))}),Zt(),Rr();var O=Oi();let C;var P=Rt(O);ui(Rt(P),{size:250});var A=Wt(P,2),R=Rt(A),I=Rt(R),W=Rt(I),D=Rt(W),F=Wt(I,2),q=e=>{var t=yi(),n=Wt(Rt(t)),i=Rt(n),s=Wt(n,2),o=e=>{er(e,Jn("Try using a smaller image or reduce the file size by compressing it."))};ar(s,e=>{r(),Rn(()=>r().weight>450)&&e(o)}),Xt(()=>nr(i,`${Cn(x)??""}x`)),er(e,t)},N=e=>{er(e,bi())},U=e=>{var t=xi(),n=Wt(Rt(t)),r=e=>{var t=ki(),n=Rt(Wt(It(t)));Xt(()=>nr(n,`${Cn(x)??""}x`)),er(e,t)};ar(n,e=>{Cn(x)>1&&e(r)}),er(e,t)},H=e=>{const t=st(()=>(i(),Rn(()=>z(1/i()))));var n=Si(),r=Rt(n);Xt(()=>nr(r,`The image file is ${Cn(t)??""}x smaller than expected on this screen. This might be fine,\n\t\t\t\t\tbut you may want to check if the image appears blurry.`)),er(e,n)};ar(F,e=>{Cn(x)>=1.3?e(q):1===Cn(x)?e(N,1):Cn(x)>=.99&&Cn(x)<1.3?e(U,2):e(H,-1)});var B=Wt(R,2),V=e=>{var t=$i();Xt(()=>{Or(t,"src",n()),Or(t,"alt",Cn(y)),Lr(t,`width: ${Cn(b)??""}px; height: ${Cn(k)??""}px;`),Or(t,"width",Cn(b)),Or(t,"height",Cn(k))}),er(e,t)};ar(B,e=>{n()&&e(V)});var K=Rt(Wt(A,2)),Z=Wt(Rt(K),2),G=e=>{var t=Ei(),n=Rt(t);Xt(()=>nr(n,`${r(),Rn(()=>r().width)??""} x ${r(),Rn(()=>r().height)??""}`)),er(e,t)},X=e=>{var t=Mi(),n=Rt(t),r=e=>{er(e,Jn("Loading..."))},i=e=>{er(e,zi())};ar(n,e=>{s()?e(r):e(i,-1)}),er(e,t)};ar(Z,e=>{r(),Rn(()=>r().width>0&&r().height>0)?e(G):e(X,-1)});var Y=Wt(K,2),J=Wt(Rt(Y),2),Q=Rt(J),ee=Wt(Y,2),te=Wt(Rt(ee),2),ne=Rt(te),re=Wt(ee,2),ie=Wt(Rt(re),2),se=Rt(ie),oe=e=>{var t=Jn();Xt(e=>nr(t,`${e??""} KB`),[()=>(l(),Rn(()=>Math.round(l().weight)))]),er(e,t)},ae=e=>{er(e,Jn("Loading..."))},le=e=>{er(e,Li())};ar(se,e=>{l(),Rn(()=>l().weight>0)?e(oe):s()?e(ae,1):e(le,-1)});var ce=Wt(re,2),de=Wt(Rt(ce),2),he=Rt(de),ve=e=>{var t=Ti(),n=Rt(t);Xt(()=>nr(n,`${c()??""} KB`)),er(e,t)},pe=e=>{er(e,Jn("Loading..."))},ge=e=>{er(e,ji())};ar(he,e=>{c()>0?e(ve):s()?e(pe,1):e(ge,-1)});var me=Rt(Wt(ce,2));Or(me,"href","https://jetpack.com/support/jetpack-boost/image-performance-guide/"),function(e){er(e,wi())}(Wt(Rt(me))),Xt(()=>{C=Lr(O,"",C,{top:`${Cn(j)??""}px`,left:`${In(E()),Rn(()=>E().left)??""}px`}),Or(W,"href",n()),nr(D,Cn(y)),nr(Q,`${o(),Rn(()=>o().width)??""} x ${o(),Rn(()=>o().height)??""}`),nr(ne,`${a(),Rn(()=>a().width)??""} x ${a(),Rn(()=>a().height)??""}`)}),function(e,t,n=t){var r="x"===e,i=()=>Dt(()=>{o=!0,clearTimeout(s),s=setTimeout(a,100),n(window[r?"scrollX":"scrollY"])});addEventListener("scroll",i,{passive:!0});var s,o=!1,a=()=>{o=!1},l=!0;Gt(()=>{var e=t();l?l=!1:o||null==e||(o=!0,clearTimeout(s),r?scrollTo(e,window.scrollY):scrollTo(window.scrollX,e),s=setTimeout(a,100))}),Vt(i),Ut(()=>{removeEventListener("scroll",i)})}("y",()=>Cn(M),e=>_t(M,e)),kr(1,O,()=>ci,()=>({duration:150,y:4,easing:ii})),Hn("mouseleave",O,function(e){Wr.call(this,t,e)}),er(e,O),ue(),u()}var Pi=Xn('<div><div class="previews svelte-6tsow1"></div> <!></div>');function Ai(e,t){fe(t,!1);const n=()=>je(c,"$sizeOnPage",r),[r,i]=Ce(),s=mt();let o=Dr(t,"stores",8),a=mt(!1);function l(e){e.relatedTarget&&e.relatedTarget.classList.contains("keep-guide-open")||_t(a,!1)}Fr(()=>{o().forEach(e=>e.updateDimensions())});const c=o()[0].sizeOnPage;let f=mt({top:0,left:0});function u(e){const t=e.detail,n=t.index;_t(f,t.position),_t(a,n)}const d=ze(o().map(e=>e.fileSize),e=>e.some(e=>-1!==e.width&&-1!==e.height));Kt(()=>n(),()=>{_t(s,function(e=-1,t=-1){return e<200||t<200?"micro":e<400||t<400?"small":"normal"}(n().width,n().height))}),Kt(()=>Cn(a),()=>{!function(e=!1){e?o().forEach(e=>e.node.classList.add("jetpack-boost-guide__backdrop")):o().forEach(e=>e.node.classList.remove("jetpack-boost-guide__backdrop"))}(!1!==Cn(a))}),Zt(),Rr();var h=Qn(),v=It(h),p=e=>{var t=Pi();let n;var r=Rt(t);ur(r,5,o,lr,(e,t,n)=>{_i(e,{index:n,get store(){return Cn(t)},$$events:{hover:u}})});var i=Wt(r,2),c=e=>{Ci(e,{get store(){return In(o()),Cn(a),Rn(()=>o()[Cn(a)])},get size(){return Cn(s)},get position(){return Cn(f)},$$events:{mouseleave:l}})};ar(i,e=>{!1!==Cn(a)&&e(c)}),Xt(()=>n=zr(t,1,`guide ${Cn(s)??""}`,"svelte-6tsow1",n,{show:!1!==Cn(a),"keep-guide-open":!1!==Cn(a)})),Hn("mouseleave",t,l),er(e,t)};ar(v,e=>{"active"===je(Gr,"$guideState",r)&&je(d,"$hasItemsWithFileSize",r)&&e(p)}),er(e,h),ue(),i()}const Ri=[];let Ii;function Wi(e){window.frameElement||(Ii=e,window.addEventListener("load",Di))}function Di(){window.addEventListener("resize",function(){let e;return()=>{e&&clearTimeout(e),e=setTimeout(()=>{Ri.forEach(e=>{e.updateDimensions()})},500)}}()),Jr.trackInitialState(),Gr.subscribe(async e=>{if("paused"===e)return;const t=await ni(Array.from(document.querySelectorAll("body *:not(.jetpack-boost-guide > *):not(.jetpack-boost-guide):not(#wpadminbar *)")),Ii),n=await Promise.all(t.map(e=>e.isImageTiny()));Ri.push(...function(e){const t=e.reduce((e,t)=>{var n;if(!t.node.parentNode)return console.error("Image has no parent",t.node),e;const r=function(e){const t=e.node;if(!(e.node instanceof HTMLImageElement)&&["static","relative"].includes(getComputedStyle(t).position))return t.classList.contains("jetpack-boost-guide")||(t.classList.add("jetpack-boost-guide","relative"),t.dataset.jetpackBoostGuideId=(++Fi).toString()),t;if(!t.parentNode||!t.parentElement)return;const n=function(e){let t,n=e.parentElement;for(;n&&n instanceof HTMLElement&&n!==document.body;){const e=getComputedStyle(n),r="inline"!==e.display,i="static"===e.position,s="relative"===e.position,o="auto"!==e.zIndex;r&&(!t&&(i||s)||s&&o)&&(t=n),n=n.parentElement}return t}(t);if(null==n?void 0:n.classList.contains("jetpack-boost-guide"))return n;if(n){const t=getComputedStyle(n);if("relative"===t.position){const e=Array.from(n.children).find(e=>e.classList.contains("jetpack-boost-guide"));if(e&&e instanceof HTMLElement)return e}const r=document.createElement("div");return r.classList.add("jetpack-boost-guide"),r.dataset.jetpackBoostGuideId=(++Fi).toString(),"static"===t.position&&(n.style.position="relative"),e.node instanceof HTMLImageElement&&(r.style.top=`${e.node.offsetTop}px`),n.prepend(r),r}return t.parentElement}(t);if(!r)return console.error("Could not find a parent for image",t),e;const i=parseInt(r.dataset.jetpackBoostGuideId||""),s=(null===(n=e[i])||void 0===n?void 0:n.props.stores)||[],o=new Yr(t);return s.push(o),1===s.length&&(e[i]={target:r,intro:!0,props:{stores:s}}),e},{});return Object.values(t).map(e=>(rr(Ai,e),e.props.stores)).flat()}(t.filter((e,t)=>!n[t]))),Jr.trackPage(Ri)})}let Fi=0;var qi=Xn('<a id="jetpack-boost-guide-bar"><!> <span> </span></a>');function Ni(e,t){fe(t,!1);const[n,r]=Ce();let i=Dr(t,"href",8),s=Dr(t,"tracksCallback",8);Kt(()=>In(s()),()=>{Jr.setTracksCallback(s())}),Zt(),Rr();var o=qi(),a=Rt(o);ui(a,{});var l,c=Rt(Wt(a,2));Xt(()=>{Or(o,"href",i()),zr(o,1,`ab-item ${je(Gr,"$guideState",n)??""}`,"svelte-1km5e3e"),nr(c,`Image Guide: ${je(Xr,"$guideLabel",n)??""}`)}),Hn("click",o,(l=function(){Gr.cycle(),Jr.trackUIStateChange()},function(...e){return e[0].preventDefault(),l?.apply(this,e)})),er(e,o),ue(),r()}function Ui(e,{href:t,tracksCallback:n,fetchFunction:r}){return Wi(r),rr(Ni,{target:e,props:{href:t,tracksCallback:n}})}export{Nr as MeasurableImage,ni as getMeasurableImages,Ui as setupImageGuideUI};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type SourceCallbackFn = (node: HTMLElement) => string | null;
|
|
2
|
+
export type Dimensions = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export type Weight = {
|
|
7
|
+
weight: number;
|
|
8
|
+
};
|
|
9
|
+
export type FetchFn = (url: string) => Promise<Response>;
|
|
10
|
+
/**
|
|
11
|
+
* A class that represents a DOM Element that
|
|
12
|
+
* has an image that should be measured and
|
|
13
|
+
* provides measurement utilities.
|
|
14
|
+
*/
|
|
15
|
+
export declare class MeasurableImage {
|
|
16
|
+
readonly node: HTMLElement | HTMLImageElement;
|
|
17
|
+
private getURLCallback;
|
|
18
|
+
fetch: FetchFn;
|
|
19
|
+
/**
|
|
20
|
+
* Constructor.
|
|
21
|
+
*
|
|
22
|
+
* @param {HTMLElement | HTMLImageElement} node - The DOM Element that contains the image.
|
|
23
|
+
* @param {SourceCallbackFn} getURL - A function that takes in the node and returns the URL of the image.
|
|
24
|
+
* @param {FetchFn} fetchFn - A function that fetches a URL and returns a Promise.
|
|
25
|
+
*/
|
|
26
|
+
constructor(node: HTMLElement | HTMLImageElement, getURL: SourceCallbackFn, fetchFn?: FetchFn | null);
|
|
27
|
+
getURL(): string;
|
|
28
|
+
getSizeOnPage(): {
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
};
|
|
32
|
+
getFileSize(url: string): Promise<{
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}>;
|
|
36
|
+
getWeight(url: string): Promise<number>;
|
|
37
|
+
getPotentialSavings(fileSize: Dimensions, fileWeight: Weight, sizeOnPage: Dimensions): number;
|
|
38
|
+
/**
|
|
39
|
+
* To get the expected size of the image,
|
|
40
|
+
* the image size on page has to be multiplied by the device pixel ratio.
|
|
41
|
+
*
|
|
42
|
+
* @param {Dimensions} sizeOnPage - The size of the image on the page.
|
|
43
|
+
* @return {object} - The expected size of the image.
|
|
44
|
+
*/
|
|
45
|
+
getExpectedSize(sizeOnPage: Dimensions): {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
};
|
|
49
|
+
getOversizedRatio(fileSize: Dimensions, sizeOnPage: Dimensions): number;
|
|
50
|
+
private fetchFileWeight;
|
|
51
|
+
private fetchFileDimensions;
|
|
52
|
+
/**
|
|
53
|
+
* Checks if the image is too small and should be ignored. Will return true on images
|
|
54
|
+
* that don't load at all - we can't establish they're tiny!
|
|
55
|
+
*
|
|
56
|
+
* @return {boolean} - if the image is smaller than 65 pixels width and height return true
|
|
57
|
+
*/
|
|
58
|
+
isImageTiny(): Promise<boolean>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
* ! MutationObserver is currently not used.
|
|
5
|
+
* ! This needs significant improvement before we can use it.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
type ImageCallback = (images: HTMLElement[]) => void;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param callback
|
|
13
|
+
*/
|
|
14
|
+
export declare function createImageObserver(callback: ImageCallback): Promise<MutationObserver>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MeasurableImageStore } from './stores/MeasurableImageStore.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Image properties sent to tracks.
|
|
4
|
+
*/
|
|
5
|
+
type ImageProperties = {
|
|
6
|
+
severity: 'red' | 'yellow' | 'green';
|
|
7
|
+
oversized_ratio: number;
|
|
8
|
+
file_width: number;
|
|
9
|
+
file_height: number;
|
|
10
|
+
size_on_page_width: number;
|
|
11
|
+
size_on_page_height: number;
|
|
12
|
+
expected_width: number;
|
|
13
|
+
expected_height: number;
|
|
14
|
+
potential_savings: number | null;
|
|
15
|
+
image_url: string;
|
|
16
|
+
};
|
|
17
|
+
export type TracksCallback = (event: string, props: {
|
|
18
|
+
[key: string]: string | number;
|
|
19
|
+
}) => void;
|
|
20
|
+
export default class ImageGuideAnalytics {
|
|
21
|
+
static trackingComplete: boolean;
|
|
22
|
+
static tracksCallback: TracksCallback;
|
|
23
|
+
static setTracksCallback(callback: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* Track the image guide analytics for a single image.
|
|
26
|
+
*
|
|
27
|
+
* @param { MeasurableImageStore } imageStore - The image store to track.
|
|
28
|
+
* @return { Promise< ImageProperties > } Promise that resolves with the properties of the image.
|
|
29
|
+
*/
|
|
30
|
+
static trackImageOutcome(imageStore: MeasurableImageStore): Promise<ImageProperties>;
|
|
31
|
+
/**
|
|
32
|
+
* Track events to record the outcome of the image guide for the current page.
|
|
33
|
+
*
|
|
34
|
+
* @param {MeasurableImageStore[]} imageStores - The image stores to track.
|
|
35
|
+
*/
|
|
36
|
+
static trackPage(imageStores: MeasurableImageStore[]): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Track the state of the UI when the user loads a page.
|
|
39
|
+
*/
|
|
40
|
+
static trackInitialState(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Track the state of the UI when the user changes it.
|
|
43
|
+
*/
|
|
44
|
+
static trackUIStateChange(): void;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MeasurableImage, type FetchFn } from './MeasurableImage.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Get elements that either are image tags or have a background image.
|
|
4
|
+
*
|
|
5
|
+
* @param {Element[]} nodes - A list of nodes to filter
|
|
6
|
+
* @return {HTMLElement[] | HTMLImageElement[]} - A list of nodes that are either image tags or have a background image.
|
|
7
|
+
*/
|
|
8
|
+
export declare function findMeasurableElements(nodes: Element[]): HTMLElement[] | HTMLImageElement[];
|
|
9
|
+
/**
|
|
10
|
+
* Get the current image source from a node.
|
|
11
|
+
*
|
|
12
|
+
* @param {HTMLImageElement} node - HTMLImageElement
|
|
13
|
+
* @return {string | null} - The URL of the image or null if it can't be determined.
|
|
14
|
+
*/
|
|
15
|
+
export declare function imageTagSource(node: HTMLImageElement): string;
|
|
16
|
+
/**
|
|
17
|
+
* Get the background image URL from a node.
|
|
18
|
+
*
|
|
19
|
+
* @param {HTMLImageElement} node - HTMLElement
|
|
20
|
+
* @return {string | null} - The URL of the image or null if it can't be determined.
|
|
21
|
+
*/
|
|
22
|
+
export declare function backgroundImageSource(node: HTMLElement): string;
|
|
23
|
+
/**
|
|
24
|
+
* Create MeasurableImage objects from a list of nodes
|
|
25
|
+
* and remove any nodes that can't be measured.
|
|
26
|
+
*
|
|
27
|
+
* @param {Element[]} domNodes - A list of nodes to measure
|
|
28
|
+
* @param {(input: string, init?: Array) => Promise<Response>} fetchFn - A function that fetches a URL and returns a Promise.
|
|
29
|
+
* @return {MeasurableImage[]} - A list of MeasurableImage objects.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getMeasurableImages(domNodes: Element[], fetchFn?: FetchFn | null): Promise<MeasurableImage[]>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MeasurableImage, type Dimensions, type FetchFn, type Weight } from './MeasurableImage.ts';
|
|
2
|
+
import { type TracksCallback } from './analytics.ts';
|
|
3
|
+
import { getMeasurableImages } from './find-image-elements.ts';
|
|
4
|
+
export { MeasurableImage, getMeasurableImages };
|
|
5
|
+
export type { Weight, Dimensions };
|
|
6
|
+
type ImageGuideUIOptions = {
|
|
7
|
+
href: string;
|
|
8
|
+
tracksCallback: TracksCallback;
|
|
9
|
+
fetchFunction: FetchFn;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Set up the Image Guide UI in the given target parent.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} target - The parent element to mount the UI in.
|
|
15
|
+
* @param {object} args - The arguments to pass to the UI.
|
|
16
|
+
* @param {string} args.href - The URL to the image guide.
|
|
17
|
+
* @param {Function} args.tracksCallback - The callback to call when tracking an event.
|
|
18
|
+
* @param {Function} args.fetchFunction - The function to use to fetch the image weight.
|
|
19
|
+
* @return {object} The Svelte component instance.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setupImageGuideUI(target: HTMLElement, { href, tracksCallback, fetchFunction }: ImageGuideUIOptions): {
|
|
22
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
23
|
+
$set?(props: Partial<Record<string, any>>): void;
|
|
24
|
+
} & Record<string, any>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MeasurableImageStore } from './stores/MeasurableImageStore.ts';
|
|
2
|
+
import type { FetchFn, MeasurableImage } from './MeasurableImage.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Set up a listener to initialize stuff on window load.
|
|
5
|
+
*
|
|
6
|
+
* @param {Function} fetchFn - An optional custom function to use when fetching the URL weights.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setupLoadListener(fetchFn?: FetchFn): void;
|
|
9
|
+
/**
|
|
10
|
+
* This gets a little tricky because of the various layout positions
|
|
11
|
+
* the images can be in.
|
|
12
|
+
*
|
|
13
|
+
* For example, images can be positioned with static, absolute, fixed, etc.
|
|
14
|
+
* But on top of that, they can be a part of a parent that has that positioning.
|
|
15
|
+
* And to make things even more complex, they can change dynamically, for example in a slider.
|
|
16
|
+
*
|
|
17
|
+
* This function attempts to attach the Svelte Components to the DOM in a non-destructive way.
|
|
18
|
+
*
|
|
19
|
+
* @param {MeasurableImage[]} measuredImages - The images to attach the guides to.
|
|
20
|
+
* @return {MeasurableImageStore[]} The stores for the attached images.
|
|
21
|
+
*/
|
|
22
|
+
export declare function attachGuides(measuredImages: MeasurableImage[]): MeasurableImageStore[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Writable } from 'svelte/store';
|
|
2
|
+
declare const store: {
|
|
3
|
+
readonly active: "Active";
|
|
4
|
+
readonly paused: "Paused";
|
|
5
|
+
};
|
|
6
|
+
type State = keyof typeof store;
|
|
7
|
+
type CyclableStore = Writable<State> & {
|
|
8
|
+
cycle: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const guideState: CyclableStore;
|
|
11
|
+
export declare const guideLabel: import("svelte/store").Readable<"Active" | "Paused">;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Writable, type Readable } from 'svelte/store';
|
|
2
|
+
import { MeasurableImage } from '../MeasurableImage.ts';
|
|
3
|
+
import type { Dimensions, Weight } from '../MeasurableImage.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Each measurable image has its own set of Svelte stores.
|
|
6
|
+
*
|
|
7
|
+
* This class relies on MeasurableImage to calculate the values
|
|
8
|
+
* and stores them in multiple Svelte stores,
|
|
9
|
+
* so that the dimensions are easily
|
|
10
|
+
* accessible in the components.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MeasurableImageStore {
|
|
13
|
+
readonly fileSize: Writable<Dimensions>;
|
|
14
|
+
readonly fileWeight: Writable<Weight>;
|
|
15
|
+
readonly sizeOnPage: Writable<Dimensions>;
|
|
16
|
+
readonly potentialSavings: Readable<number | null>;
|
|
17
|
+
readonly expectedSize: Readable<Dimensions>;
|
|
18
|
+
readonly oversizedRatio: Readable<number>;
|
|
19
|
+
readonly url: Writable<string>;
|
|
20
|
+
readonly loading: Writable<boolean>;
|
|
21
|
+
readonly image: MeasurableImage;
|
|
22
|
+
readonly node: MeasurableImage['node'];
|
|
23
|
+
private weightMap;
|
|
24
|
+
private currentSrc;
|
|
25
|
+
constructor(measurableImage: MeasurableImage);
|
|
26
|
+
private deriveOversizedRatio;
|
|
27
|
+
private deriveExpectedSize;
|
|
28
|
+
private derivePotentialSavings;
|
|
29
|
+
updateDimensions(): Promise<void>;
|
|
30
|
+
private updateFileDimensions;
|
|
31
|
+
private maybeUpdateWeight;
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MeasurableImageStore } from './stores/MeasurableImageStore.ts';
|
|
2
|
+
export type GuideSize = 'normal' | 'small' | 'micro';
|
|
3
|
+
export interface ImageGuideConfig {
|
|
4
|
+
target: HTMLElement;
|
|
5
|
+
intro?: boolean;
|
|
6
|
+
props: {
|
|
7
|
+
stores: MeasurableImageStore[];
|
|
8
|
+
};
|
|
9
|
+
}
|
package/build/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MeasurableImageStore } from './stores/MeasurableImageStore.ts';
|
|
2
|
-
import type { ComponentConstructorOptions } from 'svelte';
|
|
3
2
|
export type GuideSize = 'normal' | 'small' | 'micro';
|
|
4
|
-
export interface ImageGuideConfig
|
|
3
|
+
export interface ImageGuideConfig {
|
|
5
4
|
target: HTMLElement;
|
|
5
|
+
intro?: boolean;
|
|
6
6
|
props: {
|
|
7
7
|
stores: MeasurableImageStore[];
|
|
8
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-image-guide",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "Go through the dom to analyze image size on screen vs actual file size.",
|
|
5
5
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/image-guide/#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/Automattic/jetpack.git"
|
|
12
|
-
"directory": "projects/js-packages/image-guide"
|
|
11
|
+
"url": "git+https://github.com/Automattic/jetpack-image-guide.git"
|
|
13
12
|
},
|
|
14
13
|
"license": "GPL-2.0-or-later",
|
|
15
14
|
"author": "Automattic",
|
|
@@ -25,44 +24,45 @@
|
|
|
25
24
|
"@automattic/jetpack-image-guide": false
|
|
26
25
|
},
|
|
27
26
|
"scripts": {
|
|
28
|
-
"build": "rollup -c &&
|
|
27
|
+
"build": "rollup -c && tsgo --emitDeclarationOnly",
|
|
29
28
|
"build-concurrently": "pnpm run clear-dist && concurrently 'pnpm:validate-ts' 'rollup -c'",
|
|
30
29
|
"build-development": "pnpm run build-concurrently",
|
|
31
30
|
"build-production": "NODE_ENV=production BABEL_ENV=production pnpm run build-concurrently",
|
|
32
31
|
"clear-dist": "rm -rf app/assets/dist/*",
|
|
33
32
|
"dev": "concurrently 'pnpm:dev-validate-ts' 'pnpm:dev-compile'",
|
|
34
33
|
"dev-compile": "pnpm run clear-dist && rollup -c -w",
|
|
35
|
-
"dev-validate-ts": "
|
|
34
|
+
"dev-validate-ts": "tsgo --watch --pretty --strict false # Note: Disable Strict mode to avoid noisy development, while keeping strict errors visible in IDEs.",
|
|
36
35
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest --config=tests/jest.config.cjs",
|
|
37
36
|
"test-coverage": "pnpm run test --coverage",
|
|
38
|
-
"typecheck": "
|
|
39
|
-
"validate-ts": "
|
|
37
|
+
"typecheck": "tsgo --noEmit",
|
|
38
|
+
"validate-ts": "tsgo --pretty --strict false",
|
|
40
39
|
"watch": "pnpm run dev"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@babel/core": "^7.0.0",
|
|
44
|
-
"@babel/preset-env": "7.
|
|
45
|
-
"@babel/preset-react": "7.
|
|
46
|
-
"@babel/preset-typescript": "7.
|
|
43
|
+
"@babel/preset-env": "7.29.2",
|
|
44
|
+
"@babel/preset-react": "7.28.5",
|
|
45
|
+
"@babel/preset-typescript": "7.28.5",
|
|
47
46
|
"@rollup/plugin-babel": "6.0.4",
|
|
48
47
|
"@rollup/plugin-commonjs": "26.0.1",
|
|
49
48
|
"@rollup/plugin-json": "6.1.0",
|
|
50
49
|
"@rollup/plugin-node-resolve": "15.3.0",
|
|
51
50
|
"@rollup/plugin-replace": "5.0.2",
|
|
52
|
-
"@rollup/plugin-terser": "0.
|
|
51
|
+
"@rollup/plugin-terser": "1.0.0",
|
|
53
52
|
"@rollup/plugin-typescript": "12.1.0",
|
|
53
|
+
"@typescript/native-preview": "7.0.0-dev.20260225.1",
|
|
54
54
|
"concurrently": "9.2.1",
|
|
55
|
-
"jest": "30.
|
|
55
|
+
"jest": "30.3.0",
|
|
56
56
|
"postcss": "8.5.6",
|
|
57
|
-
"rollup": "3.
|
|
57
|
+
"rollup": "3.30.0",
|
|
58
58
|
"rollup-plugin-postcss": "4.0.2",
|
|
59
59
|
"rollup-plugin-svelte": "7.2.2",
|
|
60
60
|
"sass": "npm:sass-embedded@^1.97.2",
|
|
61
|
-
"svelte": "
|
|
61
|
+
"svelte": "5.53.12",
|
|
62
62
|
"svelte-preprocess": "6.0.2",
|
|
63
63
|
"tslib": "2.8.1",
|
|
64
64
|
"typescript": "5.9.3",
|
|
65
|
-
"webpack": "5.
|
|
65
|
+
"webpack": "5.105.2",
|
|
66
66
|
"webpack-cli": "6.0.1"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/rollup.config.js
CHANGED
|
@@ -92,7 +92,13 @@ export default {
|
|
|
92
92
|
|
|
93
93
|
// If we're building for production (npm run build
|
|
94
94
|
// instead of npm run dev), minify
|
|
95
|
-
production &&
|
|
95
|
+
production &&
|
|
96
|
+
terser( {
|
|
97
|
+
mangle: {
|
|
98
|
+
// Preserve WP i18n methods.
|
|
99
|
+
reserved: [ '__', '_n', '_nx', '_x' ],
|
|
100
|
+
},
|
|
101
|
+
} ),
|
|
96
102
|
],
|
|
97
103
|
|
|
98
104
|
watch: {
|