@swell/apps-sdk 1.0.77 → 1.0.78

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/dist/index.cjs CHANGED
@@ -30,7 +30,7 @@
30
30
  </div>
31
31
  `}}function c5(n){return(e,t,i)=>!_4(e)||!_4(t)?e:i?Math.floor(e/t):e/t}function u5(n){return(e,...t)=>{if(!e)return null;let i=D.get(e),r=j(t);return i.face(r)}}function C5(n){return(e,t,i)=>D.get(e).modify(t,i)}function m5(n){return e=>D.get(e).url()}var I2={bind(n){return async e=>{if(e){let t=e.country?.iso_code||e.country_code||(typeof e.country=="string"?e.country:null);if(e.name||e.address1||e.state||t){let i=[e.name,e.company,e.address1,e.address2,e.city,e.state,t,e.zip].filter(Boolean);if(i.length>0)return`
32
32
  <p>${i.join("<br />")}</p>
33
- `}}return"<p></p>"}},resolve:[["name","company","address1","address2","city","state","country_code","country","zip"]]};function p5(n){return(e,...t)=>{let{width:i,height:r,widths:a,srcset:o,preload:s,alt:l,loading:c="lazy",...u}=j(t);i===void 0&&(i=H2(e,"width")),r===void 0&&(r=H2(e,"height")),a===void 0&&typeof i=="number"&&(a=W1(i)),o===void 0&&Array.isArray(a)&&(o=J1(e,a)),c===null?c=void 0:s&&(c="eager");let h={src:e,width:i,height:r,srcset:o,alt:l,loading:c,...u};return`<img ${Object.entries(h).filter(([p,C])=>C!=null).map(([p,C])=>`${p}="${C}"`).join(" ")} />`}}function H2(n,e){let t=n.match(new RegExp(`${e}=(\\d+)`));return t?parseInt(t[1])/2:null}function W1(n){let e=[],t=n;for(;t>256;)t=Math.round(t*.8),e.push(t);return e}function J1(n,e){return e?.map(t=>{let i=n;return i.includes("?")?(i=i.replace(/width=\d+/,`width=${t}`),i=i.replace(/height=\d+/,"")):i=`${i}?width=${t}`,`${i} ${t}w`}).join(", ")}var B2={bind(n){return async(e,...t)=>{let r=await(e?.images?.[0]||e?.image||e?.preview_image||e),a=r?.url||r?.file?.url||(await r?.src)?.url||r,o=String(a);if(typeof o!="string")return"";let s=j(t),l=[s.width&&`width=${Number(s.width)*2}`,s.height&&`height=${Number(s.height)*2}`].filter(Boolean).join("&");return`${o}${l?`?${l}`:""}`}},resolve:[["images","image","preview_image"]]};function g5(n){return async e=>(await n.theme.getThemeConfig(`theme/assets/${e}`))?.file_data||""}function f5(n){return async(e,t=0)=>W3(e,t)}function w5(n){return async(e,t=2)=>`<pre>${await W3(e,t)}</pre>`}function y5(n){return e=>n.renderCurrency(Number(e||0))}function S5(n){return e=>`${n.renderCurrency(e)} ${n.currency?.toUpperCase()}`}function k5(n){return e=>n.renderCurrency(e).replace(/[^0-9.,]/g,"")}function L5(n){return e=>n.renderCurrency(e).split(".")[0].split(",")[0]}function A5(n){return e=>`<link href="${e}" rel="stylesheet" type="text/css" media="all" />`}function b5(n){let e=D3(n);return(t,...i)=>{let r=h5(t),a=e(t,...i);return`<time datetime="${r.toISOString()}">${a}</time>`}}function i4(n){return async(e,t)=>{let i=t&&j(t);return await n.renderTranslation(e,i)}}function T5(n){return function*(t,i,r){let a=[];t=S2(e3(t));for(let o of t)a.push(yield this.context._getFromScope(o,M4(i).replace(/\?$/,"").split("."),!1));return t.filter((o,s)=>r===void 0?y2(a[s],this.context):v3(r)?r.equals(a[s]):a[s]===r)}}function _5(n){return(e,t)=>S.get(e).rgba(t||1)}var G2={bind(n){return(e,t)=>e?.items?.find(r=>r.variant_id===t)?.quantity||0},resolve:[["items"]]};function M5(n){return e=>null}function E5(n){return e=>null}var q2=`<svg viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
33
+ `}}return"<p></p>"}},resolve:[["name","company","address1","address2","city","state","country_code","country","zip"]]};function p5(n){return(e,...t)=>{let{width:i,height:r,widths:a,srcset:o,preload:s,alt:l,loading:c="lazy",...u}=j(t);i===void 0&&(i=H2(e,"width")),r===void 0&&(r=H2(e,"height")),a===void 0&&typeof i=="number"&&(a=W1(i)),o===void 0&&Array.isArray(a)&&(o=J1(e,a)),c===null?c=void 0:s&&(c="eager");let h={src:e,width:i,height:r,srcset:o,alt:l,loading:c,...u};return`<img ${Object.entries(h).filter(([p,C])=>C!=null).map(([p,C])=>`${p}="${C}"`).join(" ")} />`}}function H2(n,e){let t=n.match(new RegExp(`${e}=(\\d+)`));return t?parseInt(t[1])/2:null}function W1(n){let e=[],t=n;for(;t>256;)t=Math.round(t*.8),e.push(t);return e}function J1(n,e){return e?.map(t=>{let i=n;return i.includes("?")?(i=i.replace(/width=\d+/,`width=${t}`),i=i.replace(/height=\d+/,"")):i=`${i}?width=${t}`,`${i} ${t}w`}).join(", ")}var B2={bind(n){return async(e,...t)=>{let r=await(e?.images?.[0]||e?.image||e?.preview_image||e),a=r?.url||r?.file?.url||(await r?.src)?.url||r,o=String(a);if(typeof o!="string")return"";let s=j(t),l=[s.width&&`width=${Number(s.width)*2}`,s.height&&`height=${Number(s.height)*2}`].filter(Boolean).join("&");return`${o}${l?`?${l}`:""}`}},resolve:[["images","image","preview_image"]]};function g5(n){return async e=>(await n.theme.getThemeConfig(`theme/assets/${e}`))?.file_data||""}function f5(n){return async(e,t=0)=>W3(e,t)}function w5(n){return async(e,t=2)=>`<pre>${await W3(e,t)}</pre>`}function y5(n){return e=>n.renderCurrency(Number(e||0))}function S5(n){return e=>`${n.renderCurrency(e)} ${n.currency?.toUpperCase()}`}function k5(n){return e=>n.renderCurrency(e).replace(/[^0-9.,]/g,"")}function L5(n){return e=>n.renderCurrency(e).split(".")[0].split(",")[0]}function A5(n){return e=>`<link href="${e}" rel="stylesheet" type="text/css" media="all" />`}function b5(n){let e=D3(n);return(t,...i)=>{let r=h5(t),a=e(t,...i);return`<time datetime="${r.toISOString()}">${a}</time>`}}function i4(n){return async(e,t)=>{let i=t&&j(t);return await n.renderTranslation(e,i)}}function T5(n){return function*(t,i,r){let a=[];t=S2(e3(t));for(let o of t)a.push(yield this.context._getFromScope(o,M4(i).replace(/\?$/,"").split("."),!1));return t.filter((o,s)=>r===void 0?y2(a[s],this.context):v3(r)?r.equals(a[s]):a[s]===r)}}function _5(n){return(e,t)=>S.get(e).rgba(t||1)}var G2={bind(n){return(e,t)=>e?.items?.find(r=>r.variant_id===t)?.quantity||0},resolve:[["items"]]};function M5(n){return e=>null}function E5(n){return e=>null}var q2=`<svg viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
34
34
  <rect width="760" height="760" fill="white"/>
35
35
  <path d="M434.923 262.5C415.291 255.712 393.386 252.693 372.579 254.298V254.309C330.763 257.518 289.641 283.753 268.363 319.614C251.778 347.565 248.351 376.93 251.587 409.157C255.63 406.306 258.956 406.811 263.335 405.97C263.01 404.556 263.536 403.266 263.749 401.942C268.755 370.243 260.58 356.284 280.704 324.338C348.39 216.91 510.044 278.524 495.116 402.559L494.433 405.263L517.01 413.297C522.789 349.596 506.898 297.139 447.835 263.51C448.272 271.32 438.742 263.824 434.923 262.5Z" fill="#E5E5E5"/>
36
36
  <path d="M515.711 490.283C521.176 481.295 517.402 445.871 517.649 432.193C505.89 421.533 491.98 415.538 472.685 414.744V404.578C464.868 405.454 459.583 401.437 451.911 405.095C450.097 405.959 449.963 409.83 445.304 408.248C442.292 438.746 447.342 474.394 445.55 505.42C449.526 516.876 468.911 515.889 472.741 504.388L473.413 504.264C490.267 501.998 504.949 507.967 515.711 490.283Z" fill="#E5E5E5"/>
@@ -46,7 +46,7 @@
46
46
  <path d="M263.749 404.175C268.755 372.476 260.58 356.273 280.704 324.327C348.39 216.899 510.044 279.646 495.128 403.692" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
47
47
  <path d="M515.89 416.663C521.669 352.963 506.897 297.139 447.835 263.51C373.296 221.073 278.755 256.71 247.959 336.951C238.697 361.098 241.71 392.348 242.079 417.785" stroke="#A3A3A3" stroke-width="6" stroke-linecap="round" stroke-linejoin="round"/>
48
48
  </svg>
49
- `;var V2=`<svg viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
49
+ `;var V2=`<svg viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
50
50
  <rect width="760" height="760" fill="white"/>
51
51
  <path d="M298.828 423.56C298.825 423.565 298.822 423.571 298.818 423.576L298.803 423.56C298.812 423.56 298.82 423.56 298.828 423.56C299.52 422.467 298.938 421.453 298.818 420.391C298.818 420.391 296.5 395 293 380.5C289.5 366 279.5 364.5 279.5 352.5C279.5 340.5 345 353.5 363.495 304.489C370.311 311.32 375.638 317.641 383.253 323.74L383.855 324.17C390.852 329.711 397.082 332.927 404.636 337.195L405.313 337.529C411.723 341.128 418.6 344.248 425.191 347.481L426.485 348.134C464.075 366.397 497.617 371.206 534.455 385.504C550.225 391.635 563.121 400.153 558.456 420.773C556.53 420.98 554.724 421.57 552.858 421.968C472.954 439.308 429.856 424.006 353.879 421.458C336.747 420.885 316.834 423.701 298.828 423.56Z" fill="#E5E5E5"/>
52
52
  <path d="M263.967 421.52C238.509 421.335 211.845 417.439 186.947 417.867C185.698 417.895 184.435 418.109 183.185 418.081C183.114 416.54 183.516 414.856 183.516 413.3C183.516 413.072 183.544 412.843 183.544 412.615C183.544 395.547 184.391 370.774 186.56 354.034C186.617 353.577 186.56 353.121 186.631 352.678C186.574 353.121 186.631 353.592 186.56 354.034L189.661 353.963C229.937 357.445 258.697 376.853 263.967 418.652C264.082 419.622 264.642 420.521 263.967 421.506V421.52Z" fill="#E5E5E5"/>
