{
  "version": 3,
  "sources": ["/cdn/shop/t/48/assets/sat-board-wave-patch.js?x=11"],
  "sourcesContent": ["/*\n * Replaces SATComponent.prototype.startBoardWave outright \u2014 the bug this\n * fixes is in the orchestration itself, so there's nothing left to preserve\n * by wrapping it (same call as assets/sat-popup-dedupe-patch.js).\n *\n * The base version advanced all 6 Departures rows through 5 steps, each step\n * staggered 200ms row-to-row (n*200 = 1200ms for the cascade to reach the\n * last row) \u2014 that part reads fine as a top-to-bottom sweep. The problem was\n * everything AFTER the cascade landed: it then held completely still for a\n * separate, much longer wait (n*200+2400 = 3600ms total per step) before the\n * next cascade began, and once every lap (after step 5) it did a special\n * SHORTER pass instead \u2014 an instant, invisible snap back to step 0 (step 5\n * and step 0 show the same city, since the stack's last entry repeats its\n * first \u2014 see the flipTransform math in sat-app.js) followed by its own\n * separate, shorter wait (n*200+300 = 1500ms). Three different rhythms\n * sharing one loop \u2014 a long hold, a short hold, a long hold, a short hold \u2014\n * is what actually read as \"clunky\" and \"held up on the last row or two\":\n * the reset lap is a full 2100ms shorter than every other lap, a real\n * hitch in what should be one steady pulse.\n *\n * Fixed by folding the reset into the END of step 5's own hold instead of\n * giving it a separate timed beat: the snap back to 0 happens instantly,\n * with no wait of its own, right before the loop's next lap starts step 1's\n * cascade. Every one of the 5 real, visible holds is now exactly the same\n * length \u2014 a single steady rhythm.\n *\n * Also swaps the per-row flip's easing from a bouncy overshoot\n * (cubic-bezier(.3,1.4,.6,1), where the 1.4 makes each flap spring past its\n * resting point and settle back) for a plain smooth ease \u2014 \"clunky\" was a\n * literal description of that overshoot, not just the timing gaps above.\n *\n * ---- The live 7th row rides this SAME loop now, not one of its own ----\n * assets/sat-live-orders-patch.js used to run the live row (real customer\n * orders, appended below the 6 fixed rows) on its own independent\n * setTimeout loop, sized to match this one's cadence as closely as\n * possible. Two loops that only *approximate* the same cadence drift out\n * of phase from each other \u2014 different start times, and every stall either\n * one hits (a throttled tab, a slow tick, anything) shifts it independently\n * of the other. That's exactly what read as \"not synced, some rows too\n * early, others too late\": it wasn't one wave, it was two waves that\n * happened to move at close to the same speed.\n *\n * Fixed by making this the single authoritative clock for every row, fixed\n * and live alike: each lap, the live row (when there are any live orders)\n * is scheduled as row index 6 in the exact same stagger sequence as rows\n * 0-5 \u2014 one more setTimeout at 6*ROW_STAGGER, same as if it were just\n * another fixed row \u2014 and reads its own step from window.SATLiveBoardBridge\n * (assets/sat-live-orders-patch.js), which owns the live-order data this\n * file has no business knowing about. The live row's own stack can be\n * shorter than the fixed rows' (1-5 real orders vs. always 5 cities), so\n * its displayed step wraps modulo its own count instead of reusing the\n * fixed rows' step number directly \u2014 but it advances, holds, and resets on\n * the identical tick as everything above it, because there is only one\n * loop now, not two loops keeping time separately.\n *\n * ---- Why the 7th row still sat frozen after all of the above ----\n * componentDidMount calls `this.startBoardWave()` exactly once, and that\n * one call is where the bug actually lived. Every other patch in this\n * theme wraps renderVals, which the runtime looks up fresh from the\n * prototype on every single render \u2014 so it never matters exactly when\n * such a patch's script finishes loading relative to first paint, the very\n * next render just picks up whatever's current. startBoardWave is\n * different: it's a long-running loop invoked ONE TIME, and once that one\n * call has started, it's already bound to whichever function body was on\n * the prototype AT THAT INSTANT \u2014 reassigning the prototype afterward (as\n * this file's own replacement above does) has no effect on a loop that's\n * already running, the same way replacing a recipe on the wall doesn't\n * change a dish that's already in the oven. Confirmed live: the board's\n * own timing consistently measured out to the ORIGINAL base version's\n * 3600ms-per-step cadence, not this file's 3280-3500ms one, even with\n * every fix above correctly deployed and correctly installed on the\n * prototype \u2014 componentDidMount's one call had already locked onto the\n * pre-patch function before this script's replacement ever took effect,\n * and nothing after that point could reach it. The live row never had a\n * chance: SATLiveBoardBridge doesn't exist at all in the version that\n * ended up running.\n *\n * ---- Why forcing a restart made it WORSE, not better ----\n * The first fix for the above forced a takeover by setting\n * this._boardRunning = false (the flag the base setRowStep(i,val,noTrans)\n * guards on: `if(!this._boardRunning || ...) return;`) and then, 50ms\n * later, calling startBoardWave() again, which immediately sets that same\n * flag back to true. That's a brief PULSE, not a kill: the pre-patch\n * loop's own outer while only rechecks the flag once per full lap (up to\n * ~17.5s), so a 50ms dip does nothing to a loop that's mid-lap \u2014 and once\n * the flag flips back to true, every setRowStep call the OLD loop's own\n * still-pending timers make from then on passes the guard and succeeds\n * again, completely unaffected. The result was two independent loops\n * (the stale pre-patch one and this file's new one) both alive at once,\n * both calling setRowStep on the exact same shared state on two different\n * schedules \u2014 which reads as rows going out of sync with each other, and\n * a scroll-triggered render landing mid-collision could catch the 7th row\n * (or any row) on either loop's half-applied value, looking \"stuck.\"\n *\n * Fixed properly below: this._boardRunning is set false ONCE, at the top\n * of every call to this function, and NEVER set back to true again by\n * anything in this file \u2014 so any stale loop gating on that flag (whether\n * it's the original pre-patch version, or an earlier lap of this very\n * function from a previous call) is permanently and unambiguously locked\n * out, forever, the instant a new call starts. This function's OWN row\n * updates don't go through setRowStep at all any more (which is the only\n * thing that flag ever gated) \u2014 setBoardRowStep below reimplements the\n * exact same state update inline, gated only by a private generation\n * counter (myGen / current()) that only THIS invocation controls, so nothing\n * about disabling the shared flag can ever block this function's own work.\n * A generation check (not just the flag) also covers the case of two calls\n * to this NEW function racing each other (e.g. the takeover below firing\n * more than once): whichever call is current wins outright, and any\n * earlier one recognizes it's been superseded within at most one step\n * (~3.3s) and exits cleanly instead of continuing to run alongside it.\n */\n(function () {\n  'use strict';\n  if (!window.SATComponent) { return; }\n  if (typeof window.SATComponent.prototype.startBoardWave !== 'function') { return; }\n\n  // Merchant's call after seeing it live: a tad slow, on both desktop and\n  // mobile. Trimmed each of the three timings by roughly 15-20% rather than\n  // just one of them, so the whole cadence \u2014 cascade, flip, and hold \u2014\n  // reads uniformly quicker instead of only shortening the pause between\n  // sweeps (was 220/480/1700, a full step-to-step lap ran ~3.28s at 6 rows;\n  // now ~2.82s, noticeably brisker without turning into a blur).\n  var ROW_STAGGER = 190; // ms between each row's flip kicking off \u2014 the cascade itself\n  var FLIP_MS = 420;     // matches the eased transition duration set below\n  var HOLD_MS = 1450;    // time to actually read a row's new value once the sweep finishes\n\n  window.SATComponent.prototype.startBoardWave = async function () {\n    var self = this;\n\n    // Permanently silences setRowStep for anyone still gating on it \u2014 the\n    // original pre-patch version of this method, or an earlier call to\n    // this very function. Never set back to true by this file; this\n    // function's own updates use setBoardRowStep below instead, which\n    // doesn't check this flag at all, so turning it off here can never\n    // block this call's own work, only a foreign/stale one's.\n    this._boardRunning = false;\n\n    var myGen = (this._boardWaveGen = (this._boardWaveGen || 0) + 1);\n    function current() { return self._boardWaveGen === myGen; }\n\n    // A private reimplementation of the base setRowStep(i, val, noTrans) \u2014\n    // same state shape, same noTrans re-enable dance \u2014 gated on this call's\n    // own generation instead of the shared (now permanently-false) flag.\n    function setBoardRowStep(i, val, noTrans) {\n      if (!current() || self.state.view !== 'site') return;\n      self.setState(function (s) {\n        var step = s.boardStep.slice(); step[i] = val;\n        var nt = s.boardNoTransition.slice(); nt[i] = noTrans;\n        return { boardStep: step, boardNoTransition: nt };\n      });\n      if (!noTrans && typeof self.isBoardVisible === 'function' && typeof self.playRollTick === 'function') {\n        try { if (self.isBoardVisible()) self.playRollTick(); } catch (e) {}\n      }\n      if (noTrans) {\n        setTimeout(function () {\n          if (!current()) return;\n          self.setState(function (s) { var nt = s.boardNoTransition.slice(); nt[i] = false; return { boardNoTransition: nt }; });\n        }, 70);\n      }\n    }\n\n    var n = this._boardRows.length; // the 6 fixed rows\n    while (current()) {\n      // Re-checked once per lap (not once per step): the live row can come\n      // and go as real orders arrive, but flipping whether it's part of the\n      // sweep mid-lap would itself be a desync \u2014 a clean boundary between\n      // laps is the only place that's safe to pick up or drop it.\n      var bridge = window.SATLiveBoardBridge;\n      var liveCount = bridge ? bridge.count() : 0;\n      var hasLive = liveCount > 0;\n      var totalRows = n + (hasLive ? 1 : 0);\n      var sweep = (totalRows - 1) * ROW_STAGGER;\n\n      for (var step = 1; step <= 5 && current(); step++) {\n        for (var i = 0; i < n; i++) {\n          (function (i) { setTimeout(function () { setBoardRowStep(i, step, false); }, i * ROW_STAGGER); })(i);\n        }\n        if (hasLive) {\n          var liveStep = ((step - 1) % liveCount) + 1;\n          setTimeout(function () {\n            if (!current()) return;\n            bridge.setStep(liveStep, false);\n            if (typeof self.forceUpdate === 'function') self.forceUpdate();\n            if (typeof self.isBoardVisible === 'function' && typeof self.playRollTick === 'function') {\n              try { if (self.isBoardVisible()) self.playRollTick(); } catch (e) {}\n            }\n          }, n * ROW_STAGGER);\n        }\n        await self.sleep(sweep + FLIP_MS + HOLD_MS);\n      }\n      if (!current()) break;\n      // Instant, invisible snap back to 0 for every row on the sweep \u2014 no\n      // stagger and no wait of its own; it rides the tail end of step 5's\n      // hold instead of being a separate, shorter beat in the loop.\n      for (var j = 0; j < n; j++) setBoardRowStep(j, 0, true);\n      if (hasLive) {\n        bridge.setStep(0, true);\n        if (typeof self.forceUpdate === 'function') self.forceUpdate();\n      }\n    }\n  };\n\n  var orig = window.SATComponent.prototype.renderVals;\n  window.SATComponent.prototype.renderVals = function () {\n    var out = orig.call(this);\n    if (Array.isArray(out.boardRows)) {\n      out.boardRows = out.boardRows.map(function (r) {\n        if (r.flipTransition === 'none') return r; // the instant reset snap \u2014 leave untouched\n        return Object.assign({}, r, { flipTransition: 'transform ' + (FLIP_MS / 1000) + 's cubic-bezier(.4,0,.2,1)' });\n      });\n    }\n    return out;\n  };\n\n  // See the top-of-file note: componentDidMount's own call to\n  // startBoardWave() can bind to whichever function was on the prototype\n  // at that one instant, and a script load order this file can't fully\n  // control decides which one that is. Rather than depend on winning that\n  // race, force the issue directly once the app exists: call this file's\n  // own replacement fresh from right here. That call's own first line\n  // permanently disables the flag any stale/foreign loop needs to keep\n  // acting, so there is only ever one loop actually touching the board\n  // from this point on, however many attempts came before it.\n  function takeOverBoardWave() {\n    var app = window.SATApp;\n    if (!app) { setTimeout(takeOverBoardWave, 50); return; }\n    if (app.__satBoardWaveTakenOver) return;\n    app.__satBoardWaveTakenOver = true;\n    app.startBoardWave();\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