@momentco-ai/moment-sdk 0.9.0-dev.52 → 0.9.0-dev.53

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.
@@ -1,43 +1,43 @@
1
- const B = "moment_sync", P = "moment_campaign";
2
- const ue = /^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/, me = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
3
- function he(i, e) {
1
+ const F = "moment_sync", P = "moment_campaign";
2
+ const me = /^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/, he = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
3
+ function pe(i, e) {
4
4
  if (!e) return null;
5
- const t = new URL(i), s = t.searchParams.get(B);
5
+ const t = new URL(i), s = t.searchParams.get(F);
6
6
  if (s === null || s.length > 200) return null;
7
- const r = ue.exec(s);
8
- if (!r) return null;
9
- const [, o, n, a] = r;
10
- let h;
11
- o === "moment" ? h = { teamSlug: e, triggerType: "moment", momentSlug: n } : o === "list" ? h = { teamSlug: e, triggerType: "list", listSlug: n } : a ? h = { teamSlug: e, triggerType: "playlist", playlistSlugs: a.split(",") } : h = { teamSlug: e, triggerType: "schedule" };
12
- const u = t.searchParams.get(P);
7
+ const n = me.exec(s);
8
+ if (!n) return null;
9
+ const [, r, o, a] = n;
10
+ let u;
11
+ r === "moment" ? u = { teamSlug: e, triggerType: "moment", momentSlug: o } : r === "list" ? u = { teamSlug: e, triggerType: "list", listSlug: o } : a ? u = { teamSlug: e, triggerType: "playlist", playlistSlugs: a.split(",") } : u = { teamSlug: e, triggerType: "schedule" };
12
+ const m = t.searchParams.get(P);
13
13
  return t.search = t.search.slice(1).split("&").filter((g) => {
14
14
  const d = g.split("=", 1)[0];
15
- return d !== B && d !== P;
15
+ return d !== F && d !== P;
16
16
  }).join("&"), {
17
- payload: h,
18
- ...u && me.test(u) ? { campaignId: u } : {},
17
+ payload: u,
18
+ ...m && he.test(m) ? { campaignId: m } : {},
19
19
  cleanUrl: t.href
20
20
  };
21
21
  }
22
- let N = !1;
23
- function pe() {
24
- return N ? !1 : (N = !0, !0);
22
+ let D = !1;
23
+ function fe() {
24
+ return D ? !1 : (D = !0, !0);
25
25
  }
26
- function fe(i, e) {
26
+ function ge(i, e) {
27
27
  i.body ? e() : i.addEventListener("DOMContentLoaded", e, { once: !0 });
28
28
  }
29
- const ge = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='15.55 11.94 120.52 21.28'%3E%3Cpath d='M16.59 33.04L17.42 29.54C18.62 24.54 19.22 21.32 19.22 19.89C19.22 19.68 19.19 19.54 19.12 19.47C19.05 19.4 18.91 19.38 18.7 19.4C18.4 19.47 17.97 19.65 17.42 19.94C16.86 20.23 16.32 20.62 15.79 21.1C15.63 20.9 15.55 20.69 15.55 20.48C15.55 20.27 15.65 20.03 15.86 19.75C16.16 19.38 16.65 18.95 17.33 18.45C18.02 17.95 18.74 17.53 19.5 17.2C20.27 16.86 20.92 16.7 21.48 16.7C21.78 16.7 22 16.79 22.14 16.99C22.28 17.19 22.35 17.5 22.35 17.94C22.35 18.55 22.24 19.42 22.04 20.56C21.83 21.71 21.55 22.88 21.2 24.09C22.34 21.96 23.59 20.19 24.95 18.79C26.32 17.4 27.7 16.7 29.12 16.7C29.79 16.7 30.27 16.87 30.57 17.23C30.87 17.59 31.02 18.14 31.02 18.88C31.02 19.97 30.69 21.7 30.02 24.09C31.13 22.01 32.44 20.25 33.94 18.83C35.44 17.41 36.94 16.7 38.42 16.7C39.11 16.7 39.63 16.88 39.98 17.25C40.33 17.62 40.5 18.16 40.5 18.88C40.5 19.18 40.45 19.62 40.34 20.18C40.24 20.75 40.1 21.37 39.91 22.04L38.42 27.7C38.09 28.92 37.93 29.77 37.93 30.23C37.93 30.48 37.97 30.67 38.05 30.8C38.13 30.93 38.27 30.99 38.45 30.99C38.89 30.99 39.47 30.69 40.17 30.09C40.88 29.49 41.46 28.85 41.92 28.18C42.25 28.44 42.41 28.72 42.41 29.05C42.41 29.26 42.34 29.48 42.2 29.71C41.74 30.5 40.98 31.28 39.93 32.05C38.87 32.82 37.82 33.21 36.75 33.21C36.08 33.21 35.56 33.02 35.17 32.62C34.79 32.23 34.6 31.66 34.6 30.92C34.6 30.3 34.8 29.22 35.19 27.7L36.79 21.55C37 20.74 37.1 20.13 37.1 19.71C37.1 19.2 36.89 18.95 36.48 18.95C35.97 18.95 35.3 19.33 34.46 20.08C33.63 20.83 32.79 21.94 31.93 23.41C31.07 24.88 30.33 26.62 29.71 28.63L28.91 31.27C28.77 31.73 28.59 32.09 28.37 32.33C28.15 32.57 27.82 32.73 27.38 32.8L25.54 33.22L25.37 33.04L26.13 29.67C26.73 27.11 27.19 25.03 27.49 23.44C27.79 21.86 27.94 20.72 27.94 20.03C27.94 19.33 27.72 19.02 27.28 19.02C26.79 19.02 26.17 19.4 25.42 20.15C24.67 20.9 23.89 22 23.1 23.46C22.3 24.92 21.6 26.65 21 28.67L20.2 31.27C20.06 31.71 19.87 32.05 19.63 32.29C19.38 32.54 19.02 32.71 18.53 32.8L16.76 33.22L16.59 33.04L16.59 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M57.66 17.94C57 17.13 55.99 16.73 54.62 16.73C52.93 16.73 51.31 17.3 49.75 18.43C49.51 18.6 49.28 18.78 49.06 18.97C49.24 19.85 49.39 20.78 49.48 21.74C49.86 21.01 50.3 20.37 50.79 19.82C51.63 18.87 52.5 18.39 53.41 18.39C54.08 18.39 54.55 18.68 54.81 19.24C55.08 19.81 55.21 20.58 55.21 21.55C55.21 23.08 54.97 24.63 54.48 26.19C54 27.75 53.35 29.03 52.54 30.04C51.73 31.04 50.86 31.55 49.94 31.55C49.53 31.55 49.19 31.44 48.9 31.22C48.74 31.9 48.54 32.55 48.31 33.19C48.5 33.2 48.7 33.21 48.9 33.21C50.54 33.21 52.11 32.63 53.61 31.48C55.12 30.32 56.33 28.82 57.26 26.98C58.18 25.14 58.65 23.28 58.65 21.38C58.65 19.9 58.32 18.75 57.66 17.94L57.66 17.94Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M61.84 33.04L62.67 29.54C63.88 24.54 64.48 21.32 64.48 19.89C64.48 19.68 64.44 19.54 64.37 19.47C64.3 19.4 64.17 19.38 63.96 19.4C63.66 19.47 63.23 19.65 62.67 19.94C62.12 20.23 61.57 20.62 61.04 21.1C60.88 20.9 60.8 20.69 60.8 20.48C60.8 20.27 60.9 20.03 61.11 19.75C61.41 19.38 61.9 18.95 62.59 18.45C63.27 17.95 63.99 17.53 64.76 17.2C65.52 16.86 66.18 16.7 66.73 16.7C67.04 16.7 67.26 16.79 67.39 16.99C67.53 17.19 67.6 17.5 67.6 17.94C67.6 18.55 67.5 19.42 67.29 20.56C67.08 21.71 66.8 22.88 66.46 24.09C67.59 21.96 68.84 20.19 70.2 18.79C71.57 17.4 72.96 16.7 74.37 16.7C75.04 16.7 75.53 16.87 75.83 17.23C76.13 17.59 76.28 18.14 76.28 18.88C76.28 19.97 75.94 21.7 75.27 24.09C76.38 22.01 77.69 20.25 79.19 18.83C80.7 17.41 82.19 16.7 83.67 16.7C84.36 16.7 84.89 16.88 85.23 17.25C85.58 17.62 85.75 18.16 85.75 18.88C85.75 19.18 85.7 19.62 85.6 20.18C85.49 20.75 85.35 21.37 85.16 22.04L83.67 27.7C83.35 28.92 83.19 29.77 83.19 30.23C83.19 30.48 83.23 30.67 83.31 30.8C83.39 30.93 83.52 30.99 83.71 30.99C84.15 30.99 84.72 30.69 85.42 30.09C86.13 29.49 86.71 28.85 87.18 28.18C87.5 28.44 87.66 28.72 87.66 29.05C87.66 29.26 87.59 29.48 87.46 29.71C86.99 30.5 86.24 31.28 85.18 32.05C84.13 32.82 83.07 33.21 82.01 33.21C81.34 33.21 80.81 33.02 80.43 32.62C80.05 32.23 79.86 31.66 79.86 30.92C79.86 30.3 80.05 29.22 80.44 27.7L82.04 21.55C82.25 20.74 82.35 20.13 82.35 19.71C82.35 19.2 82.15 18.95 81.73 18.95C81.22 18.95 80.55 19.33 79.72 20.08C78.88 20.83 78.04 21.94 77.18 23.41C76.33 24.88 75.59 26.62 74.96 28.63L74.16 31.27C74.02 31.73 73.85 32.09 73.63 32.33C73.41 32.57 73.08 32.73 72.64 32.8L70.8 33.22L70.62 33.04L71.39 29.67C71.99 27.11 72.44 25.03 72.74 23.44C73.04 21.86 73.19 20.72 73.19 20.03C73.19 19.33 72.97 19.02 72.53 19.02C72.05 19.02 71.43 19.4 70.68 20.15C69.92 20.9 69.15 22 68.35 23.46C67.55 24.92 66.85 26.65 66.25 28.67L65.45 31.27C65.31 31.71 65.12 32.05 64.88 32.29C64.64 32.54 64.27 32.71 63.79 32.8L62.02 33.22L61.84 33.04L61.84 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M91.01 31.91C90.19 31.04 89.78 29.85 89.78 28.32C89.78 26.47 90.32 24.64 91.41 22.84C92.49 21.03 93.87 19.56 95.54 18.41C97.2 17.27 98.82 16.69 100.4 16.69C101.23 16.69 101.87 16.9 102.31 17.3C102.75 17.71 102.97 18.25 102.97 18.95C102.97 20.08 102.55 21.13 101.72 22.09C100.88 23.05 99.77 23.81 98.37 24.38C96.97 24.95 95.47 25.23 93.87 25.23H93.52C93.25 26.16 93.11 27.05 93.11 27.9C93.11 28.97 93.32 29.79 93.75 30.37C94.18 30.95 94.8 31.24 95.61 31.24C96.51 31.24 97.4 30.91 98.28 30.26C99.16 29.62 99.99 28.69 100.78 27.49C100.96 27.72 101.1 27.91 101.18 28.06C101.26 28.21 101.3 28.39 101.3 28.6C101.3 28.81 101.22 29.06 101.06 29.36C100.78 29.89 100.32 30.46 99.67 31.05C99.02 31.63 98.24 32.14 97.33 32.57C96.41 33 95.43 33.21 94.39 33.21C92.96 33.21 91.83 32.78 91.01 31.91V31.91ZM94.32 23.81C95.43 23.81 96.43 23.58 97.33 23.12C98.22 22.65 98.92 22.08 99.42 21.4C99.93 20.71 100.19 20.05 100.19 19.4C100.19 18.69 99.85 18.33 99.18 18.33C98.3 18.33 97.37 18.85 96.39 19.91C95.41 20.96 94.61 22.25 94.01 23.78C94.08 23.8 94.19 23.81 94.32 23.81L94.32 23.81Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M105.91 33.04L106.78 29.12C107.96 24.08 108.55 21.04 108.55 20.03C108.55 19.82 108.5 19.66 108.4 19.56C108.29 19.45 108.15 19.4 107.96 19.4C107.68 19.4 107.3 19.54 106.82 19.82C106.33 20.1 105.75 20.51 105.08 21.07C105.01 21 104.95 20.89 104.91 20.75C104.86 20.62 104.84 20.5 104.84 20.41C104.84 20.27 104.86 20.13 104.89 19.99C104.93 19.85 105.01 19.7 105.15 19.54C105.43 19.17 105.88 18.76 106.52 18.31C107.16 17.86 107.83 17.47 108.55 17.16C109.27 16.85 109.89 16.69 110.43 16.69C110.79 16.69 111.06 16.79 111.21 16.97C111.36 17.16 111.43 17.47 111.43 17.91C111.43 19.09 111.05 21.2 110.29 24.26C111.42 22.08 112.72 20.28 114.19 18.84C115.66 17.41 117.14 16.69 118.65 16.69C119.37 16.69 119.92 16.88 120.3 17.25C120.68 17.62 120.87 18.14 120.87 18.81C120.87 19.48 120.67 20.57 120.28 22.07L118.72 27.97C118.44 28.99 118.3 29.74 118.3 30.23C118.3 30.71 118.48 30.99 118.82 30.99C119.26 30.99 119.84 30.69 120.54 30.09C121.25 29.49 121.83 28.85 122.29 28.18C122.62 28.43 122.78 28.72 122.78 29.05C122.78 29.26 122.71 29.48 122.57 29.71C122.32 30.17 121.91 30.67 121.34 31.22C120.77 31.76 120.12 32.23 119.39 32.62C118.67 33.02 117.92 33.21 117.16 33.21C116.46 33.21 115.92 33.02 115.54 32.62C115.16 32.23 114.97 31.63 114.97 30.82C114.97 30.15 115.18 29.04 115.59 27.49L117.09 22.14C117.36 21.05 117.5 20.24 117.5 19.71C117.5 19.18 117.32 18.95 116.95 18.95C116.37 18.95 115.65 19.35 114.8 20.15C113.94 20.95 113.08 22.09 112.21 23.58C111.34 25.07 110.63 26.84 110.08 28.87L109.45 31.06C109.31 31.59 109.13 31.98 108.9 32.22C108.67 32.47 108.33 32.65 107.89 32.76L106.09 33.21L105.91 33.04L105.91 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M126.29 32.28C125.82 31.65 125.59 30.84 125.59 29.85C125.59 29.27 125.7 28.37 125.9 27.16C126.11 25.94 126.47 24.18 126.98 21.87L127.6 18.88H124.52L124.76 17.49L127.99 17.15L130.03 13.12C130.24 12.75 130.43 12.48 130.59 12.32C130.75 12.16 130.95 12.06 131.18 12.01C131.41 11.96 131.76 11.94 132.22 11.94L132.36 12.11L131.28 17.15H136.07L135.9 18.01C135.85 18.36 135.75 18.59 135.6 18.71C135.45 18.82 135.18 18.88 134.79 18.88H130.9L130.24 21.94C129.73 24.34 129.37 26.11 129.17 27.23C128.96 28.35 128.85 29.14 128.85 29.61C128.85 30 128.93 30.29 129.08 30.47C129.23 30.66 129.48 30.75 129.82 30.75C130.42 30.75 131.14 30.5 131.98 30.01C132.81 29.51 133.55 28.89 134.2 28.15C134.57 28.43 134.75 28.69 134.75 28.95C134.75 29.39 134.42 29.95 133.75 30.63C133.07 31.31 132.25 31.91 131.26 32.43C130.28 32.96 129.34 33.22 128.44 33.22C127.47 33.22 126.75 32.9 126.28 32.28L126.29 32.28Z' fill='%23FAFAF9'%3E%3C/path%3E%3C/svg%3E", Ce = 120.52 / 21.28, ye = 4e3, be = 80, D = ["#f04a34", "#041abe", "#041139", "#1cd4ed", "#b8e070"], ve = 260, U = { x: 0.5, y: 0.7 }, Te = [
29
+ const Ce = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='15.55 11.94 120.52 21.28'%3E%3Cpath d='M16.59 33.04L17.42 29.54C18.62 24.54 19.22 21.32 19.22 19.89C19.22 19.68 19.19 19.54 19.12 19.47C19.05 19.4 18.91 19.38 18.7 19.4C18.4 19.47 17.97 19.65 17.42 19.94C16.86 20.23 16.32 20.62 15.79 21.1C15.63 20.9 15.55 20.69 15.55 20.48C15.55 20.27 15.65 20.03 15.86 19.75C16.16 19.38 16.65 18.95 17.33 18.45C18.02 17.95 18.74 17.53 19.5 17.2C20.27 16.86 20.92 16.7 21.48 16.7C21.78 16.7 22 16.79 22.14 16.99C22.28 17.19 22.35 17.5 22.35 17.94C22.35 18.55 22.24 19.42 22.04 20.56C21.83 21.71 21.55 22.88 21.2 24.09C22.34 21.96 23.59 20.19 24.95 18.79C26.32 17.4 27.7 16.7 29.12 16.7C29.79 16.7 30.27 16.87 30.57 17.23C30.87 17.59 31.02 18.14 31.02 18.88C31.02 19.97 30.69 21.7 30.02 24.09C31.13 22.01 32.44 20.25 33.94 18.83C35.44 17.41 36.94 16.7 38.42 16.7C39.11 16.7 39.63 16.88 39.98 17.25C40.33 17.62 40.5 18.16 40.5 18.88C40.5 19.18 40.45 19.62 40.34 20.18C40.24 20.75 40.1 21.37 39.91 22.04L38.42 27.7C38.09 28.92 37.93 29.77 37.93 30.23C37.93 30.48 37.97 30.67 38.05 30.8C38.13 30.93 38.27 30.99 38.45 30.99C38.89 30.99 39.47 30.69 40.17 30.09C40.88 29.49 41.46 28.85 41.92 28.18C42.25 28.44 42.41 28.72 42.41 29.05C42.41 29.26 42.34 29.48 42.2 29.71C41.74 30.5 40.98 31.28 39.93 32.05C38.87 32.82 37.82 33.21 36.75 33.21C36.08 33.21 35.56 33.02 35.17 32.62C34.79 32.23 34.6 31.66 34.6 30.92C34.6 30.3 34.8 29.22 35.19 27.7L36.79 21.55C37 20.74 37.1 20.13 37.1 19.71C37.1 19.2 36.89 18.95 36.48 18.95C35.97 18.95 35.3 19.33 34.46 20.08C33.63 20.83 32.79 21.94 31.93 23.41C31.07 24.88 30.33 26.62 29.71 28.63L28.91 31.27C28.77 31.73 28.59 32.09 28.37 32.33C28.15 32.57 27.82 32.73 27.38 32.8L25.54 33.22L25.37 33.04L26.13 29.67C26.73 27.11 27.19 25.03 27.49 23.44C27.79 21.86 27.94 20.72 27.94 20.03C27.94 19.33 27.72 19.02 27.28 19.02C26.79 19.02 26.17 19.4 25.42 20.15C24.67 20.9 23.89 22 23.1 23.46C22.3 24.92 21.6 26.65 21 28.67L20.2 31.27C20.06 31.71 19.87 32.05 19.63 32.29C19.38 32.54 19.02 32.71 18.53 32.8L16.76 33.22L16.59 33.04L16.59 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M57.66 17.94C57 17.13 55.99 16.73 54.62 16.73C52.93 16.73 51.31 17.3 49.75 18.43C49.51 18.6 49.28 18.78 49.06 18.97C49.24 19.85 49.39 20.78 49.48 21.74C49.86 21.01 50.3 20.37 50.79 19.82C51.63 18.87 52.5 18.39 53.41 18.39C54.08 18.39 54.55 18.68 54.81 19.24C55.08 19.81 55.21 20.58 55.21 21.55C55.21 23.08 54.97 24.63 54.48 26.19C54 27.75 53.35 29.03 52.54 30.04C51.73 31.04 50.86 31.55 49.94 31.55C49.53 31.55 49.19 31.44 48.9 31.22C48.74 31.9 48.54 32.55 48.31 33.19C48.5 33.2 48.7 33.21 48.9 33.21C50.54 33.21 52.11 32.63 53.61 31.48C55.12 30.32 56.33 28.82 57.26 26.98C58.18 25.14 58.65 23.28 58.65 21.38C58.65 19.9 58.32 18.75 57.66 17.94L57.66 17.94Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M61.84 33.04L62.67 29.54C63.88 24.54 64.48 21.32 64.48 19.89C64.48 19.68 64.44 19.54 64.37 19.47C64.3 19.4 64.17 19.38 63.96 19.4C63.66 19.47 63.23 19.65 62.67 19.94C62.12 20.23 61.57 20.62 61.04 21.1C60.88 20.9 60.8 20.69 60.8 20.48C60.8 20.27 60.9 20.03 61.11 19.75C61.41 19.38 61.9 18.95 62.59 18.45C63.27 17.95 63.99 17.53 64.76 17.2C65.52 16.86 66.18 16.7 66.73 16.7C67.04 16.7 67.26 16.79 67.39 16.99C67.53 17.19 67.6 17.5 67.6 17.94C67.6 18.55 67.5 19.42 67.29 20.56C67.08 21.71 66.8 22.88 66.46 24.09C67.59 21.96 68.84 20.19 70.2 18.79C71.57 17.4 72.96 16.7 74.37 16.7C75.04 16.7 75.53 16.87 75.83 17.23C76.13 17.59 76.28 18.14 76.28 18.88C76.28 19.97 75.94 21.7 75.27 24.09C76.38 22.01 77.69 20.25 79.19 18.83C80.7 17.41 82.19 16.7 83.67 16.7C84.36 16.7 84.89 16.88 85.23 17.25C85.58 17.62 85.75 18.16 85.75 18.88C85.75 19.18 85.7 19.62 85.6 20.18C85.49 20.75 85.35 21.37 85.16 22.04L83.67 27.7C83.35 28.92 83.19 29.77 83.19 30.23C83.19 30.48 83.23 30.67 83.31 30.8C83.39 30.93 83.52 30.99 83.71 30.99C84.15 30.99 84.72 30.69 85.42 30.09C86.13 29.49 86.71 28.85 87.18 28.18C87.5 28.44 87.66 28.72 87.66 29.05C87.66 29.26 87.59 29.48 87.46 29.71C86.99 30.5 86.24 31.28 85.18 32.05C84.13 32.82 83.07 33.21 82.01 33.21C81.34 33.21 80.81 33.02 80.43 32.62C80.05 32.23 79.86 31.66 79.86 30.92C79.86 30.3 80.05 29.22 80.44 27.7L82.04 21.55C82.25 20.74 82.35 20.13 82.35 19.71C82.35 19.2 82.15 18.95 81.73 18.95C81.22 18.95 80.55 19.33 79.72 20.08C78.88 20.83 78.04 21.94 77.18 23.41C76.33 24.88 75.59 26.62 74.96 28.63L74.16 31.27C74.02 31.73 73.85 32.09 73.63 32.33C73.41 32.57 73.08 32.73 72.64 32.8L70.8 33.22L70.62 33.04L71.39 29.67C71.99 27.11 72.44 25.03 72.74 23.44C73.04 21.86 73.19 20.72 73.19 20.03C73.19 19.33 72.97 19.02 72.53 19.02C72.05 19.02 71.43 19.4 70.68 20.15C69.92 20.9 69.15 22 68.35 23.46C67.55 24.92 66.85 26.65 66.25 28.67L65.45 31.27C65.31 31.71 65.12 32.05 64.88 32.29C64.64 32.54 64.27 32.71 63.79 32.8L62.02 33.22L61.84 33.04L61.84 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M91.01 31.91C90.19 31.04 89.78 29.85 89.78 28.32C89.78 26.47 90.32 24.64 91.41 22.84C92.49 21.03 93.87 19.56 95.54 18.41C97.2 17.27 98.82 16.69 100.4 16.69C101.23 16.69 101.87 16.9 102.31 17.3C102.75 17.71 102.97 18.25 102.97 18.95C102.97 20.08 102.55 21.13 101.72 22.09C100.88 23.05 99.77 23.81 98.37 24.38C96.97 24.95 95.47 25.23 93.87 25.23H93.52C93.25 26.16 93.11 27.05 93.11 27.9C93.11 28.97 93.32 29.79 93.75 30.37C94.18 30.95 94.8 31.24 95.61 31.24C96.51 31.24 97.4 30.91 98.28 30.26C99.16 29.62 99.99 28.69 100.78 27.49C100.96 27.72 101.1 27.91 101.18 28.06C101.26 28.21 101.3 28.39 101.3 28.6C101.3 28.81 101.22 29.06 101.06 29.36C100.78 29.89 100.32 30.46 99.67 31.05C99.02 31.63 98.24 32.14 97.33 32.57C96.41 33 95.43 33.21 94.39 33.21C92.96 33.21 91.83 32.78 91.01 31.91V31.91ZM94.32 23.81C95.43 23.81 96.43 23.58 97.33 23.12C98.22 22.65 98.92 22.08 99.42 21.4C99.93 20.71 100.19 20.05 100.19 19.4C100.19 18.69 99.85 18.33 99.18 18.33C98.3 18.33 97.37 18.85 96.39 19.91C95.41 20.96 94.61 22.25 94.01 23.78C94.08 23.8 94.19 23.81 94.32 23.81L94.32 23.81Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M105.91 33.04L106.78 29.12C107.96 24.08 108.55 21.04 108.55 20.03C108.55 19.82 108.5 19.66 108.4 19.56C108.29 19.45 108.15 19.4 107.96 19.4C107.68 19.4 107.3 19.54 106.82 19.82C106.33 20.1 105.75 20.51 105.08 21.07C105.01 21 104.95 20.89 104.91 20.75C104.86 20.62 104.84 20.5 104.84 20.41C104.84 20.27 104.86 20.13 104.89 19.99C104.93 19.85 105.01 19.7 105.15 19.54C105.43 19.17 105.88 18.76 106.52 18.31C107.16 17.86 107.83 17.47 108.55 17.16C109.27 16.85 109.89 16.69 110.43 16.69C110.79 16.69 111.06 16.79 111.21 16.97C111.36 17.16 111.43 17.47 111.43 17.91C111.43 19.09 111.05 21.2 110.29 24.26C111.42 22.08 112.72 20.28 114.19 18.84C115.66 17.41 117.14 16.69 118.65 16.69C119.37 16.69 119.92 16.88 120.3 17.25C120.68 17.62 120.87 18.14 120.87 18.81C120.87 19.48 120.67 20.57 120.28 22.07L118.72 27.97C118.44 28.99 118.3 29.74 118.3 30.23C118.3 30.71 118.48 30.99 118.82 30.99C119.26 30.99 119.84 30.69 120.54 30.09C121.25 29.49 121.83 28.85 122.29 28.18C122.62 28.43 122.78 28.72 122.78 29.05C122.78 29.26 122.71 29.48 122.57 29.71C122.32 30.17 121.91 30.67 121.34 31.22C120.77 31.76 120.12 32.23 119.39 32.62C118.67 33.02 117.92 33.21 117.16 33.21C116.46 33.21 115.92 33.02 115.54 32.62C115.16 32.23 114.97 31.63 114.97 30.82C114.97 30.15 115.18 29.04 115.59 27.49L117.09 22.14C117.36 21.05 117.5 20.24 117.5 19.71C117.5 19.18 117.32 18.95 116.95 18.95C116.37 18.95 115.65 19.35 114.8 20.15C113.94 20.95 113.08 22.09 112.21 23.58C111.34 25.07 110.63 26.84 110.08 28.87L109.45 31.06C109.31 31.59 109.13 31.98 108.9 32.22C108.67 32.47 108.33 32.65 107.89 32.76L106.09 33.21L105.91 33.04L105.91 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M126.29 32.28C125.82 31.65 125.59 30.84 125.59 29.85C125.59 29.27 125.7 28.37 125.9 27.16C126.11 25.94 126.47 24.18 126.98 21.87L127.6 18.88H124.52L124.76 17.49L127.99 17.15L130.03 13.12C130.24 12.75 130.43 12.48 130.59 12.32C130.75 12.16 130.95 12.06 131.18 12.01C131.41 11.96 131.76 11.94 132.22 11.94L132.36 12.11L131.28 17.15H136.07L135.9 18.01C135.85 18.36 135.75 18.59 135.6 18.71C135.45 18.82 135.18 18.88 134.79 18.88H130.9L130.24 21.94C129.73 24.34 129.37 26.11 129.17 27.23C128.96 28.35 128.85 29.14 128.85 29.61C128.85 30 128.93 30.29 129.08 30.47C129.23 30.66 129.48 30.75 129.82 30.75C130.42 30.75 131.14 30.5 131.98 30.01C132.81 29.51 133.55 28.89 134.2 28.15C134.57 28.43 134.75 28.69 134.75 28.95C134.75 29.39 134.42 29.95 133.75 30.63C133.07 31.31 132.25 31.91 131.26 32.43C130.28 32.96 129.34 33.22 128.44 33.22C127.47 33.22 126.75 32.9 126.28 32.28L126.29 32.28Z' fill='%23FAFAF9'%3E%3C/path%3E%3C/svg%3E", ye = 120.52 / 21.28, be = 4e3, ve = 80, N = ["#f04a34", "#041abe", "#041139", "#1cd4ed", "#b8e070"], Te = 260, U = { x: 0.5, y: 0.7 }, Ee = [
30
30
  { share: 0.25, spread: 26, velocity: 55, decay: 0.91, scalar: 1 },
31
31
  { share: 0.2, spread: 60, velocity: 45, decay: 0.91, scalar: 1 },
32
32
  { share: 0.35, spread: 100, velocity: 45, decay: 0.91, scalar: 0.8 },
33
33
  { share: 0.1, spread: 120, velocity: 25, decay: 0.92, scalar: 1.2 },
34
34
  { share: 0.1, spread: 120, velocity: 45, decay: 0.91, scalar: 1 }
35
- ], xe = 3, Ae = 0.2, Ee = 200, we = 1e3 / 60, Se = 4, Ie = 0.75, Le = "M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z", Me = "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z", _e = "M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z", Oe = "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z", $ = {
36
- success: { fill: "#1c1d22", glyph: "#fafafc", path: Le },
35
+ ], we = 3, xe = 0.2, Ae = 200, Se = 1e3 / 60, Le = 4, Ie = 0.75, ke = "M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z", Me = "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z", _e = "M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z", Oe = "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z", $ = {
36
+ success: { fill: "#1c1d22", glyph: "#fafafc", path: ke },
37
37
  info: { fill: "#146eaa", glyph: "#ffffff", path: Me },
38
38
  warning: { fill: "#aa4e19", glyph: "#ffffff", path: _e },
39
39
  error: { fill: "#c62734", glyph: "#ffffff", path: Oe }
40
- }, ke = {
40
+ }, Re = {
41
41
  position: "absolute",
42
42
  top: "calc(56px + env(safe-area-inset-top, 0px))",
43
43
  left: "0",
@@ -60,7 +60,7 @@ const ge = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox
60
60
  lineHeight: "20px",
61
61
  fontWeight: "400",
62
62
  overflowWrap: "anywhere"
63
- }, Re = {
63
+ }, He = {
64
64
  display: "flex",
65
65
  alignItems: "center",
66
66
  justifyContent: "center",
@@ -69,7 +69,7 @@ const ge = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox
69
69
  height: "28px",
70
70
  margin: "2px",
71
71
  borderRadius: "50%"
72
- }, He = {
72
+ }, Be = {
73
73
  position: "absolute",
74
74
  width: "1px",
75
75
  height: "1px",
@@ -80,12 +80,12 @@ const ge = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox
80
80
  clipPath: "inset(50%)",
81
81
  whiteSpace: "nowrap"
82
82
  };
83
- function A(i, e) {
83
+ function w(i, e) {
84
84
  const t = document.createElement(i);
85
85
  return Object.assign(t.style, e), t;
86
86
  }
87
87
  function Fe(i, e) {
88
- const t = A("div", {
88
+ const t = w("div", {
89
89
  position: "absolute",
90
90
  inset: "0",
91
91
  overflow: "hidden",
@@ -93,26 +93,26 @@ function Fe(i, e) {
93
93
  zIndex: "1"
94
94
  });
95
95
  t.setAttribute("aria-hidden", "true"), i.appendChild(t);
96
- const s = A("span", He);
96
+ const s = w("span", Be);
97
97
  s.setAttribute("role", "status"), (e.querySelector('[role="dialog"]') ?? e).appendChild(s);
98
- let r = null, o = null, n = null, a = null;
99
- const h = () => {
100
- o && clearTimeout(o), o = null, a?.(), a = null, r?.remove(), r = null, s.textContent = "";
101
- }, u = (c) => {
102
- const m = () => {
98
+ let n = null, r = null, o = null, a = null;
99
+ const u = () => {
100
+ r && clearTimeout(r), r = null, a?.(), a = null, n?.remove(), n = null, s.textContent = "";
101
+ }, m = (c) => {
102
+ const h = () => {
103
103
  a = null, s.textContent = c;
104
104
  };
105
105
  if (typeof requestAnimationFrame == "function") {
106
- const l = requestAnimationFrame(m);
106
+ const l = requestAnimationFrame(h);
107
107
  a = () => cancelAnimationFrame(l);
108
108
  } else {
109
- const l = setTimeout(m, 0);
109
+ const l = setTimeout(h, 0);
110
110
  a = () => clearTimeout(l);
111
111
  }
112
- }, g = ({ spread: c, velocity: m, decay: l, scalar: f }, C, x, p) => {
113
- const y = (4 + Math.random() * 6) * f, b = A("span", {
112
+ }, g = ({ spread: c, velocity: h, decay: l, scalar: f }, C, E, p) => {
113
+ const y = (4 + Math.random() * 6) * f, b = w("span", {
114
114
  position: "absolute",
115
- left: `${x}px`,
115
+ left: `${E}px`,
116
116
  top: `${p}px`,
117
117
  width: `${y}px`,
118
118
  height: `${y * (0.5 + Math.random())}px`,
@@ -120,64 +120,64 @@ function Fe(i, e) {
120
120
  backgroundColor: C
121
121
  });
122
122
  b.setAttribute("data-moment-confetti", ""), t.appendChild(b);
123
- const E = -Math.PI / 2 + (Math.random() - 0.5) * c * Math.PI / 180;
124
- let T = m * (0.5 + Math.random());
125
- const ne = (Math.random() * 2 - 1) * Ae, re = (0.25 + Math.random() * 0.5) * Math.PI, oe = Math.random() < 0.5 ? 0.1 : -0.1, ae = Math.random() * 10, le = Math.min(0.11, 0.05 + Math.random() * 0.1), I = [{ tick: 0, x: 0, y: 0 }];
126
- let [v, k, L] = [0, 0, 0];
123
+ const x = -Math.PI / 2 + (Math.random() - 0.5) * c * Math.PI / 180;
124
+ let T = h * (0.5 + Math.random());
125
+ const oe = (Math.random() * 2 - 1) * xe, re = (0.25 + Math.random() * 0.5) * Math.PI, ae = Math.random() < 0.5 ? 0.1 : -0.1, le = Math.random() * 10, de = Math.min(0.11, 0.05 + Math.random() * 0.1), L = [{ tick: 0, x: 0, y: 0 }];
126
+ let [v, O, I] = [0, 0, 0];
127
127
  do
128
- k += Math.cos(E) * T + ne, L += Math.sin(E) * T + xe, T *= l, v++, v % Se === 0 && I.push({ tick: v, x: k, y: L });
129
- while (v < Ee || L < 1);
130
- I.at(-1).tick !== v && I.push({ tick: v, x: k, y: L }), b.animate(
131
- I.map((w) => {
132
- const F = w.tick / v, de = (re + w.tick * oe) * 180 / Math.PI, ce = Math.cos(ae + w.tick * le);
128
+ O += Math.cos(x) * T + oe, I += Math.sin(x) * T + we, T *= l, v++, v % Le === 0 && L.push({ tick: v, x: O, y: I });
129
+ while (v < Ae || I < 1);
130
+ L.at(-1).tick !== v && L.push({ tick: v, x: O, y: I }), b.animate(
131
+ L.map((A) => {
132
+ const B = A.tick / v, ce = (re + A.tick * ae) * 180 / Math.PI, ue = Math.cos(le + A.tick * de);
133
133
  return {
134
- offset: F,
135
- transform: `translate(${w.x.toFixed(1)}px, ${w.y.toFixed(1)}px) rotate(${de.toFixed(0)}deg) scaleY(${ce.toFixed(2)})`,
136
- opacity: Math.min(1, (1 - F) / (1 - Ie))
134
+ offset: B,
135
+ transform: `translate(${A.x.toFixed(1)}px, ${A.y.toFixed(1)}px) rotate(${ce.toFixed(0)}deg) scaleY(${ue.toFixed(2)})`,
136
+ opacity: Math.min(1, (1 - B) / (1 - Ie))
137
137
  };
138
138
  }),
139
- { duration: v * we, fill: "both" }
139
+ { duration: v * Se, fill: "both" }
140
140
  ).onfinish = () => b.remove();
141
141
  }, d = () => {
142
- n = null;
143
- const c = window.innerWidth * U.x, m = window.innerHeight * U.y;
142
+ o = null;
143
+ const c = window.innerWidth * U.x, h = window.innerHeight * U.y;
144
144
  let l = 0;
145
- for (const f of Te)
146
- for (let C = Math.floor(be * f.share); C > 0; C--)
147
- g(f, D[l++ % D.length], c, m);
145
+ for (const f of Ee)
146
+ for (let C = Math.floor(ve * f.share); C > 0; C--)
147
+ g(f, N[l++ % N.length], c, h);
148
148
  };
149
149
  return {
150
150
  celebrate() {
151
- window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || typeof t.animate != "function" || n || (n = setTimeout(d, ve));
151
+ window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || typeof t.animate != "function" || o || (o = setTimeout(d, Te));
152
152
  },
153
- toast(c, m = "success") {
154
- h();
155
- const l = $[Object.hasOwn($, m) ? m : "success"], f = A("span", { ...Re, backgroundColor: l.fill, color: l.glyph });
153
+ toast(c, h = "success") {
154
+ u();
155
+ const l = $[Object.hasOwn($, h) ? h : "success"], f = w("span", { ...He, backgroundColor: l.fill, color: l.glyph });
156
156
  f.innerHTML = `<svg width="16" height="16" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="${l.path}"/></svg>`;
157
- const C = A("span", { minWidth: "0" });
158
- C.textContent = c, r = A("div", ke), r.setAttribute("data-moment-toast", ""), r.appendChild(f), r.appendChild(C), t.appendChild(r), u(c), o = setTimeout(h, ye);
157
+ const C = w("span", { minWidth: "0" });
158
+ C.textContent = c, n = w("div", Re), n.setAttribute("data-moment-toast", ""), n.appendChild(f), n.appendChild(C), t.appendChild(n), m(c), r = setTimeout(u, be);
159
159
  },
160
160
  destroy() {
161
- n && clearTimeout(n), n = null, h(), t.remove(), s.remove();
161
+ o && clearTimeout(o), o = null, u(), t.remove(), s.remove();
162
162
  }
163
163
  };
164
164
  }
165
- function X() {
165
+ function Q() {
166
166
  if (typeof window > "u") return "";
167
167
  const i = window.location.origin, e = i === "null" ? self.origin : i;
168
168
  return e === "null" && console.error(
169
169
  '[MomentSdk] This page has an opaque origin ("null"), so Moment Live cannot message it and calendar sync will not work. Serve the page over http(s), and give a sandboxed iframe allow-same-origin.'
170
170
  ), e;
171
171
  }
172
- function Be(i, e, t = X(), s) {
172
+ function Pe(i, e, t = Q(), s) {
173
173
  if (e.triggerType === "schedule") {
174
- const o = new URLSearchParams();
175
- return o.set("teamSlug", e.teamSlug), o.set("returnOrigin", t), o.set("embed", "1"), o.set("sdkVersion", "0.9.0-dev.52"), s && (o.set("entry", "link"), s.campaignId && o.set("campaignId", s.campaignId)), `${i}/en/embed/schedule?${o.toString()}`;
174
+ const r = new URLSearchParams();
175
+ return r.set("teamSlug", e.teamSlug), r.set("returnOrigin", t), r.set("embed", "1"), r.set("sdkVersion", "0.9.0-dev.53"), s && (r.set("entry", "link"), s.campaignId && r.set("campaignId", s.campaignId)), `${i}/en/embed/schedule?${r.toString()}`;
176
176
  }
177
- const r = new URLSearchParams();
178
- return r.set("teamSlug", e.teamSlug), e.momentSlug && r.set("momentSlug", e.momentSlug), e.listSlug && r.set("listSlug", e.listSlug), r.set("triggerType", e.triggerType), e.ids?.length && r.set("ids", e.ids.join(",")), e.playlistSlugs?.length && r.set("playlistSlugs", e.playlistSlugs.join(",")), e.calendar && r.set("calendar", e.calendar), e.apiSourceId && r.set("subscriptionId", e.apiSourceId), e.externalEventId && r.set("externalId", e.externalEventId), e.externalEventIdPrefix && !e.externalEventId && r.set("externalIdPrefix", e.externalEventIdPrefix), r.set("returnOrigin", t), r.set("embed", "1"), r.set("sdkVersion", "0.9.0-dev.52"), s && (r.set("entry", "link"), s.campaignId && r.set("campaignId", s.campaignId)), `${i}/en/embed/sync?${r.toString()}`;
177
+ const n = new URLSearchParams();
178
+ return n.set("teamSlug", e.teamSlug), e.momentSlug && n.set("momentSlug", e.momentSlug), e.listSlug && n.set("listSlug", e.listSlug), n.set("triggerType", e.triggerType), e.ids?.length && n.set("ids", e.ids.join(",")), e.playlistSlugs?.length && n.set("playlistSlugs", e.playlistSlugs.join(",")), e.calendar && n.set("calendar", e.calendar), e.apiSourceId && n.set("subscriptionId", e.apiSourceId), e.externalEventId && n.set("externalId", e.externalEventId), e.externalEventIdPrefix && !e.externalEventId && n.set("externalIdPrefix", e.externalEventIdPrefix), n.set("returnOrigin", t), n.set("embed", "1"), n.set("sdkVersion", "0.9.0-dev.53"), s && (n.set("entry", "link"), s.campaignId && n.set("campaignId", s.campaignId)), `${i}/en/embed/sync?${n.toString()}`;
179
179
  }
180
- const W = 500, j = 700, Pe = 500;
180
+ const W = 500, j = 700, De = 500;
181
181
  class Ne {
182
182
  popup = null;
183
183
  pollTimer = null;
@@ -192,19 +192,19 @@ class Ne {
192
192
  */
193
193
  open(e) {
194
194
  this.cleanup(), this.resultReceived = !1;
195
- const t = this.buildPopupUrl(e), s = Math.round(window.screenX + (window.outerWidth - W) / 2), r = Math.round(window.screenY + (window.outerHeight - j) / 2);
195
+ const t = this.buildPopupUrl(e), s = Math.round(window.screenX + (window.outerWidth - W) / 2), n = Math.round(window.screenY + (window.outerHeight - j) / 2);
196
196
  if (this.popup = window.open(
197
197
  t,
198
198
  "moment-oauth-popup",
199
- `width=${W},height=${j},left=${s},top=${r},menubar=no,toolbar=no,location=yes,status=no`
199
+ `width=${W},height=${j},left=${s},top=${n},menubar=no,toolbar=no,location=yes,status=no`
200
200
  ), !this.popup || this.popup.closed) {
201
201
  this.sendStatusToIframe("popup-blocked"), this.opts.onPopupBlocked();
202
202
  return;
203
203
  }
204
- this.sendStatusToIframe("popup-opened"), this.startPolling(), this.messageHandler = (o) => {
205
- if (o.origin !== this.opts.liveOrigin || o.source !== this.popup) return;
206
- const n = o.data;
207
- !n || typeof n != "object" || n.source !== "moment-live-embed" || n.type !== "moment.embed.result" || (this.resultReceived = !0, this.sendStatusToIframe("completed"), this.opts.iframeWindow && this.opts.iframeWindow.postMessage(n, this.opts.liveOrigin), e.intent !== "connect" && this.opts.onResult(n), this.cleanup());
204
+ this.sendStatusToIframe("popup-opened"), this.startPolling(), this.messageHandler = (r) => {
205
+ if (r.origin !== this.opts.liveOrigin || r.source !== this.popup) return;
206
+ const o = r.data;
207
+ !o || typeof o != "object" || o.source !== "moment-live-embed" || o.type !== "moment.embed.result" || (this.resultReceived = !0, this.sendStatusToIframe("completed"), this.opts.iframeWindow && this.opts.iframeWindow.postMessage(o, this.opts.liveOrigin), e.intent !== "connect" && this.opts.onResult(o), this.cleanup());
208
208
  }, window.addEventListener("message", this.messageHandler);
209
209
  }
210
210
  /**
@@ -219,13 +219,13 @@ class Ne {
219
219
  this.popup = null;
220
220
  }
221
221
  buildPopupUrl(e) {
222
- const t = De(e, X());
222
+ const t = Ue(e, Q());
223
223
  return this.opts.campaignId && t.set("campaignId", this.opts.campaignId), `${this.opts.liveBaseUrl}/en/embed/oauth-popup?${t.toString()}`;
224
224
  }
225
225
  startPolling() {
226
226
  this.pollTimer = setInterval(() => {
227
227
  (!this.popup || this.popup.closed) && (this.pollTimer && (clearInterval(this.pollTimer), this.pollTimer = null), this.resultReceived || (this.sendStatusToIframe("popup-closed"), this.opts.onPopupClosed()), this.cleanup());
228
- }, Pe);
228
+ }, De);
229
229
  }
230
230
  sendStatusToIframe(e) {
231
231
  if (!this.opts.iframeWindow) return;
@@ -237,7 +237,7 @@ class Ne {
237
237
  this.opts.iframeWindow.postMessage(t, this.opts.liveOrigin);
238
238
  }
239
239
  }
240
- function De(i, e) {
240
+ function Ue(i, e) {
241
241
  const t = new URLSearchParams({
242
242
  provider: i.provider,
243
243
  teamSlug: i.teamSlug,
@@ -251,11 +251,11 @@ function De(i, e) {
251
251
  schedulePlaylistIds: i.schedulePlaylistIds,
252
252
  scheduleListIds: i.scheduleListIds
253
253
  };
254
- for (const [r, o] of Object.entries(s))
255
- o?.length && t.set(r, o.join(","));
254
+ for (const [n, r] of Object.entries(s))
255
+ r?.length && t.set(n, r.join(","));
256
256
  return i.addons?.length && t.set("addons", i.addons.join(",")), i.intent === "connect" && t.set("intent", "connect"), t;
257
257
  }
258
- const G = "moment-sdk-styles", Q = "moment-sdk-close", H = "moment-sdk-tray", M = "moment-sdk-closing", Ue = `
258
+ const G = "moment-sdk-styles", J = "moment-sdk-close", H = "moment-sdk-tray", k = "moment-sdk-closing", $e = `
259
259
  :where(.moment-sync-trigger) {
260
260
  background-color: #1c1917;
261
261
  color: #ffffff;
@@ -280,7 +280,7 @@ const G = "moment-sdk-styles", Q = "moment-sdk-close", H = "moment-sdk-tray", M
280
280
  outline-offset: 2px;
281
281
  }
282
282
 
283
- .${Q}:focus-visible {
283
+ .${J}:focus-visible {
284
284
  outline: 2px solid #ffffff;
285
285
  outline-offset: 0;
286
286
  box-shadow: 0 0 0 4px #121316;
@@ -311,48 +311,48 @@ const G = "moment-sdk-styles", Q = "moment-sdk-close", H = "moment-sdk-tray", M
311
311
  animation: moment-sdk-tray-in 0.35s cubic-bezier(0.32, 0.72, 0, 1);
312
312
  }
313
313
 
314
- .${M} {
314
+ .${k} {
315
315
  animation: moment-sdk-dim-out 0.25s ease-in forwards;
316
316
  }
317
317
 
318
- .${M} > * {
318
+ .${k} > * {
319
319
  animation: moment-sdk-fade-out 0.25s ease-in forwards;
320
320
  }
321
321
 
322
- .${M} .${H} {
322
+ .${k} .${H} {
323
323
  animation: moment-sdk-tray-out 0.25s cubic-bezier(0.32, 0.72, 0, 1) forwards;
324
324
  }
325
325
  }
326
326
  `;
327
- function $e() {
327
+ function We() {
328
328
  if (typeof document > "u" || document.getElementById(G)) return;
329
329
  const i = document.createElement("style");
330
- i.id = G, i.textContent = Ue, document.head.appendChild(i);
330
+ i.id = G, i.textContent = $e, document.head.appendChild(i);
331
331
  }
332
- function We(i) {
332
+ function je(i) {
333
333
  return typeof i == "string" && i.startsWith("webcal://");
334
334
  }
335
- function je(i) {
335
+ function Ge(i) {
336
336
  return !i || i.closed ? "blocked" : "opened";
337
337
  }
338
- const Ge = 1024, R = 600, Ke = 400, ze = 40, K = 80, z = 90, Ye = 420, Ve = 520, Y = 48, J = "#0d0d0d", _ = "#121316", Ze = {
339
- backgroundColor: J,
338
+ const Ke = 1024, R = 600, Ye = 400, ze = 40, K = 80, Y = 90, Ve = 420, Ze = 520, z = 48, ee = "#0d0d0d", M = "#121316", qe = {
339
+ backgroundColor: ee,
340
340
  boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
341
341
  backdropFilter: "none",
342
342
  webkitBackdropFilter: "none"
343
- }, ee = "inset 0 0.5px 0.75px rgb(255 255 255 / 0.6)", qe = "inset 0 -0.5px 0.75px rgb(255 255 255 / 0.3)", te = [
343
+ }, te = "inset 0 0.5px 0.75px rgb(255 255 255 / 0.6)", Xe = "inset 0 -0.5px 0.75px rgb(255 255 255 / 0.3)", ie = [
344
344
  "0 0 0 0.5px #9c9c9c",
345
345
  "0 4px 8px 0 #0000001f",
346
346
  "0 12px 32px 0 #00000047"
347
- ], ie = {
347
+ ], se = {
348
348
  backgroundColor: "rgb(19 19 19 / 0.812)",
349
349
  backdropFilter: "blur(14px)",
350
350
  webkitBackdropFilter: "blur(14px)",
351
- boxShadow: [ee, qe, ...te].join(", ")
352
- }, Xe = {
353
- ...ie,
354
- boxShadow: [ee, ...te].join(", ")
355
- }, S = 32, V = "height 0.25s cubic-bezier(0.32, 0.72, 0, 1)", Qe = 2e3, Je = 500, et = 400, O = 12, tt = "2147483647", it = 'button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])', se = "#38393B", st = "#4B4B4E", nt = {
351
+ boxShadow: [te, Xe, ...ie].join(", ")
352
+ }, Qe = {
353
+ ...se,
354
+ boxShadow: [te, ...ie].join(", ")
355
+ }, S = 32, V = "height 0.25s cubic-bezier(0.32, 0.72, 0, 1)", Je = 2e3, et = 500, tt = 400, _ = 12, it = "2147483647", st = 'button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])', ne = "#38393B", nt = "#4B4B4E", ot = {
356
356
  position: "absolute",
357
357
  top: "16px",
358
358
  right: "16px",
@@ -362,23 +362,23 @@ const Ge = 1024, R = 600, Ke = 400, ze = 40, K = 80, z = 90, Ye = 420, Ve = 520,
362
362
  padding: "0",
363
363
  border: "none",
364
364
  borderRadius: "50%",
365
- backgroundColor: se,
365
+ backgroundColor: ne,
366
366
  color: "#F5F5F5",
367
367
  cursor: "pointer",
368
368
  display: "flex",
369
369
  alignItems: "center",
370
370
  justifyContent: "center"
371
371
  };
372
- function rt(i, e, t = O, s = "v1", r = 0, o = _) {
373
- const n = s === "v2", a = i < Ge, u = {
374
- showFooter: !n,
375
- material: n ? "glass" : "solid",
376
- wrapperMaterial: n ? a ? Xe : ie : Ze,
377
- card: { backgroundColor: n ? "transparent" : o },
378
- iframe: n ? { background: "transparent", colorScheme: "dark" } : { background: "", colorScheme: "" }
379
- }, g = n ? "rgba(0, 0, 0, 0.4)" : "rgba(0, 0, 0, 0.5)", d = n ? O : t, c = `${d}px ${d}px 0px 0px`;
372
+ function rt(i, e, t = _, s = "v1", n = 0, r = M) {
373
+ const o = s === "v2", a = i < Ke, m = {
374
+ showFooter: !o,
375
+ material: o ? "glass" : "solid",
376
+ wrapperMaterial: o ? a ? Qe : se : qe,
377
+ card: { backgroundColor: o ? "transparent" : r },
378
+ iframe: o ? { background: "transparent", colorScheme: "dark" } : { background: "", colorScheme: "" }
379
+ }, g = o ? "rgba(0, 0, 0, 0.4)" : "rgba(0, 0, 0, 0.5)", d = o ? _ : t, c = `${d}px ${d}px 0px 0px`;
380
380
  if (a) {
381
- const l = n ? e - Y - r : Math.floor(e * z / 100) - S;
381
+ const l = o ? e - z - n : Math.floor(e * Y / 100) - S;
382
382
  return {
383
383
  isTray: !0,
384
384
  // No blur: iPhone Safari tints its status bar and toolbar from the page, and over a blurred
@@ -400,27 +400,27 @@ function rt(i, e, t = O, s = "v1", r = 0, o = _) {
400
400
  container: {
401
401
  // ponytail: no vh fallback for browsers without dvh (Safari < 15.4); the iframe cap still
402
402
  // holds there.
403
- maxHeight: n ? `calc(100dvh - ${Y}px - env(safe-area-inset-bottom, 0px))` : `calc(${z}dvh - ${S}px)`,
403
+ maxHeight: o ? `calc(100dvh - ${z}px - env(safe-area-inset-bottom, 0px))` : `calc(${Y}dvh - ${S}px)`,
404
404
  borderRadius: c
405
405
  },
406
406
  iframeMaxHeight: l,
407
- iframeOpeningHeight: Math.min(Ye, l),
408
- ...u
407
+ iframeOpeningHeight: Math.min(Ve, l),
408
+ ...m
409
409
  };
410
410
  }
411
- const m = e - K;
411
+ const h = e - K;
412
412
  return {
413
413
  isTray: !1,
414
414
  overlay: {
415
415
  alignItems: "center",
416
416
  padding: "16px",
417
417
  // Roman (Q1): under v2 the page behind stays sharp; only the dim layer covers it.
418
- backdropFilter: n ? "none" : "blur(2px)",
418
+ backdropFilter: o ? "none" : "blur(2px)",
419
419
  backgroundColor: g
420
420
  },
421
421
  wrapper: {
422
422
  maxWidth: `${R}px`,
423
- minWidth: `${Ke}px`,
423
+ minWidth: `${Ye}px`,
424
424
  borderRadius: `${d}px`,
425
425
  paddingBottom: "0"
426
426
  },
@@ -428,27 +428,28 @@ function rt(i, e, t = O, s = "v1", r = 0, o = _) {
428
428
  maxHeight: `calc(100vh - ${K}px)`,
429
429
  borderRadius: c
430
430
  },
431
- iframeMaxHeight: m,
432
- iframeOpeningHeight: Math.min(Ve, m),
433
- ...u
431
+ iframeMaxHeight: h,
432
+ iframeOpeningHeight: Math.min(Ze, h),
433
+ ...m
434
434
  };
435
435
  }
436
436
  function Z(i, e) {
437
437
  return Math.min(i, e);
438
438
  }
439
- function ot(i) {
439
+ function at(i) {
440
440
  return i.triggerType !== "schedule" && i.keepOpen !== !0;
441
441
  }
442
- const at = 32;
443
- function lt(i) {
442
+ const lt = 32;
443
+ function dt(i) {
444
444
  const e = {
445
445
  hideCloseButton: i.closeControl === "embed",
446
- dismissByEmbed: i.dismiss === "embed"
446
+ dismissByEmbed: i.dismiss === "embed",
447
+ backByEmbed: i.back === "embed"
447
448
  };
448
- return typeof i.borderRadius == "number" && Number.isFinite(i.borderRadius) && (e.cardRadius = Math.max(0, Math.min(i.borderRadius, at))), typeof i.surface == "string" && i.surface !== "" && (e.surface = i.surface), (i.design === "v1" || i.design === "v2") && (e.design = i.design), e;
449
+ return typeof i.borderRadius == "number" && Number.isFinite(i.borderRadius) && (e.cardRadius = Math.max(0, Math.min(i.borderRadius, lt))), typeof i.surface == "string" && i.surface !== "" && (e.surface = i.surface), (i.design === "v1" || i.design === "v2") && (e.design = i.design), e;
449
450
  }
450
- const dt = ".moment-sync-trigger", ct = 6, q = 60, ut = "rgba(255, 255, 255, 0.216)", mt = "https://live.dev.momentco.ai";
451
- class ht {
451
+ const ct = ".moment-sync-trigger", q = "momentSdkSheet", ut = 6, X = 60, mt = "rgba(255, 255, 255, 0.216)", ht = "https://live.dev.momentco.ai";
452
+ class pt {
452
453
  opts;
453
454
  liveBaseUrl;
454
455
  liveOrigin;
@@ -478,13 +479,21 @@ class ht {
478
479
  /** A dismissal posted to the embed and not yet acknowledged: it closes the sheet when it fires. */
479
480
  dismissAckTimer = null;
480
481
  // The card radius the frame is laid out with: the default until a theme hint sends the brand's.
481
- cardRadius = O;
482
+ cardRadius = _;
482
483
  /** The frame the embed last asked for: `v2` (glass) or `v1` (the 0.8.0 look). */
483
484
  design = "v1";
484
485
  /** The card colour the embed last sent, kept through a v2 sheet so v1 gets it back. */
485
- surface = _;
486
+ surface = M;
486
487
  /** The embed sent `dismiss: 'embed'` this open; it counts only while the frame is v2. */
487
488
  dismissByEmbed = !1;
489
+ /** The embed sent `back: 'embed'` this open; it counts only while the frame is v2. */
490
+ backByEmbed = !1;
491
+ /** This open's mark on the history entries it holds for the phone's back; null until it holds one. */
492
+ historyToken = null;
493
+ /** The level of the sheet's entry the page is on: 0 is the sheet's own, -1 the page's. */
494
+ historyLevel = -1;
495
+ /** The page started navigating away; giving the history entries back now would cancel that. */
496
+ pageUnloading = !1;
488
497
  /** The height the embed last asked for, so a re-cap after a resize can grow back to it. */
489
498
  lastRequestedHeight = null;
490
499
  footer = null;
@@ -496,15 +505,15 @@ class ht {
496
505
  closeReported = !1;
497
506
  constructor(e) {
498
507
  this.opts = {
499
- triggerSelector: dt,
508
+ triggerSelector: ct,
500
509
  ...e
501
- }, this.liveBaseUrl = mt;
510
+ }, this.liveBaseUrl = ht;
502
511
  try {
503
512
  this.liveOrigin = new URL(this.liveBaseUrl).origin;
504
513
  } catch {
505
514
  throw new Error(`[MomentSdk] Invalid VITE_LIVE_BASE_URL: "${this.liveBaseUrl}"`);
506
515
  }
507
- $e(), this.bindTriggers(), this.emitAnalytics("embed.init"), this.opts.autoOpen && this.autoOpenFromUrl(this.opts.autoOpen.teamSlug);
516
+ We(), this.bindTriggers(), this.emitAnalytics("embed.init"), this.opts.autoOpen && this.autoOpenFromUrl(this.opts.autoOpen.teamSlug);
508
517
  }
509
518
  /**
510
519
  * Programmatically open the sync modal.
@@ -549,19 +558,19 @@ class ht {
549
558
  * params from the address bar so a reload doesn't reopen it.
550
559
  */
551
560
  autoOpenFromUrl(e) {
552
- if (!pe()) return;
553
- const t = he(window.location.href, e);
554
- t && fe(document, () => {
561
+ if (!fe()) return;
562
+ const t = pe(window.location.href, e);
563
+ t && ge(document, () => {
555
564
  this.openWith(t.payload, t), history.replaceState(history.state, "", t.cleanUrl);
556
565
  });
557
566
  }
558
567
  // ── Private: trigger binding ──────────────────────────────────────
559
568
  bindTriggers() {
560
569
  document.querySelectorAll(this.opts.triggerSelector).forEach((t) => {
561
- const s = (o) => {
562
- o.preventDefault(), this.handleTriggerClick(t);
563
- }, r = this.boundClickHandlers.get(t);
564
- r && t.removeEventListener("click", r), t.addEventListener("click", s), this.boundClickHandlers.set(t, s);
570
+ const s = (r) => {
571
+ r.preventDefault(), this.handleTriggerClick(t);
572
+ }, n = this.boundClickHandlers.get(t);
573
+ n && t.removeEventListener("click", n), t.addEventListener("click", s), this.boundClickHandlers.set(t, s);
565
574
  });
566
575
  }
567
576
  unbindTriggers() {
@@ -570,36 +579,36 @@ class ht {
570
579
  }), this.boundClickHandlers.clear();
571
580
  }
572
581
  handleTriggerClick(e) {
573
- const t = e.getAttribute("data-moment-team-slug") ?? "", s = e.getAttribute("data-moment-slug") ?? void 0, r = e.getAttribute("data-moment-list-slug") ?? void 0, o = e.getAttribute("data-moment-trigger-type");
574
- let n = "moment";
575
- o != null && o !== "" && (o === "moment" || o === "list" || o === "team" || o === "brand-playlist" || o === "playlist" || o === "schedule" ? n = o : console.warn(
582
+ const t = e.getAttribute("data-moment-team-slug") ?? "", s = e.getAttribute("data-moment-slug") ?? void 0, n = e.getAttribute("data-moment-list-slug") ?? void 0, r = e.getAttribute("data-moment-trigger-type");
583
+ let o = "moment";
584
+ r != null && r !== "" && (r === "moment" || r === "list" || r === "team" || r === "brand-playlist" || r === "playlist" || r === "schedule" ? o = r : console.warn(
576
585
  "[MomentSdk] Invalid data-moment-trigger-type, falling back to 'moment':",
577
- o
586
+ r
578
587
  ));
579
- const a = e.getAttribute("data-moment-ids") ?? e.getAttribute("data-moment-game-id") ?? "", h = a ? a.split(",").filter(Boolean) : [], u = e.getAttribute("data-moment-playlist-slugs") ?? "", g = u ? u.split(",").map((x) => x.trim()).filter(Boolean) : [], d = e.getAttribute("data-moment-calendar");
588
+ const a = e.getAttribute("data-moment-ids") ?? e.getAttribute("data-moment-game-id") ?? "", u = a ? a.split(",").filter(Boolean) : [], m = e.getAttribute("data-moment-playlist-slugs") ?? "", g = m ? m.split(",").map((E) => E.trim()).filter(Boolean) : [], d = e.getAttribute("data-moment-calendar");
580
589
  let c;
581
590
  d != null && d !== "" && (d === "google" || d === "outlook" ? c = d : console.warn("[MomentSdk] Invalid data-moment-calendar, ignoring value:", d));
582
- const m = e.getAttribute("data-api-source-id") ?? void 0, l = e.getAttribute("data-external-event-id") ?? void 0, f = e.getAttribute("data-external-event-id-prefix") ?? void 0;
591
+ const h = e.getAttribute("data-api-source-id") ?? void 0, l = e.getAttribute("data-external-event-id") ?? void 0, f = e.getAttribute("data-external-event-id-prefix") ?? void 0;
583
592
  if (l && f && console.warn(
584
593
  "[MomentSdk] Both data-external-event-id and data-external-event-id-prefix are set; using data-external-event-id only."
585
594
  ), !t) {
586
595
  console.warn("[MomentSdk] Missing data-moment-team-slug on trigger element");
587
596
  return;
588
597
  }
589
- const C = n === "team" || n === "brand-playlist" || n === "playlist" || n === "schedule";
598
+ const C = o === "team" || o === "brand-playlist" || o === "playlist" || o === "schedule";
590
599
  this.emitAnalytics("embed.trigger.click", {
591
600
  teamSlug: t,
592
- triggerType: n,
593
- momentIds: C ? [] : h
601
+ triggerType: o,
602
+ momentIds: C ? [] : u
594
603
  }), this.open({
595
604
  teamSlug: t,
596
605
  momentSlug: s,
597
- listSlug: r,
598
- triggerType: n,
599
- ids: h,
606
+ listSlug: n,
607
+ triggerType: o,
608
+ ids: u,
600
609
  playlistSlugs: g,
601
610
  calendar: c ?? void 0,
602
- apiSourceId: m,
611
+ apiSourceId: h,
603
612
  externalEventId: f && !l ? void 0 : l,
604
613
  externalEventIdPrefix: l ? void 0 : f
605
614
  });
@@ -627,7 +636,7 @@ class ht {
627
636
  this.overlay = document.createElement("div"), this.overlay.setAttribute("role", "presentation"), Object.assign(this.overlay.style, {
628
637
  position: "fixed",
629
638
  inset: "0",
630
- zIndex: tt,
639
+ zIndex: it,
631
640
  display: "flex",
632
641
  justifyContent: "center",
633
642
  // backgroundColor comes from the layout: 50%, or 40% for a v2 sheet.
@@ -637,12 +646,12 @@ class ht {
637
646
  }), this.overlay.addEventListener("click", (p) => {
638
647
  p.target === this.overlay && this.requestDismiss();
639
648
  });
640
- const r = (p) => {
649
+ const n = (p) => {
641
650
  p.key === "Escape" && this.requestDismiss();
642
651
  };
643
- document.addEventListener("keydown", r);
644
- const o = document.createElement("div");
645
- Object.assign(o.style, {
652
+ document.addEventListener("keydown", n), window.addEventListener("popstate", this.onPopState), window.addEventListener("beforeunload", this.onBeforeUnload);
653
+ const r = document.createElement("div");
654
+ Object.assign(r.style, {
646
655
  position: "relative",
647
656
  width: "100%",
648
657
  // Ease radius changes so a brand's configured radius (arriving via
@@ -650,20 +659,20 @@ class ht {
650
659
  // smoothly instead of snapping.
651
660
  transition: "border-radius 0.3s ease",
652
661
  overflow: "hidden",
653
- backgroundColor: J,
662
+ backgroundColor: ee,
654
663
  boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
655
664
  display: "flex",
656
665
  flexDirection: "column"
657
666
  });
658
- const n = document.createElement("div");
659
- n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-label", "Calendar sync modal"), n.tabIndex = -1, Object.assign(n.style, {
667
+ const o = document.createElement("div");
668
+ o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Calendar sync modal"), o.tabIndex = -1, Object.assign(o.style, {
660
669
  position: "relative",
661
670
  width: "100%",
662
671
  transition: "border-radius 0.3s ease",
663
672
  overflow: "auto",
664
673
  // The sheet colour Live's embeds paint, so the card never flashes white before the
665
674
  // embed's theme (and its own `surface`) arrives.
666
- backgroundColor: _,
675
+ backgroundColor: M,
667
676
  // `tabIndex = -1` above makes this a programmatic focus target for the
668
677
  // focus trap, never a Tab stop — but browsers still draw their platform
669
678
  // focus ring (blue on stock macOS/Windows) around the whole card when we
@@ -672,12 +681,12 @@ class ht {
672
681
  outline: "none"
673
682
  });
674
683
  const a = document.createElement("button");
675
- a.type = "button", a.className = Q, a.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.75 5.25 5.25 18.75M5.25 5.25l13.5 13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>', a.setAttribute("aria-label", "Close"), Object.assign(a.style, nt), a.addEventListener("mouseenter", () => {
676
- a.style.backgroundColor = st;
684
+ a.type = "button", a.className = J, a.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.75 5.25 5.25 18.75M5.25 5.25l13.5 13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>', a.setAttribute("aria-label", "Close"), Object.assign(a.style, ot), a.addEventListener("mouseenter", () => {
685
+ a.style.backgroundColor = nt;
677
686
  }), a.addEventListener("mouseleave", () => {
678
- a.style.backgroundColor = se;
687
+ a.style.backgroundColor = ne;
679
688
  }), a.addEventListener("click", () => this.handleCancel());
680
- const h = e.triggerType !== "schedule";
689
+ const u = e.triggerType !== "schedule";
681
690
  this.iframe = document.createElement("iframe"), this.iframe.src = s, this.iframe.setAttribute("allow", "web-share; clipboard-write"), this.iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups allow-forms"), this.iframe.setAttribute("scrolling", "no"), Object.assign(this.iframe.style, {
682
691
  width: "100%",
683
692
  border: "none",
@@ -687,13 +696,13 @@ class ht {
687
696
  // guess to the embed's real content height. Eased and a little slower so
688
697
  // that reads as the sheet settling rather than a snap.
689
698
  transition: V
690
- }), h && (n.appendChild(a), this.closeButton = a), n.appendChild(this.iframe);
691
- const u = document.createElement("div");
692
- this.footer = u, Object.assign(u.style, {
699
+ }), u && (o.appendChild(a), this.closeButton = a), o.appendChild(this.iframe);
700
+ const m = document.createElement("div");
701
+ this.footer = m, Object.assign(m.style, {
693
702
  display: "flex",
694
703
  alignItems: "center",
695
704
  justifyContent: "center",
696
- gap: `${ct}px`,
705
+ gap: `${ut}px`,
697
706
  height: `${S}px`,
698
707
  // The wrapper is a flex column, so without this the tray would be the
699
708
  // first thing squeezed when the card hits its max height.
@@ -710,45 +719,45 @@ class ht {
710
719
  color: "#ffffff"
711
720
  });
712
721
  const d = document.createElement("img");
713
- d.alt = "Moment", d.src = ge, Object.assign(d.style, {
722
+ d.alt = "Moment", d.src = Ce, Object.assign(d.style, {
714
723
  display: "block",
715
724
  // Both dimensions are explicit so the tray has no reflow to do, even if
716
725
  // the image is ever swapped for one that has to decode.
717
- width: `${q}px`,
718
- height: `${(q / Ce).toFixed(2)}px`
719
- }), u.appendChild(g), u.appendChild(d), this.wrapper = o, this.container = n, this.applyFrameLayout();
726
+ width: `${X}px`,
727
+ height: `${(X / ye).toFixed(2)}px`
728
+ }), m.appendChild(g), m.appendChild(d), this.wrapper = r, this.container = o, this.applyFrameLayout();
720
729
  const c = document.createElement("div");
721
730
  this.hairline = c, c.setAttribute("aria-hidden", "true"), Object.assign(c.style, {
722
731
  position: "absolute",
723
732
  inset: "0",
724
733
  borderRadius: "inherit",
725
- boxShadow: `inset 0 0 0 1px ${ut}`,
734
+ boxShadow: `inset 0 0 0 1px ${mt}`,
726
735
  pointerEvents: "none",
727
736
  zIndex: "2"
728
- }), o.appendChild(n), o.appendChild(u), o.appendChild(c), this.overlay.appendChild(o), this.feedback = Fe(this.overlay, o), document.body.appendChild(this.overlay), this.revealTimer = setTimeout(() => this.reveal(), Qe), this.viewportResizeHandler = () => this.applyFrameLayout(), window.addEventListener("resize", this.viewportResizeHandler);
729
- const m = () => n.querySelectorAll(it), l = (p) => {
737
+ }), r.appendChild(o), r.appendChild(m), r.appendChild(c), this.overlay.appendChild(r), this.feedback = Fe(this.overlay, r), document.body.appendChild(this.overlay), this.revealTimer = setTimeout(() => this.reveal(), Je), this.viewportResizeHandler = () => this.applyFrameLayout(), window.addEventListener("resize", this.viewportResizeHandler);
738
+ const h = () => o.querySelectorAll(st), l = (p) => {
730
739
  if (p.key !== "Tab") return;
731
- const y = m(), b = y[0], E = y[y.length - 1], T = document.activeElement;
732
- p.shiftKey && (T === b || T === n) ? (p.preventDefault(), E.focus()) : !p.shiftKey && T === E && (p.preventDefault(), b.focus());
740
+ const y = h(), b = y[0], x = y[y.length - 1], T = document.activeElement;
741
+ p.shiftKey && (T === b || T === o) ? (p.preventDefault(), x.focus()) : !p.shiftKey && T === x && (p.preventDefault(), b.focus());
733
742
  };
734
- n.addEventListener("keydown", l);
743
+ o.addEventListener("keydown", l);
735
744
  const f = (p) => {
736
745
  const y = document.createElement("span");
737
746
  return y.tabIndex = 0, Object.assign(y.style, { position: "fixed", opacity: "0" }), y.addEventListener("focus", () => {
738
- const b = m();
747
+ const b = h();
739
748
  b[p === "first" ? 0 : b.length - 1].focus();
740
749
  }), y;
741
750
  };
742
- n.before(f("last")), n.after(f("first"));
751
+ o.before(f("last")), o.after(f("first"));
743
752
  const C = document.documentElement.clientWidth;
744
753
  this.previousBodyOverflow = document.body.style.overflow, document.body.style.overflow = "hidden", this.didManageBodyOverflow = !0;
745
- const x = document.documentElement.clientWidth - C;
746
- if (x > 0) {
754
+ const E = document.documentElement.clientWidth - C;
755
+ if (E > 0) {
747
756
  this.previousBodyPaddingRight = document.body.style.paddingRight;
748
757
  const p = Number.parseFloat(getComputedStyle(document.body).paddingRight) || 0;
749
- document.body.style.paddingRight = `${p + x}px`, this.didManageBodyPadding = !0;
758
+ document.body.style.paddingRight = `${p + E}px`, this.didManageBodyPadding = !0;
750
759
  }
751
- this.setupMessageListener(), this.overlay._escHandler = r, this.overlay._focusTrapHandler = l;
760
+ this.setupMessageListener(), this.overlay._escHandler = n, this.overlay._focusTrapHandler = l;
752
761
  }
753
762
  /** Show the hidden frame, in the look the embed has asked for so far. Runs once per open. */
754
763
  reveal() {
@@ -765,12 +774,12 @@ class ht {
765
774
  Object.assign(this.overlay.style, e.overlay), Object.assign(this.wrapper.style, e.wrapperMaterial), Object.assign(this.container.style, e.container), Object.assign(this.container.style, e.card), Object.assign(this.iframe.style, e.iframe);
766
775
  const t = this.footer?.style.display !== "none";
767
776
  if (this.footer && this.revealed && t !== e.showFooter) {
768
- const o = this.iframe.offsetHeight;
769
- this.iframe.style.transition = "none", this.iframe.style.height = `${o + (t ? S : -S)}px`, this.iframe.offsetHeight, this.iframe.style.transition = V;
777
+ const r = this.iframe.offsetHeight;
778
+ this.iframe.style.transition = "none", this.iframe.style.height = `${r + (t ? S : -S)}px`, this.iframe.offsetHeight, this.iframe.style.transition = V;
770
779
  }
771
780
  this.footer && (this.footer.style.display = e.showFooter ? "flex" : "none"), this.hairline && (this.hairline.style.display = e.material === "glass" ? "none" : ""), this.wrapper.classList.toggle(H, e.isTray && this.revealed);
772
- const s = Number.parseFloat(this.iframe.style.height), r = this.lastRequestedHeight !== null ? Z(this.lastRequestedHeight, e.iframeMaxHeight) : Number.isNaN(s) ? e.iframeOpeningHeight : Math.min(s, e.iframeMaxHeight);
773
- this.iframe.style.height = `${r}px`;
781
+ const s = Number.parseFloat(this.iframe.style.height), n = this.lastRequestedHeight !== null ? Z(this.lastRequestedHeight, e.iframeMaxHeight) : Number.isNaN(s) ? e.iframeOpeningHeight : Math.min(s, e.iframeMaxHeight);
782
+ this.iframe.style.height = `${n}px`;
774
783
  }
775
784
  /**
776
785
  * The frame for the current viewport, design, radius and card colour. The bottom inset is the
@@ -788,7 +797,7 @@ class ht {
788
797
  );
789
798
  }
790
799
  buildIframeUrl(e, t) {
791
- return Be(this.liveBaseUrl, e, void 0, t);
800
+ return Pe(this.liveBaseUrl, e, void 0, t);
792
801
  }
793
802
  // ── Private: message handling ─────────────────────────────────────
794
803
  setupMessageListener() {
@@ -808,29 +817,33 @@ class ht {
808
817
  const s = typeof t.height == "number" ? t.height : 0;
809
818
  if (s > 0 && this.iframe) {
810
819
  this.lastRequestedHeight = s;
811
- const { iframeMaxHeight: r } = this.currentLayout();
812
- this.iframe.style.height = `${Z(s, r)}px`;
820
+ const { iframeMaxHeight: n } = this.currentLayout();
821
+ this.iframe.style.height = `${Z(s, n)}px`;
813
822
  }
814
823
  return;
815
824
  }
816
825
  if (t.source === "moment-live-embed" && t.type === "moment.embed.theme") {
817
- const s = lt(t);
818
- s.design && s.design !== this.design && (this.design = s.design, this.applyFrameLayout()), s.cardRadius !== void 0 && (this.cardRadius = s.cardRadius, this.applyFrameLayout()), s.hideCloseButton && this.closeButton && (document.activeElement === this.closeButton && this.container?.focus(), this.closeButton.remove()), s.surface !== void 0 && (this.surface = s.surface, this.applyFrameLayout()), s.dismissByEmbed && (this.dismissByEmbed = !0), this.reveal();
826
+ const s = dt(t);
827
+ s.design && s.design !== this.design && (this.design = s.design, this.applyFrameLayout()), s.cardRadius !== void 0 && (this.cardRadius = s.cardRadius, this.applyFrameLayout()), s.hideCloseButton && this.closeButton && (document.activeElement === this.closeButton && this.container?.focus(), this.closeButton.remove()), s.surface !== void 0 && (this.surface = s.surface, this.applyFrameLayout()), s.dismissByEmbed && (this.dismissByEmbed = !0), s.backByEmbed && (this.backByEmbed = !0), this.reveal(), this.backByEmbed && !this.historyToken && this.pushHistoryLevel();
819
828
  return;
820
829
  }
821
830
  if (t.source === "moment-live-embed" && t.type === "moment.embed.open.url") {
822
831
  const { url: s } = t;
823
- if (We(s)) {
824
- const r = je(window.open(s, "_blank"));
825
- r === "blocked" && this.emitAnalytics("open.url.blocked", {}), this.sendOpenUrlStatus(r, s);
832
+ if (je(s)) {
833
+ const n = Ge(window.open(s, "_blank"));
834
+ n === "blocked" && this.emitAnalytics("open.url.blocked", {}), this.sendOpenUrlStatus(n, s);
826
835
  } else
827
836
  this.sendOpenUrlStatus("blocked", typeof s == "string" ? s : "");
828
837
  return;
829
838
  }
830
- if (t.source === "moment-live-embed" && t.type === "moment.embed.dismiss.ack") {
839
+ if (t.source === "moment-live-embed" && (t.type === "moment.embed.dismiss.ack" || t.type === "moment.embed.back.ack")) {
831
840
  this.clearDismissAckTimer();
832
841
  return;
833
842
  }
843
+ if (t.source === "moment-live-embed" && t.type === "moment.embed.history.push") {
844
+ this.historyToken && this.pushHistoryLevel();
845
+ return;
846
+ }
834
847
  if (t.source === "moment-live-embed" && t.type === "moment.embed.close") {
835
848
  this.handleCancel();
836
849
  return;
@@ -840,8 +853,8 @@ class ht {
840
853
  return;
841
854
  }
842
855
  if (t.source === "moment-live-embed" && t.type === "moment.embed.toast") {
843
- const { text: s, variant: r } = t;
844
- typeof s == "string" && s.trim() !== "" && this.feedback?.toast(s, r);
856
+ const { text: s, variant: n } = t;
857
+ typeof s == "string" && s.trim() !== "" && this.feedback?.toast(s, n);
845
858
  return;
846
859
  }
847
860
  if (t.source === "moment-live-embed" && t.type === "moment.embed.result") {
@@ -879,13 +892,13 @@ class ht {
879
892
  sendOpenUrlStatus(e, t) {
880
893
  const s = this.iframe?.contentWindow;
881
894
  if (!s) return;
882
- const r = {
895
+ const n = {
883
896
  source: "moment-sdk",
884
897
  type: "moment.embed.open.url.status",
885
898
  status: e,
886
899
  url: t
887
900
  };
888
- s.postMessage(r, this.liveOrigin);
901
+ s.postMessage(n, this.liveOrigin);
889
902
  }
890
903
  handleResult(e) {
891
904
  e.result !== "cancelled" && (e.keepOpen === !0 && e.triggerType !== "schedule" && (this.closeReported = !0), e.result === "success" || e.result === "partial" ? (this.emitAnalytics("subscribe.success", {
@@ -896,22 +909,55 @@ class ht {
896
909
  provider: e.provider,
897
910
  triggerType: e.triggerType,
898
911
  momentIds: e.momentIds
899
- }), this.opts.onError?.(e)), this.opts.onClose?.(e), this.emitAnalytics("embed.close"), ot(e) && (this.closeTimer = setTimeout(() => this.cleanup(), 1500)));
912
+ }), this.opts.onError?.(e)), this.opts.onClose?.(e), this.emitAnalytics("embed.close"), at(e) && (this.closeTimer = setTimeout(() => this.cleanup(), 1500)));
900
913
  }
901
914
  /**
902
- * A tap outside the sheet or Escape on the page. A v2 sheet that claimed it hears it, answers
903
- * with `moment.embed.dismiss.ack` and does what its own ✕ does, closing through
904
- * `moment.embed.close`; anything else, or no answer in time, closes here.
915
+ * A tap outside the sheet or Escape on the page, or with `back` the phone's back. A v2 sheet that
916
+ * claimed it hears it (`moment.sdk.dismiss` is its ✕, `moment.sdk.back` its ‹), answers with
917
+ * the matching ack and acts, closing through `moment.embed.close`; anything else, or no answer
918
+ * in time, closes here.
905
919
  */
906
- requestDismiss() {
907
- const e = this.iframe?.contentWindow;
908
- if (!this.dismissByEmbed || this.design !== "v2" || !e) {
920
+ requestDismiss(e = !1) {
921
+ const t = this.iframe?.contentWindow;
922
+ if (!(e ? this.backByEmbed : this.dismissByEmbed) || this.design !== "v2" || !t) {
909
923
  this.handleCancel();
910
924
  return;
911
925
  }
912
- const t = { source: "moment-sdk", type: "moment.sdk.dismiss" };
913
- e.postMessage(t, this.liveOrigin), this.dismissAckTimer || (this.dismissAckTimer = setTimeout(() => this.handleCancel(), Je));
926
+ const s = {
927
+ source: "moment-sdk",
928
+ type: e ? "moment.sdk.back" : "moment.sdk.dismiss"
929
+ };
930
+ t.postMessage(s, this.liveOrigin), this.dismissAckTimer || (this.dismissAckTimer = setTimeout(() => this.handleCancel(), et));
931
+ }
932
+ /**
933
+ * The phone's back steps back inside a sheet that claimed it (Roman, 18 Nov). The sheet holds
934
+ * one history entry when it shows, and one more for each level the fan taps into, each at the
935
+ * page's own URL with the page's state copied, so a router reads it as the page it is on. Pushed
936
+ * on a tap, an entry is one the browser stops at; Chrome and Safari skip past one pushed without
937
+ * a tap, so a back never pushes one back.
938
+ */
939
+ // ponytail: a back that keeps its level (it opens Leave with Selection, or closes How it works) still uses up an entry; a third back in a row can then leave the page.
940
+ pushHistoryLevel() {
941
+ const e = this.historyToken ?? `${Date.now()}.${Math.random()}`, t = history.state !== null && typeof history.state == "object" ? history.state : {}, s = this.historyLevel + 1;
942
+ try {
943
+ history.pushState({ ...t, [q]: { token: e, level: s } }, ""), this.historyToken = e, this.historyLevel = s;
944
+ } catch {
945
+ }
946
+ }
947
+ /** The level of this open's entry the page is on now, or -1 when it is on one of the page's. */
948
+ currentHistoryLevel() {
949
+ const e = history.state?.[q];
950
+ return e?.token === this.historyToken && typeof e.level == "number" ? e.level : -1;
914
951
  }
952
+ /** The fan went back (or forward) through the history: a back is the sheet's ‹. */
953
+ onPopState = () => {
954
+ if (!this.historyToken) return;
955
+ const e = this.currentHistoryLevel(), t = e < this.historyLevel;
956
+ this.historyLevel = e, t && this.requestDismiss(!0);
957
+ };
958
+ onBeforeUnload = () => {
959
+ this.pageUnloading = !0;
960
+ };
915
961
  clearDismissAckTimer() {
916
962
  this.dismissAckTimer && clearTimeout(this.dismissAckTimer), this.dismissAckTimer = null;
917
963
  }
@@ -936,18 +982,20 @@ class ht {
936
982
  */
937
983
  cleanup(e = !1) {
938
984
  const t = e && this.design === "v2" && this.revealed && !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
939
- if (this.closeTimer && (clearTimeout(this.closeTimer), this.closeTimer = null), this.revealTimer && (clearTimeout(this.revealTimer), this.revealTimer = null), this.clearDismissAckTimer(), this.revealed = !1, this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.messageHandler && (window.removeEventListener("message", this.messageHandler), this.messageHandler = null), this.feedback?.destroy(), this.feedback = null, this.closeReported = !1, this.design = "v1", this.surface = _, this.dismissByEmbed = !1, this.lastRequestedHeight = null, this.footer = null, this.hairline = null, this.viewportResizeHandler && (window.removeEventListener("resize", this.viewportResizeHandler), this.viewportResizeHandler = null), this.overlay) {
940
- const { _escHandler: s, _focusTrapHandler: r } = this.overlay;
941
- s && document.removeEventListener("keydown", s);
985
+ this.closeTimer && (clearTimeout(this.closeTimer), this.closeTimer = null), this.revealTimer && (clearTimeout(this.revealTimer), this.revealTimer = null), this.clearDismissAckTimer(), this.revealed = !1, this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.messageHandler && (window.removeEventListener("message", this.messageHandler), this.messageHandler = null), this.feedback?.destroy(), this.feedback = null, this.closeReported = !1, window.removeEventListener("popstate", this.onPopState), window.removeEventListener("beforeunload", this.onBeforeUnload);
986
+ const s = this.historyToken ? this.currentHistoryLevel() : -1;
987
+ if (s >= 0 && !this.pageUnloading && history.go(-(s + 1)), this.historyToken = null, this.historyLevel = -1, this.pageUnloading = !1, this.design = "v1", this.surface = M, this.dismissByEmbed = !1, this.backByEmbed = !1, this.lastRequestedHeight = null, this.footer = null, this.hairline = null, this.viewportResizeHandler && (window.removeEventListener("resize", this.viewportResizeHandler), this.viewportResizeHandler = null), this.overlay) {
988
+ const { _escHandler: n, _focusTrapHandler: r } = this.overlay;
989
+ n && document.removeEventListener("keydown", n);
942
990
  const o = this.overlay.firstElementChild;
943
991
  if (o && r && o.removeEventListener("keydown", r), t) {
944
- const n = this.overlay;
945
- n.style.pointerEvents = "none", n.style.width = `${document.documentElement.clientWidth}px`, n.classList.add(M);
946
- const a = setTimeout(() => n.remove(), et);
947
- n.addEventListener(
992
+ const a = this.overlay;
993
+ a.style.pointerEvents = "none", a.style.width = `${document.documentElement.clientWidth}px`, a.classList.add(k);
994
+ const u = setTimeout(() => a.remove(), tt);
995
+ a.addEventListener(
948
996
  "animationend",
949
997
  () => {
950
- clearTimeout(a), n.remove();
998
+ clearTimeout(u), a.remove();
951
999
  },
952
1000
  { once: !0 }
953
1001
  );
@@ -955,7 +1003,7 @@ class ht {
955
1003
  this.overlay.remove();
956
1004
  this.overlay = null;
957
1005
  }
958
- this.iframe = null, this.wrapper = null, this.container = null, this.closeButton = null, this.activePayload = null, this.activeCampaignId = void 0, this.cardRadius = O, this.didManageBodyOverflow && (document.body.style.overflow = this.previousBodyOverflow, this.didManageBodyOverflow = !1), this.didManageBodyPadding && (document.body.style.paddingRight = this.previousBodyPaddingRight, this.didManageBodyPadding = !1), this.previousFocusedElement && typeof this.previousFocusedElement.focus == "function" && this.previousFocusedElement.focus(), this.previousFocusedElement = null;
1006
+ this.iframe = null, this.wrapper = null, this.container = null, this.closeButton = null, this.activePayload = null, this.activeCampaignId = void 0, this.cardRadius = _, this.didManageBodyOverflow && (document.body.style.overflow = this.previousBodyOverflow, this.didManageBodyOverflow = !1), this.didManageBodyPadding && (document.body.style.paddingRight = this.previousBodyPaddingRight, this.didManageBodyPadding = !1), this.previousFocusedElement && typeof this.previousFocusedElement.focus == "function" && this.previousFocusedElement.focus(), this.previousFocusedElement = null;
959
1007
  }
960
1008
  // ── Private: analytics ────────────────────────────────────────────
961
1009
  emitAnalytics(e, t) {
@@ -966,7 +1014,7 @@ class ht {
966
1014
  });
967
1015
  }
968
1016
  }
969
- function pt(i) {
1017
+ function ft(i) {
970
1018
  const e = document.createElement("button");
971
1019
  return e.type = "button", e.classList.add("moment-sync-trigger"), i.className && i.className.split(" ").forEach((t) => {
972
1020
  t && e.classList.add(t);
@@ -974,9 +1022,9 @@ function pt(i) {
974
1022
  }
975
1023
  if (typeof window < "u") {
976
1024
  const i = window;
977
- i.MomentSdk = ht, i.createMomentButton = pt;
1025
+ i.MomentSdk = pt, i.createMomentButton = ft;
978
1026
  }
979
1027
  export {
980
- ht as MomentSdk,
981
- pt as createMomentButton
1028
+ pt as MomentSdk,
1029
+ ft as createMomentButton
982
1030
  };