@@ -59,7 +59,7 @@
59
59
  <path d="M188.374 340.734C236.786 344.934 273.252 370.236 279.586 420.645" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
60
60
  <path d="M336.782 430.986C285.696 434.428 218.846 429.551 191.807 426.683C204.751 431.846 242.03 442.172 287.594 442.172C344.549 442.172 328.153 435.288 404.955 444.754C466.398 452.327 486.936 445.041 489.525 440.451C448.966 447.336 400.641 426.683 336.782 430.986Z" fill="#E5E5E5"/>
61
61
  </svg>
62
- `;var O2=`<svg viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
62
+ `;var O2=`<svg viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
63
63
  <rect width="760" height="760" fill="white"/>
64
64
  <path d="M464.905 411.321C419.039 409.104 343.478 420.962 324.414 424.145C305.351 427.328 304.544 428.112 304.544 428.112C319.607 450.43 372.586 486.89 400.257 486.028C409.793 485.725 447.459 458.488 459.33 452.08C470.128 446.252 481.392 441.07 493.169 437.613C493.358 437.559 493.534 437.431 493.723 437.377C503.738 434.5 514.374 432.472 524.963 433.995L524.633 429.015C504.123 423.348 486.535 412.365 464.905 411.321Z" fill="#E5E5E5"/>
65
65
  <path d="M228.031 432.95C229.037 435.565 229.928 434.742 232.452 436.171L321.231 418.132C306.742 345.385 308.595 315.263 343.478 295.335C323.812 295.84 297.255 303.185 279.816 312.376C275.624 314.586 265.95 320.705 258.158 327.449C240.593 342.653 223.698 354.112 223.698 375.938C223.698 397.764 226.344 428.577 228.031 432.95Z" fill="#E5E5E5"/>
@@ -71,7 +71,7 @@
71
71
  <path d="M491.715 437.232C507.242 446.669 535.659 455.341 551.349 443.018L551.993 442.601" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
72
72
  <path d="M334.318 277.358C326.417 270.595 317.369 269.4 310.974 279.127" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
73
73
  </svg>
74
- `;var U2=`<svg viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
74
+ `;var U2=`<svg viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
75
75
  <rect width="760" height="760" fill="white"/>
76
76
  <path d="M313.863 430.914C357.895 429.203 371.999 379.5 365.499 368.769C357.493 368.769 348.402 368.427 337.88 364.778C324.728 360.217 270.998 358.057 265.499 364.778C260 371.5 263.54 433.765 313.863 430.914Z" fill="#E5E5E5"/>
77
77
  <path d="M464 430C503.581 428.778 517.594 386.5 512.594 368.5C501.594 367 494.194 364 486.594 364C477.094 364 473.594 367 443.594 365.5C419.594 364.3 415.261 370 416.094 373C415.427 391.667 415.406 431.5 464 430Z" fill="#E5E5E5"/>
@@ -83,7 +83,7 @@
83
83
  <path d="M334.5 335C334.5 335 327 326.5 319.5 328C312 329.5 248 354.5 248 354.5" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
84
84
  <path d="M427 335C427 335 434.5 326.5 442 328C449.5 329.5 513.5 354.5 513.5 354.5" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
85
85
  </svg>
86
- `;var $2=`<svg viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
86
+ `;var $2=`<svg viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
87
87
  <rect width="760" height="760" fill="white"/>
88
88
  <path d="M323.499 252.705C321.786 251.737 309.397 252.126 305.964 252.831V252.822C303.445 253.338 284.999 252.831 284.999 265V345.5C284.99 362.006 283.462 386.467 283.498 402.982L301.832 402.855H483.152L486.603 402.982C486.63 385.418 486.782 367.882 487.006 350.327C489.292 349.793 489.686 351.856 490.744 352.877C495.172 357.164 512.4 377.197 517.097 375.795C522.978 369.899 561.881 334.527 560.984 329.345C559.783 322.444 496.275 265.312 487.293 255.165C482.264 251.873 440.251 251.33 437.983 252.705C436.45 253.636 433.806 264.182 431.484 267.537C414.982 291.377 353.781 291.16 336.499 268.369C333.397 264.281 327.093 254.749 323.499 252.705Z" fill="#E5E5E5"/>
89
89
  <path d="M482.876 494H316.318C316.318 494 314.499 495.5 314.499 501.5C314.499 507.5 317.138 518.545 332.965 521.543C374.094 517.431 423.018 525.959 463.188 521.847C480.073 520.118 484.966 509.337 485.999 494.147L482.876 494Z" fill="#E5E5E5"/>
@@ -96,7 +96,7 @@
96
96
  <path d="M380.67 276.51V347.63" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
97
97
  <path d="M270.59 347.79C264.6 351.31 247.68 374.64 242.11 373.31C238.65 372.49 192.56 326.23 192.23 322.69C192.35 320.82 193.16 319.53 194.26 318.07C201.33 308.73 267.69 243.35 275.37 239.37C277.97 238.02 280.87 237.72 283.68 237.15C287.51 236.37 325.57 235.94 327.48 237.01C331.49 239.27 333.61 249.81 337.07 254.33C356.35 279.53 405.3 279.77 423.71 253.41C426.3 249.7 429.25 238.04 430.96 237.01C433.49 235.49 480.36 236.09 485.97 239.73C495.99 250.95 566.84 314.12 568.18 321.75C569.18 327.48 525.78 366.59 519.22 373.11C513.98 374.66 494.76 352.51 489.82 347.77" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
98
98
  </svg>
99
- `;var K2=`<svg viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
99
+ `;var K2=`<svg viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
100
100
  <rect width="760" height="760" fill="white"/>
101
101
  <path d="M328 261.307C317.995 265.675 308.33 272.901 301.141 281C301.115 279.935 301.124 278.87 301.124 277.789C301.107 263.428 300.597 255.95 301.779 241.623C305.761 241.706 325.371 239.979 327.166 241.941L327.821 260.066L328 261.307Z" fill="#E5E5E5"/>
102
102
  <path d="M466.91 284C460.74 277.235 449.527 268.778 441 265.124L441.261 263.773L442.549 241H467.129C468.821 242.46 467.491 277.936 467.693 283.458L466.918 286L466.91 284Z" fill="#E5E5E5"/>
@@ -414,7 +414,7 @@
414
414
  <circle cx="203.5" cy="212.5" r="5.5" stroke="#A3A3A3" stroke-width="2"/>
415
415
  <rect x="174" y="194" width="178" height="138" rx="7" stroke="#A3A3A3" stroke-width="2"/>
416
416
  </svg>
417
- `;var ne=`<svg preserveAspectRatio="xMidYMid slice" viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
417
+ `;var ne=`<svg preserveAspectRatio="xMidYMid slice" viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
418
418
  <rect width="760" height="760" fill="white"/>
419
419
  <path d="M275.341 319.699C274.471 329.199 274.731 338.699 274.731 348.219C274.731 366.479 275.101 384.729 275.141 402.989C275.161 412.229 275.051 421.479 275.141 430.709C275.241 440.559 274.971 450.429 275.141 460.269C275.291 469.109 274.201 479.609 274.801 488.029C276.011 505.149 279.851 517.749 299.161 521.409C349.341 516.389 409.031 526.799 458.041 521.779C478.641 519.669 484.601 506.499 485.871 487.969C486.441 479.589 484.901 469.059 485.041 460.209C485.191 450.349 485.211 440.439 485.281 430.569C485.341 421.339 484.971 412.149 484.981 402.939C485.021 383.529 485.181 364.129 485.431 344.719C485.541 336.379 485.661 328.009 485.811 319.669" fill="white"/>
420
420
  <path d="M270.36 347.559C264.37 351.079 247.45 374.409 241.88 373.079C238.42 372.259 192.33 325.999 192 322.459C192.12 320.589 192.93 319.299 194.03 317.839C201.1 308.499 267.46 243.119 275.14 239.139C277.74 237.789 280.64 237.489 283.45 236.919C287.28 236.139 325.34 235.709 327.25 236.779C331.26 239.039 333.38 249.579 336.84 254.099C356.12 279.299 405.07 279.539 423.48 253.179C426.07 249.469 429.02 237.809 430.73 236.779C433.26 235.259 480.13 235.859 485.74 239.499C495.76 250.719 566.61 313.889 567.95 321.519C568.95 327.249 525.55 366.359 518.99 372.879C513.75 374.429 494.53 352.279 489.59 347.539" fill="white"/>
@@ -423,7 +423,7 @@
423
423
  <path d="M380.439 276.279V347.399" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
424
424
  <path d="M270.36 347.559C264.37 351.079 247.45 374.409 241.88 373.079C238.42 372.259 192.33 325.999 192 322.459C192.12 320.589 192.93 319.299 194.03 317.839C201.1 308.499 267.46 243.119 275.14 239.139C277.74 237.789 280.64 237.489 283.45 236.919C287.28 236.139 325.34 235.709 327.25 236.779C331.26 239.039 333.38 249.579 336.84 254.099C356.12 279.299 405.07 279.539 423.48 253.179C426.07 249.469 429.02 237.809 430.73 236.779C433.26 235.259 480.13 235.859 485.74 239.499C495.76 250.719 566.61 313.889 567.95 321.519C568.95 327.249 525.55 366.359 518.99 372.879C513.75 374.429 494.53 352.279 489.59 347.539" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
425
425
  </svg>
426
- `;var re=`<svg preserveAspectRatio="xMidYMid slice" viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
426
+ `;var re=`<svg preserveAspectRatio="xMidYMid slice" viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
427
427
  <rect width="760" height="760" fill="white"/>
428
428
  <path d="M275.339 319.699C274.469 329.199 274.729 338.699 274.729 348.219C274.729 366.479 275.099 384.729 275.139 402.989C275.159 412.229 275.049 421.479 275.139 430.709C275.239 440.559 274.969 450.429 275.139 460.269C275.289 469.109 274.199 479.609 274.799 488.029C276.009 505.149 279.849 517.749 299.159 521.409C349.339 516.389 409.029 526.799 458.039 521.779C478.639 519.669 484.599 506.499 485.869 487.969C486.439 479.589 484.899 469.059 485.039 460.209C485.189 450.349 485.209 440.439 485.279 430.569C485.339 421.339 484.969 412.149 484.979 402.939C485.019 383.529 485.179 364.129 485.429 344.719C485.539 336.379 485.659 328.009 485.809 319.669" fill="white"/>
429
429
  <path d="M270.36 347.559C264.37 351.079 247.45 374.409 241.88 373.079C238.42 372.259 192.33 325.999 192 322.459C192.12 320.589 192.93 319.299 194.03 317.839C201.1 308.499 267.46 243.119 275.14 239.139C277.74 237.789 280.64 237.489 283.45 236.919C287.28 236.139 325.34 235.709 327.25 236.779C331.26 239.039 333.38 249.579 336.84 254.099C356.12 279.299 405.07 279.539 423.48 253.179C426.07 249.469 429.02 237.809 430.73 236.779C433.26 235.259 480.13 235.859 485.74 239.499C495.76 250.719 566.61 313.889 567.95 321.519C568.95 327.249 525.55 366.359 518.99 372.879C513.75 374.429 494.53 352.279 489.59 347.539" fill="white"/>
@@ -438,7 +438,7 @@
438
438
  <path d="M278.84 402.819H481.13" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
439
439
  <path d="M380.439 276.279V347.399" stroke="#A3A3A3" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
