app-preheater.js.bak 90 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317
  1. !function e(t, n, r) {
  2. function i(a, s) {
  3. if (!n[a]) {
  4. if (!t[a]) {
  5. var u = "function" == typeof require && require;
  6. if (!s && u)
  7. return u(a, !0);
  8. if (o)
  9. return o(a, !0);
  10. var c = new Error("Cannot find module '" + a + "'");
  11. throw c.code = "MODULE_NOT_FOUND",
  12. c
  13. }
  14. var l = n[a] = {
  15. exports: {}
  16. };
  17. t[a][0].call(l.exports, function(e) {
  18. var n = t[a][1][e];
  19. return i(n ? n : e)
  20. }, l, l.exports, e, t, n, r)
  21. }
  22. return n[a].exports
  23. }
  24. for (var o = "function" == typeof require && require, a = 0; a < r.length; a++)
  25. i(r[a]);
  26. return i
  27. }({
  28. 1: [function(e, t, n) {
  29. (function(n) {
  30. "use strict";
  31. function r() {
  32. return 100 * Math.random()
  33. }
  34. var i = e("./util/logger")
  35. , o = e("./util/browser")
  36. , a = new i(n)
  37. , s = window.MP_AB_TESTS = window.MP_AB_TESTS || {
  38. initialized: !1,
  39. init: function(e, t) {
  40. if (t = t || {},
  41. !this.initialized) {
  42. this.initialized = !0,
  43. o.valueFromHash("tilegen") && (t.tilegen = 1 === o.valueFromHash("tilegen", 0)),
  44. o.valueFromHash("imgopt") && (t.imgopt = 1 === o.valueFromHash("imgopt", 0));
  45. for (var n in e) {
  46. var i = n.match("^sc_tilegen_([0-9]+)$");
  47. i && (s.tilegen = r() < parseInt(i[1]));
  48. var u = n.match("^sc_imgopt_([0-9]+)$");
  49. u && (s.imgopt = r() < parseInt(u[1]))
  50. }
  51. for (var c in t)
  52. s[c] = t[c],
  53. a.debug("A/B override:", c, s[c])
  54. }
  55. },
  56. changeIfTileGenerating: function(e) {
  57. return s.tilegen && (e += e.indexOf("?") === -1 ? "?" : "&",
  58. e += "imgopt=1"),
  59. e
  60. },
  61. changeIfImageOptimzing: function(e) {
  62. return s.imgopt && e.indexOf("imgopt=1") === -1 && (e += e.indexOf("?") === -1 ? "?" : "&",
  63. e += "imgopt=1"),
  64. e
  65. },
  66. tilegen: !1,
  67. imgopt: !1
  68. };
  69. t.exports = s
  70. }
  71. ).call(this, "/js/ab.js")
  72. }
  73. , {
  74. "./util/browser": 13,
  75. "./util/logger": 15
  76. }],
  77. 2: [function(e, t, n) {
  78. "use strict";
  79. t.exports = {
  80. signedUrlDefaultExpireTime: 24e4,
  81. signedUrlCheckInterval: 1e4,
  82. signedUrlRefreshBuffer: 15e3,
  83. dollhouseFOV: 70,
  84. dollhouseNear: 1,
  85. dollhouseFar: 5e3,
  86. insideFOV: 70,
  87. insideFOVMax: 120,
  88. insideNear: .1,
  89. insideFar: 5e3,
  90. insideLookSpeed: .12,
  91. insideLookLimitUp: 40,
  92. insideLookLimitDown: -40,
  93. orthoNear: 1,
  94. orthoFar: 5e3,
  95. orthoBase: 10,
  96. narrowLandscapeHeight: 290,
  97. reallyNarrowLandscapeHeight: 250,
  98. visionTilingStartDate: new Date("8/26/2016"),
  99. visionTilingStartVersion: "1.1.407.13667",
  100. windowHeightHighQualityThreshold: 900,
  101. tourStepDelayDefault: 3500,
  102. tourStepDelaySlideShow: 5e3,
  103. workshopApsect: 9 / 16,
  104. highQualityMaxZoom: 2,
  105. ultraHighQualityMaxZoom: 3
  106. }
  107. }
  108. , {}],
  109. 3: [function(e, t, n) {
  110. "use strict";
  111. t.exports = {
  112. GL_TEXTURE_CUBE_MAP_POSITIVE_X: 0,
  113. GL_TEXTURE_CUBE_MAP_NEGATIVE_X: 1,
  114. GL_TEXTURE_CUBE_MAP_POSITIVE_Y: 2,
  115. GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: 3,
  116. GL_TEXTURE_CUBE_MAP_POSITIVE_Z: 4,
  117. GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 5
  118. }
  119. }
  120. , {}],
  121. 4: [function(e, t, n) {
  122. "use strict";
  123. function r(e) {
  124. this.message = e
  125. }
  126. t.exports = r
  127. }
  128. , {}],
  129. 5: [function(e, t, n) {
  130. "use strict";
  131. function r(e) {
  132. i.call(this, e)
  133. }
  134. var i = e("./BasicException");
  135. r.prototype = Object.create(i.prototype),
  136. t.exports = r
  137. }
  138. , {
  139. "./BasicException": 4
  140. }],
  141. 6: [function(e, t, n) {
  142. (function(n) {
  143. "use strict";
  144. function r(e) {
  145. var t = {};
  146. if (e) {
  147. var n = e.flags;
  148. if (n)
  149. for (var r in n)
  150. n.hasOwnProperty(r) && (t[n[r]] = !0);
  151. return t
  152. }
  153. return u.debug("Feature flags -> parseFeatureFlags: rawData is null."),
  154. null
  155. }
  156. var i = e("./util/ajax")
  157. , o = e("./util/showcase")
  158. , a = e("./util/logger")
  159. //, s = "/api/v1/user/"
  160. , s = "/data/"
  161. , u = new a(n)
  162. , c = {};
  163. t.exports = {
  164. loadFeatureFlags: function(e) {
  165. var t = $.Deferred();
  166. return i.get(e.urlBase + s, {
  167. responseType: "json",
  168. prefetchFrom: "user",
  169. auth: o.getAuthorizationHeader()
  170. }).done(function(e) {
  171. c = r(e),
  172. c ? t.resolve(c) : t.reject("loading-failed")
  173. }).fail(function() {
  174. u.debug("Retrieval of feature flags failed."),
  175. t.reject("loading-failed")
  176. }),
  177. t.promise()
  178. },
  179. getFlags: function() {
  180. return c
  181. },
  182. updateDependentSettings: function(e, t) {
  183. e = e || c,
  184. e.labels && (t.labels.enabled = !0),
  185. e.zooming && !t.zoom.forceOff && (t.zoom.enabled = !0),
  186. e.showcase_sdk && (t.sdkInit = !0),
  187. e.mobile_highq_override && (t.tiling.mobileHighQualityOverride = !0),
  188. e.showcase_webvr && (t.vr.allowWebVR = !0),
  189. e.uhql && (t.tiling.allowUltraHighResolution = !0),
  190. e.hide_sc_sharing && (t.share.enabled = !1)
  191. }
  192. }
  193. }
  194. ).call(this, "/js/featureflags.js")
  195. }
  196. , {
  197. "./util/ajax": 12,
  198. "./util/logger": 15,
  199. "./util/showcase": 17
  200. }],
  201. 7: [function(e, t, n) {
  202. (function(t) {
  203. "use strict";
  204. function n() {
  205. if (window.location.hash) {
  206. var e = window.location.href.replace(/#model/i, "?m");
  207. return e = e.replace(/#m/i, "?m"),
  208. window.location.href = e,
  209. !0
  210. }
  211. return !1
  212. }
  213. function r(e) {
  214. this.sid = e.sid,
  215. this.urlConfig = e.urlConfig,
  216. this.urls = new o(this.urlConfig.urlFiles),
  217. this.urls.init()
  218. }
  219. function i(e) {
  220. var t = a.parseSidUrl(e);
  221. v.loadFeatureFlags(t).then(function() {
  222. w.init(v.getFlags()),
  223. new r({
  224. sid: e,
  225. urlConfig: t
  226. }).init()
  227. })
  228. }
  229. var o = e("./util/ModelUrls")
  230. , a = e("./util/showcase")
  231. , s = e("./util/ajax")
  232. , u = e("./util/showcase")
  233. , c = e("./util/panorama")
  234. , l = e("./util/browser")
  235. , h = e("./util/logger")
  236. , f = e("./tile/TileUtils")
  237. , p = e("./tile/TileModeValidator")
  238. , d = e("./util/cameraLight")
  239. , m = e("./constants")
  240. , g = e("./util/MathLight")
  241. , v = e("./featureflags")
  242. , w = e("./ab")
  243. , _ = new h(t)
  244. , E = l.valueFromHash("usetiles", null) || l.valueFromHash("tiles", null)
  245. , y = {
  246. quickstart: 1 === l.valueFromHash("qust", 0) || 1 === l.valueFromHash("qs", 0),
  247. tiles: null !== E ? "1" === E : null
  248. };
  249. if (r.prototype.init = function() {
  250. _.warn("Preheating");
  251. var e;
  252. return this.loadModelData().then(function(t) {
  253. e = a.normalizeModeldata(t, g)
  254. }).then(this.urls.init.bind(this.urls)).then(function() {
  255. var t, n, r = e.startPano, i = y.tiles === !0 || null === y.tiles && u.modelDataPromisesTiles(e);
  256. if (r && r.pano)
  257. t = i ? this.loadTiledPanoTextures(r, "high") : this.loadPanoTextures(r.pano.uuid, "high");
  258. else if (i) {
  259. var o = Object.keys(e.sweeps)[0];
  260. this.testSingleTile(o)
  261. }
  262. return n = s.get(this.urls.get("vision.modeldata"), {
  263. responseType: "arraybuffer"
  264. }),
  265. $.when(n, t)
  266. }
  267. .bind(this)).then(function() {
  268. _.warn("Done preheating")
  269. })
  270. }
  271. ,
  272. r.prototype.loadModelData = function() {
  273. return s.get(this.urlConfig.urlModel, {
  274. responseType: "json",
  275. prefetchFrom: "model",
  276. auth: u.getAuthorizationHeader()
  277. })
  278. }
  279. ,
  280. r.prototype.loadPanoTextures = function(e, t) {
  281. var n = c.getCubemapUrls(this.urls, e, t)
  282. , r = n.map(function(e) {
  283. return s.getImage(e)
  284. });
  285. return $.when(r[0], r[1], r[2], r[3], r[4], r[5])
  286. }
  287. ,
  288. r.prototype.loadTiledPanoTextures = function(e) {
  289. var t = []
  290. , n = 1024
  291. , r = new g.Matrix4
  292. , i = new g.Vector3(0,0,-1);
  293. r.makeRotationFromQuaternion(e.camera.quaternion),
  294. r.applyToVector3(i);
  295. var o = d.getHFOVFromVFOV(m.insideFOV, window.innerWidth, window.innerHeight)
  296. , a = m.insideFOV;
  297. f.matchingTilesInDirection(e.pano, n, i, o, a, t);
  298. var u = t.map(function(t) {
  299. var n = this.urls.get("tiles/" + e.pano.uuid + "/1k_face" + t.face + "_" + t.tileX + "_" + t.tileY + ".jpg");
  300. return n = w.changeIfTileGenerating(n),
  301. s.getImage(n, 0).fail(function() {
  302. p.redirectToNonTiledMode()
  303. })
  304. }
  305. .bind(this));
  306. return $.when.apply($, u).done(function() {
  307. [0, 1, 2, 3, 4, 5].forEach(function(t) {
  308. var n = this.urls.get("tiles/" + e.pano.uuid + "/512_face" + t + "_0_0.jpg");
  309. return n = w.changeIfTileGenerating(n),
  310. s.getImage(n)
  311. }
  312. .bind(this))
  313. }
  314. .bind(this))
  315. }
  316. ,
  317. r.prototype.testSingleTile = function(e) {
  318. if (!w.tilegen) {
  319. var t = this.urls.get("tiles/" + e + "/1k_face0_0_0.jpg");
  320. s.getImage(t, 0).fail(function() {
  321. p.redirectToNonTiledMode()
  322. })
  323. }
  324. }
  325. ,
  326. !n()) {
  327. var b = a.getModelIDFromQueryString();
  328. b ? i(b) : _.warn("No sid, cannot preheat.")
  329. }
  330. }
  331. ).call(this, "/js/preheater.js")
  332. }
  333. , {
  334. "./ab": 1,
  335. "./constants": 2,
  336. "./featureflags": 6,
  337. "./tile/TileModeValidator": 8,
  338. "./tile/TileUtils": 9,
  339. "./util/MathLight": 10,
  340. "./util/ModelUrls": 11,
  341. "./util/ajax": 12,
  342. "./util/browser": 13,
  343. "./util/cameraLight": 14,
  344. "./util/logger": 15,
  345. "./util/panorama": 16,
  346. "./util/showcase": 17
  347. }],
  348. 8: [function(e, t, n) {
  349. "use strict";
  350. var r = {};
  351. r.allTilingParameterNames = ["usetiles", "tiles", "maxtileq", "tileoverlay", "tileupdelay", "itiledelay", "maxtpf", "tilecustcomp", "tileprerender"],
  352. r.redirectToNonTiledMode = function() {
  353. var e = window.location.href;
  354. r.allTilingParameterNames.forEach(function(t) {
  355. e = r.removeURLParameter(e, t)
  356. }),
  357. window.location.href = e
  358. }
  359. ,
  360. r.removeURLParameter = function(e, t) {
  361. var n = new RegExp(t + "=[^$&]*&?");
  362. return e.replace(n, "")
  363. }
  364. ,
  365. t.exports = r
  366. }
  367. , {}],
  368. 9: [function(e, t, n) {
  369. "use strict";
  370. var r = e("../enum/GLCubeFaces")
  371. , i = e("../util/MathLight")
  372. , o = {};
  373. o.TILE_SIZE = 512,
  374. o.FACES_PER_PANO = 6,
  375. o.LocationOnTile = {
  376. Center: 0,
  377. UpperLeft: 1,
  378. UpperRight: 2,
  379. LowerRight: 3,
  380. LowerLeft: 4
  381. },
  382. o.getTileVector = function() {
  383. return function(e, t, n, a, s, u, c, l) {
  384. u = u || o.LocationOnTile.Center;
  385. var h = e / t
  386. , f = a / h;
  387. s = -s + (h - 1);
  388. var p = s / h
  389. , d = t / e
  390. , m = 2 * d
  391. , g = m / 2
  392. , v = 2 * f - 1 + g
  393. , w = 2 * p - 1 + g;
  394. switch (u) {
  395. case o.LocationOnTile.UpperLeft:
  396. v -= g,
  397. w += g,
  398. v += c * m;
  399. break;
  400. case o.LocationOnTile.UpperRight:
  401. v += g,
  402. w += g,
  403. w -= c * m;
  404. break;
  405. case o.LocationOnTile.LowerRight:
  406. v += g,
  407. w -= g,
  408. v -= c * m;
  409. break;
  410. case o.LocationOnTile.LowerLeft:
  411. v -= g,
  412. w -= g,
  413. w += c * m;
  414. break;
  415. case o.LocationOnTile.Center:
  416. }
  417. switch (n) {
  418. case r.GL_TEXTURE_CUBE_MAP_POSITIVE_X:
  419. i.setVector(l, -1, w, -v);
  420. break;
  421. case r.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
  422. i.setVector(l, 1, w, v);
  423. break;
  424. case r.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
  425. i.setVector(l, -v, 1, -w);
  426. break;
  427. case r.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
  428. i.setVector(l, -v, -1, w);
  429. break;
  430. case r.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
  431. i.setVector(l, -v, w, 1);
  432. break;
  433. case r.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
  434. i.setVector(l, v, w, -1)
  435. }
  436. i.normalize(l)
  437. }
  438. }(),
  439. o.getFaceForTile = function(e, t) {
  440. var n = o.TILE_SIZE;
  441. e < o.TILE_SIZE && (n = e);
  442. var r = Math.floor(e / n)
  443. , i = r * r;
  444. return Math.floor(t / i)
  445. }
  446. ,
  447. o.getTileLocation = function(e, t, n) {
  448. var r = o.TILE_SIZE;
  449. e < o.TILE_SIZE && (r = e);
  450. var i = o.getFaceForTile(e, t)
  451. , a = Math.floor(e / r)
  452. , s = a * a
  453. , u = t - i * s;
  454. n.tileX = u % a,
  455. n.tileY = Math.floor(u / a),
  456. n.face = i,
  457. n.faceTileIndex = u
  458. }
  459. ,
  460. o.getTileCountForSize = function(e) {
  461. if (e <= o.TILE_SIZE)
  462. return o.FACES_PER_PANO;
  463. var t = Math.floor(e / o.TILE_SIZE)
  464. , n = t * t
  465. , r = n * o.FACES_PER_PANO;
  466. return r
  467. }
  468. ,
  469. o.getRelativeDirection = function() {
  470. var e = new i.Matrix4
  471. , t = new i.Quaternion;
  472. return function(n, r) {
  473. t.copy(n),
  474. t.inverse(),
  475. e.makeRotationFromQuaternion(t),
  476. e.applyToVector3(r),
  477. i.normalize(r)
  478. }
  479. }(),
  480. o.matchingTilesInDirection = function() {
  481. var e = new i.Vector3
  482. , t = new i.Vector3(0,0,-1)
  483. , n = new i.Quaternion
  484. , r = function(e, t) {
  485. e.push({
  486. face: t.face,
  487. faceTileIndex: t.faceTileIndex,
  488. tileX: t.tileX,
  489. tileY: t.tileY
  490. })
  491. }
  492. , a = function() {
  493. var e = {
  494. face: -1,
  495. faceTileIndex: -1,
  496. tileX: -1,
  497. tileY: -1
  498. };
  499. return function(t, n, i) {
  500. for (var a = o.getTileCountForSize(t), s = 0, u = 0; u < a; u++)
  501. o.getTileLocation(t, u, e),
  502. n && !n(e) || (s++,
  503. i && r(i, e));
  504. return s
  505. }
  506. }();
  507. return function(r, s, u, c, l, h) {
  508. var f = s < o.TILE_SIZE ? s : o.TILE_SIZE;
  509. o.getTileCountForSize(s);
  510. if (!c && !l)
  511. return a(s, null, h);
  512. var p = !!l;
  513. if (l = l || c,
  514. l = Math.max(0, Math.min(l, 360)),
  515. c = Math.max(0, Math.min(c, 360)),
  516. i.copyVector(u, e),
  517. o.getRelativeDirection(r.quaternion, e),
  518. p) {
  519. n.setFromUnitVectors(e, t);
  520. var d = function(e) {
  521. return o.isTileWithinFrustum(s, f, e.face, e.tileX, e.tileY, n, c, l)
  522. };
  523. return a(s, d, h)
  524. }
  525. var m = function(t) {
  526. return o.isTileWithinFOV(s, f, t.face, t.tileX, t.tileY, e, c)
  527. };
  528. return a(s, m, h)
  529. }
  530. }(),
  531. o.isTileWithinFrustum = function() {
  532. var e = new i.Vector3
  533. , t = 1e-5;
  534. return function(n, r, a, s, u, c, l, h) {
  535. for (var f = Math.tan(.5 * h * i.RADIANS_PER_DEGREE), p = -f, d = Math.tan(.5 * l * i.RADIANS_PER_DEGREE), m = -d, g = o.mapFaceToCubemapFace(a), v = 0, w = 0, _ = 0, E = 0, y = 0, b = 0, T = o.LocationOnTile.Center; T <= o.LocationOnTile.LowerLeft; T++)
  536. if (o.getTileVector(n, r, g, s, u, T, 0, e),
  537. i.applyQuaternionToVector(c, e),
  538. e.z >= -t)
  539. y++;
  540. else {
  541. var x = -1 / e.z
  542. , A = e.x * x
  543. , R = e.y * x;
  544. R > f ? v++ : R < p && w++,
  545. A > d ? _++ : A < m && E++,
  546. b++
  547. }
  548. return w !== b && v !== b && _ !== b && E !== b
  549. }
  550. }(),
  551. o.isTileWithinFOV = function() {
  552. var e = new i.Vector3
  553. , t = new i.Vector3(0,1,0)
  554. , n = new i.Vector3(1,0,0);
  555. return function(r, a, s, u, c, l, h) {
  556. var f = o.mapFaceToCubemapFace(s);
  557. if (i.cross(l, t, n),
  558. o.getTileVector(r, a, f, u, c, o.LocationOnTile.Center, 0, e),
  559. o.isWithinFOV(e, l, h, null))
  560. return !0;
  561. for (var p = h / 360, d = Math.floor(1 / p), m = 0, g = 0; g < d; g++) {
  562. for (var v = o.LocationOnTile.UpperLeft; v <= o.LocationOnTile.LowerLeft; v++)
  563. if (o.getTileVector(r, a, f, u, c, v, m, e),
  564. o.isWithinFOV(e, l, h, null))
  565. return !0;
  566. m += p
  567. }
  568. return !1
  569. }
  570. }(),
  571. o.isWithinFOV = function() {
  572. var e = new i.Vector3
  573. , t = new i.Vector3;
  574. return function(n, r, o, a) {
  575. if (i.copyVector(n, t),
  576. a) {
  577. i.copyVector(a, e),
  578. i.normalize(e);
  579. var s = i.dot(e, n);
  580. e.x *= s,
  581. e.y *= s,
  582. e.z *= s,
  583. i.subVector(t, e)
  584. }
  585. var u = o / 2 * i.RADIANS_PER_DEGREE
  586. , c = Math.cos(u)
  587. , l = i.dot(t, r);
  588. return l >= c
  589. }
  590. }(),
  591. o.mapFaceToCubemapFace = function() {
  592. var e = {
  593. 0: r.GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
  594. 1: r.GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
  595. 2: r.GL_TEXTURE_CUBE_MAP_POSITIVE_X,
  596. 3: r.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
  597. 4: r.GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
  598. 5: r.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
  599. };
  600. return function(t) {
  601. return e[t]
  602. }
  603. }(),
  604. t.exports = o
  605. }
  606. , {
  607. "../enum/GLCubeFaces": 3,
  608. "../util/MathLight": 10
  609. }],
  610. 10: [function(e, t, n) {
  611. "use strict";
  612. var r = e("../constants")
  613. , i = {};
  614. i.RADIANS_PER_DEGREE = Math.PI / 180,
  615. i.DEGREES_PER_RADIAN = 180 / Math.PI,
  616. i.Vector3 = function(e, t, n) {
  617. this.x = e || 0,
  618. this.y = t || 0,
  619. this.z = n || 0
  620. }
  621. ,
  622. i.Matrix4 = function() {
  623. this.elements = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
  624. arguments.length > 0 && console.error("MathLight.Matrix4: the constructor no longer reads arguments. use .set() instead.")
  625. }
  626. ,
  627. i.Matrix4.prototype = {
  628. identity: function() {
  629. return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
  630. this
  631. },
  632. copy: function(e) {
  633. return this.elements.set(e.elements),
  634. this
  635. },
  636. applyToVector3: function(e) {
  637. var t = e.x
  638. , n = e.y
  639. , r = e.z
  640. , i = this.elements;
  641. return e.x = i[0] * t + i[4] * n + i[8] * r + i[12],
  642. e.y = i[1] * t + i[5] * n + i[9] * r + i[13],
  643. e.z = i[2] * t + i[6] * n + i[10] * r + i[14],
  644. this
  645. },
  646. getInverse: function(e, t) {
  647. var n = this.elements
  648. , r = e.elements
  649. , i = r[0]
  650. , o = r[1]
  651. , a = r[2]
  652. , s = r[3]
  653. , u = r[4]
  654. , c = r[5]
  655. , l = r[6]
  656. , h = r[7]
  657. , f = r[8]
  658. , p = r[9]
  659. , d = r[10]
  660. , m = r[11]
  661. , g = r[12]
  662. , v = r[13]
  663. , w = r[14]
  664. , _ = r[15]
  665. , E = p * w * h - v * d * h + v * l * m - c * w * m - p * l * _ + c * d * _
  666. , y = g * d * h - f * w * h - g * l * m + u * w * m + f * l * _ - u * d * _
  667. , b = f * v * h - g * p * h + g * c * m - u * v * m - f * c * _ + u * p * _
  668. , T = g * p * l - f * v * l - g * c * d + u * v * d + f * c * w - u * p * w
  669. , x = i * E + o * y + a * b + s * T;
  670. if (0 === x) {
  671. var A = "MathLight.Matrix4.getInverse(): can't invert matrix, determinant is 0";
  672. if (t)
  673. throw new Error(A);
  674. return console.warn(A),
  675. this.identity()
  676. }
  677. var R = 1 / x;
  678. return n[0] = E * R,
  679. n[1] = (v * d * s - p * w * s - v * a * m + o * w * m + p * a * _ - o * d * _) * R,
  680. n[2] = (c * w * s - v * l * s + v * a * h - o * w * h - c * a * _ + o * l * _) * R,
  681. n[3] = (p * l * s - c * d * s - p * a * h + o * d * h + c * a * m - o * l * m) * R,
  682. n[4] = y * R,
  683. n[5] = (f * w * s - g * d * s + g * a * m - i * w * m - f * a * _ + i * d * _) * R,
  684. n[6] = (g * l * s - u * w * s - g * a * h + i * w * h + u * a * _ - i * l * _) * R,
  685. n[7] = (u * d * s - f * l * s + f * a * h - i * d * h - u * a * m + i * l * m) * R,
  686. n[8] = b * R,
  687. n[9] = (g * p * s - f * v * s - g * o * m + i * v * m + f * o * _ - i * p * _) * R,
  688. n[10] = (u * v * s - g * c * s + g * o * h - i * v * h - u * o * _ + i * c * _) * R,
  689. n[11] = (f * c * s - u * p * s - f * o * h + i * p * h + u * o * m - i * c * m) * R,
  690. n[12] = T * R,
  691. n[13] = (f * v * a - g * p * a + g * o * d - i * v * d - f * o * w + i * p * w) * R,
  692. n[14] = (g * c * a - u * v * a - g * o * l + i * v * l + u * o * w - i * c * w) * R,
  693. n[15] = (u * p * a - f * c * a + f * o * l - i * p * l - u * o * d + i * c * d) * R,
  694. this
  695. },
  696. makeRotationFromQuaternion: function(e) {
  697. var t = this.elements
  698. , n = e.x
  699. , r = e.y
  700. , i = e.z
  701. , o = e.w
  702. , a = n + n
  703. , s = r + r
  704. , u = i + i
  705. , c = n * a
  706. , l = n * s
  707. , h = n * u
  708. , f = r * s
  709. , p = r * u
  710. , d = i * u
  711. , m = o * a
  712. , g = o * s
  713. , v = o * u;
  714. return t[0] = 1 - (f + d),
  715. t[4] = l - v,
  716. t[8] = h + g,
  717. t[1] = l + v,
  718. t[5] = 1 - (c + d),
  719. t[9] = p - m,
  720. t[2] = h - g,
  721. t[6] = p + m,
  722. t[10] = 1 - (c + f),
  723. t[3] = 0,
  724. t[7] = 0,
  725. t[11] = 0,
  726. t[12] = 0,
  727. t[13] = 0,
  728. t[14] = 0,
  729. t[15] = 1,
  730. this
  731. }
  732. },
  733. i.Quaternion = function(e, t, n, r) {
  734. this._x = e || 0,
  735. this._y = t || 0,
  736. this._z = n || 0,
  737. this._w = void 0 !== r ? r : 1
  738. }
  739. ,
  740. i.Quaternion.prototype = {
  741. get x() {
  742. return this._x
  743. },
  744. set x(e) {
  745. this._x = e
  746. },
  747. get y() {
  748. return this._y
  749. },
  750. set y(e) {
  751. this._y = e
  752. },
  753. get z() {
  754. return this._z
  755. },
  756. set z(e) {
  757. this._z = e
  758. },
  759. get w() {
  760. return this._w
  761. },
  762. set w(e) {
  763. this._w = e
  764. },
  765. copy: function(e) {
  766. this._x = e.x,
  767. this._y = e.y,
  768. this._z = e.z,
  769. this._w = e.w
  770. },
  771. inverse: function() {
  772. return this.conjugate().normalize()
  773. },
  774. conjugate: function() {
  775. return this._x *= -1,
  776. this._y *= -1,
  777. this._z *= -1,
  778. this
  779. },
  780. length: function() {
  781. return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w)
  782. },
  783. normalize: function() {
  784. var e = this.length();
  785. return 0 === e ? (this._x = 0,
  786. this._y = 0,
  787. this._z = 0,
  788. this._w = 1) : (e = 1 / e,
  789. this._x = this._x * e,
  790. this._y = this._y * e,
  791. this._z = this._z * e,
  792. this._w = this._w * e),
  793. this
  794. },
  795. setFromAxisAngle: function(e, t) {
  796. var n = t / 2
  797. , r = Math.sin(n);
  798. return this._x = e.x * r,
  799. this._y = e.y * r,
  800. this._z = e.z * r,
  801. this._w = Math.cos(n),
  802. this
  803. },
  804. setFromUnitVectors: function() {
  805. var e, t, n = 1e-6;
  806. return function(r, o) {
  807. return void 0 === e && (e = new i.Vector3),
  808. t = i.dot(r, o) + 1,
  809. t < n ? (t = 0,
  810. Math.abs(r.x) > Math.abs(r.z) ? i.setVector(e, -r.y, r.x, 0) : i.setVector(e, 0, -r.z, r.y)) : i.cross(r, o, e),
  811. this._x = e.x,
  812. this._y = e.y,
  813. this._z = e.z,
  814. this._w = t,
  815. this.normalize()
  816. }
  817. }(),
  818. multiply: function(e) {
  819. return this.multiplyQuaternions(this, e)
  820. },
  821. premultiply: function(e) {
  822. return this.multiplyQuaternions(e, this)
  823. },
  824. multiplyQuaternions: function(e, t) {
  825. var n = e._x
  826. , r = e._y
  827. , i = e._z
  828. , o = e._w
  829. , a = t._x
  830. , s = t._y
  831. , u = t._z
  832. , c = t._w;
  833. return this._x = n * c + o * a + r * u - i * s,
  834. this._y = r * c + o * s + i * a - n * u,
  835. this._z = i * c + o * u + n * s - r * a,
  836. this._w = o * c - n * a - r * s - i * u,
  837. this
  838. }
  839. },
  840. i.convertWorkshopVector = function(e) {
  841. return new i.Vector3(-e.x,e.y,e.z)
  842. }
  843. ,
  844. i.convertWorkshopQuaternion = function(e) {
  845. return new i.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new i.Quaternion(Math.sqrt(2) / 2,Math.sqrt(2) / 2,0,0))
  846. }
  847. ;
  848. i.convertWorkshopOrthoZoom = function(e) {
  849. return e === -1 ? -1 : e / 16 * (window.innerWidth / window.innerHeight) / r.workshopApsect
  850. }
  851. ,
  852. i.convertWorkshopPanoramaQuaternion = function(e) {
  853. return new i.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new i.Quaternion).setFromAxisAngle(new i.Vector3(0,1,0), 270 * i.RADIANS_PER_DEGREE))
  854. }
  855. ,
  856. i.normalize = function(e) {
  857. var t = e.x * e.x + e.y * e.y + e.z * e.z
  858. , n = Math.sqrt(t);
  859. e.x /= n,
  860. e.y /= n,
  861. e.z /= n
  862. }
  863. ,
  864. i.dot = function(e, t) {
  865. return e.x * t.x + e.y * t.y + e.z * t.z
  866. }
  867. ,
  868. i.cross = function(e, t, n) {
  869. var r = e.x
  870. , i = e.y
  871. , o = e.z;
  872. n.x = i * t.z - o * t.y,
  873. n.y = o * t.x - r * t.z,
  874. n.z = r * t.y - i * t.x
  875. }
  876. ,
  877. i.setVector = function(e, t, n, r) {
  878. e.x = t,
  879. e.y = n,
  880. e.z = r
  881. }
  882. ,
  883. i.copyVector = function(e, t) {
  884. t.x = e.x,
  885. t.y = e.y,
  886. t.z = e.z
  887. }
  888. ,
  889. i.addVector = function(e, t) {
  890. e.x += t.x,
  891. e.y += t.y,
  892. e.z += t.z
  893. }
  894. ,
  895. i.subVector = function(e, t) {
  896. e.x -= t.x,
  897. e.y -= t.y,
  898. e.z -= t.z
  899. }
  900. ,
  901. i.applyQuaternionToVector = function(e, t) {
  902. var n = t.x
  903. , r = t.y
  904. , i = t.z
  905. , o = e.x
  906. , a = e.y
  907. , s = e.z
  908. , u = e.w
  909. , c = u * n + a * i - s * r
  910. , l = u * r + s * n - o * i
  911. , h = u * i + o * r - a * n
  912. , f = -o * n - a * r - s * i;
  913. t.x = c * u + f * -o + l * -s - h * -a,
  914. t.y = l * u + f * -a + h * -o - c * -s,
  915. t.z = h * u + f * -s + c * -a - l * -o
  916. }
  917. ,
  918. i.angleBetweenVectors = function(e, t) {
  919. return Math.acos(i.dot(e, t))
  920. }
  921. ,
  922. t.exports = i
  923. }
  924. , {
  925. "../constants": 2
  926. }],
  927. 11: [function(e, t, n) {
  928. (function(n) {
  929. "use strict";
  930. function r(e) {
  931. this.cache = null,
  932. this.expires = 0
  933. }
  934. function i() {
  935. this.baseUrl = null,
  936. this.cache = null,
  937. this.expires = 0
  938. }
  939. function o() {
  940. this.baseUrl = null,
  941. this.expires = 0
  942. }
  943. function a(e) {
  944. this.initialLoadingPromise = null,
  945. this.endpoint = e + "?type=3",
  946. this.urlContainer = null,
  947. this.authorizationHeader = l.getAuthorizationHeader(),
  948. this.containerClasses = [o, i, r]
  949. }
  950. var s = e("./ajax")
  951. , u = e("./logger")
  952. , c = e("../constants")
  953. , l = e("./showcase")
  954. , h = (e("../ab"),
  955. new u(n));
  956. r.prototype = {
  957. version: 1,
  958. validate: function(e) {
  959. return "catalog.json"in e && Object.keys(e).length > 0
  960. },
  961. update: function(e) {
  962. return this.cache = e,
  963. this.expires = Date.now() + c.signedUrlDefaultExpireTime,
  964. $.when()
  965. },
  966. get: function(e) {
  967. return this.cache[e]
  968. }
  969. },
  970. i.prototype = {
  971. version: 2,
  972. validate: function(e) {
  973. return "catalog.json"in e && "base.url"in e && Object.keys(e).length > 1
  974. },
  975. update: function(e) {
  976. return this.baseUrl = e["base.url"],
  977. this.cache = e,
  978. this.expires = Date.now() + c.signedUrlDefaultExpireTime,
  979. $.when()
  980. },
  981. get: function(e) {
  982. var t = this.cache[e];
  983. return t ? this.baseUrl.replace("{{filename}}", e) + t : null
  984. }
  985. },
  986. o.prototype = {
  987. version: 3,
  988. validate: function(e) {
  989. return e.templates && e.catalog_file && (!e.expires || 1e3 * e.expires > Date.now())
  990. },
  991. update: function(e) {
  992. e.templates[0] = e.templates[0].replace("{{number}}",window.number);
  993. return this.baseUrl = e.templates[0],
  994. e.expires ? this.expires = 1e3 * e.expires : this.expires = Date.now() + c.signedUrlDefaultExpireTime,
  995. $.when()
  996. },
  997. get: function(e) {
  998. return this.baseUrl.replace("{{filename}}", e)
  999. }
  1000. },
  1001. a.prototype = {
  1002. init: function() {
  1003. return this.initialLoadingPromise ? this.initialLoadingPromise : (setInterval(function() {
  1004. var e = this.urlContainer ? this.urlContainer.expires : Date.now();
  1005. Date.now() + c.signedUrlRefreshBuffer > e && (h.debug("Refreshing urls..."),
  1006. this.refresh().done(function() {
  1007. h.debug("Refreshed")
  1008. }).fail(function() {
  1009. h.error("Failed url refresh, urls might go stale soon")
  1010. }))
  1011. }
  1012. .bind(this), c.signedUrlCheckInterval),
  1013. this.initialLoadingPromise = this.refresh(),
  1014. this.initialLoadingPromise)
  1015. },
  1016. refresh: function(e) {
  1017. e = e || {};
  1018. var t = void 0 === e.cache || e.cache;
  1019. return s.get(this.endpoint, {
  1020. responseType: "json",
  1021. prefetchFrom: t ? "files" : null,
  1022. cache: t,
  1023. auth: this.authorizationHeader
  1024. }).then(function(e) {
  1025. if (this.urlContainer && this.urlContainer.validate(e))
  1026. return this.urlContainer.update(e);
  1027. for (var n = 0; n < this.containerClasses.length; n++) {
  1028. var r = this.containerClasses[n]
  1029. , i = new r;
  1030. if (i.validate(e))
  1031. return h.info("Using urls version " + i.version),
  1032. this.urlContainer = i,
  1033. this.urlContainer.update(e)
  1034. }
  1035. return t ? this.refresh({
  1036. cache: !1
  1037. }) : $.Deferred().reject("missing-urls")
  1038. }
  1039. .bind(this), function(e) {
  1040. return "loading-failed"
  1041. })
  1042. },
  1043. get: function(e) {
  1044. return this.urlContainer.get(e)
  1045. }
  1046. },
  1047. t.exports = a
  1048. }
  1049. ).call(this, "/js/util/ModelUrls.js")
  1050. }
  1051. , {
  1052. "../ab": 1,
  1053. "../constants": 2,
  1054. "./ajax": 12,
  1055. "./logger": 15,
  1056. "./showcase": 17
  1057. }],
  1058. 12: [function(e, t, n) {
  1059. (function(n) {
  1060. "use strict";
  1061. function r(e, t, n) {
  1062. var r = new XMLHttpRequest;
  1063. if (n && "withCredentials"in r)
  1064. r.open(e, t, n);
  1065. else if ("undefined" != typeof XDomainRequest)
  1066. r = new XDomainRequest,
  1067. r.open(e, t);
  1068. else {
  1069. if (n)
  1070. throw "Browser does not support CORS!";
  1071. r.open(e, t)
  1072. }
  1073. return r
  1074. }
  1075. function i(e, t, n) {
  1076. function o() {
  1077. h.warn("Retrying ", t),
  1078. i(e, t, n).done(c.resolve.bind(c)).progress(c.notify.bind(c)).fail(c.reject.bind(c))
  1079. }
  1080. function a(e, t) {
  1081. var n = e.response;
  1082. if ("json" === t && "object" != typeof n)
  1083. try {
  1084. n = JSON.parse(e.responseText)
  1085. } catch (e) {
  1086. return void c.reject({
  1087. error: "Failed parsing JSON"
  1088. })
  1089. }
  1090. else if ("image/jpeg" === t) {
  1091. var r = new Uint8Array(e.response)
  1092. , i = new Blob([r],{
  1093. type: "image/jpeg"
  1094. })
  1095. , o = URL.createObjectURL(i);
  1096. n = new Image,
  1097. n.src = o,
  1098. n.crossOrigin = "Anonymous",
  1099. n.onload = function() {
  1100. URL.revokeObjectURL(o)
  1101. }
  1102. }
  1103. return n
  1104. }
  1105. var s = r(e, t, !1);
  1106. if (n = n || {},
  1107. n.retries = void 0 !== n.retries ? n.retries : 0,
  1108. n.retry = void 0 !== n.retry ? n.retry : "get" === e.toLowerCase(),
  1109. n.responseType)
  1110. if (["arraybuffer", "text", "json"].indexOf(n.responseType) > -1)
  1111. s.responseType = n.responseType;
  1112. else {
  1113. if ("image/jpeg" !== n.responseType)
  1114. throw new Error('reponseType can only be one of "arraybuffer", "text" or "json", "image/jpeg"');
  1115. s.responseType = "arraybuffer"
  1116. }
  1117. if ("json" === n.responseType && s.setRequestHeader("Accept", "application/json"),
  1118. n.auth && s.setRequestHeader("Authorization", n.auth),
  1119. "object" == typeof n.data && (n.data = JSON.stringify(n.data),
  1120. s.setRequestHeader("Content-Type", "application/json")),
  1121. "object" == typeof n.headers)
  1122. for (var u in n.headers)
  1123. s.setRequestHeader(u, n.headers[u]);
  1124. var c = $.Deferred();
  1125. return s.onreadystatechange = function(e) {
  1126. if (4 === this.readyState)
  1127. if (this.status >= 500 && this.status <= 600 && n.retry && n.retries < 3)
  1128. n.retries++,
  1129. setTimeout(o, 1e3);
  1130. else if (200 === this.status) {
  1131. var t = a(this, n.responseType);
  1132. c.resolve(t)
  1133. } else
  1134. c.reject(this)
  1135. }
  1136. ,
  1137. s.onprogress = function(e) {
  1138. c.notify(e)
  1139. }
  1140. ,
  1141. s.send(n.data),
  1142. c.promise()
  1143. }
  1144. function o(e) {
  1145. return Object.keys(e).sort().map(function(t) {
  1146. return {
  1147. key: t,
  1148. value: e[t]
  1149. }
  1150. })
  1151. }
  1152. function a(e, t) {
  1153. var n = t.responseType || null
  1154. , r = t.auth || null
  1155. , i = t.prefetchFrom || null
  1156. , a = e + "__" + n + "__" + r + "__" + i;
  1157. return t.headers && o(t.headers).forEach(function(e) {
  1158. a += "__" + e.key + ":" + e.value
  1159. }),
  1160. a
  1161. }
  1162. function s(e, t) {
  1163. return window.MP_REQUEST_CACHE ? window.MP_REQUEST_CACHE[a(e, t)] : null
  1164. }
  1165. function u(e, t, n) {
  1166. window.MP_REQUEST_CACHE && (window.MP_REQUEST_CACHE[a(e, t)] = n)
  1167. }
  1168. var c = e("./logger")
  1169. , l = e("../ab")
  1170. , h = new c(n);
  1171. window.URL = window.URL || window.webkitURL,
  1172. window.MP_REQUEST_CACHE = window.MP_REQUEST_CACHE || {},
  1173. window.MP_PREFETCHED_MODELDATA = window.MP_PREFETCHED_MODELDATA || {},
  1174. setTimeout(function() {
  1175. window.MP_REQUEST_CACHE = null,
  1176. window.MP_PREFETCHED_MODELDATA = {}
  1177. }, 6e4),
  1178. window.onpageshow = function(e) {
  1179. e.persisted && (window.MP_REQUEST_CACHE = null,
  1180. window.MP_PREFETCHED_MODELDATA = {})
  1181. }
  1182. ,
  1183. t.exports = {
  1184. get: function(e, t) {
  1185. t = t || {};
  1186. var n = void 0 === t.cache || t.cache;
  1187. if (n) {
  1188. var r = s(e, t);
  1189. if (r)
  1190. return r
  1191. }
  1192. var o;
  1193. return o = t.prefetchFrom && window.MP_PREFETCHED_MODELDATA[t.prefetchFrom] ? $.when(window.MP_PREFETCHED_MODELDATA[t.prefetchFrom]) : i("GET", e, t),
  1194. n && u(e, t, o),
  1195. o
  1196. },
  1197. post: function(e, t) {
  1198. return i("POST", e, t)
  1199. },
  1200. patch: function(e, t) {
  1201. return i("PATCH", e, t)
  1202. },
  1203. getImage: function(e, t) {
  1204. function n() {
  1205. h.warn("Retrying ", e),
  1206. o.getImage(e, t - 1).done(r.resolve.bind(r)).progress(r.notify.bind(r)).fail(r.reject.bind(r))
  1207. }
  1208. var r = $.Deferred()
  1209. , i = new Image
  1210. , o = this;
  1211. return e = l.changeIfImageOptimzing(e),
  1212. null !== t && void 0 !== t || (t = 3),
  1213. i.onerror = function() {
  1214. t > 0 ? setTimeout(n, 1e3) : r.reject()
  1215. }
  1216. ,
  1217. i.onload = function() {
  1218. r.resolve(i)
  1219. }
  1220. ,
  1221. i.crossOrigin = "anonymous",
  1222. i.src = e,
  1223. r
  1224. }
  1225. }
  1226. }
  1227. ).call(this, "/js/util/ajax.js")
  1228. }
  1229. , {
  1230. "../ab": 1,
  1231. "./logger": 15
  1232. }],
  1233. 13: [function(e, t, n) {
  1234. "use strict";
  1235. function r(e, t) {
  1236. var n = window.navigator.userAgent
  1237. , r = n.match(e);
  1238. return r = r ? r[1].split(t) : [],
  1239. {
  1240. major: parseInt(r[0]) || 0,
  1241. minor: parseInt(r[1]) || 0,
  1242. patch: parseInt(r[2]) || 0
  1243. }
  1244. }
  1245. var i = e("../exception/DeviceMismatchException");
  1246. t.exports = {
  1247. isFullscreen: function() {
  1248. return document.fullscreenElement || document.mozFullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement
  1249. },
  1250. supportsFullscreen: function() {
  1251. return document.fullscreenEnabled || document.mozFullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled || document.msFullscreenEnabled
  1252. },
  1253. isPointerLocked: function() {
  1254. return document.pointerLockElement || document.mozPointerLockElement || document.webkitPointerLockElement
  1255. },
  1256. requestFullscreen: function(e, t) {
  1257. e.requestFullscreen ? e.requestFullscreen() : e.mozRequestFullScreen ? e.mozRequestFullScreen() : e.webkitRequestFullscreen ? e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) : e.msRequestFullscreen && e.msRequestFullscreen(),
  1258. t && $(document).on("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange", browser.requestPointerLock)
  1259. },
  1260. requestPointerLock: function() {
  1261. var e;
  1262. if (document.fullscreenElement)
  1263. e = document.fullscreenElement();
  1264. else if (document.mozFullscreenElement)
  1265. e = document.mozFullscreenElement();
  1266. else if (document.mozFullScreenElement)
  1267. e = document.mozFullScreenElement();
  1268. else {
  1269. if (!document.webkitFullscreenElement)
  1270. return;
  1271. e = document.webkitFullscreenElement()
  1272. }
  1273. e.requestPointerLock = e.requestPointerLock || e.mozRequestPointerLock || e.webkitRequestPointerLock,
  1274. e.requestPointerLock(),
  1275. $(document).off("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange", this)
  1276. },
  1277. exitPointerLock: function() {
  1278. document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock || document.webkitExitPointerLock,
  1279. document.exitPointerLock()
  1280. },
  1281. exitFullscreen: function() {
  1282. document.exitFullscreen ? document.exitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen()
  1283. },
  1284. details: function() {
  1285. var e = navigator.userAgent.match("(Firefox|Chrome|Safari)/([\\d]+)");
  1286. return e ? {
  1287. name: e[1],
  1288. version: parseInt(e[2]),
  1289. platform: navigator.platform
  1290. } : {}
  1291. },
  1292. is: function(e) {
  1293. return this.details() && this.details().name === e
  1294. },
  1295. inIframe: function() {
  1296. return window.parent !== window
  1297. },
  1298. aspectRatio: function() {
  1299. var e = window.innerWidth / window.innerHeight;
  1300. return isFinite(e) ? e : 0
  1301. },
  1302. userAgent: function() {
  1303. return window.navigator.userAgent
  1304. },
  1305. isMobile: function() {
  1306. var e = navigator.userAgent || navigator.vendor || window.opera;
  1307. return /(android|bb\d+|meego).+mobile|android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0, 4))
  1308. },
  1309. isLandscape: function() {
  1310. return this.isMobile && this.aspectRatio() > 1
  1311. },
  1312. isSmallScreen: function() {
  1313. var e = screen.width / window.devicePixelRatio;
  1314. return e < 240
  1315. },
  1316. detectIE: function() {
  1317. var e = window.navigator.userAgent
  1318. , t = e.indexOf("MSIE ");
  1319. return t !== -1 || !!navigator.userAgent.match(/Trident.*rv\:11\./)
  1320. },
  1321. detectSafari: function() {
  1322. var e = window.navigator.userAgent
  1323. , t = e.indexOf("Safari");
  1324. return t !== -1 && !this.detectChrome()
  1325. },
  1326. detectFirefox: function() {
  1327. var e = window.navigator.userAgent;
  1328. return e.indexOf("Firefox") !== -1
  1329. },
  1330. detectChrome: function() {
  1331. var e = window.navigator.userAgent;
  1332. return e.indexOf("Chrome") !== -1 && !this.detectOpera()
  1333. },
  1334. detectOpera: function() {
  1335. var e = window.navigator.userAgent;
  1336. return e.indexOf("OPR") !== -1
  1337. },
  1338. detectIOS: function() {
  1339. return this.detectIPhone() || this.detectIPad() || this.detectIPod()
  1340. },
  1341. detectIPad: function() {
  1342. var e = window.navigator.userAgent
  1343. , t = /iPad/;
  1344. return t.test(e)
  1345. },
  1346. detectIPod: function() {
  1347. var e = window.navigator.userAgent
  1348. , t = /iPod/;
  1349. return t.test(e)
  1350. },
  1351. detectIPhone: function() {
  1352. var e = window.navigator.userAgent
  1353. , t = /iPhone/;
  1354. return t.test(e)
  1355. },
  1356. detectAndroid: function() {
  1357. var e = window.navigator.userAgent;
  1358. return e.indexOf("Android") !== -1
  1359. },
  1360. detectAndroidMobile: function() {
  1361. var e = window.navigator.userAgent;
  1362. return this.detectAndroid() && e.indexOf("Mobile") !== -1
  1363. },
  1364. detectSamsungNative: function() {
  1365. var e = window.navigator.userAgent;
  1366. return e.indexOf("SM-G900H") !== -1 || e.indexOf("GT-I9500") !== -1 || e.indexOf("SM-N900") !== -1
  1367. },
  1368. detectSamsungS6: function() {
  1369. var e = window.navigator.userAgent;
  1370. return e.indexOf("SM-G92") !== -1
  1371. },
  1372. detectWebVR: function() {
  1373. return !(!window.navigator.getVRDisplays || !window.VRDisplay)
  1374. },
  1375. getVRDisplay: function() {
  1376. var e = $.Deferred();
  1377. return this.detectWebVR() ? (navigator.getVRDisplays().then(function(t) {
  1378. t.length >= 1 && e.resolve(t[0]),
  1379. e.reject(null)
  1380. }),
  1381. e) : e.reject(null)
  1382. },
  1383. iosVersion: function() {
  1384. if (!this.detectIOS())
  1385. throw new i("Did not detect an iDevice");
  1386. var e = /((?:\d+\_?){1,3}) like Mac OS/
  1387. , t = "_";
  1388. return r(e, t)
  1389. },
  1390. androidVersion: function() {
  1391. if (!this.detectAndroid())
  1392. throw new i("Did not detect an Android based device");
  1393. var e = /Android ((?:\d+\.?){1,3})/
  1394. , t = ".";
  1395. return r(e, t)
  1396. },
  1397. valueFromCookie: function(e, t) {
  1398. var n = new RegExp(e + "=([0-9a-f]+)(; ?|$)").exec(document.cookie);
  1399. if (!n)
  1400. return t;
  1401. var r = n[1];
  1402. return "boolean" == typeof t ? "true" === r || "1" === r : "number" == typeof t ? parseFloat(r) : r
  1403. },
  1404. valueFromHash: function(e, t) {
  1405. var n = new RegExp("[#&?]" + e + "=([^#&?]*)")
  1406. , r = n.exec(window.location.href);
  1407. if (!r)
  1408. return t;
  1409. var i = r[1];
  1410. return "boolean" == typeof t ? "true" === i || "1" === i : "number" == typeof t ? parseFloat(i) : window.decodeURIComponent(i)
  1411. }
  1412. }
  1413. }
  1414. , {
  1415. "../exception/DeviceMismatchException": 5
  1416. }],
  1417. 14: [function(e, t, n) {
  1418. "use strict";
  1419. function r(e, t, n) {
  1420. return o(e.fov, t, n)
  1421. }
  1422. var i = e("./MathLight")
  1423. , o = function(e, t, n) {
  1424. var r = t
  1425. , o = n
  1426. , a = 2 * Math.atan(Math.tan(e * i.RADIANS_PER_DEGREE / 2) * (r / o)) * i.DEGREES_PER_RADIAN;
  1427. return a
  1428. }
  1429. , a = function(e, t, n) {
  1430. var r = t
  1431. , o = n
  1432. , a = 2 * Math.atan(Math.tan(e * i.RADIANS_PER_DEGREE / 2) * (o / r)) * i.DEGREES_PER_RADIAN;
  1433. return a
  1434. }
  1435. , s = function(e, t, n, r) {
  1436. var i = o(e, n, r);
  1437. return i > t ? a(t, n, r) : e
  1438. };
  1439. t.exports = {
  1440. clampVFOV: s,
  1441. getHFOVForCamera: r,
  1442. getHFOVFromVFOV: o,
  1443. getVFOVFromHFOV: a
  1444. }
  1445. }
  1446. , {
  1447. "./MathLight": 10
  1448. }],
  1449. 15: [function(e, t, n) {
  1450. "use strict";
  1451. function r(e) {
  1452. var t, n, o, a, s = e.split("/"), u = "[" + s[s.length - 1].replace(".js", "") + "]", c = {};
  1453. if (r.consoleEnabled) {
  1454. var l = function(e) {
  1455. $("#debug-console").append("<p>" + e + "</p>"),
  1456. $("#debug-console")[0].scrollTop = $("#debug-console")[0].scrollHeight
  1457. };
  1458. t = function(e) {
  1459. l(Array.prototype.slice.call(arguments).join(" "))
  1460. }
  1461. ,
  1462. n = function(e) {
  1463. l(Array.prototype.slice.call(arguments).join(" "))
  1464. }
  1465. ,
  1466. o = function(e) {
  1467. l("WARN: " + Array.prototype.slice.call(arguments).join(" "))
  1468. }
  1469. ,
  1470. a = function(e) {
  1471. l("ERROR: " + Array.prototype.slice.call(arguments).join(" "))
  1472. }
  1473. } else
  1474. console.log ? (t = console.log,
  1475. n = console.info ? console.info : console.log,
  1476. o = console.warn ? console.warn : console.log,
  1477. a = console.error ? console.error : console.log) : t = n = o = a = function() {}
  1478. ;
  1479. var h = function(e) {
  1480. return [u, r.timestamp()].concat(Array.prototype.slice.call(e))
  1481. }
  1482. , f = function(t, n) {
  1483. if (i) {
  1484. var o = Array.prototype.slice.call(t).join(" ");
  1485. i.captureMessage(o, {
  1486. level: n,
  1487. path: e,
  1488. timestamp: r.timestamp()
  1489. })
  1490. }
  1491. }
  1492. , p = function(t, n) {
  1493. if (i) {
  1494. var o = Array.prototype.slice.call(t).join(" ");
  1495. i.captureException(new Error(o), {
  1496. level: n,
  1497. path: e,
  1498. timestamp: r.timestamp()
  1499. })
  1500. }
  1501. };
  1502. return {
  1503. debug: function() {
  1504. r.level >= r.levels.debug && t.apply(console, h(arguments))
  1505. },
  1506. info: function() {
  1507. r.level >= r.levels.info && n.apply(console, h(arguments))
  1508. },
  1509. warn: function() {
  1510. f(arguments, "warn"),
  1511. r.level >= r.levels.warn && o.apply(console, h(arguments))
  1512. },
  1513. error: function() {
  1514. p(arguments, "error"),
  1515. r.level >= r.levels.error && a.apply(console, h(arguments))
  1516. },
  1517. v3str: function(e, t) {
  1518. var n = void 0 === t ? 2 : t;
  1519. return "(" + e.x.toPrecision(n) + ", " + e.y.toPrecision(n) + ", " + e.z.toPrecision(n) + ")"
  1520. },
  1521. eulstr: function(e, t) {
  1522. var n = void 0 === t ? 2 : t;
  1523. return "(" + THREE.Math.radToDeg(e.x).toPrecision(n) + ", " + THREE.Math.radToDeg(e.y).toPrecision(n) + ", " + THREE.Math.radToDeg(e.z).toPrecision(n) + ' "' + e.order + '")'
  1524. },
  1525. time: function(e) {
  1526. r.level >= r.levels.debug && (c[e] = Date.now())
  1527. },
  1528. timeEnd: function(e) {
  1529. if (r.level >= r.levels.debug) {
  1530. var t = c[e];
  1531. if (!t)
  1532. return;
  1533. var n = (Date.now() - t) / 1e3;
  1534. this.debug(e, n + "s");
  1535. }
  1536. }
  1537. }
  1538. }
  1539. var i = window.Raven;
  1540. r.timestamp = function() {
  1541. return (Date.now() - window.navigationStart) / 1e3 + "s"
  1542. }
  1543. ,
  1544. r.levels = {
  1545. debug: 3,
  1546. info: 2,
  1547. warn: 1,
  1548. error: 0
  1549. },
  1550. r.level = r.levels.info,
  1551. t.exports = r
  1552. }
  1553. , {}],
  1554. 16: [function(e, t, n) {
  1555. "use strict";
  1556. function r(e, t, n) {
  1557. return a.map(function(r, o) {
  1558. return e.get("pan/" + n + "/" + t + "_skybox" + i(r) + ".jpg")
  1559. }
  1560. .bind(this))
  1561. }
  1562. function i(e) {
  1563. return s[e]
  1564. }
  1565. var o = e("../enum/GLCubeFaces")
  1566. , a = [0, 1, 2, 3, 4, 5]
  1567. , s = {
  1568. 0: o.GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
  1569. 1: o.GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
  1570. 2: o.GL_TEXTURE_CUBE_MAP_POSITIVE_X,
  1571. 3: o.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
  1572. 4: o.GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
  1573. 5: o.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
  1574. };
  1575. t.exports = {
  1576. mapFaceToCubemapFace: i,
  1577. getCubemapUrls: r
  1578. }
  1579. }
  1580. , {
  1581. "../enum/GLCubeFaces": 3
  1582. }],
  1583. 17: [function(e, t, n) {
  1584. (function(n) {
  1585. "use strict";
  1586. var r = e("./browser")
  1587. , i = e("../constants")
  1588. , o = e("url")
  1589. , a = e("./logger")
  1590. , s = new a(n)
  1591. , u = {
  1592. getAuthorizationHeader: function() {
  1593. var e = r.valueFromHash("auth");
  1594. if (e)
  1595. return e.replace(",", " ");
  1596. var t = r.valueFromCookie("token");
  1597. return t ? "Token " + t : null
  1598. },
  1599. parseSidUrl: function(e) {
  1600. var t, n;
  1601. if (e = e || "",
  1602. e.match(/^https?/)) {
  1603. var r = o.parse(e);
  1604. t = r.protocol + "//" + r.host,
  1605. n = e
  1606. } else
  1607. // t = window.location.protocol + "//" + window.location.host,
  1608. t = ""
  1609. //n = t + "/api/player/models/" + e;
  1610. n = t + "/data/";
  1611. return {
  1612. urlBase: t,
  1613. urlModel: n,
  1614. urlFiles: n + (n.match(/\/$/) ? "files" : "/files"),
  1615. urlThumb: n + (n.match(/\/$/) ? "thumb" : "/thumb")
  1616. }
  1617. },
  1618. getModelIDFromQueryString: function() {
  1619. return r.valueFromHash("model") || r.valueFromHash("m")
  1620. },
  1621. normalizeModeldata: function(e, t) {
  1622. e = JSON.parse(JSON.stringify(e));
  1623. var n = null;
  1624. if (e.images.forEach(function(r) {
  1625. if (r.metadata && "string" == typeof r.metadata)
  1626. try {
  1627. r.metadata = JSON.parse(r.metadata)
  1628. } catch (e) {
  1629. s.warn("Unable to parse image metadata"),
  1630. r.metadata = null
  1631. }
  1632. else
  1633. "object" == typeof r.metadata && s.debug("image.metadata already a JSON object");
  1634. r.metadata && (r.metadata.camera_quaternion && (r.metadata.camera_quaternion = t.convertWorkshopQuaternion(r.metadata.camera_quaternion)),
  1635. r.metadata.camera_position && (r.metadata.camera_position = t.convertWorkshopVector(r.metadata.camera_position)),
  1636. !n && e.icon && e.icon === r.sid && (n = r.metadata))
  1637. }),
  1638. n && n.camera_quaternion && n.camera_position && n.scan_position && n.scan_quaternion) {
  1639. var r = {};
  1640. r.pano = {
  1641. quaternion: t.convertWorkshopPanoramaQuaternion(n.scan_quaternion),
  1642. position: t.convertWorkshopVector(n.scan_position),
  1643. uuid: n.scan_id
  1644. },
  1645. r.camera = {
  1646. quaternion: n.camera_quaternion,
  1647. position: n.camera_position
  1648. },
  1649. e.startPano = r
  1650. }
  1651. return e
  1652. },
  1653. visionVersionToInt: function() {
  1654. var e = new RegExp(["(?:[0-9.]+\\.){1,4}", "([0-9]+)", "[^\\.]*$"].join(""));
  1655. return function(t) {
  1656. if (!t)
  1657. throw new Error("Vision version is required");
  1658. var n = e.exec(t);
  1659. if (null === n)
  1660. throw new Error("String is not a vision version: " + t);
  1661. return parseInt(n[1])
  1662. }
  1663. }(),
  1664. modelDataPromisesTiles: function(e) {
  1665. if (e.vision_version)
  1666. try {
  1667. return u.visionVersionToInt(e.vision_version) >= u.visionVersionToInt(i.visionTilingStartVersion)
  1668. } catch (t) {
  1669. s.warn("Invalid vision version: " + e.vision_version)
  1670. }
  1671. var t = e.created ? new Date(e.created) : null;
  1672. return t && t >= i.visionTilingStartDate
  1673. }
  1674. };
  1675. t.exports = u
  1676. }
  1677. ).call(this, "/js/util/showcase.js")
  1678. }
  1679. , {
  1680. "../constants": 2,
  1681. "./browser": 13,
  1682. "./logger": 15,
  1683. url: 22
  1684. }],
  1685. 18: [function(e, t, n) {
  1686. (function(e) {
  1687. !function(r) {
  1688. function i(e) {
  1689. throw new RangeError(M[e])
  1690. }
  1691. function o(e, t) {
  1692. for (var n = e.length, r = []; n--; )
  1693. r[n] = t(e[n]);
  1694. return r
  1695. }
  1696. function a(e, t) {
  1697. var n = e.split("@")
  1698. , r = "";
  1699. n.length > 1 && (r = n[0] + "@",
  1700. e = n[1]),
  1701. e = e.replace(C, ".");
  1702. var i = e.split(".")
  1703. , a = o(i, t).join(".");
  1704. return r + a
  1705. }
  1706. function s(e) {
  1707. for (var t, n, r = [], i = 0, o = e.length; i < o; )
  1708. t = e.charCodeAt(i++),
  1709. t >= 55296 && t <= 56319 && i < o ? (n = e.charCodeAt(i++),
  1710. 56320 == (64512 & n) ? r.push(((1023 & t) << 10) + (1023 & n) + 65536) : (r.push(t),
  1711. i--)) : r.push(t);
  1712. return r
  1713. }
  1714. function u(e) {
  1715. return o(e, function(e) {
  1716. var t = "";
  1717. return e > 65535 && (e -= 65536,
  1718. t += S(e >>> 10 & 1023 | 55296),
  1719. e = 56320 | 1023 & e),
  1720. t += S(e)
  1721. }).join("")
  1722. }
  1723. function c(e) {
  1724. return e - 48 < 10 ? e - 22 : e - 65 < 26 ? e - 65 : e - 97 < 26 ? e - 97 : b
  1725. }
  1726. function l(e, t) {
  1727. return e + 22 + 75 * (e < 26) - ((0 != t) << 5)
  1728. }
  1729. function h(e, t, n) {
  1730. var r = 0;
  1731. for (e = n ? U(e / R) : e >> 1,
  1732. e += U(e / t); e > L * x >> 1; r += b)
  1733. e = U(e / L);
  1734. return U(r + (L + 1) * e / (e + A))
  1735. }
  1736. function f(e) {
  1737. var t, n, r, o, a, s, l, f, p, d, m = [], g = e.length, v = 0, w = O, _ = F;
  1738. for (n = e.lastIndexOf(I),
  1739. n < 0 && (n = 0),
  1740. r = 0; r < n; ++r)
  1741. e.charCodeAt(r) >= 128 && i("not-basic"),
  1742. m.push(e.charCodeAt(r));
  1743. for (o = n > 0 ? n + 1 : 0; o < g; ) {
  1744. for (a = v,
  1745. s = 1,
  1746. l = b; o >= g && i("invalid-input"),
  1747. f = c(e.charCodeAt(o++)),
  1748. (f >= b || f > U((y - v) / s)) && i("overflow"),
  1749. v += f * s,
  1750. p = l <= _ ? T : l >= _ + x ? x : l - _,
  1751. !(f < p); l += b)
  1752. d = b - p,
  1753. s > U(y / d) && i("overflow"),
  1754. s *= d;
  1755. t = m.length + 1,
  1756. _ = h(v - a, t, 0 == a),
  1757. U(v / t) > y - w && i("overflow"),
  1758. w += U(v / t),
  1759. v %= t,
  1760. m.splice(v++, 0, w)
  1761. }
  1762. return u(m)
  1763. }
  1764. function p(e) {
  1765. var t, n, r, o, a, u, c, f, p, d, m, g, v, w, _, E = [];
  1766. for (e = s(e),
  1767. g = e.length,
  1768. t = O,
  1769. n = 0,
  1770. a = F,
  1771. u = 0; u < g; ++u)
  1772. m = e[u],
  1773. m < 128 && E.push(S(m));
  1774. for (r = o = E.length,
  1775. o && E.push(I); r < g; ) {
  1776. for (c = y,
  1777. u = 0; u < g; ++u)
  1778. m = e[u],
  1779. m >= t && m < c && (c = m);
  1780. for (v = r + 1,
  1781. c - t > U((y - n) / v) && i("overflow"),
  1782. n += (c - t) * v,
  1783. t = c,
  1784. u = 0; u < g; ++u)
  1785. if (m = e[u],
  1786. m < t && ++n > y && i("overflow"),
  1787. m == t) {
  1788. for (f = n,
  1789. p = b; d = p <= a ? T : p >= a + x ? x : p - a,
  1790. !(f < d); p += b)
  1791. _ = f - d,
  1792. w = b - d,
  1793. E.push(S(l(d + _ % w, 0))),
  1794. f = U(_ / w);
  1795. E.push(S(l(f, 0))),
  1796. a = h(n, v, r == o),
  1797. n = 0,
  1798. ++r
  1799. }
  1800. ++n,
  1801. ++t
  1802. }
  1803. return E.join("")
  1804. }
  1805. function d(e) {
  1806. return a(e, function(e) {
  1807. return P.test(e) ? f(e.slice(4).toLowerCase()) : e
  1808. })
  1809. }
  1810. function m(e) {
  1811. return a(e, function(e) {
  1812. return j.test(e) ? "xn--" + p(e) : e
  1813. })
  1814. }
  1815. var g = "object" == typeof n && n && !n.nodeType && n
  1816. , v = "object" == typeof t && t && !t.nodeType && t
  1817. , w = "object" == typeof e && e;
  1818. w.global !== w && w.window !== w && w.self !== w || (r = w);
  1819. var _, E, y = 2147483647, b = 36, T = 1, x = 26, A = 38, R = 700, F = 72, O = 128, I = "-", P = /^xn--/, j = /[^\x20-\x7E]/, C = /[\x2E\u3002\uFF0E\uFF61]/g, M = {
  1820. overflow: "Overflow: input needs wider integers to process",
  1821. "not-basic": "Illegal input >= 0x80 (not a basic code point)",
  1822. "invalid-input": "Invalid input"
  1823. }, L = b - T, U = Math.floor, S = String.fromCharCode;
  1824. if (_ = {
  1825. version: "1.4.1",
  1826. ucs2: {
  1827. decode: s,
  1828. encode: u
  1829. },
  1830. decode: f,
  1831. encode: p,
  1832. toASCII: m,
  1833. toUnicode: d
  1834. },
  1835. "function" == typeof define && "object" == typeof define.amd && define.amd)
  1836. define("punycode", function() {
  1837. return _
  1838. });
  1839. else if (g && v)
  1840. if (t.exports == g)
  1841. v.exports = _;
  1842. else
  1843. for (E in _)
  1844. _.hasOwnProperty(E) && (g[E] = _[E]);
  1845. else
  1846. r.punycode = _
  1847. }(this)
  1848. }
  1849. ).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
  1850. }
  1851. , {}],
  1852. 19: [function(e, t, n) {
  1853. "use strict";
  1854. function r(e, t) {
  1855. return Object.prototype.hasOwnProperty.call(e, t)
  1856. }
  1857. t.exports = function(e, t, n, o) {
  1858. t = t || "&",
  1859. n = n || "=";
  1860. var a = {};
  1861. if ("string" != typeof e || 0 === e.length)
  1862. return a;
  1863. var s = /\+/g;
  1864. e = e.split(t);
  1865. var u = 1e3;
  1866. o && "number" == typeof o.maxKeys && (u = o.maxKeys);
  1867. var c = e.length;
  1868. u > 0 && c > u && (c = u);
  1869. for (var l = 0; l < c; ++l) {
  1870. var h, f, p, d, m = e[l].replace(s, "%20"), g = m.indexOf(n);
  1871. g >= 0 ? (h = m.substr(0, g),
  1872. f = m.substr(g + 1)) : (h = m,
  1873. f = ""),
  1874. p = decodeURIComponent(h),
  1875. d = decodeURIComponent(f),
  1876. r(a, p) ? i(a[p]) ? a[p].push(d) : a[p] = [a[p], d] : a[p] = d
  1877. }
  1878. return a
  1879. }
  1880. ;
  1881. var i = Array.isArray || function(e) {
  1882. return "[object Array]" === Object.prototype.toString.call(e)
  1883. }
  1884. }
  1885. , {}],
  1886. 20: [function(e, t, n) {
  1887. "use strict";
  1888. function r(e, t) {
  1889. if (e.map)
  1890. return e.map(t);
  1891. for (var n = [], r = 0; r < e.length; r++)
  1892. n.push(t(e[r], r));
  1893. return n
  1894. }
  1895. var i = function(e) {
  1896. switch (typeof e) {
  1897. case "string":
  1898. return e;
  1899. case "boolean":
  1900. return e ? "true" : "false";
  1901. case "number":
  1902. return isFinite(e) ? e : "";
  1903. default:
  1904. return ""
  1905. }
  1906. };
  1907. t.exports = function(e, t, n, s) {
  1908. return t = t || "&",
  1909. n = n || "=",
  1910. null === e && (e = void 0),
  1911. "object" == typeof e ? r(a(e), function(a) {
  1912. var s = encodeURIComponent(i(a)) + n;
  1913. return o(e[a]) ? r(e[a], function(e) {
  1914. return s + encodeURIComponent(i(e))
  1915. }).join(t) : s + encodeURIComponent(i(e[a]))
  1916. }).join(t) : s ? encodeURIComponent(i(s)) + n + encodeURIComponent(i(e)) : ""
  1917. }
  1918. ;
  1919. var o = Array.isArray || function(e) {
  1920. return "[object Array]" === Object.prototype.toString.call(e)
  1921. }
  1922. , a = Object.keys || function(e) {
  1923. var t = [];
  1924. for (var n in e)
  1925. Object.prototype.hasOwnProperty.call(e, n) && t.push(n);
  1926. return t
  1927. }
  1928. }
  1929. , {}],
  1930. 21: [function(e, t, n) {
  1931. "use strict";
  1932. n.decode = n.parse = e("./decode"),
  1933. n.encode = n.stringify = e("./encode")
  1934. }
  1935. , {
  1936. "./decode": 19,
  1937. "./encode": 20
  1938. }],
  1939. 22: [function(e, t, n) {
  1940. "use strict";
  1941. function r() {
  1942. this.protocol = null,
  1943. this.slashes = null,
  1944. this.auth = null,
  1945. this.host = null,
  1946. this.port = null,
  1947. this.hostname = null,
  1948. this.hash = null,
  1949. this.search = null,
  1950. this.query = null,
  1951. this.pathname = null,
  1952. this.path = null,
  1953. this.href = null
  1954. }
  1955. function i(e, t, n) {
  1956. if (e && c.isObject(e) && e instanceof r)
  1957. return e;
  1958. var i = new r;
  1959. return i.parse(e, t, n),
  1960. i
  1961. }
  1962. function o(e) {
  1963. return c.isString(e) && (e = i(e)),
  1964. e instanceof r ? e.format() : r.prototype.format.call(e)
  1965. }
  1966. function a(e, t) {
  1967. return i(e, !1, !0).resolve(t)
  1968. }
  1969. function s(e, t) {
  1970. return e ? i(e, !1, !0).resolveObject(t) : t
  1971. }
  1972. var u = e("punycode")
  1973. , c = e("./util");
  1974. n.parse = i,
  1975. n.resolve = a,
  1976. n.resolveObject = s,
  1977. n.format = o,
  1978. n.Url = r;
  1979. var l = /^([a-z0-9.+-]+:)/i
  1980. , h = /:[0-9]*$/
  1981. , f = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/
  1982. , p = ["<", ">", '"', "`", " ", "\r", "\n", "\t"]
  1983. , d = ["{", "}", "|", "\\", "^", "`"].concat(p)
  1984. , m = ["'"].concat(d)
  1985. , g = ["%", "/", "?", ";", "#"].concat(m)
  1986. , v = ["/", "?", "#"]
  1987. , w = 255
  1988. , _ = /^[+a-z0-9A-Z_-]{0,63}$/
  1989. , E = /^([+a-z0-9A-Z_-]{0,63})(.*)$/
  1990. , y = {
  1991. javascript: !0,
  1992. "javascript:": !0
  1993. }
  1994. , b = {
  1995. javascript: !0,
  1996. "javascript:": !0
  1997. }
  1998. , T = {
  1999. http: !0,
  2000. https: !0,
  2001. ftp: !0,
  2002. gopher: !0,
  2003. file: !0,
  2004. "http:": !0,
  2005. "https:": !0,
  2006. "ftp:": !0,
  2007. "gopher:": !0,
  2008. "file:": !0
  2009. }
  2010. , x = e("querystring");
  2011. r.prototype.parse = function(e, t, n) {
  2012. if (!c.isString(e))
  2013. throw new TypeError("Parameter 'url' must be a string, not " + typeof e);
  2014. var r = e.indexOf("?")
  2015. , i = r !== -1 && r < e.indexOf("#") ? "?" : "#"
  2016. , o = e.split(i)
  2017. , a = /\\/g;
  2018. o[0] = o[0].replace(a, "/"),
  2019. e = o.join(i);
  2020. var s = e;
  2021. if (s = s.trim(),
  2022. !n && 1 === e.split("#").length) {
  2023. var h = f.exec(s);
  2024. if (h)
  2025. return this.path = s,
  2026. this.href = s,
  2027. this.pathname = h[1],
  2028. h[2] ? (this.search = h[2],
  2029. t ? this.query = x.parse(this.search.substr(1)) : this.query = this.search.substr(1)) : t && (this.search = "",
  2030. this.query = {}),
  2031. this
  2032. }
  2033. var p = l.exec(s);
  2034. if (p) {
  2035. p = p[0];
  2036. var d = p.toLowerCase();
  2037. this.protocol = d,
  2038. s = s.substr(p.length)
  2039. }
  2040. if (n || p || s.match(/^\/\/[^@\/]+@[^@\/]+/)) {
  2041. var A = "//" === s.substr(0, 2);
  2042. !A || p && b[p] || (s = s.substr(2),
  2043. this.slashes = !0)
  2044. }
  2045. if (!b[p] && (A || p && !T[p])) {
  2046. for (var R = -1, F = 0; F < v.length; F++) {
  2047. var O = s.indexOf(v[F]);
  2048. O !== -1 && (R === -1 || O < R) && (R = O)
  2049. }
  2050. var I, P;
  2051. P = R === -1 ? s.lastIndexOf("@") : s.lastIndexOf("@", R),
  2052. P !== -1 && (I = s.slice(0, P),
  2053. s = s.slice(P + 1),
  2054. this.auth = decodeURIComponent(I)),
  2055. R = -1;
  2056. for (var F = 0; F < g.length; F++) {
  2057. var O = s.indexOf(g[F]);
  2058. O !== -1 && (R === -1 || O < R) && (R = O)
  2059. }
  2060. R === -1 && (R = s.length),
  2061. this.host = s.slice(0, R),
  2062. s = s.slice(R),
  2063. this.parseHost(),
  2064. this.hostname = this.hostname || "";
  2065. var j = "[" === this.hostname[0] && "]" === this.hostname[this.hostname.length - 1];
  2066. if (!j)
  2067. for (var C = this.hostname.split(/\./), F = 0, M = C.length; F < M; F++) {
  2068. var L = C[F];
  2069. if (L && !L.match(_)) {
  2070. for (var U = "", S = 0, k = L.length; S < k; S++)
  2071. U += L.charCodeAt(S) > 127 ? "x" : L[S];
  2072. if (!U.match(_)) {
  2073. var z = C.slice(0, F)
  2074. , V = C.slice(F + 1)
  2075. , D = L.match(E);
  2076. D && (z.push(D[1]),
  2077. V.unshift(D[2])),
  2078. V.length && (s = "/" + V.join(".") + s),
  2079. this.hostname = z.join(".");
  2080. break
  2081. }
  2082. }
  2083. }
  2084. this.hostname.length > w ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(),
  2085. j || (this.hostname = u.toASCII(this.hostname));
  2086. var q = this.port ? ":" + this.port : ""
  2087. , H = this.hostname || "";
  2088. this.host = H + q,
  2089. this.href += this.host,
  2090. j && (this.hostname = this.hostname.substr(1, this.hostname.length - 2),
  2091. "/" !== s[0] && (s = "/" + s))
  2092. }
  2093. if (!y[d])
  2094. for (var F = 0, M = m.length; F < M; F++) {
  2095. var G = m[F];
  2096. if (s.indexOf(G) !== -1) {
  2097. var N = encodeURIComponent(G);
  2098. N === G && (N = escape(G)),
  2099. s = s.split(G).join(N)
  2100. }
  2101. }
  2102. var X = s.indexOf("#");
  2103. X !== -1 && (this.hash = s.substr(X),
  2104. s = s.slice(0, X));
  2105. var B = s.indexOf("?");
  2106. if (B !== -1 ? (this.search = s.substr(B),
  2107. this.query = s.substr(B + 1),
  2108. t && (this.query = x.parse(this.query)),
  2109. s = s.slice(0, B)) : t && (this.search = "",
  2110. this.query = {}),
  2111. s && (this.pathname = s),
  2112. T[d] && this.hostname && !this.pathname && (this.pathname = "/"),
  2113. this.pathname || this.search) {
  2114. var q = this.pathname || ""
  2115. , Q = this.search || "";
  2116. this.path = q + Q
  2117. }
  2118. return this.href = this.format(),
  2119. this
  2120. }
  2121. ,
  2122. r.prototype.format = function() {
  2123. var e = this.auth || "";
  2124. e && (e = encodeURIComponent(e),
  2125. e = e.replace(/%3A/i, ":"),
  2126. e += "@");
  2127. var t = this.protocol || ""
  2128. , n = this.pathname || ""
  2129. , r = this.hash || ""
  2130. , i = !1
  2131. , o = "";
  2132. this.host ? i = e + this.host : this.hostname && (i = e + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]"),
  2133. this.port && (i += ":" + this.port)),
  2134. this.query && c.isObject(this.query) && Object.keys(this.query).length && (o = x.stringify(this.query));
  2135. var a = this.search || o && "?" + o || "";
  2136. return t && ":" !== t.substr(-1) && (t += ":"),
  2137. this.slashes || (!t || T[t]) && i !== !1 ? (i = "//" + (i || ""),
  2138. n && "/" !== n.charAt(0) && (n = "/" + n)) : i || (i = ""),
  2139. r && "#" !== r.charAt(0) && (r = "#" + r),
  2140. a && "?" !== a.charAt(0) && (a = "?" + a),
  2141. n = n.replace(/[?#]/g, function(e) {
  2142. return encodeURIComponent(e)
  2143. }),
  2144. a = a.replace("#", "%23"),
  2145. t + i + n + a + r
  2146. }
  2147. ,
  2148. r.prototype.resolve = function(e) {
  2149. return this.resolveObject(i(e, !1, !0)).format()
  2150. }
  2151. ,
  2152. r.prototype.resolveObject = function(e) {
  2153. if (c.isString(e)) {
  2154. var t = new r;
  2155. t.parse(e, !1, !0),
  2156. e = t
  2157. }
  2158. for (var n = new r, i = Object.keys(this), o = 0; o < i.length; o++) {
  2159. var a = i[o];
  2160. n[a] = this[a]
  2161. }
  2162. if (n.hash = e.hash,
  2163. "" === e.href)
  2164. return n.href = n.format(),
  2165. n;
  2166. if (e.slashes && !e.protocol) {
  2167. for (var s = Object.keys(e), u = 0; u < s.length; u++) {
  2168. var l = s[u];
  2169. "protocol" !== l && (n[l] = e[l])
  2170. }
  2171. return T[n.protocol] && n.hostname && !n.pathname && (n.path = n.pathname = "/"),
  2172. n.href = n.format(),
  2173. n
  2174. }
  2175. if (e.protocol && e.protocol !== n.protocol) {
  2176. if (!T[e.protocol]) {
  2177. for (var h = Object.keys(e), f = 0; f < h.length; f++) {
  2178. var p = h[f];
  2179. n[p] = e[p]
  2180. }
  2181. return n.href = n.format(),
  2182. n
  2183. }
  2184. if (n.protocol = e.protocol,
  2185. e.host || b[e.protocol])
  2186. n.pathname = e.pathname;
  2187. else {
  2188. for (var d = (e.pathname || "").split("/"); d.length && !(e.host = d.shift()); )
  2189. ;
  2190. e.host || (e.host = ""),
  2191. e.hostname || (e.hostname = ""),
  2192. "" !== d[0] && d.unshift(""),
  2193. d.length < 2 && d.unshift(""),
  2194. n.pathname = d.join("/")
  2195. }
  2196. if (n.search = e.search,
  2197. n.query = e.query,
  2198. n.host = e.host || "",
  2199. n.auth = e.auth,
  2200. n.hostname = e.hostname || e.host,
  2201. n.port = e.port,
  2202. n.pathname || n.search) {
  2203. var m = n.pathname || ""
  2204. , g = n.search || "";
  2205. n.path = m + g
  2206. }
  2207. return n.slashes = n.slashes || e.slashes,
  2208. n.href = n.format(),
  2209. n
  2210. }
  2211. var v = n.pathname && "/" === n.pathname.charAt(0)
  2212. , w = e.host || e.pathname && "/" === e.pathname.charAt(0)
  2213. , _ = w || v || n.host && e.pathname
  2214. , E = _
  2215. , y = n.pathname && n.pathname.split("/") || []
  2216. , d = e.pathname && e.pathname.split("/") || []
  2217. , x = n.protocol && !T[n.protocol];
  2218. if (x && (n.hostname = "",
  2219. n.port = null,
  2220. n.host && ("" === y[0] ? y[0] = n.host : y.unshift(n.host)),
  2221. n.host = "",
  2222. e.protocol && (e.hostname = null,
  2223. e.port = null,
  2224. e.host && ("" === d[0] ? d[0] = e.host : d.unshift(e.host)),
  2225. e.host = null),
  2226. _ = _ && ("" === d[0] || "" === y[0])),
  2227. w)
  2228. n.host = e.host || "" === e.host ? e.host : n.host,
  2229. n.hostname = e.hostname || "" === e.hostname ? e.hostname : n.hostname,
  2230. n.search = e.search,
  2231. n.query = e.query,
  2232. y = d;
  2233. else if (d.length)
  2234. y || (y = []),
  2235. y.pop(),
  2236. y = y.concat(d),
  2237. n.search = e.search,
  2238. n.query = e.query;
  2239. else if (!c.isNullOrUndefined(e.search)) {
  2240. if (x) {
  2241. n.hostname = n.host = y.shift();
  2242. var A = !!(n.host && n.host.indexOf("@") > 0) && n.host.split("@");
  2243. A && (n.auth = A.shift(),
  2244. n.host = n.hostname = A.shift())
  2245. }
  2246. return n.search = e.search,
  2247. n.query = e.query,
  2248. c.isNull(n.pathname) && c.isNull(n.search) || (n.path = (n.pathname ? n.pathname : "") + (n.search ? n.search : "")),
  2249. n.href = n.format(),
  2250. n
  2251. }
  2252. if (!y.length)
  2253. return n.pathname = null,
  2254. n.search ? n.path = "/" + n.search : n.path = null,
  2255. n.href = n.format(),
  2256. n;
  2257. for (var R = y.slice(-1)[0], F = (n.host || e.host || y.length > 1) && ("." === R || ".." === R) || "" === R, O = 0, I = y.length; I >= 0; I--)
  2258. R = y[I],
  2259. "." === R ? y.splice(I, 1) : ".." === R ? (y.splice(I, 1),
  2260. O++) : O && (y.splice(I, 1),
  2261. O--);
  2262. if (!_ && !E)
  2263. for (; O--; O)
  2264. y.unshift("..");
  2265. !_ || "" === y[0] || y[0] && "/" === y[0].charAt(0) || y.unshift(""),
  2266. F && "/" !== y.join("/").substr(-1) && y.push("");
  2267. var P = "" === y[0] || y[0] && "/" === y[0].charAt(0);
  2268. if (x) {
  2269. n.hostname = n.host = P ? "" : y.length ? y.shift() : "";
  2270. var A = !!(n.host && n.host.indexOf("@") > 0) && n.host.split("@");
  2271. A && (n.auth = A.shift(),
  2272. n.host = n.hostname = A.shift())
  2273. }
  2274. return _ = _ || n.host && y.length,
  2275. _ && !P && y.unshift(""),
  2276. y.length ? n.pathname = y.join("/") : (n.pathname = null,
  2277. n.path = null),
  2278. c.isNull(n.pathname) && c.isNull(n.search) || (n.path = (n.pathname ? n.pathname : "") + (n.search ? n.search : "")),
  2279. n.auth = e.auth || n.auth,
  2280. n.slashes = n.slashes || e.slashes,
  2281. n.href = n.format(),
  2282. n
  2283. }
  2284. ,
  2285. r.prototype.parseHost = function() {
  2286. var e = this.host
  2287. , t = h.exec(e);
  2288. t && (t = t[0],
  2289. ":" !== t && (this.port = t.substr(1)),
  2290. e = e.substr(0, e.length - t.length)),
  2291. e && (this.hostname = e)
  2292. }
  2293. }
  2294. , {
  2295. "./util": 23,
  2296. punycode: 18,
  2297. querystring: 21
  2298. }],
  2299. 23: [function(e, t, n) {
  2300. "use strict";
  2301. t.exports = {
  2302. isString: function(e) {
  2303. return "string" == typeof e
  2304. },
  2305. isObject: function(e) {
  2306. return "object" == typeof e && null !== e
  2307. },
  2308. isNull: function(e) {
  2309. return null === e
  2310. },
  2311. isNullOrUndefined: function(e) {
  2312. return null == e
  2313. }
  2314. }
  2315. }
  2316. , {}]
  2317. }, {}, [7]);