<!-- SOLID CITY · part 3748 -->
ey input = instant takeover; Resume Watch.
 * Client-only; uses window.SC.api from city.js.
 */
(function () {
'use strict';
if (!window.SC || !SC.api) return;
var A = SC.api, T = A.T, S = A.S, Y = A.CITY_Y, PAD = A.PAD, UP = new T.Vector3(0, 1, 0);
var $ = function (id) { return document.getElementById(id); };
function clamp(v, a, b) { return v < a ? a : v > b ? b : v; }
function smooth(t) { t = clamp(t, 0, 1); return t * t * (3 - 2 * t); }
function esc(s) { return String(s).replace(/[&<>"']/g, function (c) { return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]; }); }
function gnd(x, z) { return Math.max(0, A.groundAt(x, z)); }
function fmtT(s) { s = Math.round(s); return Math.floor(s / 60) + ':' + ('0' + s % 60).slice(-2); }

/* ---------------- landmarks ---------------- */
function V(name) { for (var i = 0; i < A.VOLCANOES.length; i++) if (A.VOLCANOES[i].name === name) return A.VOLCANOES[i]; }
var ML = V('MAUNA LOA'), MK = V('MAUNA KEA'), HU = V('HUALĀLAI'), KO = V('KOHALA'), KI = V('KĪLAUEA');
var ROMAN = ['II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'];
function isle(k) { var I = A.ISLANDS[k]; return { x: I.x, z: I.z, r: I.r, name: 'ISLE ' + (ROMAN[k - 1] || k) }; }
function top(v) { return A.heightAt(v.x, v.z); }
function around(Vc, R, alt, a0, sweep, n, v, cap) { // points circling a peak
  var out = []; for (var i = 0; i < n; i++) { var a = a0 + sweep * i / (n - 1); out.push({ x: Vc.x + Math.cos(a) * R, z: Vc.z + Math.sin(a) * R, y: alt, v: v, cap: i === 1 ? cap : null }); } return out;
}
function L(cap, sub, say) { return { cap: cap, sub: sub, say: say }; }
var CAP = {
  city: L('SOLID CITY', 'Forum Plaza · the King\u2019s capital', 'Solid City. Below us, the Forum Plaza, heart of the King\u2019s capital.'),
  studio: L('MUSIC STUDIO TOWER', 'Studio Radio · Solid Sound', 'The Music Studio Tower. Its rings pulse with Studio Radio.'),
  coast: L('THE KONA COAST', 'Black sand · basalt cliffs', 'Along the Kona coast: black sand and basalt cliffs.'),
  kohala: L('KOHALA', 'The oldest volcano · 1.4 km', 'Kohala, the oldest volcano on the island.'),
  mk: L('MAUNA KEA', 'Snow-capped summit · ' + (top(MK) / 1000).toFixed(1) + ' km', 'Mauna Kea. The tallest peak, with snow on its summit.'),
  ki: L('KĪLAUEA', 'Active lava crater', 'Kilauea. The lava crater is glowing below us.'),
  ml: L('MAUNA LOA', 'The great shield volcano · ' + (top(ML) / 1000).toFixed(1) + ' km', 'Mauna Loa, the great shield volcano.'),
  hu: L('HUALĀLAI', 'Above the capital', 'Hualalai, the volcano above the capital.'),
  orbit: L('ORBIT', 'Above the atmosphere · see the curve of the planet', 'We\u2019re in orbit. That curve is the planet.'),
  home: L('HOME', 'Orbital Spaceport · landing', 'Coming home to the Orbital Spaceport.')
};
function isleCap(I) { return L(I.name, 'Outer isle · ' + (I.r / 1000).toFixed(1) + ' km across', 'Outer island, ' + I.name.toLowerCase().replace('isle', 'isle') + '.'); }
function W(x, z, y, v, cap, agl) { return { x: x, z: z, y: y, v: v, cap: cap || null, agl: agl }; }
var ROUTES = {
  grand: { name: 'GRAND TOUR', vk: 1.42, blurb: 'City, coast, volcanoes, lava, isles, orbit', build: function () {
    var i7 = isle(7), i8 = isle(8), i1 = isle(1);
    return [W(-200, 260, 420, 200), W(0, 40, 380, 190, CAP.city), W(430, -170, 430, 200, CAP.studio), W(-700, -1800, 320, 300, CAP.coast), W(-500, -5200, 380, 360),
      W(KO.x - 2400, KO.z + 300, top(KO) + 450, 380, CAP.kohala)]
      .concat(around(MK, 3000, top(MK) + 120, Math.PI * 1.05, Math.PI * 1.15, 4, 330, CAP.mk))
      .concat([W(KI.x - 2200, KI.z - 2600, top(KI) + 600, 330), W(KI.x, KI.z, top(KI) + 380, 240, CAP.ki), W(KI.x - 600, KI.z + 2600, top(KI) + 500, 320)])
      .concat(around(ML, 3200, top(ML) + 150, Math.PI * 0.35, Math.PI * 0.95, 4, 330, CAP.ml))
      .concat([W(i7.x, i7.z, top(i7) + 550, 480, isleCap(i7)), W(i8.x, i8.z, top(i8) + 550, 480, isleCap(i8)), W(i1.x, i1.z, top(i1) + 550, 450, isleCap(i1)),
        W(i1.x - 9000, i1.z - 3000, 9000, 900), W(-24000, 2000, 40000, 2400, CAP.orbit), W(-20000, -9000, 44000, 2600), W(-9000, -5000, 14000, 1500),
        W(-3200, 1200, 2600, 560), W(PAD.x - 1800, PAD.z + 900, 480, 230, CAP.home)]);
  } },
  volcano: { name: 'VOLCANO RUN', blurb: 'Hualālai, Mauna Loa, the lava crater, Mauna Kea', build: function () {
    return [W(-150, 200, 420, 210), W(0, 30, 380, 200, CAP.city), W(HU.x - 1800, HU.z + 400, top(HU) + 350, 320, CAP.hu)]
      .concat(around(ML, 3000, top(ML) + 150, Math.PI * 1.0, -Math.PI * 0.9, 4, 320, CAP.ml))
      .concat([W(KI.x - 2000, KI.z + 1800, top(KI) + 500, 320), W(KI.x, KI.z, top(KI) + 360, 230, CAP.ki), W(KI.x + 1200, KI.z - 2600, top(KI) + 500, 320)])
      .concat(around(MK, 2800, top(MK) + 120, Math.PI * 0.2, Math.PI * 1.1, 4, 330, CAP.mk))
      .concat([W(KO.x, KO.z + 1500, top(KO) + 450, 380, CAP.kohala), W(-600, -3200, 380, 340, CAP.coast), W(PAD.x - 1800, PAD.z + 900, 480, 230, CAP.home)]);
  } }