440
440
  </svg>
441
- `;var ae=`<svg preserveAspectRatio="xMidYMid slice" viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
441
+ `;var ae=`<svg preserveAspectRatio="xMidYMid slice" viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
442
442
  <rect width="760" height="760" fill="white"/>
443
443
  <path d="M275.339 319.699C274.469 329.199 274.729 338.699 274.729 348.219C274.729 366.479 275.099 384.729 275.139 402.989C275.159 412.229 275.049 421.479 275.139 430.709C275.239 440.559 274.969 450.429 275.139 460.269C275.289 469.109 274.199 479.609 274.799 488.029C276.009 505.149 279.849 517.749 299.159 521.409C349.339 516.389 409.029 526.799 458.039 521.779C478.639 519.669 484.599 506.499 485.869 487.969C486.439 479.589 484.899 469.059 485.039 460.209C485.189 450.349 485.209 440.439 485.279 430.569C485.339 421.339 484.969 412.149 484.979 402.939C485.019 383.529 485.179 364.129 485.429 344.719C485.539 336.379 485.659 328.009 485.809 319.669" fill="white"/>
444
444
  <path d="M270.36 347.559C264.37 351.079 247.45 374.409 241.88 373.079C238.42 372.259 192.33 325.999 192 322.459C192.12 320.589 192.93 319.299 194.03 317.839C201.1 308.499 267.46 243.119 275.14 239.139C277.74 237.789 280.64 237.489 283.45 236.919C287.28 236.139 325.34 235.709 327.25 236.779C331.26 239.039 333.38 249.579 336.84 254.099C356.12 279.299 405.07 279.539 423.48 253.179C426.07 249.469 429.02 237.809 430.73 236.779C433.26 235.259 480.13 235.859 485.74 239.499C495.76 250.719 566.61 313.889 567.95 321.519C568.95 327.249 525.55 366.359 518.99 372.879C513.75 374.429 494.53 352.279 489.59 347.539" fill="white"/>
@@ -450,7 +450,7 @@
450
450
  <circle cx="378" cy="408" r="7" fill="#A3A3A3"/>
451
451
  <circle cx="378" cy="454" r="7" fill="#A3A3A3"/>
452
452
  </svg>
453
- `;var oe=`<svg preserveAspectRatio="xMidYMid slice" viewBox="0 0 760 760" fill="none" xmlns="http://www.w3.org/2000/svg">
453
+ `;var oe=`<svg preserveAspectRatio="xMidYMid slice" viewBox="120 120 520 520" fill="none" xmlns="http://www.w3.org/2000/svg">
454
454
  <rect width="760" height="760" fill="white"/>
455
455
  <path d="M275.339 319.699C274.469 329.199 274.729 338.699 274.729 348.219C274.729 366.479 275.099 384.729 275.139 402.989C275.159 412.229 275.049 421.479 275.139 430.709C275.239 440.559 274.969 450.429 275.139 460.269C275.289 469.109 274.199 479.609 274.799 488.029C276.009 505.149 279.849 517.749 299.159 521.409C349.339 516.389 409.029 526.799 458.039 521.779C478.639 519.669 484.599 506.499 485.869 487.969C486.439 479.589 484.899 469.059 485.039 460.209C485.189 450.349 485.209 440.439 485.279 430.569C485.339 421.339 484.969 412.149 484.979 402.939C485.019 383.529 485.179 364.129 485.429 344.719C485.539 336.379 485.659 328.009 485.809 319.669" fill="white"/>
456
456
  <path d="M270.36 347.559C264.37 351.079 247.45 374.409 241.88 373.079C238.42 372.259 192.33 325.999 192 322.459C192.12 320.589 192.93 319.299 194.03 317.839C201.1 308.499 267.46 243.119 275.14 239.139C277.74 237.789 280.64 237.489 283.45 236.919C287.28 236.139 325.34 235.709 327.25 236.779C331.26 239.039 333.38 249.579 336.84 254.099C356.12 279.299 405.07 279.539 423.48 253.179C426.07 249.469 429.02 237.809 430.73 236.779C433.26 235.259 480.13 235.859 485.74 239.499C495.76 250.719 566.61 313.889 567.95 321.519C568.95 327.249 525.55 366.359 518.99 372.879C513.75 374.429 494.53 352.279 489.59 347.539" fill="white"/>
@@ -932,7 +932,7 @@
932
932
  </clipPath>
933
933
  </defs>
934
934
  </svg>
935
- `;var Mt={image:ie,"product-1":q2,"product-2":V2,"product-3":O2,"product-4":U2,"product-5":$2,"product-6":K2,"collection-1":z2,"collection-2":W2,"collection-3":J2,"collection-4":Y2,"collection-5":Q2,"collection-6":X2,"lifestyle-1":ee,"lifestyle-2":te,"product-apparel-1":ne,"product-apparel-2":re,"product-apparel-3":ae,"product-apparel-4":oe,"collection-apparel-1":se,"collection-apparel-2":le,"collection-apparel-3":he,"collection-apparel-4":de,"hero-apparel-1":ce,"hero-apparel-2":ue,"hero-apparel-3":Ce,"blog-apparel-1":me,"blog-apparel-2":pe,"blog-apparel-3":ge,"detailed-apparel-1":fe},we=Mt;function v5(n){return e=>{let t=we[e];return t?.src?`<img src="${t.src}" alt="${e}" class="placeholder-svg placeholder-svg--${e}" />`:t}}function P5(n){return(e,t)=>(typeof e=="object"&&"value"in e&&(e=e.value),`<span data-swell-inline-editable="${t}">${e}</span>`)}var Et={asset_url:z4,brightness_difference:W4,color_brightness:J4,color_contrast:Y4,color_darken:Q4,color_desaturate:X4,color_difference:e5,color_extract:t5,color_lighten:i5,color_mix:n5,color_modify:r5,color_saturate:a5,color_to_hex:o5,color_to_hsl:s5,color_to_rgb:l5,date:D3,default_errors:d5,divided_by:c5,font_face:u5,font_modify:C5,font_url:m5,format_address:I2,image_tag:p5,image_url:B2,inline_asset_content:g5,json:f5,json_pretty:w5,money:y5,money_with_currency:S5,money_without_currency:k5,money_without_trailing_zeros:L5,stylesheet_tag:A5,time_tag:b5,translate:i4,t:i4,where:T5,hex_to_rgba:_5,item_count_for_variant:G2,payment_button:M5,payment_terms:E5,placeholder_svg_tag:v5,inline_editable:P5};function Se(n){(0,ye.each)(Et,(e,t)=>{if(typeof e=="function")n.engine.registerFilter(t,e(n));else if(typeof e.bind=="function"){let{bind:i,resolve:r}=e;n.engine.registerFilter(t,vt(n,i,r))}})}function vt(n,e,t=[]){let i=e(n);return Array.isArray(t)?async(...r)=>{let a=await Promise.all(r.map((o,s)=>Array.isArray(t[s])||t[s]===!0?ke(o,t[s]):o));return i(...a)}:i}async function ke(n,e){if(!n)return n;let t=n;P(t)&&(t=await t);try{if(Array.isArray(e))for(let i of e){if(typeof i!="string")continue;let[r,...a]=i.split("."),o=t[r];P(o)?t[r]=await o:typeof o?.resolve=="function"&&(t[r]=await o.resolve()),a.length>0&&(t[r]=await ke(t[r],[a.join(".")]))}}catch{}return t}var Le=require("liquidjs");var Ae={...Le.defaultOperators,"==":be};function be(n,e){return v3(n)?n.equals(e):v3(e)?e.equals(n):(n=e3(n),e=e3(e),c3(n)?c3(e)&&Pt(n,e):n==e)}function Pt(n,e){return n.length!==e.length?!1:!n.some((t,i)=>!be(t,e[i]))}var r4=h3(require("color"),1),S=class n{color;colorValues;red;green;blue;constructor(e){try{this.color=Dt(e)?e.color:(0,r4.default)(e),this.colorValues=this.color.object(),this.red=Number(this.colorValues.r),this.green=Number(this.colorValues.g),this.blue=Number(this.colorValues.b)}catch{this.color=(0,r4.default)("#000000"),this.colorValues=this.color.object(),this.red=Number(this.colorValues.r),this.green=Number(this.colorValues.g),this.blue=Number(this.colorValues.b)}}static get(e){return e instanceof n?e:new n(e)}toString(){return this.color.string()}lighten(e){return this.color.lighten(e/100).hex().toLowerCase()}darken(e){return this.color.darken(e/100).hex().toLowerCase()}rgb(){return this.color.rgb().toString()}rgba(e){return this.color.alpha(e).rgb().toString()}hsl(){return this.color.hsl().round().toString()}hex(){return this.color.hex().toLowerCase()}saturate(e){return this.color.saturate(e/100).hex().toLowerCase()}desaturate(e){return this.color.desaturate(e/100).hex().toLowerCase()}modify(e,t){switch(e){case"red":case"green":case"blue":case"alpha":case"hue":case"lightness":break;case"saturation":return this.color.saturationl(t).hex();default:return this.toString()}let i=this.color[e](t);return e==="alpha"?i.string():i.hex()}extract(e){switch(e){case"red":case"green":case"blue":case"alpha":case"hue":case"lightness":break;case"saturation":return this.color.saturationl().toString();default:return this.toString()}return this.color[e]().toString()}mix(e,t){let i=this.color,r=e.color,[a,o,s]=i.rgb().array(),[l,c,u]=r.rgb().array(),h=r4.default.rgb([n4(a,l,t),n4(o,c,t),n4(s,u,t)]).alpha(n4(i.alpha(),r.alpha(),t));return i.alpha()!==1?h.string():h.hex()}contrast(e){return this.color.contrast(e.color).toFixed(1)}difference(e){let[t,i,r]=this.color.rgb().array(),[a,o,s]=e.color.rgb().array();return D5(t,a)+D5(i,o)+D5(r,s)}brightness(){return(this.red*299+this.green*587+this.blue*114)/1e3}brightnessDifference(e){return Math.max(this.brightness(),e.brightness())-Math.min(this.brightness(),e.brightness())}};function n4(n,e,t){return(n*t+e*(100-t))/100}function D5(n,e){return Math.max(n,e)-Math.min(n,e)}function Dt(n){return typeof n=="object"&&n!==null&&Object.hasOwn(n,"color")&&Object.hasOwn(n,"colorValues")&&Object.hasOwn(n,"red")&&Object.hasOwn(n,"green")&&Object.hasOwn(n,"blue")}var x3=class extends x5.Liquid{theme;getThemeConfig;getThemeTemplateConfigByType;getAssetUrl;renderTemplate;renderTemplateString;renderTemplateSections;renderTranslation;renderCurrency;engine;isEditor;locale;currency;layoutName;extName;componentsDir;sectionsDir;lastSchema;constructor({theme:e,getThemeConfig:t,getThemeTemplateConfigByType:i,getAssetUrl:r,renderTemplate:a,renderTemplateString:o,renderTemplateSections:s,renderTranslation:l,renderCurrency:c,isEditor:u,locale:h,currency:p,layoutName:C,extName:m,componentsDir:g,sectionsDir:f}){super(),this.theme=e,this.getThemeConfig=t||e.getThemeConfig.bind(e),this.getThemeTemplateConfigByType=i||e.getThemeTemplateConfigByType.bind(e),this.getAssetUrl=r||e.getAssetUrl.bind(e),this.renderTemplate=a||e.renderTemplate.bind(e),this.renderTemplateString=o||e.renderTemplateString.bind(e),this.renderTemplateSections=s||e.renderTemplateSections.bind(e),this.renderTranslation=l||e.renderTranslation.bind(e),this.renderCurrency=c||e.renderCurrency.bind(e),this.isEditor=u,this.locale=h||"en-US",this.currency=p||"USD",this.layoutName=C||"theme",this.extName=m||"liquid",this.componentsDir=g||"components",this.sectionsDir=f||"sections",this.engine=this.initLiquidEngine()}initLiquidEngine(){return this.engine=new x5.Liquid({cache:!1,relativeReference:!1,fs:this.getLiquidFS(),ownPropertyOnly:!1,operators:Ae}),F2(this),Se(this),this.engine}getLiquidFS(){let{getThemeConfig:e,resolveFilePath:t}=this;return{async readFile(i){let r=t(i);return e(r).then(a=>a?.file_data||`<!-- theme template not found: ${r} -->`)},async exists(i){return!0},readFileSync(i){return""},existsSync(i){return!1},contains(i,r){return!0},resolve(i,r,a){return r},fallback(i){}}}async parseAndRender(e,t){return this.engine.parseAndRender(e,t)}resolveFilePath(e,t){return`theme/${e}.${t||this.extName}`}async resolveFilePathByType(e,t){if(this.getThemeTemplateConfigByType){let i=await this.getThemeTemplateConfigByType(e,t);if(i?.file_path)return i.file_path}}async getComponentPath(e){return await this.resolveFilePathByType("components",e)||this.resolveFilePath(`${this.componentsDir}/${e}`)}async getSectionPath(e){return await this.resolveFilePathByType("sections",e)||this.resolveFilePath(`${this.sectionsDir}/${e}`)}async getSectionGroupPath(e){return await this.resolveFilePathByType("sections",`${e}.json`)||this.resolveFilePath(`${this.sectionsDir}/${e}`,"json")}};var R5=require("lodash-es");async function j5(n,e,t){let r=(await Promise.all(e?.map(async a=>({...a,items:await Z5(n,a.items,t)})))).map(a=>(n.shopifyCompatibility&&Object.assign(a,n.shopifyCompatibility.getMenuData(a)),a))||[];return F5([...r,...n.shopifyCompatibility?r.reduce((a,o)=>(o.handle&&a.push({...o,id:o.handle}),a),[]):[]])}async function Z5(n,e,t){return e?.length>0?Promise.all(e.map(async r=>{let{url:a,resource:o}=await Te(n,r,{trailingSlash:t?.currentUrl?.endsWith("/")&&t.currentUrl!=="/"}),s=r.items&&await Z5(n,r.items,t);return{...r,url:a,resource:o,levels:_e(s),current:t?.currentUrl===a,active:t?.currentUrl?.startsWith(a),...s?{items:s,child_current:xt(s),child_active:N5(s)}:void 0}})):[]}async function Te(n,e,t){if(!e)return{url:"#invalid-link-item"};if(typeof e=="object"&&e!==null){let{url:i,resource:r}=await Ee(n,e),a=i.slice(-1)==="/";return t?.trailingSlash&&!a&&i.length>1&&(i=i+"/"),!t?.trailingSlash&&a&&i.length>1&&(i=i.slice(0,-1)),{url:i,resource:r}}else return{url:e}}function _e(n){return n?.reduce((e,t)=>Math.max(e,t.items?1+_e(t.items):0),0)||0}function xt(n){return n.some(e=>e.current||e.items&&N5(e.items))}function N5(n){return n.some(e=>e.active||e.items&&N5(e.items))}function Me(n){return(0,R5.get)(n,"id",(0,R5.get)(n,"slug",typeof n=="string"?n:""))||""}async function Ee(n,e){let{type:t,value:i,url:r,model:a}=e;if(typeof t>"u"&&r)return{url:r};if(t==="url")return{url:typeof i=="string"?i:""};let o=Me(i);switch(t){case"home":return{url:a3(n,"index")};case"category":return o?await r3(n,"categories/category",o):{url:a3(n,"categories/index")};case"product":return o?await r3(n,"products/product",o):{url:a3(n,"products/index")};case"page":return await r3(n,"pages/page",o);case"blog":return await r3(n,"blogs/blog",o,async s=>new _(n.swell,"content/blog-categories",s.category_id).slug);case"blog_category":return await r3(n,"blogs/category",o);case"content_list":if(a){let s=a?.replace("content/","");return{url:a3(n,"content/index",s),resource:new A(n.swell,a)}}break;case"content":if(a){let s=a?.replace("content/","");return await r3(n,"content/content",o,s)}break;case"search":return{url:a3(n,"search")};default:break}return{url:`/${o}`}}function a3(n,e,t,i){let{props:r}=n,a=r?.pages?.find(o=>o.id===e)?.url;return a?.includes(":collection")&&i&&(a=a.replace(":collection",i)),a?.includes(":slug")&&(a=a.replace(":slug",t||"")),a||`/${t||""}`}async function r3(n,e,t,i){let{props:r}=n,a=r?.pages?.find(c=>c.id===e)?.collection,o=a?new _(n.swell,a,t):void 0,s=await o?.slug||t,l=typeof i=="string"?i:void 0;return o?.id&&typeof i=="function"&&(l=await i(o)),{url:a3(n,e,s,typeof l=="string"?l:void 0),resource:o}}var ve=h3(require("bluebird"),1);var{Promise:R3}=ve.default,Rt=50,a4=class n{static cache;swell;manifest=null;configs={};configPaths=[];constructor(e){this.swell=e}async init(e){let{swellHeaders:t}=this.swell;if(e){this.setConfigs(e);return}t["theme-id"]&&(await this.fetchManifest(),this.manifest||(console.log("ThemeLoader.init - version manifest not found"),await this.loadTheme()))}async loadTheme(){let{swellHeaders:e}=this.swell;if(console.log("ThemeLoader.loadTheme",e["theme-version-hash"]),e["theme-version-hash"]){let t=await this.loadThemeFromManifest();if(t)return t}return this.loadThemeAllConfigs()}setConfigs(e){this.configs=Object.fromEntries(e),this.configPaths=Object.keys(this.configs),this.manifest=this.configPaths.reduce((t,i)=>(t[i]=this.configs[i]?.hash,t),{})}async preloadTheme(e,t){console.log(`ThemeLoader.preloadTheme${e?.hash?` - manifest: ${e.hash}`:""}${t?.length?` - configs: ${t.length}`:""}`),await R3.all([e&&this.cacheManifest(e),t&&R3.map(t,i=>this.cacheThemeConfig(i),{concurrency:10})])}async fetchThemeConfig(e){if(this.configs[e]!==void 0)return this.configs[e];let t=this.manifest?.[e];if(t){let i=await this.getCache().get(`config:${t}`);return i?(this.configs[e]=i,i):this.fetchThemeConfigsFromSourceByPath(e)}return null}async fetchThemeConfigsByPath(e,t){let i=this.configPaths.filter(a=>a.startsWith(e)&&(!t||a.endsWith(t)));return(await R3.map(i,a=>this.fetchThemeConfig(a),{concurrency:10})).filter(a=>a!==null)}async loadThemeAllConfigs(){let{swellHeaders:e}=this.swell,t=String(e["theme-config-version"]);if(!t)throw new Error("Theme version is required");return(await this.getCache().fetch(`configs-all:${this.swell.instanceId}:v@${t}2`,()=>this.fetchThemeConfigsFromSource()))?.results??[]}async loadThemeFromManifest(){let e=await this.fetchManifest();if(!e)return null;let t=[],i=new Map;if(await R3.map(Object.values(e),r=>this.getCache().get(`config:${r}`).then(a=>{a?(i.set(a.hash,a),this.configs[a.file_path]=a):t.push(r)}),{concurrency:10}),t.length>0){let a=(await this.fetchThemeConfigsFromSource(i.size===0?void 0:t))?.results??[];for(let o of a)i.set(o.hash,o),this.configs[o.file_path]=o;await R3.map(a,o=>this.cacheThemeConfig(o),{concurrency:10})}return Array.from(i.values())}async cacheManifest(e){e?.hash&&await this.getCache().set(`manifest:${e.hash}`,e.manifest)}async cacheThemeConfig(e){e?.hash&&await this.getCache().set(`config:${e.hash}`,e)}async fetchManifest(){let{swellHeaders:e}=this.swell,t=e["theme-version-hash"];console.log("ThemeLoader.fetchManifest",t);let i=await this.getCache().get(`manifest:${t}`);if(!i){let r=await this.swell.get("/:themes:versions/:last",{...this.themeVersionQueryFilter(),fields:"hash, manifest"});r&&(await this.cacheManifest(r),i=r.manifest)}return this.manifest=i,this.configPaths=Object.keys(i||{}),this.manifest}async fetchThemeConfigsFromSource(e=void 0){e=e||[];let{swellHeaders:t}=this.swell,i=String(t["theme-config-version"]),r=e.length===0||e.length>Rt;return console.log(`Retrieving ${r?"all":"some"} theme configurations - version: ${i}`),await this.swell.get("/:themes:configs",{...this.themeVersionQueryFilter(),...r?{}:{hash:{$in:e}},limit:1e3,type:"theme",fields:"name, file, file_path, hash",include:{file_data:Q3}})}async fetchThemeConfigsFromSourceByPath(e){console.log(`Retrieving theme config - ${e}`);let t=await this.swell.get("/:themes:configs/:last",{...this.themeVersionQueryFilter(),file_path:e,fields:"name, file, file_path, hash",include:{file_data:Q3}});return t&&await this.cacheThemeConfig(t),this.configs[e]=t,t}themeVersionQueryFilter(){let{swellHeaders:e}=this.swell,t=e["theme-id"];if(!t)throw new Error("Theme ID is required");return{parent_id:t,branch_id:e["theme-branch-id"]||null,preview:e["deployment-mode"]==="editor"||e["deployment-mode"]==="preview"?!0:{$ne:!0}}}getCache(){return n.cache||(n.cache=new E3(this.swell.workerEnv?.THEME)),n.cache}};var H5=class{swell;props;globals;forms;resources;liquidSwell;themeLoader;themeConfigs=null;page;pageId;shopifyCompatibility=null;shopifyCompatibilityClass=g3;shopifyCompatibilityConfig=null;formData={};globalData={};constructor(e,t={}){let{forms:i,resources:r,globals:a,shopifyCompatibilityClass:o}=t;this.swell=e,this.props=this.getSwellAppThemeProps(e.config),this.shopifyCompatibilityConfig=e.shopifyCompatibilityConfig||null,this.globals=a||{},this.forms=i,this.resources=r,this.shopifyCompatibilityClass=o||g3,this.liquidSwell=new x3({theme:this,getThemeConfig:this.getThemeConfig.bind(this),getAssetUrl:this.getAssetUrl.bind(this),getThemeTemplateConfigByType:this.getThemeTemplateConfigByType.bind(this),renderTemplate:this.renderTemplate.bind(this),renderTemplateString:this.renderTemplateString.bind(this),renderTemplateSections:this.renderTemplateSections.bind(this),renderTranslation:this.lang.bind(this),renderCurrency:this.renderCurrency.bind(this),isEditor:e.isEditor}),this.themeLoader=new a4(e)}getSwellAppThemeProps(e){return e?.storefront?.theme||{}}async initGlobals(e){this.pageId=e,await this.themeLoader.init(this.themeConfigs||void 0);let{store:t,session:i,menus:r,geo:a,configs:o}=await this.getSettingsAndConfigs(),{settings:s,request:l,page:c,cart:u,account:h,customer:p}=await this.resolvePageData(t,o,i,e);this.page=c;let C={...this.globalData,store:t,settings:s,session:i,request:l,menus:r,page:c,cart:u,account:h,customer:p,geo:a,configs:o,translations:o?.translations,canonical_url:`${t.url}${this.swell.url?.pathname||""}`,shopify_compatibility:!!s.shopify_compatibility};this.shopifyCompatibility&&this.shopifyCompatibility.adaptGlobals(C),this.setGlobals(C),this.shopifyCompatibility&&this.shopifyCompatibility.adaptQueryParams()}setGlobals(e){this.globals={...this.globals,...e},this.liquidSwell.engine.options.globals={...this.globals}}async getSettingsAndConfigs(){let e=D4,[t,i]=await Promise.all([this.swell.getStorefrontSettings(),this.getThemeConfigsByPath("theme/config/",".json")]),r={theme:{},editor:{},translations:{},presets:[],...Array.from(i.values()).reduce((l,c)=>{let u=String(c?.name||"").split(".")[0];if(u){let h;try{h=JSON.parse(c.file_data)}catch{h=null}l[u]=h}return l},{})},a=await this.swell.storefront.settings.session(),o=a.locale||t?.store?.locale;this.resolveTranslationLocale(r.translations,o),await this.setCompatibilityConfigs(r,o);let s=await this.resolveMenuSettings();return{store:t?.store,session:a,menus:s,geo:e,configs:r}}async resolvePageData(e,t,i,r){let a=String(this.swell.swellHeaders["theme-config-version"]),o=await this.swell.getCachedResource(`theme-settings-resolved:v@${a}`,[],()=>N3(this,t.theme,t.editor?.settings));if(!o)throw new Error("Failed to resolve theme settings");let s={host:this.swell.url.host,origin:this.swell.url.origin,path:this.swell.url.pathname,query:this.swell.queryParams,locale:i?.locale||e.locale,currency:i?.currency||e.currency,is_editor:this.swell.isEditor,is_preview:this.swell.isPreview},l=this.props.pages?.find(m=>m.id===r),c=!l,u={...l,current:this.swell.queryParams.page||1,url:this.swell.url.pathname,custom:c,slug:null,description:null};if(r){let m=await this.getThemeTemplateConfigByType("templates",r),g;try{g=JSON.parse(m?.file_data||"")}catch{}if(g?.page){let{slug:f,label:Q,description:l3}=g.page;u.slug=f,u.label=Q,u.description=l3}}let[h,p]=await Promise.all([this.fetchSingletonResourceCached("cart",()=>this.fetchCart(),{}),this.fetchSingletonResourceCached("account",()=>this.fetchAccount(),null)]);if(!h)throw new Error("Failed to fetch cart");let C;return this.shopifyCompatibility&&(C=p),{settings:o,request:s,page:u,cart:h,account:p,customer:C}}async fetchSingletonResourceCached(e,t,i){let r=this.swell.storefront.session.getCookie();return r?this.swell.getCachedResource(`${e}-${r}`,[],()=>t()):i}async fetchCart(){let e=this.resources?.singletons?.cart,t=e?new e(this.swell):new J(this.swell,"cart");if(await t.id,!t?.id)return{};if(this.shopifyCompatibility){let i=C3(this.shopifyCompatibility,t);t.setCompatibilityProps(i)}return t}async fetchAccount(){let e=this.resources?.singletons?.account,t=e?new e(this.swell):new J(this.swell,"account");if(await t.id,!t?.id)return null;if(this.shopifyCompatibility){let i=K(this.shopifyCompatibility,t);t.setCompatibilityProps(i)}return t}getFormConfig(e){let t=e;if(this.shopifyCompatibility){let i=this.shopifyCompatibility.getAdaptedFormType(e);i&&(t=i)}return this.forms?.find(i=>i.id===t)}setFormData(e,t){let i=this.formData[e]||new O(e);i instanceof O&&(t?.params&&i.setParams(t.params),t?.errors?(i.setSuccess(!1),i.setErrors(t.errors)):t?.success&&(t.withoutErrors&&!i.errors?i.setSuccess(!0):t.withoutErrors||(i.setSuccess(!0),i.clearErrors())),this.shopifyCompatibility&&Object.assign(i,this.shopifyCompatibility.getFormData(i))),this.formData[e]=i,this.setGlobals({forms:this.formData})}setFormSuccessWithoutErrors(e){this.setFormData(e,{success:!0,withoutErrors:!0})}clearFormData(e){e?delete this.formData[e]:this.formData={},this.setGlobals({forms:this.formData})}serializeFormData(){let e={};for(let t in this.formData){let i=this.formData[t];e[t]={success:i.success,errors:i.errors&&Array.from(i.errors)}}return Object.keys(e).length>0?e:null}setGlobalData(e={}){this.globalData={...this.globalData,...e},this.setGlobals(this.globalData)}serializeGlobalData(){return Object.keys(this.globalData).length>0?this.globalData:null}updateSettings(e,t){return this.shopifyCompatibility?this.shopifyCompatibility.adaptSettings(e,t):w3(e,t)}resolveTranslationLocale(e,t){if(!e)return{};if(!t)return e;let i=t.split("-")[0];return(0,b.reduce)(e,(r,a,o)=>{if(f3(a))r[o]=this.resolveTranslationLocale(a,t);else if(typeof a=="string"&&a.startsWith("t:")){let s=a.slice(2),l=s.split("."),c=l.pop(),u=l.join("."),h=this.globals.translations;r[o]=(0,b.get)(h,`${u}.$locale.${t}.${c}`)||(0,b.get)(h,`${u}.$locale.${i}.${c}`)||(0,b.get)(h,s)||a}else r[o]=(0,b.get)(e,`$locale.${t}.${o}`)||(0,b.get)(e,`$locale.${i}.${o}`)||a;return r},{})}async setCompatibilityConfigs(e,t){let i=()=>(this.shopifyCompatibility||(this.shopifyCompatibility=new this.shopifyCompatibilityClass(this)),this.shopifyCompatibility);!Object.keys(e.editor).length&&e.settings_schema&&(e.editor=i().getEditorConfig(e.settings_schema),e.editor=await i().renderSchemaTranslations(this,e.editor,t)),!Object.keys(e.theme).length&&e.settings_data&&(e.theme=i().getThemeConfig(e.settings_data)),!Object.keys(e.presets).length&&e.settings_data&&(e.presets=i().getPresetsConfig(e.settings_data)),Object.keys(e.translations).length||(e.translations=await i().getLocaleConfig(this,t),Object.keys(e.translations).length||(this.shopifyCompatibility=null)),e.theme.shopify_compatibility?i():this.shopifyCompatibility&&(e.theme.shopify_compatibility=!0)}setCompatibilityData(e){!e||!this.shopifyCompatibility||this.shopifyCompatibility.adaptPageData(e)}resolveLookupSetting(e,t){if(t instanceof T)return t;let i=Pe(e);if(i){if(e.multiple){if(t instanceof Array)return t.map(r=>this.resolveLookupResource(i,r))}else if(t!==""&&t!==null&&t!==void 0)return this.resolveLookupResource(i,t)}return null}resolveLookupResource(e,t){let i=this.resources?.records?.[e],r=i?new i(this.swell,t):new _(this.swell,e,t);return this.shopifyCompatibility&&this.shopifyCompatibility.adaptPageData({resource:r}),r}resolveMenuSettings(){return j5(this,this.swell.getStorefrontMenus(),{currentUrl:this.swell.url.pathname})}resolveMenuSetting(e){if(!e)return null;let t=this.globals.menus||{};return t[e]||t[e.replace(/-/g,"_")]||null}async lang(e,t,i){return await this.renderTranslation(e,t,i)}resolveFontSetting(e){if(this.shopifyCompatibility){let t=this.shopifyCompatibility.getFontFromShopifySetting(e),i=new D(t||e);return Object.assign(i,this.shopifyCompatibility.getFontData(i)),i}return new D(e)}resolveUrlSetting(e){let t=e;if(this.shopifyCompatibility){e?.startsWith("shopify://")&&(t=e.replace("shopify://","/"));let i=this.shopifyCompatibility.getAdaptedPageUrl(t);if(i)return i}return t}resolveImageSetting(e){let t=e;return this.shopifyCompatibility&&e?.startsWith("shopify://")&&(t=""),t}async getAllThemeConfigs(){if(!this.themeConfigs){let e=await this.themeLoader.loadTheme(),t=new Map;for(let i of e)t.set(i.file_path,i);this.themeConfigs=t}return this.themeConfigs}async preloadThemeConfigs(e,t){await this.themeLoader.preloadTheme(e,t)}getPageConfigPath(e){return this.shopifyCompatibility?`theme/${this.shopifyCompatibility.getThemeFilePath("templates",e)}.json`:`theme/templates/${e}.json`}async getThemeConfig(e){return this.themeConfigs?this.themeConfigs.get(e)??null:this.themeLoader.fetchThemeConfig(e)}async getThemeConfigsByPath(e,t){let i=await this.themeLoader.fetchThemeConfigsByPath(e,t),r=new Map;for(let a of i)r.set(a.file_path,a);return r}async getThemeTemplateConfig(e){if(e.endsWith(".json")||e.endsWith(".liquid"))return this.getThemeConfig(e);let t=await this.getThemeConfig(`${e}.json`);return t||this.getThemeConfig(`${e}.liquid`)}async getThemeTemplateConfigByType(e,t){let i=[`${e}/${t}`];this.shopifyCompatibility&&i.push(this.shopifyCompatibility.getThemeFilePath(e,t));for(let r of i){let a=await this.getThemeTemplateConfig(`theme/${r}`);if(a)return a}return null}async getAssetUrl(e){return(await this.getThemeConfig(`theme/assets/${e}`)||await this.getThemeConfig(`assets/${e}`))?.file?.url||null}async renderTemplate(e,t){let i=e?.file_data||null;if(e===null||i===null)return"";try{return await this.liquidSwell.parseAndRender(i,t)}catch(r){return console.error(r),`<!-- template render error: ${r.message} -->`}}async renderTemplateString(e,t){try{return await this.liquidSwell.parseAndRender(e,t)}catch(i){return console.error(i),""}}async getSectionSchema(e){let t,i=await this.getThemeTemplateConfigByType("sections",e);if(i?.file_path?.endsWith(".json"))try{t=JSON.parse(i.file_data)||void 0}catch{return}else if(i?.file_path?.endsWith(".liquid")&&this.shopifyCompatibility){this.liquidSwell.lastSchema=void 0;let r=this.getSectionConfigWithSchemaTagOnly(i);if(!r)return;await this.renderTemplate(r);let a=this.liquidSwell.lastSchema;a&&(t=this.shopifyCompatibility.getSectionConfigSchema(a),t=await this.shopifyCompatibility.renderSchemaTranslations(this,t,this.globals.request?.locale))}return t.id=t.id||e,t.label=t.label||e,t.fields=t.fields||[],t}getSectionConfigWithSchemaTagOnly(e){let t="{% schema %}",i="{% endschema %}",r=e.file_data.indexOf(t),a=e.file_data.indexOf(i),o=e.file_data.slice(r+t.length,a);return r===-1||a===-1?null:{...e,file_data:t+o+i}}async renderThemeTemplate(e,t){let i=await this.getThemeTemplateConfig(e),r=await this.renderTemplate(i,{...t,template:i});if(i?.file_path?.endsWith(".json"))try{return JSON.parse(r)}catch(a){throw console.log("Unable to render theme template",i.file_path,r),new j3(a)}return r}async renderLayoutTemplate(e,t){let i=await this.getThemeTemplateConfigByType("layouts",e);if(i){let r=await this.renderThemeTemplate(i.file_path,t);return typeof r=="string"?r:`<!-- invalid layout: ${e}--> {{ content_for_layout }}`}throw new Error(`Layout template not found: ${e}`)}async renderPageTemplate(e,t,i){let r=null;if(i&&(r=await this.getThemeTemplateConfigByType("templates",`${e}.${i}`)),r||(r=await this.getThemeTemplateConfigByType("templates",e)),r){let a=await this.renderThemeTemplate(r.file_path,t);return a&&typeof a!="string"&&(a.id=r.name),a}throw console.error(new Error(`Page template not found: templates/${e}.liquid`)),new Z3}async renderPage(e,t){e&&this.setGlobals(e);let i;if(this.page?.id?i=await this.renderPageTemplate(this.page.id,e,t):i=await this.renderPageTemplate("404",e),typeof i!="string"&&i?.page){if(i.page.published===!1)throw new Z3;i.page=this.resolveTranslationLocale(i.page,this.globals.request?.locale)}return i}async renderAllSections(e,t){let i=typeof e=="string"?e.split(/\s*,\s*/):e;return(await Promise.all(i.map?.(a=>this.renderSection(a,t)))).reduce((a,o,s)=>{let l=i[s];return this.shopifyCompatibility?a[l]=`
935
+ `;var Mt={image:ie,"product-1":q2,"product-2":V2,"product-3":O2,"product-4":U2,"product-5":$2,"product-6":K2,"collection-1":z2,"collection-2":W2,"collection-3":J2,"collection-4":Y2,"collection-5":Q2,"collection-6":X2,"lifestyle-1":ee,"lifestyle-2":te,"product-apparel-1":ne,"product-apparel-2":re,"product-apparel-3":ae,"product-apparel-4":oe,"collection-apparel-1":se,"collection-apparel-2":le,"collection-apparel-3":he,"collection-apparel-4":de,"hero-apparel-1":ce,"hero-apparel-2":ue,"hero-apparel-3":Ce,"blog-apparel-1":me,"blog-apparel-2":pe,"blog-apparel-3":ge,"detailed-apparel-1":fe},we=Mt;function v5(n){return e=>{let t=we[e];return t?.src?`<img src="${t.src}" alt="${e}" class="placeholder-svg placeholder-svg--${e}" />`:t}}function P5(n){return(e,t)=>(typeof e=="object"&&"value"in e&&(e=e.value),`<span data-swell-inline-editable="${t}">${e}</span>`)}var Et={asset_url:z4,brightness_difference:W4,color_brightness:J4,color_contrast:Y4,color_darken:Q4,color_desaturate:X4,color_difference:e5,color_extract:t5,color_lighten:i5,color_mix:n5,color_modify:r5,color_saturate:a5,color_to_hex:o5,color_to_hsl:s5,color_to_rgb:l5,date:D3,default_errors:d5,divided_by:c5,font_face:u5,font_modify:C5,font_url:m5,format_address:I2,image_tag:p5,image_url:B2,inline_asset_content:g5,json:f5,json_pretty:w5,money:y5,money_with_currency:S5,money_without_currency:k5,money_without_trailing_zeros:L5,stylesheet_tag:A5,time_tag:b5,translate:i4,t:i4,where:T5,hex_to_rgba:_5,item_count_for_variant:G2,payment_button:M5,payment_terms:E5,placeholder_svg_tag:v5,inline_editable:P5};function Se(n){(0,ye.each)(Et,(e,t)=>{if(typeof e=="function")n.engine.registerFilter(t,e(n));else if(typeof e.bind=="function"){let{bind:i,resolve:r}=e;n.engine.registerFilter(t,vt(n,i,r))}})}function vt(n,e,t=[]){let i=e(n);return Array.isArray(t)?async(...r)=>{let a=await Promise.all(r.map((o,s)=>Array.isArray(t[s])||t[s]===!0?ke(o,t[s]):o));return i(...a)}:i}async function ke(n,e){if(!n)return n;let t=n;P(t)&&(t=await t);try{if(Array.isArray(e))for(let i of e){if(typeof i!="string")continue;let[r,...a]=i.split("."),o=t[r];P(o)?t[r]=await o:typeof o?.resolve=="function"&&(t[r]=await o.resolve()),a.length>0&&(t[r]=await ke(t[r],[a.join(".")]))}}catch{}return t}var Le=require("liquidjs");var Ae={...Le.defaultOperators,"==":be};function be(n,e){return v3(n)?n.equals(e):v3(e)?e.equals(n):(n=e3(n),e=e3(e),c3(n)?c3(e)&&Pt(n,e):n==e)}function Pt(n,e){return n.length!==e.length?!1:!n.some((t,i)=>!be(t,e[i]))}var r4=h3(require("color"),1),S=class n{color;colorValues;red;green;blue;constructor(e){try{this.color=Dt(e)?e.color:(0,r4.default)(e),this.colorValues=this.color.object(),this.red=Number(this.colorValues.r),this.green=Number(this.colorValues.g),this.blue=Number(this.colorValues.b)}catch{this.color=(0,r4.default)("#000000"),this.colorValues=this.color.object(),this.red=Number(this.colorValues.r),this.green=Number(this.colorValues.g),this.blue=Number(this.colorValues.b)}}static get(e){return e instanceof n?e:new n(e)}toString(){return this.color.string()}lighten(e){return this.color.lighten(e/100).hex().toLowerCase()}darken(e){return this.color.darken(e/100).hex().toLowerCase()}rgb(){return this.color.rgb().toString()}rgba(e){return this.color.alpha(e).rgb().toString()}hsl(){return this.color.hsl().round().toString()}hex(){return this.color.hex().toLowerCase()}saturate(e){return this.color.saturate(e/100).hex().toLowerCase()}desaturate(e){return this.color.desaturate(e/100).hex().toLowerCase()}modify(e,t){switch(e){case"red":case"green":case"blue":case"alpha":case"hue":case"lightness":break;case"saturation":return this.color.saturationl(t).hex();default:return this.toString()}let i=this.color[e](t);return e==="alpha"?i.string():i.hex()}extract(e){switch(e){case"red":case"green":case"blue":case"alpha":case"hue":case"lightness":break;case"saturation":return this.color.saturationl().toString();default:return this.toString()}return this.color[e]().toString()}mix(e,t){let i=this.color,r=e.color,[a,o,s]=i.rgb().array(),[l,c,u]=r.rgb().array(),h=r4.default.rgb([n4(a,l,t),n4(o,c,t),n4(s,u,t)]).alpha(n4(i.alpha(),r.alpha(),t));return i.alpha()!==1?h.string():h.hex()}contrast(e){return this.color.contrast(e.color).toFixed(1)}difference(e){let[t,i,r]=this.color.rgb().array(),[a,o,s]=e.color.rgb().array();return D5(t,a)+D5(i,o)+D5(r,s)}brightness(){return(this.red*299+this.green*587+this.blue*114)/1e3}brightnessDifference(e){return Math.max(this.brightness(),e.brightness())-Math.min(this.brightness(),e.brightness())}};function n4(n,e,t){return(n*t+e*(100-t))/100}function D5(n,e){return Math.max(n,e)-Math.min(n,e)}function Dt(n){return typeof n=="object"&&n!==null&&Object.hasOwn(n,"color")&&Object.hasOwn(n,"colorValues")&&Object.hasOwn(n,"red")&&Object.hasOwn(n,"green")&&Object.hasOwn(n,"blue")}var x3=class extends x5.Liquid{theme;getThemeConfig;getThemeTemplateConfigByType;getAssetUrl;renderTemplate;renderTemplateString;renderTemplateSections;renderTranslation;renderCurrency;engine;isEditor;locale;currency;layoutName;extName;componentsDir;sectionsDir;lastSchema;constructor({theme:e,getThemeConfig:t,getThemeTemplateConfigByType:i,getAssetUrl:r,renderTemplate:a,renderTemplateString:o,renderTemplateSections:s,renderTranslation:l,renderCurrency:c,isEditor:u,locale:h,currency:p,layoutName:C,extName:m,componentsDir:g,sectionsDir:f}){super(),this.theme=e,this.getThemeConfig=t||e.getThemeConfig.bind(e),this.getThemeTemplateConfigByType=i||e.getThemeTemplateConfigByType.bind(e),this.getAssetUrl=r||e.getAssetUrl.bind(e),this.renderTemplate=a||e.renderTemplate.bind(e),this.renderTemplateString=o||e.renderTemplateString.bind(e),this.renderTemplateSections=s||e.renderTemplateSections.bind(e),this.renderTranslation=l||e.renderTranslation.bind(e),this.renderCurrency=c||e.renderCurrency.bind(e),this.isEditor=u,this.locale=h||"en-US",this.currency=p||"USD",this.layoutName=C||"theme",this.extName=m||"liquid",this.componentsDir=g||"components",this.sectionsDir=f||"sections",this.engine=this.initLiquidEngine()}initLiquidEngine(){return this.engine=new x5.Liquid({cache:!1,relativeReference:!1,fs:this.getLiquidFS(),ownPropertyOnly:!1,operators:Ae}),F2(this),Se(this),this.engine}getLiquidFS(){let{getThemeConfig:e,resolveFilePath:t}=this;return{async readFile(i){let r=t(i);return e(r).then(a=>a?.file_data||`<!-- theme template not found: ${r} -->`)},async exists(i){return!0},readFileSync(i){return""},existsSync(i){return!1},contains(i,r){return!0},resolve(i,r,a){return r},fallback(i){}}}async parseAndRender(e,t){return this.engine.parseAndRender(e,t)}resolveFilePath(e,t){return`theme/${e}.${t||this.extName}`}async resolveFilePathByType(e,t){if(this.getThemeTemplateConfigByType){let i=await this.getThemeTemplateConfigByType(e,t);if(i?.file_path)return i.file_path}}async getComponentPath(e){return await this.resolveFilePathByType("components",e)||this.resolveFilePath(`${this.componentsDir}/${e}`)}async getSectionPath(e){return await this.resolveFilePathByType("sections",e)||this.resolveFilePath(`${this.sectionsDir}/${e}`)}async getSectionGroupPath(e){return await this.resolveFilePathByType("sections",`${e}.json`)||this.resolveFilePath(`${this.sectionsDir}/${e}`,"json")}};var R5=require("lodash-es");async function j5(n,e,t){let r=(await Promise.all(e?.map(async a=>({...a,items:await Z5(n,a.items,t)})))).map(a=>(n.shopifyCompatibility&&Object.assign(a,n.shopifyCompatibility.getMenuData(a)),a))||[];return F5([...r,...n.shopifyCompatibility?r.reduce((a,o)=>(o.handle&&a.push({...o,id:o.handle}),a),[]):[]])}async function Z5(n,e,t){return e?.length>0?Promise.all(e.map(async r=>{let{url:a,resource:o}=await Te(n,r,{trailingSlash:t?.currentUrl?.endsWith("/")&&t.currentUrl!=="/"}),s=r.items&&await Z5(n,r.items,t);return{...r,url:a,resource:o,levels:_e(s),current:t?.currentUrl===a,active:t?.currentUrl?.startsWith(a),...s?{items:s,child_current:xt(s),child_active:N5(s)}:void 0}})):[]}async function Te(n,e,t){if(!e)return{url:"#invalid-link-item"};if(typeof e=="object"&&e!==null){let{url:i,resource:r}=await Ee(n,e),a=i.slice(-1)==="/";return t?.trailingSlash&&!a&&i.length>1&&(i=i+"/"),!t?.trailingSlash&&a&&i.length>1&&(i=i.slice(0,-1)),{url:i,resource:r}}else return{url:e}}function _e(n){return n?.reduce((e,t)=>Math.max(e,t.items?1+_e(t.items):0),0)||0}function xt(n){return n.some(e=>e.current||e.items&&N5(e.items))}function N5(n){return n.some(e=>e.active||e.items&&N5(e.items))}function Me(n){return(0,R5.get)(n,"id",(0,R5.get)(n,"slug",typeof n=="string"?n:""))||""}async function Ee(n,e){let{type:t,value:i,url:r,model:a}=e;if(typeof t>"u"&&r)return{url:r};if(t==="url")return{url:typeof i=="string"?i:""};let o=Me(i);switch(t){case"home":return{url:a3(n,"index")};case"category":return o?await r3(n,"categories/category",o):{url:a3(n,"categories/index")};case"product":return o?await r3(n,"products/product",o):{url:a3(n,"products/index")};case"page":return await r3(n,"pages/page",o);case"blog":return await r3(n,"blogs/blog",o,async s=>new _(n.swell,"content/blog-categories",s.category_id).slug);case"blog_category":return await r3(n,"blogs/category",o);case"content_list":if(a){let s=a?.replace("content/","");return{url:a3(n,"content/index",s),resource:new A(n.swell,a)}}break;case"content":if(a){let s=a?.replace("content/","");return await r3(n,"content/content",o,s)}break;case"search":return{url:a3(n,"search")};default:break}return{url:`/${o}`}}function a3(n,e,t,i){let{props:r}=n,a=r?.pages?.find(o=>o.id===e)?.url;return a?.includes(":collection")&&i&&(a=a.replace(":collection",i)),a?.includes(":slug")&&(a=a.replace(":slug",t||"")),a||`/${t||""}`}async function r3(n,e,t,i){let{props:r}=n,a=r?.pages?.find(c=>c.id===e)?.collection,o=a?new _(n.swell,a,t):void 0,s=await o?.slug||t,l=typeof i=="string"?i:void 0;return o?.id&&typeof i=="function"&&(l=await i(o)),{url:a3(n,e,s,typeof l=="string"?l:void 0),resource:o}}var ve=h3(require("bluebird"),1);var{Promise:R3}=ve.default,Rt=50,a4=class n{static cache;swell;manifest=null;configs={};configPaths=[];constructor(e){this.swell=e}async init(e){let{swellHeaders:t}=this.swell;if(e){this.setConfigs(e);return}t["theme-id"]&&(await this.fetchManifest(),this.manifest||(console.log("ThemeLoader.init - version manifest not found"),await this.loadTheme()))}async loadTheme(){let{swellHeaders:e}=this.swell;if(console.log("ThemeLoader.loadTheme",e["theme-version-hash"]),e["theme-version-hash"]){let t=await this.loadThemeFromManifest();if(t)return t}return this.loadThemeAllConfigs()}setConfigs(e){this.configs=Object.fromEntries(e),this.configPaths=Object.keys(this.configs),this.manifest=this.configPaths.reduce((t,i)=>(t[i]=this.configs[i]?.hash,t),{})}async preloadTheme(e,t){console.log(`ThemeLoader.preloadTheme${e?.hash?` - manifest: ${e.hash}`:""}${t?.length?` - configs: ${t.length}`:""}`),await R3.all([e&&this.cacheManifest(e),t&&R3.map(t,i=>this.cacheThemeConfig(i),{concurrency:10})])}async fetchThemeConfig(e){if(this.configs[e]!==void 0)return this.configs[e];let t=this.manifest?.[e];if(t){let i=await this.getCache().get(`config:${t}`);return i?(this.configs[e]=i,i):this.fetchThemeConfigsFromSourceByPath(e,t)}return null}async fetchThemeConfigsByPath(e,t){let i=this.configPaths.filter(a=>a.startsWith(e)&&(!t||a.endsWith(t)));return(await R3.map(i,a=>this.fetchThemeConfig(a),{concurrency:10})).filter(a=>a!==null)}async loadThemeAllConfigs(){let{swellHeaders:e}=this.swell,t=String(e["theme-config-version"]);if(!t)throw new Error("Theme version is required");return(await this.getCache().fetch(`configs-all:${this.swell.instanceId}:v@${t}2`,()=>this.fetchThemeConfigsFromSource()))?.results??[]}async loadThemeFromManifest(){let e=await this.fetchManifest();if(!e)return null;let t=[],i=new Map;if(await R3.map(Object.values(e),r=>this.getCache().get(`config:${r}`).then(a=>{a?(i.set(a.hash,a),this.configs[a.file_path]=a):t.push(r)}),{concurrency:10}),t.length>0){let a=(await this.fetchThemeConfigsFromSource(i.size===0?void 0:t))?.results??[];for(let o of a)i.set(o.hash,o),this.configs[o.file_path]=o;await R3.map(a,o=>this.cacheThemeConfig(o),{concurrency:10})}return Array.from(i.values())}async cacheManifest(e){e?.hash&&await this.getCache().set(`manifest:${e.hash}`,e.manifest)}async cacheThemeConfig(e){e?.hash&&await this.getCache().set(`config:${e.hash}`,e)}async fetchManifest(){let{swellHeaders:e}=this.swell,t=e["theme-version-hash"];console.log("ThemeLoader.fetchManifest",t);let i=await this.getCache().get(`manifest:${t}`);if(!i){let r=await this.swell.get("/:themes:versions/:last",{...this.themeVersionQueryFilter(),fields:"hash, manifest"});r&&(await this.cacheManifest(r),i=r.manifest)}return this.manifest=i,this.configPaths=Object.keys(i||{}),this.manifest}async fetchThemeConfigsFromSource(e=void 0){e=e||[];let{swellHeaders:t}=this.swell,i=String(t["theme-config-version"]),r=e.length===0||e.length>Rt;return console.log(`Retrieving ${r?"all":"some"} theme configurations - version: ${i}`),await this.swell.get("/:themes:configs",{...this.themeVersionQueryFilter(),...r?{}:{hash:{$in:e}},limit:1e3,type:"theme",fields:"name, file, file_path, hash",include:{file_data:Q3}})}async fetchThemeConfigsFromSourceByPath(e,t){console.log(`Retrieving theme config - ${e}`);let i=await this.swell.get("/:themes:configs/:last",{...this.themeVersionQueryFilter(),file_path:e,fields:"name, file, file_path, hash",include:{file_data:Q3}});return i&&(t&&(i.hash=t),await this.cacheThemeConfig(i)),this.configs[e]=i,i}themeVersionQueryFilter(){let{swellHeaders:e}=this.swell,t=e["theme-id"];if(!t)throw new Error("Theme ID is required");return{parent_id:t,branch_id:e["theme-branch-id"]||null,preview:e["deployment-mode"]==="editor"||e["deployment-mode"]==="preview"?!0:{$ne:!0}}}getCache(){return n.cache||(n.cache=new E3(this.swell.workerEnv?.THEME)),n.cache}};var H5=class{swell;props;globals;forms;resources;liquidSwell;themeLoader;themeConfigs=null;page;pageId;shopifyCompatibility=null;shopifyCompatibilityClass=g3;shopifyCompatibilityConfig=null;formData={};globalData={};constructor(e,t={}){let{forms:i,resources:r,globals:a,shopifyCompatibilityClass:o}=t;this.swell=e,this.props=this.getSwellAppThemeProps(e.config),this.shopifyCompatibilityConfig=e.shopifyCompatibilityConfig||null,this.globals=a||{},this.forms=i,this.resources=r,this.shopifyCompatibilityClass=o||g3,this.liquidSwell=new x3({theme:this,getThemeConfig:this.getThemeConfig.bind(this),getAssetUrl:this.getAssetUrl.bind(this),getThemeTemplateConfigByType:this.getThemeTemplateConfigByType.bind(this),renderTemplate:this.renderTemplate.bind(this),renderTemplateString:this.renderTemplateString.bind(this),renderTemplateSections:this.renderTemplateSections.bind(this),renderTranslation:this.lang.bind(this),renderCurrency:this.renderCurrency.bind(this),isEditor:e.isEditor}),this.themeLoader=new a4(e)}getSwellAppThemeProps(e){return e?.storefront?.theme||{}}async initGlobals(e){this.pageId=e,await this.themeLoader.init(this.themeConfigs||void 0);let{store:t,session:i,menus:r,geo:a,configs:o}=await this.getSettingsAndConfigs(),{settings:s,request:l,page:c,cart:u,account:h,customer:p}=await this.resolvePageData(t,o,i,e);this.page=c;let C={...this.globalData,store:t,settings:s,session:i,request:l,menus:r,page:c,cart:u,account:h,customer:p,geo:a,configs:o,translations:o?.translations,canonical_url:`${t.url}${this.swell.url?.pathname||""}`,shopify_compatibility:!!s.shopify_compatibility};this.shopifyCompatibility&&this.shopifyCompatibility.adaptGlobals(C),this.setGlobals(C),this.shopifyCompatibility&&this.shopifyCompatibility.adaptQueryParams()}setGlobals(e){this.globals={...this.globals,...e},this.liquidSwell.engine.options.globals={...this.globals}}async getSettingsAndConfigs(){let e=D4,[t,i]=await Promise.all([this.swell.getStorefrontSettings(),this.getThemeConfigsByPath("theme/config/",".json")]),r={theme:{},editor:{},translations:{},presets:[],...Array.from(i.values()).reduce((l,c)=>{let u=String(c?.name||"").split(".")[0];if(u){let h;try{h=JSON.parse(c.file_data)}catch{h=null}l[u]=h}return l},{})},a=await this.swell.storefront.settings.session(),o=a.locale||t?.store?.locale;this.resolveTranslationLocale(r.translations,o),await this.setCompatibilityConfigs(r,o);let s=await this.resolveMenuSettings();return{store:t?.store,session:a,menus:s,geo:e,configs:r}}async resolvePageData(e,t,i,r){let a=String(this.swell.swellHeaders["theme-config-version"]),o=await this.swell.getCachedResource(`theme-settings-resolved:v@${a}`,[],()=>N3(this,t.theme,t.editor?.settings));if(!o)throw new Error("Failed to resolve theme settings");let s={host:this.swell.url.host,origin:this.swell.url.origin,path:this.swell.url.pathname,query:this.swell.queryParams,locale:i?.locale||e.locale,currency:i?.currency||e.currency,is_editor:this.swell.isEditor,is_preview:this.swell.isPreview},l=this.props.pages?.find(m=>m.id===r),c=!l,u={...l,current:this.swell.queryParams.page||1,url:this.swell.url.pathname,custom:c,slug:null,description:null};if(r){let m=await this.getThemeTemplateConfigByType("templates",r),g;try{g=JSON.parse(m?.file_data||"")}catch{}if(g?.page){let{slug:f,label:Q,description:l3}=g.page;u.slug=f,u.label=Q,u.description=l3}}let[h,p]=await Promise.all([this.fetchSingletonResourceCached("cart",()=>this.fetchCart(),{}),this.fetchSingletonResourceCached("account",()=>this.fetchAccount(),null)]);if(!h)throw new Error("Failed to fetch cart");let C;return this.shopifyCompatibility&&(C=p),{settings:o,request:s,page:u,cart:h,account:p,customer:C}}async fetchSingletonResourceCached(e,t,i){let r=this.swell.storefront.session.getCookie();return r?this.swell.getCachedResource(`${e}-${r}`,[],()=>t()):i}async fetchCart(){let e=this.resources?.singletons?.cart,t=e?new e(this.swell):new J(this.swell,"cart");if(await t.id,!t?.id)return{};if(this.shopifyCompatibility){let i=C3(this.shopifyCompatibility,t);t.setCompatibilityProps(i)}return t}async fetchAccount(){let e=this.resources?.singletons?.account,t=e?new e(this.swell):new J(this.swell,"account");if(await t.id,!t?.id)return null;if(this.shopifyCompatibility){let i=K(this.shopifyCompatibility,t);t.setCompatibilityProps(i)}return t}getFormConfig(e){let t=e;if(this.shopifyCompatibility){let i=this.shopifyCompatibility.getAdaptedFormType(e);i&&(t=i)}return this.forms?.find(i=>i.id===t)}setFormData(e,t){let i=this.formData[e]||new O(e);i instanceof O&&(t?.params&&i.setParams(t.params),t?.errors?(i.setSuccess(!1),i.setErrors(t.errors)):t?.success&&(t.withoutErrors&&!i.errors?i.setSuccess(!0):t.withoutErrors||(i.setSuccess(!0),i.clearErrors())),this.shopifyCompatibility&&Object.assign(i,this.shopifyCompatibility.getFormData(i))),this.formData[e]=i,this.setGlobals({forms:this.formData})}setFormSuccessWithoutErrors(e){this.setFormData(e,{success:!0,withoutErrors:!0})}clearFormData(e){e?delete this.formData[e]:this.formData={},this.setGlobals({forms:this.formData})}serializeFormData(){let e={};for(let t in this.formData){let i=this.formData[t];e[t]={success:i.success,errors:i.errors&&Array.from(i.errors)}}return Object.keys(e).length>0?e:null}setGlobalData(e={}){this.globalData={...this.globalData,...e},this.setGlobals(this.globalData)}serializeGlobalData(){return Object.keys(this.globalData).length>0?this.globalData:null}updateSettings(e,t){return this.shopifyCompatibility?this.shopifyCompatibility.adaptSettings(e,t):w3(e,t)}resolveTranslationLocale(e,t){if(!e)return{};if(!t)return e;let i=t.split("-")[0];return(0,b.reduce)(e,(r,a,o)=>{if(f3(a))r[o]=this.resolveTranslationLocale(a,t);else if(typeof a=="string"&&a.startsWith("t:")){let s=a.slice(2),l=s.split("."),c=l.pop(),u=l.join("."),h=this.globals.translations;r[o]=(0,b.get)(h,`${u}.$locale.${t}.${c}`)||(0,b.get)(h,`${u}.$locale.${i}.${c}`)||(0,b.get)(h,s)||a}else r[o]=(0,b.get)(e,`$locale.${t}.${o}`)||(0,b.get)(e,`$locale.${i}.${o}`)||a;return r},{})}async setCompatibilityConfigs(e,t){let i=()=>(this.shopifyCompatibility||(this.shopifyCompatibility=new this.shopifyCompatibilityClass(this)),this.shopifyCompatibility);!Object.keys(e.editor).length&&e.settings_schema&&(e.editor=i().getEditorConfig(e.settings_schema),e.editor=await i().renderSchemaTranslations(this,e.editor,t)),!Object.keys(e.theme).length&&e.settings_data&&(e.theme=i().getThemeConfig(e.settings_data)),!Object.keys(e.presets).length&&e.settings_data&&(e.presets=i().getPresetsConfig(e.settings_data)),Object.keys(e.translations).length||(e.translations=await i().getLocaleConfig(this,t),Object.keys(e.translations).length||(this.shopifyCompatibility=null)),e.theme.shopify_compatibility?i():this.shopifyCompatibility&&(e.theme.shopify_compatibility=!0)}setCompatibilityData(e){!e||!this.shopifyCompatibility||this.shopifyCompatibility.adaptPageData(e)}resolveLookupSetting(e,t){if(t instanceof T)return t;let i=Pe(e);if(i){if(e.multiple){if(t instanceof Array)return t.map(r=>this.resolveLookupResource(i,r))}else if(t!==""&&t!==null&&t!==void 0)return this.resolveLookupResource(i,t)}return null}resolveLookupResource(e,t){let i=this.resources?.records?.[e],r=i?new i(this.swell,t):new _(this.swell,e,t);return this.shopifyCompatibility&&this.shopifyCompatibility.adaptPageData({resource:r}),r}resolveMenuSettings(){return j5(this,this.swell.getStorefrontMenus(),{currentUrl:this.swell.url.pathname})}resolveMenuSetting(e){if(!e)return null;let t=this.globals.menus||{};return t[e]||t[e.replace(/-/g,"_")]||null}async lang(e,t,i){return await this.renderTranslation(e,t,i)}resolveFontSetting(e){if(this.shopifyCompatibility){let t=this.shopifyCompatibility.getFontFromShopifySetting(e),i=new D(t||e);return Object.assign(i,this.shopifyCompatibility.getFontData(i)),i}return new D(e)}resolveUrlSetting(e){let t=e;if(this.shopifyCompatibility){e?.startsWith("shopify://")&&(t=e.replace("shopify://","/"));let i=this.shopifyCompatibility.getAdaptedPageUrl(t);if(i)return i}return t}resolveImageSetting(e){let t=e;return this.shopifyCompatibility&&e?.startsWith("shopify://")&&(t=""),t}async getAllThemeConfigs(){if(!this.themeConfigs){let e=await this.themeLoader.loadTheme(),t=new Map;for(let i of e)t.set(i.file_path,i);this.themeConfigs=t}return this.themeConfigs}async preloadThemeConfigs(e,t){await this.themeLoader.preloadTheme(e,t)}getPageConfigPath(e){return this.shopifyCompatibility?`theme/${this.shopifyCompatibility.getThemeFilePath("templates",e)}.json`:`theme/templates/${e}.json`}async getThemeConfig(e){return this.themeConfigs?this.themeConfigs.get(e)??null:this.themeLoader.fetchThemeConfig(e)}async getThemeConfigsByPath(e,t){let i=await this.themeLoader.fetchThemeConfigsByPath(e,t),r=new Map;for(let a of i)r.set(a.file_path,a);return r}async getThemeTemplateConfig(e){if(e.endsWith(".json")||e.endsWith(".liquid"))return this.getThemeConfig(e);let t=await this.getThemeConfig(`${e}.json`);return t||this.getThemeConfig(`${e}.liquid`)}async getThemeTemplateConfigByType(e,t){let i=[`${e}/${t}`];this.shopifyCompatibility&&i.push(this.shopifyCompatibility.getThemeFilePath(e,t));for(let r of i){let a=await this.getThemeTemplateConfig(`theme/${r}`);if(a)return a}return null}async getAssetUrl(e){return(await this.getThemeConfig(`theme/assets/${e}`)||await this.getThemeConfig(`assets/${e}`))?.file?.url||null}async renderTemplate(e,t){let i=e?.file_data||null;if(e===null||i===null)return"";try{return await this.liquidSwell.parseAndRender(i,t)}catch(r){return console.error(r),`<!-- template render error: ${r.message} -->`}}async renderTemplateString(e,t){try{return await this.liquidSwell.parseAndRender(e,t)}catch(i){return console.error(i),""}}async getSectionSchema(e){let t,i=await this.getThemeTemplateConfigByType("sections",e);if(i?.file_path?.endsWith(".json"))try{t=JSON.parse(i.file_data)||void 0}catch{return}else if(i?.file_path?.endsWith(".liquid")&&this.shopifyCompatibility){this.liquidSwell.lastSchema=void 0;let r=this.getSectionConfigWithSchemaTagOnly(i);if(!r)return;await this.renderTemplate(r);let a=this.liquidSwell.lastSchema;a&&(t=this.shopifyCompatibility.getSectionConfigSchema(a),t=await this.shopifyCompatibility.renderSchemaTranslations(this,t,this.globals.request?.locale))}return t.id=t.id||e,t.label=t.label||e,t.fields=t.fields||[],t}getSectionConfigWithSchemaTagOnly(e){let t="{% schema %}",i="{% endschema %}",r=e.file_data.indexOf(t),a=e.file_data.indexOf(i),o=e.file_data.slice(r+t.length,a);return r===-1||a===-1?null:{...e,file_data:t+o+i}}async renderThemeTemplate(e,t){let i=await this.getThemeTemplateConfig(e),r=await this.renderTemplate(i,{...t,template:i});if(i?.file_path?.endsWith(".json"))try{return JSON.parse(r)}catch(a){throw console.log("Unable to render theme template",i.file_path,r),new j3(a)}return r}async renderLayoutTemplate(e,t){let i=await this.getThemeTemplateConfigByType("layouts",e);if(i){let r=await this.renderThemeTemplate(i.file_path,t);return typeof r=="string"?r:`<!-- invalid layout: ${e}--> {{ content_for_layout }}`}throw new Error(`Layout template not found: ${e}`)}async renderPageTemplate(e,t,i){let r=null;if(i&&(r=await this.getThemeTemplateConfigByType("templates",`${e}.${i}`)),r||(r=await this.getThemeTemplateConfigByType("templates",e)),r){let a=await this.renderThemeTemplate(r.file_path,t);return a&&typeof a!="string"&&(a.id=r.name),a}throw console.error(new Error(`Page template not found: templates/${e}.liquid`)),new Z3}async renderPage(e,t){e&&this.setGlobals(e);let i;if(this.page?.id?i=await this.renderPageTemplate(this.page.id,e,t):i=await this.renderPageTemplate("404",e),typeof i!="string"&&i?.page){if(i.page.published===!1)throw new Z3;i.page=this.resolveTranslationLocale(i.page,this.globals.request?.locale)}return i}async renderAllSections(e,t){let i=typeof e=="string"?e.split(/\s*,\s*/):e;return(await Promise.all(i.map?.(a=>this.renderSection(a,t)))).reduce((a,o,s)=>{let l=i[s];return this.shopifyCompatibility?a[l]=`
936
936
  <div id="shopify-section-${l}" class="shopify-section">${o}</div>
937
937
  `.trim():a[l]=`
938
938
  <div id="swell-section-${l}" class="swell-section">${o}</div>