Flow Youtube Chat

Youtubeのチャットをニコニコ風に画面上へ流すスクリプトです(再アップ,絵文字バグ修正済み)

目前為 2021-08-04 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Flow Youtube Chat
  3. // @version 1.15.7
  4. // @description Youtubeのチャットをニコニコ風に画面上へ流すスクリプトです(再アップ,絵文字バグ修正済み)
  5. // @match https://www.youtube.com/*
  6. // @namespace FlowYoutubeChatScript
  7. // @run-at document-end
  8. // @grant GM.setValue
  9. // @grant GM.getValue
  10. // @grant GM.deleteValue
  11. // @grant GM.listValues
  12. // @grant GM.setClipboard
  13. // @noframes
  14. // @license AGPL-3.0-or-later
  15. // @require https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.all.min.js#sha384-EoPspU1QiQ0II6WaHKy5pERCBPBD1VqZByJ29O7fDUJxGXwWLyEREDpvym8c4v2S
  16. // @require https://unpkg.com/loglevel@1.7.0/dist/loglevel.min.js#sha384-7gGuWfek8Ql6j/uNDFrS0BCe4x2ZihD4B68w9Eu580OVHJBV+bl3rZmEWC7q5/Gj
  17. // @require https://unpkg.com/rxjs@7.3.0/dist/bundles/rxjs.umd.min.js#sha384-B2HMABdZA26zJ9QwbG/c5zrcdr6+Zs8J4MgKs7udycjXgvRDA5nZKLzJ1vXWzJyH
  18. // @require https://unpkg.com/mithril@2.0.4/mithril.min.js#sha384-vo9crXih40MlEv6JWHqS7SsPiFp+76csaWQFOF2UU0/xI58Jm/ZvK/1UtpaicJT9
  19. // @require https://cdn.jsdelivr.net/npm/check-types@11.1.2/src/check-types.min.js#sha384-KGnImnhVjA5llfqKEbjBiY+1Mp6oa+NvW/TEY1XTPAKWNgrAwa3Qvn//MXL07wBM
  20. // @require https://cdn.jsdelivr.net/npm/deep-diff@1.0.2/index.min.js#sha384-Q/uiWfFlwn9XjOpL49VpFKn01EkScmaC3hh1prAn7S++WoZgXRrrjQvZ7cI7C7Zn
  21. // @require https://cdn.jsdelivr.net/npm/astring@1.7.5/dist/astring.min.js#sha384-mGnfE+xZkK7mo04MqU0t7DI1ZTFZSKwfPNjrLFeibz94N4lJgdHXh5+kI6rf5x10
  22. // @require https://cdn.jsdelivr.net/npm/jsep@0.4.0/build/jsep.min.js#sha384-89PRdfFVlT2bC9VxvLdvlByyVGml9l14DjpPqZYVI9umfvV24KPZ5dY6qBOeKf2z
  23. // @require https://cdn.jsdelivr.net/npm/hash-it@5.0.2/dist/hash-it.min.js#sha384-biRMep0zr/5fw/hIdnBIb56UHRgiIyhAagZrngd9dSxxQ9aDFMP0hbYR8PEj5lVu
  24. // @require https://cdn.jsdelivr.net/npm/micro-memoize@4.0.9/dist/micro-memoize.min.js#sha384-aGxbSIH2oMTKxZ93i+/iQKx5xefR8mHJW3mkbRaiSZizVoCvKS6wzndlLeQzMv9B
  25. // ==/UserScript==
  26.  
  27. /* jshint esversion: 6 */
  28.  
  29. ;(() => {
  30. var __webpack_modules__ = {
  31. 73: (
  32. __unused_webpack_module,
  33. __unused_webpack___webpack_exports__,
  34. __webpack_require__
  35. ) => {
  36. "use strict"
  37. const external_log_namespaceObject = log
  38. var external_log_default = __webpack_require__.n(
  39. external_log_namespaceObject
  40. )
  41. const lib = observer => value => {
  42. observer.next(value)
  43. }
  44. function sleep(time) {
  45. time || (time = 0)
  46. return new Promise(function (res) {
  47. return setTimeout(res, time)
  48. })
  49. }
  50. function randomToken() {
  51. return Math.random().toString(36).substring(2)
  52. }
  53. var lastMs = 0,
  54. additional = 0
  55. function microSeconds() {
  56. var ms = new Date().getTime()
  57. if (ms === lastMs) return 1e3 * ms + ++additional
  58. lastMs = ms
  59. additional = 0
  60. return 1e3 * ms
  61. }
  62. var isNode =
  63. "[object process]" ===
  64. Object.prototype.toString.call(
  65. "undefined" != typeof process ? process : 0
  66. )
  67. const methods_native = {
  68. create: function (channelName) {
  69. var state = {
  70. messagesCallback: null,
  71. bc: new BroadcastChannel(channelName),
  72. subFns: [],
  73. }
  74. state.bc.onmessage = function (msg) {
  75. state.messagesCallback && state.messagesCallback(msg.data)
  76. }
  77. return state
  78. },
  79. close: function (channelState) {
  80. channelState.bc.close()
  81. channelState.subFns = []
  82. },
  83. onMessage: function (channelState, fn) {
  84. channelState.messagesCallback = fn
  85. },
  86. postMessage: function (channelState, messageJson) {
  87. try {
  88. channelState.bc.postMessage(messageJson, !1)
  89. return Promise.resolve()
  90. } catch (err) {
  91. return Promise.reject(err)
  92. }
  93. },
  94. canBeUsed: function () {
  95. if (isNode && "undefined" == typeof window) return !1
  96. if ("function" == typeof BroadcastChannel) {
  97. if (BroadcastChannel._pubkey)
  98. throw new Error(
  99. "BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill"
  100. )
  101. return !0
  102. }
  103. return !1
  104. },
  105. type: "native",
  106. averageResponseTime: function () {
  107. return 150
  108. },
  109. microSeconds,
  110. }
  111. var ObliviousSet = (function () {
  112. function ObliviousSet(ttl) {
  113. this.ttl = ttl
  114. this.set = new Set()
  115. this.timeMap = new Map()
  116. }
  117. ObliviousSet.prototype.has = function (value) {
  118. return this.set.has(value)
  119. }
  120. ObliviousSet.prototype.add = function (value) {
  121. var _this = this
  122. this.timeMap.set(value, now())
  123. this.set.add(value)
  124. setTimeout(function () {
  125. !(function (obliviousSet) {
  126. var olderThen = now() - obliviousSet.ttl,
  127. iterator = obliviousSet.set[Symbol.iterator]()
  128. for (;;) {
  129. var value = iterator.next().value
  130. if (!value) return
  131. if (!(obliviousSet.timeMap.get(value) < olderThen)) return
  132. obliviousSet.timeMap.delete(value)
  133. obliviousSet.set.delete(value)
  134. }
  135. })(_this)
  136. }, 0)
  137. }
  138. ObliviousSet.prototype.clear = function () {
  139. this.set.clear()
  140. this.timeMap.clear()
  141. }
  142. return ObliviousSet
  143. })()
  144. function now() {
  145. return new Date().getTime()
  146. }
  147. function options_fillOptionsWithDefaults() {
  148. var originalOptions =
  149. arguments.length > 0 && void 0 !== arguments[0]
  150. ? arguments[0]
  151. : {},
  152. options = JSON.parse(JSON.stringify(originalOptions))
  153. void 0 === options.webWorkerSupport && (options.webWorkerSupport = !0)
  154. options.idb || (options.idb = {})
  155. options.idb.ttl || (options.idb.ttl = 45e3)
  156. options.idb.fallbackInterval || (options.idb.fallbackInterval = 150)
  157. originalOptions.idb &&
  158. "function" == typeof originalOptions.idb.onclose &&
  159. (options.idb.onclose = originalOptions.idb.onclose)
  160. options.localstorage || (options.localstorage = {})
  161. options.localstorage.removeTimeout ||
  162. (options.localstorage.removeTimeout = 6e4)
  163. originalOptions.methods && (options.methods = originalOptions.methods)
  164. options.node || (options.node = {})
  165. options.node.ttl || (options.node.ttl = 12e4)
  166. void 0 === options.node.useFastPath && (options.node.useFastPath = !0)
  167. return options
  168. }
  169. function getIdb() {
  170. if ("undefined" != typeof indexedDB) return indexedDB
  171. if ("undefined" != typeof window) {
  172. if (void 0 !== window.mozIndexedDB) return window.mozIndexedDB
  173. if (void 0 !== window.webkitIndexedDB) return window.webkitIndexedDB
  174. if (void 0 !== window.msIndexedDB) return window.msIndexedDB
  175. }
  176. return !1
  177. }
  178. function getMessagesHigherThan(db, lastCursorId) {
  179. var objectStore = db.transaction("messages").objectStore("messages"),
  180. ret = []
  181. return new Promise(function (res) {
  182. ;(function () {
  183. try {
  184. var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, 1 / 0)
  185. return objectStore.openCursor(keyRangeValue)
  186. } catch (e) {
  187. return objectStore.openCursor()
  188. }
  189. })().onsuccess = function (ev) {
  190. var cursor = ev.target.result
  191. if (cursor)
  192. if (cursor.value.id < lastCursorId + 1)
  193. cursor.continue(lastCursorId + 1)
  194. else {
  195. ret.push(cursor.value)
  196. cursor.continue()
  197. }
  198. else res(ret)
  199. }
  200. })
  201. }
  202. function cleanOldMessages(db, ttl) {
  203. return (function (db, ttl) {
  204. var olderThen = new Date().getTime() - ttl,
  205. objectStore = db.transaction("messages").objectStore("messages"),
  206. ret = []
  207. return new Promise(function (res) {
  208. objectStore.openCursor().onsuccess = function (ev) {
  209. var cursor = ev.target.result
  210. if (cursor) {
  211. var msgObk = cursor.value
  212. if (!(msgObk.time < olderThen)) {
  213. res(ret)
  214. return
  215. }
  216. ret.push(msgObk)
  217. cursor.continue()
  218. } else res(ret)
  219. }
  220. })
  221. })(db, ttl).then(function (tooOld) {
  222. return Promise.all(
  223. tooOld.map(function (msgObj) {
  224. return (function (db, id) {
  225. var request = db
  226. .transaction(["messages"], "readwrite")
  227. .objectStore("messages")
  228. .delete(id)
  229. return new Promise(function (res) {
  230. request.onsuccess = function () {
  231. return res()
  232. }
  233. })
  234. })(db, msgObj.id)
  235. })
  236. )
  237. })
  238. }
  239. function _readLoop(state) {
  240. state.closed ||
  241. readNewMessages(state)
  242. .then(function () {
  243. return sleep(state.options.idb.fallbackInterval)
  244. })
  245. .then(function () {
  246. return _readLoop(state)
  247. })
  248. }
  249. function readNewMessages(state) {
  250. return state.closed
  251. ? Promise.resolve()
  252. : state.messagesCallback
  253. ? getMessagesHigherThan(state.db, state.lastCursorId).then(
  254. function (newerMessages) {
  255. newerMessages
  256. .filter(function (msgObj) {
  257. return !!msgObj
  258. })
  259. .map(function (msgObj) {
  260. msgObj.id > state.lastCursorId &&
  261. (state.lastCursorId = msgObj.id)
  262. return msgObj
  263. })
  264. .filter(function (msgObj) {
  265. return (function (msgObj, state) {
  266. return !(
  267. msgObj.uuid === state.uuid ||
  268. state.eMIs.has(msgObj.id) ||
  269. msgObj.data.time < state.messagesCallbackTime
  270. )
  271. })(msgObj, state)
  272. })
  273. .sort(function (msgObjA, msgObjB) {
  274. return msgObjA.time - msgObjB.time
  275. })
  276. .forEach(function (msgObj) {
  277. if (state.messagesCallback) {
  278. state.eMIs.add(msgObj.id)
  279. state.messagesCallback(msgObj.data)
  280. }
  281. })
  282. return Promise.resolve()
  283. }
  284. )
  285. : Promise.resolve()
  286. }
  287. const indexed_db = {
  288. create: function (channelName, options) {
  289. options = options_fillOptionsWithDefaults(options)
  290. return (function (channelName) {
  291. var dbName = "pubkey.broadcast-channel-0-" + channelName,
  292. openRequest = getIdb().open(dbName, 1)
  293. openRequest.onupgradeneeded = function (ev) {
  294. ev.target.result.createObjectStore("messages", {
  295. keyPath: "id",
  296. autoIncrement: !0,
  297. })
  298. }
  299. return new Promise(function (res, rej) {
  300. openRequest.onerror = function (ev) {
  301. return rej(ev)
  302. }
  303. openRequest.onsuccess = function () {
  304. res(openRequest.result)
  305. }
  306. })
  307. })(channelName).then(function (db) {
  308. var state = {
  309. closed: !1,
  310. lastCursorId: 0,
  311. channelName,
  312. options,
  313. uuid: randomToken(),
  314. eMIs: new ObliviousSet(2 * options.idb.ttl),
  315. writeBlockPromise: Promise.resolve(),
  316. messagesCallback: null,
  317. readQueuePromises: [],
  318. db,
  319. }
  320. db.onclose = function () {
  321. state.closed = !0
  322. options.idb.onclose && options.idb.onclose()
  323. }
  324. _readLoop(state)
  325. return state
  326. })
  327. },
  328. close: function (channelState) {
  329. channelState.closed = !0
  330. channelState.db.close()
  331. },
  332. onMessage: function (channelState, fn, time) {
  333. channelState.messagesCallbackTime = time
  334. channelState.messagesCallback = fn
  335. readNewMessages(channelState)
  336. },
  337. postMessage: function (channelState, messageJson) {
  338. channelState.writeBlockPromise = channelState.writeBlockPromise
  339. .then(function () {
  340. return (function (db, readerUuid, messageJson) {
  341. var writeObject = {
  342. uuid: readerUuid,
  343. time: new Date().getTime(),
  344. data: messageJson,
  345. },
  346. transaction = db.transaction(["messages"], "readwrite")
  347. return new Promise(function (res, rej) {
  348. transaction.oncomplete = function () {
  349. return res()
  350. }
  351. transaction.onerror = function (ev) {
  352. return rej(ev)
  353. }
  354. transaction.objectStore("messages").add(writeObject)
  355. })
  356. })(channelState.db, channelState.uuid, messageJson)
  357. })
  358. .then(function () {
  359. 0 ===
  360. (function (min, max) {
  361. return Math.floor(Math.random() * (max - min + 1) + min)
  362. })(0, 10) &&
  363. cleanOldMessages(
  364. channelState.db,
  365. channelState.options.idb.ttl
  366. )
  367. })
  368. return channelState.writeBlockPromise
  369. },
  370. canBeUsed: function () {
  371. return !isNode && !!getIdb()
  372. },
  373. type: "idb",
  374. averageResponseTime: function (options) {
  375. return 2 * options.idb.fallbackInterval
  376. },
  377. microSeconds,
  378. }
  379. function getLocalStorage() {
  380. var localStorage
  381. if ("undefined" == typeof window) return null
  382. try {
  383. localStorage = window.localStorage
  384. localStorage =
  385. window["ie8-eventlistener/storage"] || window.localStorage
  386. } catch (e) {}
  387. return localStorage
  388. }
  389. function storageKey(channelName) {
  390. return "pubkey.broadcastChannel-" + channelName
  391. }
  392. function localstorage_canBeUsed() {
  393. if (isNode) return !1
  394. var ls = getLocalStorage()
  395. if (!ls) return !1
  396. try {
  397. var key = "__broadcastchannel_check"
  398. ls.setItem(key, "works")
  399. ls.removeItem(key)
  400. } catch (e) {
  401. return !1
  402. }
  403. return !0
  404. }
  405. const localstorage = {
  406. create: function (channelName, options) {
  407. options = options_fillOptionsWithDefaults(options)
  408. if (!localstorage_canBeUsed())
  409. throw new Error("BroadcastChannel: localstorage cannot be used")
  410. var uuid = randomToken(),
  411. eMIs = new ObliviousSet(options.localstorage.removeTimeout),
  412. state = { channelName, uuid, eMIs }
  413. state.listener = (function (channelName, fn) {
  414. var key = storageKey(channelName),
  415. listener = function (ev) {
  416. ev.key === key && fn(JSON.parse(ev.newValue))
  417. }
  418. window.addEventListener("storage", listener)
  419. return listener
  420. })(channelName, function (msgObj) {
  421. if (
  422. state.messagesCallback &&
  423. msgObj.uuid !== uuid &&
  424. msgObj.token &&
  425. !eMIs.has(msgObj.token) &&
  426. !(
  427. msgObj.data.time &&
  428. msgObj.data.time < state.messagesCallbackTime
  429. )
  430. ) {
  431. eMIs.add(msgObj.token)
  432. state.messagesCallback(msgObj.data)
  433. }
  434. })
  435. return state
  436. },
  437. close: function (channelState) {
  438. ;(listener = channelState.listener),
  439. window.removeEventListener("storage", listener)
  440. var listener
  441. },
  442. onMessage: function (channelState, fn, time) {
  443. channelState.messagesCallbackTime = time
  444. channelState.messagesCallback = fn
  445. },
  446. postMessage: function (channelState, messageJson) {
  447. return new Promise(function (res) {
  448. sleep().then(function () {
  449. var key = storageKey(channelState.channelName),
  450. writeObj = {
  451. token: randomToken(),
  452. time: new Date().getTime(),
  453. data: messageJson,
  454. uuid: channelState.uuid,
  455. },
  456. value = JSON.stringify(writeObj)
  457. getLocalStorage().setItem(key, value)
  458. var ev = document.createEvent("Event")
  459. ev.initEvent("storage", !0, !0)
  460. ev.key = key
  461. ev.newValue = value
  462. window.dispatchEvent(ev)
  463. res()
  464. })
  465. })
  466. },
  467. canBeUsed: localstorage_canBeUsed,
  468. type: "localstorage",
  469. averageResponseTime: function () {
  470. var userAgent = navigator.userAgent.toLowerCase()
  471. return userAgent.includes("safari") && !userAgent.includes("chrome")
  472. ? 240
  473. : 120
  474. },
  475. microSeconds,
  476. }
  477. var simulate_microSeconds = microSeconds,
  478. SIMULATE_CHANNELS = new Set()
  479. const simulate = {
  480. create: function (channelName) {
  481. var state = { name: channelName, messagesCallback: null }
  482. SIMULATE_CHANNELS.add(state)
  483. return state
  484. },
  485. close: function (channelState) {
  486. SIMULATE_CHANNELS.delete(channelState)
  487. },
  488. onMessage: function (channelState, fn) {
  489. channelState.messagesCallback = fn
  490. },
  491. postMessage: function (channelState, messageJson) {
  492. return new Promise(function (res) {
  493. return setTimeout(function () {
  494. Array.from(SIMULATE_CHANNELS)
  495. .filter(function (channel) {
  496. return channel.name === channelState.name
  497. })
  498. .filter(function (channel) {
  499. return channel !== channelState
  500. })
  501. .filter(function (channel) {
  502. return !!channel.messagesCallback
  503. })
  504. .forEach(function (channel) {
  505. return channel.messagesCallback(messageJson)
  506. })
  507. res()
  508. }, 5)
  509. })
  510. },
  511. canBeUsed: function () {
  512. return !0
  513. },
  514. type: "simulate",
  515. averageResponseTime: function () {
  516. return 5
  517. },
  518. microSeconds: simulate_microSeconds,
  519. }
  520. var METHODS = [methods_native, indexed_db, localstorage]
  521. if (isNode) {
  522. var NodeMethod = __webpack_require__(633)
  523. "function" == typeof NodeMethod.canBeUsed && METHODS.push(NodeMethod)
  524. }
  525. var ENFORCED_OPTIONS,
  526. broadcast_channel_BroadcastChannel = function (name, options) {
  527. this.name = name
  528. ENFORCED_OPTIONS && (options = ENFORCED_OPTIONS)
  529. this.options = options_fillOptionsWithDefaults(options)
  530. this.method = (function (options) {
  531. var chooseMethods = []
  532. .concat(options.methods, METHODS)
  533. .filter(Boolean)
  534. if (options.type) {
  535. if ("simulate" === options.type) return simulate
  536. var ret = chooseMethods.find(function (m) {
  537. return m.type === options.type
  538. })
  539. if (ret) return ret
  540. throw new Error("method-type " + options.type + " not found")
  541. }
  542. options.webWorkerSupport ||
  543. isNode ||
  544. (chooseMethods = chooseMethods.filter(function (m) {
  545. return "idb" !== m.type
  546. }))
  547. var useMethod = chooseMethods.find(function (method) {
  548. return method.canBeUsed()
  549. })
  550. if (useMethod) return useMethod
  551. throw new Error(
  552. "No useable methode found:" +
  553. JSON.stringify(
  554. METHODS.map(function (m) {
  555. return m.type
  556. })
  557. )
  558. )
  559. })(this.options)
  560. this._iL = !1
  561. this._onML = null
  562. this._addEL = { message: [], internal: [] }
  563. this._uMP = new Set()
  564. this._befC = []
  565. this._prepP = null
  566. !(function (channel) {
  567. var maybePromise = channel.method.create(
  568. channel.name,
  569. channel.options
  570. )
  571. if (
  572. ((obj = maybePromise), obj && "function" == typeof obj.then)
  573. ) {
  574. channel._prepP = maybePromise
  575. maybePromise.then(function (s) {
  576. channel._state = s
  577. })
  578. } else channel._state = maybePromise
  579. var obj
  580. })(this)
  581. }
  582. broadcast_channel_BroadcastChannel._pubkey = !0
  583. broadcast_channel_BroadcastChannel.prototype = {
  584. postMessage: function (msg) {
  585. if (this.closed)
  586. throw new Error(
  587. "BroadcastChannel.postMessage(): Cannot post message after channel has closed"
  588. )
  589. return _post(this, "message", msg)
  590. },
  591. postInternal: function (msg) {
  592. return _post(this, "internal", msg)
  593. },
  594. set onmessage(fn) {
  595. var listenObj = { time: this.method.microSeconds(), fn }
  596. _removeListenerObject(this, "message", this._onML)
  597. if (fn && "function" == typeof fn) {
  598. this._onML = listenObj
  599. _addListenerObject(this, "message", listenObj)
  600. } else this._onML = null
  601. },
  602. addEventListener: function (type, fn) {
  603. _addListenerObject(this, type, {
  604. time: this.method.microSeconds(),
  605. fn,
  606. })
  607. },
  608. removeEventListener: function (type, fn) {
  609. _removeListenerObject(
  610. this,
  611. type,
  612. this._addEL[type].find(function (obj) {
  613. return obj.fn === fn
  614. })
  615. )
  616. },
  617. close: function () {
  618. var _this = this
  619. if (!this.closed) {
  620. this.closed = !0
  621. var awaitPrepare = this._prepP ? this._prepP : Promise.resolve()
  622. this._onML = null
  623. this._addEL.message = []
  624. return awaitPrepare
  625. .then(function () {
  626. return Promise.all(Array.from(_this._uMP))
  627. })
  628. .then(function () {
  629. return Promise.all(
  630. _this._befC.map(function (fn) {
  631. return fn()
  632. })
  633. )
  634. })
  635. .then(function () {
  636. return _this.method.close(_this._state)
  637. })
  638. }
  639. },
  640. get type() {
  641. return this.method.type
  642. },
  643. get isClosed() {
  644. return this.closed
  645. },
  646. }
  647. function _post(broadcastChannel, type, msg) {
  648. var msgObj = {
  649. time: broadcastChannel.method.microSeconds(),
  650. type,
  651. data: msg,
  652. }
  653. return (
  654. broadcastChannel._prepP
  655. ? broadcastChannel._prepP
  656. : Promise.resolve()
  657. ).then(function () {
  658. var sendPromise = broadcastChannel.method.postMessage(
  659. broadcastChannel._state,
  660. msgObj
  661. )
  662. broadcastChannel._uMP.add(sendPromise)
  663. sendPromise.catch().then(function () {
  664. return broadcastChannel._uMP.delete(sendPromise)
  665. })
  666. return sendPromise
  667. })
  668. }
  669. function _hasMessageListeners(channel) {
  670. return (
  671. channel._addEL.message.length > 0 ||
  672. channel._addEL.internal.length > 0
  673. )
  674. }
  675. function _addListenerObject(channel, type, obj) {
  676. channel._addEL[type].push(obj)
  677. !(function (channel) {
  678. if (!channel._iL && _hasMessageListeners(channel)) {
  679. var listenerFn = function (msgObj) {
  680. channel._addEL[msgObj.type].forEach(function (obj) {
  681. msgObj.time >= obj.time && obj.fn(msgObj.data)
  682. })
  683. },
  684. time = channel.method.microSeconds()
  685. if (channel._prepP)
  686. channel._prepP.then(function () {
  687. channel._iL = !0
  688. channel.method.onMessage(channel._state, listenerFn, time)
  689. })
  690. else {
  691. channel._iL = !0
  692. channel.method.onMessage(channel._state, listenerFn, time)
  693. }
  694. }
  695. })(channel)
  696. }
  697. function _removeListenerObject(channel, type, obj) {
  698. channel._addEL[type] = channel._addEL[type].filter(function (o) {
  699. return o !== obj
  700. })
  701. !(function (channel) {
  702. if (channel._iL && !_hasMessageListeners(channel)) {
  703. channel._iL = !1
  704. var time = channel.method.microSeconds()
  705. channel.method.onMessage(channel._state, null, time)
  706. }
  707. })(channel)
  708. }
  709. const external_DeepDiff_namespaceObject = DeepDiff
  710. var function_getMonoid = function (M) {
  711. var S,
  712. getSemigroupM =
  713. ((S = M),
  714. function () {
  715. return {
  716. concat: function (f, g) {
  717. return function (a) {
  718. return S.concat(f(a), g(a))
  719. }
  720. },
  721. }
  722. })
  723. return function () {
  724. return {
  725. concat: getSemigroupM().concat,
  726. empty: function () {
  727. return M.empty
  728. },
  729. }
  730. }
  731. }
  732. function function_identity(a) {
  733. return a
  734. }
  735. function constant(a) {
  736. return function () {
  737. return a
  738. }
  739. }
  740. var constUndefined = constant(void 0)
  741. function function_flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
  742. switch (arguments.length) {
  743. case 1:
  744. return ab
  745. case 2:
  746. return function () {
  747. return bc(ab.apply(this, arguments))
  748. }
  749. case 3:
  750. return function () {
  751. return cd(bc(ab.apply(this, arguments)))
  752. }
  753. case 4:
  754. return function () {
  755. return de(cd(bc(ab.apply(this, arguments))))
  756. }
  757. case 5:
  758. return function () {
  759. return ef(de(cd(bc(ab.apply(this, arguments)))))
  760. }
  761. case 6:
  762. return function () {
  763. return fg(ef(de(cd(bc(ab.apply(this, arguments))))))
  764. }
  765. case 7:
  766. return function () {
  767. return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))
  768. }
  769. case 8:
  770. return function () {
  771. return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))))
  772. }
  773. case 9:
  774. return function () {
  775. return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))))
  776. }
  777. }
  778. }
  779. function function_pipe(
  780. a,
  781. ab,
  782. bc,
  783. cd,
  784. de,
  785. ef,
  786. fg,
  787. gh,
  788. hi,
  789. ij,
  790. jk,
  791. kl,
  792. lm,
  793. mn,
  794. no,
  795. op,
  796. pq,
  797. qr,
  798. rs,
  799. st
  800. ) {
  801. switch (arguments.length) {
  802. case 1:
  803. return a
  804. case 2:
  805. return ab(a)
  806. case 3:
  807. return bc(ab(a))
  808. case 4:
  809. return cd(bc(ab(a)))
  810. case 5:
  811. return de(cd(bc(ab(a))))
  812. case 6:
  813. return ef(de(cd(bc(ab(a)))))
  814. case 7:
  815. return fg(ef(de(cd(bc(ab(a))))))
  816. case 8:
  817. return gh(fg(ef(de(cd(bc(ab(a)))))))
  818. case 9:
  819. return hi(gh(fg(ef(de(cd(bc(ab(a))))))))
  820. case 10:
  821. return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))
  822. case 11:
  823. return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))
  824. case 12:
  825. return kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))
  826. case 13:
  827. return lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))
  828. case 14:
  829. return mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))
  830. case 15:
  831. return no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))
  832. case 16:
  833. return op(
  834. no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))
  835. )
  836. case 17:
  837. return pq(
  838. op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  839. )
  840. case 18:
  841. return qr(
  842. pq(
  843. op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  844. )
  845. )
  846. case 19:
  847. return rs(
  848. qr(
  849. pq(
  850. op(
  851. no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))
  852. )
  853. )
  854. )
  855. )
  856. case 20:
  857. return st(
  858. rs(
  859. qr(
  860. pq(
  861. op(
  862. no(
  863. mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))
  864. )
  865. )
  866. )
  867. )
  868. )
  869. )
  870. }
  871. }
  872. var isSome = function (fa) {
  873. return "Some" === fa._tag
  874. },
  875. none = { _tag: "None" },
  876. some = function (a) {
  877. return { _tag: "Some", value: a }
  878. },
  879. isLeft = function (ma) {
  880. return "Left" === ma._tag
  881. },
  882. right = function (a) {
  883. return { _tag: "Right", right: a }
  884. },
  885. internal_isNonEmpty = function (as) {
  886. return as.length > 0
  887. },
  888. head = function (as) {
  889. return as[0]
  890. },
  891. emptyReadonlyArray = [],
  892. Predicate_not =
  893. (Object.prototype.hasOwnProperty,
  894. function (predicate) {
  895. return function (a) {
  896. return !predicate(a)
  897. }
  898. })
  899. function map(F, G) {
  900. return function (f) {
  901. return function (fa) {
  902. return F.map(fa, function (ga) {
  903. return G.map(ga, f)
  904. })
  905. }
  906. }
  907. }
  908. function flap(F) {
  909. return function (a) {
  910. return function (fab) {
  911. return F.map(fab, function (f) {
  912. return f(a)
  913. })
  914. }
  915. }
  916. }
  917. function bindTo(F) {
  918. return function (name) {
  919. return function (fa) {
  920. return F.map(fa, function (a) {
  921. var _a
  922. return ((_a = {})[name] = a), _a
  923. })
  924. }
  925. }
  926. }
  927. function Functor_getFunctorComposition(F, G) {
  928. var _map = map(F, G)
  929. return {
  930. map: function (fga, f) {
  931. return function_pipe(fga, _map(f))
  932. },
  933. }
  934. }
  935. var Separated_separated = function (left, right) {
  936. return { left, right }
  937. },
  938. Separated_map = function (f) {
  939. return function (fa) {
  940. return Separated_separated(
  941. Separated_left(fa),
  942. f(Separated_right(fa))
  943. )
  944. }
  945. },
  946. Separated_left =
  947. (flap({
  948. URI: "Separated",
  949. map: function (fa, f) {
  950. return function_pipe(fa, Separated_map(f))
  951. },
  952. }),
  953. function (s) {
  954. return s.left
  955. }),
  956. Separated_right = function (s) {
  957. return s.right
  958. }
  959. function Witherable_wiltDefault(T, C) {
  960. return function (F) {
  961. var traverseF = T.traverse(F)
  962. return function (wa, f) {
  963. return F.map(traverseF(wa, f), C.separate)
  964. }
  965. }
  966. }
  967. function Witherable_witherDefault(T, C) {
  968. return function (F) {
  969. var traverseF = T.traverse(F)
  970. return function (wa, f) {
  971. return F.map(traverseF(wa, f), C.compact)
  972. }
  973. }
  974. }
  975. var Option_none = none,
  976. Option_some = some
  977. function fromPredicate(predicate) {
  978. return function (a) {
  979. return predicate(a) ? Option_some(a) : Option_none
  980. }
  981. }
  982. var getLeft = function (ma) {
  983. return "Right" === ma._tag ? Option_none : Option_some(ma.left)
  984. },
  985. getRight = function (ma) {
  986. return "Left" === ma._tag ? Option_none : Option_some(ma.right)
  987. },
  988. Option_map = function (fa, f) {
  989. return function_pipe(fa, es6_Option_map(f))
  990. },
  991. _ap = function (fab, fa) {
  992. return function_pipe(fab, ap(fa))
  993. },
  994. _chain = function (ma, f) {
  995. return function_pipe(ma, chain(f))
  996. },
  997. _reduce = function (fa, b, f) {
  998. return function_pipe(fa, reduce(b, f))
  999. },
  1000. _foldMap = function (M) {
  1001. var foldMapM = foldMap(M)
  1002. return function (fa, f) {
  1003. return function_pipe(fa, foldMapM(f))
  1004. }
  1005. },
  1006. _reduceRight = function (fa, b, f) {
  1007. return function_pipe(fa, reduceRight(b, f))
  1008. },
  1009. _traverse = function (F) {
  1010. var traverseF = traverse(F)
  1011. return function (ta, f) {
  1012. return function_pipe(ta, traverseF(f))
  1013. }
  1014. },
  1015. _alt = function (fa, that) {
  1016. return function_pipe(fa, alt(that))
  1017. },
  1018. _filter = function (fa, predicate) {
  1019. return function_pipe(fa, filter(predicate))
  1020. },
  1021. _filterMap = function (fa, f) {
  1022. return function_pipe(fa, filterMap(f))
  1023. },
  1024. _extend = function (wa, f) {
  1025. return function_pipe(wa, extend(f))
  1026. },
  1027. _partition = function (fa, predicate) {
  1028. return function_pipe(fa, partition(predicate))
  1029. },
  1030. _partitionMap = function (fa, f) {
  1031. return function_pipe(fa, partitionMap(f))
  1032. },
  1033. getEq = function (E) {
  1034. return {
  1035. equals: function (x, y) {
  1036. return (
  1037. x === y ||
  1038. (Option_isNone(x)
  1039. ? Option_isNone(y)
  1040. : !Option_isNone(y) && E.equals(x.value, y.value))
  1041. )
  1042. },
  1043. }
  1044. },
  1045. es6_Option_map = function (f) {
  1046. return function (fa) {
  1047. return Option_isNone(fa) ? Option_none : Option_some(f(fa.value))
  1048. }
  1049. },
  1050. Option_Functor = { URI: "Option", map: Option_map },
  1051. of = Option_some,
  1052. ap = function (fa) {
  1053. return function (fab) {
  1054. return Option_isNone(fab) || Option_isNone(fa)
  1055. ? Option_none
  1056. : Option_some(fab.value(fa.value))
  1057. }
  1058. },
  1059. Apply = { URI: "Option", map: Option_map, ap: _ap },
  1060. chain = function (f) {
  1061. return function (ma) {
  1062. return Option_isNone(ma) ? Option_none : f(ma.value)
  1063. }
  1064. },
  1065. reduce = function (b, f) {
  1066. return function (fa) {
  1067. return Option_isNone(fa) ? b : f(b, fa.value)
  1068. }
  1069. },
  1070. foldMap = function (M) {
  1071. return function (f) {
  1072. return function (fa) {
  1073. return Option_isNone(fa) ? M.empty : f(fa.value)
  1074. }
  1075. }
  1076. },
  1077. reduceRight = function (b, f) {
  1078. return function (fa) {
  1079. return Option_isNone(fa) ? b : f(fa.value, b)
  1080. }
  1081. },
  1082. alt = function (that) {
  1083. return function (fa) {
  1084. return Option_isNone(fa) ? that() : fa
  1085. }
  1086. },
  1087. zero = function () {
  1088. return Option_none
  1089. },
  1090. extend = function (f) {
  1091. return function (wa) {
  1092. return Option_isNone(wa) ? Option_none : Option_some(f(wa))
  1093. }
  1094. },
  1095. compact = chain(function_identity),
  1096. defaultSeparated = Separated_separated(Option_none, Option_none),
  1097. separate = function (ma) {
  1098. return Option_isNone(ma)
  1099. ? defaultSeparated
  1100. : Separated_separated(getLeft(ma.value), getRight(ma.value))
  1101. },
  1102. Compactable = { URI: "Option", compact, separate },
  1103. filter = function (predicate) {
  1104. return function (fa) {
  1105. return Option_isNone(fa)
  1106. ? Option_none
  1107. : predicate(fa.value)
  1108. ? fa
  1109. : Option_none
  1110. }
  1111. },
  1112. filterMap = function (f) {
  1113. return function (fa) {
  1114. return Option_isNone(fa) ? Option_none : f(fa.value)
  1115. }
  1116. },
  1117. partition = function (predicate) {
  1118. return function (fa) {
  1119. return Separated_separated(
  1120. _filter(fa, Predicate_not(predicate)),
  1121. _filter(fa, predicate)
  1122. )
  1123. }
  1124. },
  1125. partitionMap = function (f) {
  1126. return function_flow(es6_Option_map(f), separate)
  1127. },
  1128. traverse = function (F) {
  1129. return function (f) {
  1130. return function (ta) {
  1131. return Option_isNone(ta)
  1132. ? F.of(Option_none)
  1133. : F.map(f(ta.value), Option_some)
  1134. }
  1135. }
  1136. },
  1137. sequence = function (F) {
  1138. return function (ta) {
  1139. return Option_isNone(ta)
  1140. ? F.of(Option_none)
  1141. : F.map(ta.value, Option_some)
  1142. }
  1143. },
  1144. Traversable = {
  1145. URI: "Option",
  1146. map: Option_map,
  1147. reduce: _reduce,
  1148. foldMap: _foldMap,
  1149. reduceRight: _reduceRight,
  1150. traverse: _traverse,
  1151. sequence,
  1152. },
  1153. _wither = Witherable_witherDefault(Traversable, Compactable),
  1154. _wilt = Witherable_wiltDefault(Traversable, Compactable),
  1155. throwError = function () {
  1156. return Option_none
  1157. },
  1158. Option_isSome = isSome,
  1159. Option_isNone = function (fa) {
  1160. return "None" === fa._tag
  1161. },
  1162. matchW = function (onNone, onSome) {
  1163. return function (ma) {
  1164. return Option_isNone(ma) ? onNone() : onSome(ma.value)
  1165. }
  1166. },
  1167. match = matchW,
  1168. getOrElseW = function (onNone) {
  1169. return function (ma) {
  1170. return Option_isNone(ma) ? onNone() : ma.value
  1171. }
  1172. },
  1173. getOrElse = getOrElseW,
  1174. fromNullable = function (a) {
  1175. return null == a ? Option_none : Option_some(a)
  1176. },
  1177. chainNullableK = function (f) {
  1178. return function (ma) {
  1179. return Option_isNone(ma) ? Option_none : fromNullable(f(ma.value))
  1180. }
  1181. },
  1182. toUndefined = match(constUndefined, function_identity)
  1183. of(emptyReadonlyArray)
  1184. var Option_option = {
  1185. URI: "Option",
  1186. map: Option_map,
  1187. of,
  1188. ap: _ap,
  1189. chain: _chain,
  1190. reduce: _reduce,
  1191. foldMap: _foldMap,
  1192. reduceRight: _reduceRight,
  1193. traverse: _traverse,
  1194. sequence,
  1195. zero,
  1196. alt: _alt,
  1197. extend: _extend,
  1198. compact,
  1199. separate,
  1200. filter: _filter,
  1201. filterMap: _filterMap,
  1202. partition: _partition,
  1203. partitionMap: _partitionMap,
  1204. wither: _wither,
  1205. wilt: _wilt,
  1206. throwError,
  1207. }
  1208. function Apply_apSecond(A) {
  1209. return function (second) {
  1210. return function (first) {
  1211. return A.ap(
  1212. A.map(first, function () {
  1213. return function (b) {
  1214. return b
  1215. }
  1216. }),
  1217. second
  1218. )
  1219. }
  1220. }
  1221. }
  1222. function OptionT_some(F) {
  1223. return function_flow(Option_some, F.of)
  1224. }
  1225. function OptionT_zero(F) {
  1226. return constant(F.of(Option_none))
  1227. }
  1228. function fromF(F) {
  1229. return function (ma) {
  1230. return F.map(ma, Option_some)
  1231. }
  1232. }
  1233. function OptionT_chain(M) {
  1234. var zeroM = OptionT_zero(M)
  1235. return function (f) {
  1236. return function (ma) {
  1237. return M.chain(
  1238. ma,
  1239. match(function () {
  1240. return zeroM()
  1241. }, f)
  1242. )
  1243. }
  1244. }
  1245. }
  1246. function Compactable_compact(F, G) {
  1247. return function (fga) {
  1248. return F.map(fga, G.compact)
  1249. }
  1250. }
  1251. function Compactable_separate(F, C, G) {
  1252. var _compact = Compactable_compact(F, C),
  1253. _map = map(F, G)
  1254. return function (fge) {
  1255. return Separated_separated(
  1256. _compact(function_pipe(fge, _map(getLeft))),
  1257. _compact(function_pipe(fge, _map(getRight)))
  1258. )
  1259. }
  1260. }
  1261. function Filterable_filter(F, G) {
  1262. return function (predicate) {
  1263. return function (fga) {
  1264. return F.map(fga, function (ga) {
  1265. return G.filter(ga, predicate)
  1266. })
  1267. }
  1268. }
  1269. }
  1270. function Filterable_filterMap(F, G) {
  1271. return function (f) {
  1272. return function (fga) {
  1273. return F.map(fga, function (ga) {
  1274. return G.filterMap(ga, f)
  1275. })
  1276. }
  1277. }
  1278. }
  1279. function Chain_chainFirst(M) {
  1280. return function (f) {
  1281. return function (first) {
  1282. return M.chain(first, function (a) {
  1283. return M.map(f(a), function () {
  1284. return a
  1285. })
  1286. })
  1287. }
  1288. }
  1289. }
  1290. var M,
  1291. apM,
  1292. mapM,
  1293. chainM,
  1294. altM,
  1295. foldM,
  1296. getOrElseM,
  1297. zeroM,
  1298. IO_map = function (ma, f) {
  1299. return function () {
  1300. return f(ma())
  1301. }
  1302. },
  1303. IO_ap = function (mab, ma) {
  1304. return function () {
  1305. return mab()(ma())
  1306. }
  1307. },
  1308. IO_chain = function (ma, f) {
  1309. return function () {
  1310. return f(ma())()
  1311. }
  1312. },
  1313. _chainRec = function (a, f) {
  1314. return function () {
  1315. for (var e = f(a)(); "Left" === e._tag; ) e = f(e.left)()
  1316. return e.right
  1317. }
  1318. },
  1319. es6_IO_map = function (f) {
  1320. return function (fa) {
  1321. return IO_map(fa, f)
  1322. }
  1323. },
  1324. IO_of = constant,
  1325. es6_IO_chain = function (f) {
  1326. return function (ma) {
  1327. return IO_chain(ma, f)
  1328. }
  1329. },
  1330. IO_Functor = { URI: "IO", map: IO_map },
  1331. IO_Apply = (flap(IO_Functor), { URI: "IO", map: IO_map, ap: IO_ap }),
  1332. IO_apSecond = Apply_apSecond(IO_Apply),
  1333. IO_Chain = { URI: "IO", map: IO_map, ap: IO_ap, chain: IO_chain },
  1334. IO_chainFirst = Chain_chainFirst(IO_Chain),
  1335. fromIO = function_identity,
  1336. IO_ApT = IO_of(emptyReadonlyArray),
  1337. IO_traverseReadonlyArrayWithIndex = function (f) {
  1338. var g = (function (f) {
  1339. return function (as) {
  1340. return function () {
  1341. for (var out = [f(0, head(as))()], i = 1; i < as.length; i++)
  1342. out.push(f(i, as[i])())
  1343. return out
  1344. }
  1345. }
  1346. })(f)
  1347. return function (as) {
  1348. return internal_isNonEmpty(as) ? g(as) : IO_ApT
  1349. }
  1350. },
  1351. IO_sequenceArray = (function (f) {
  1352. return IO_traverseReadonlyArrayWithIndex(function (_, a) {
  1353. return f(a)
  1354. })
  1355. })(function_identity),
  1356. IO_io = {
  1357. URI: "IO",
  1358. map: IO_map,
  1359. of: IO_of,
  1360. ap: IO_ap,
  1361. chain: IO_chain,
  1362. fromIO,
  1363. chainRec: _chainRec,
  1364. },
  1365. __assign = function () {
  1366. return (__assign =
  1367. Object.assign ||
  1368. function (t) {
  1369. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1370. s = arguments[i]
  1371. for (var p in s)
  1372. Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p])
  1373. }
  1374. return t
  1375. }).apply(this, arguments)
  1376. },
  1377. T =
  1378. ((apM = (function (F) {
  1379. return (function (F, G) {
  1380. return function (fa) {
  1381. return function (fab) {
  1382. return F.ap(
  1383. F.map(fab, function (gab) {
  1384. return function (ga) {
  1385. return G.ap(gab, ga)
  1386. }
  1387. }),
  1388. fa
  1389. )
  1390. }
  1391. }
  1392. })(F, Apply)
  1393. })((M = IO_io))),
  1394. (mapM = (function (F) {
  1395. return map(F, Option_Functor)
  1396. })(M)),
  1397. (chainM = OptionT_chain(M)),
  1398. (altM = (function (M) {
  1399. var _some = OptionT_some(M)
  1400. return function (second) {
  1401. return function (first) {
  1402. return M.chain(first, match(second, _some))
  1403. }
  1404. }
  1405. })(M)),
  1406. (foldM = (function (M) {
  1407. return function (onNone, onSome) {
  1408. return function (ma) {
  1409. return M.chain(ma, match(onNone, onSome))
  1410. }
  1411. }
  1412. })(M)),
  1413. (getOrElseM = (function (M) {
  1414. return function (onNone) {
  1415. return function (fa) {
  1416. return M.chain(fa, match(onNone, M.of))
  1417. }
  1418. }
  1419. })(M)),
  1420. (zeroM = OptionT_zero(M)),
  1421. {
  1422. map: function (fa, f) {
  1423. return function_pipe(fa, mapM(f))
  1424. },
  1425. ap: function (fab, fa) {
  1426. return function_pipe(fab, apM(fa))
  1427. },
  1428. of: OptionT_some(M),
  1429. chain: function (ma, f) {
  1430. return function_pipe(ma, chainM(f))
  1431. },
  1432. alt: function (fa, that) {
  1433. return function_pipe(fa, altM(that))
  1434. },
  1435. fold: function (fa, onNone, onSome) {
  1436. return function_pipe(fa, foldM(onNone, onSome))
  1437. },
  1438. getOrElse: function (fa, onNone) {
  1439. return function_pipe(fa, getOrElseM(onNone))
  1440. },
  1441. fromM: fromF(M),
  1442. none: function () {
  1443. return zeroM()
  1444. },
  1445. }),
  1446. F = (function (F, G) {
  1447. var map = Functor_getFunctorComposition(F, G).map,
  1448. _compact = Compactable_compact(F, G),
  1449. _separate = Compactable_separate(F, G, G),
  1450. _filter = Filterable_filter(F, G),
  1451. _filterMap = Filterable_filterMap(F, G),
  1452. _partition = (function (F, G) {
  1453. var _filter = Filterable_filter(F, G)
  1454. return function (predicate) {
  1455. var left = _filter(Predicate_not(predicate)),
  1456. right = _filter(predicate)
  1457. return function (fgb) {
  1458. return Separated_separated(left(fgb), right(fgb))
  1459. }
  1460. }
  1461. })(F, G),
  1462. _partitionMap = (function (F, G) {
  1463. var _filterMap = Filterable_filterMap(F, G)
  1464. return function (f) {
  1465. return function (fga) {
  1466. return Separated_separated(
  1467. function_pipe(
  1468. fga,
  1469. _filterMap(function (a) {
  1470. return getLeft(f(a))
  1471. })
  1472. ),
  1473. function_pipe(
  1474. fga,
  1475. _filterMap(function (a) {
  1476. return getRight(f(a))
  1477. })
  1478. )
  1479. )
  1480. }
  1481. }
  1482. })(F, G)
  1483. return {
  1484. map,
  1485. compact: _compact,
  1486. separate: _separate,
  1487. filter: function (fga, f) {
  1488. return function_pipe(fga, _filter(f))
  1489. },
  1490. filterMap: function (fga, f) {
  1491. return function_pipe(fga, _filterMap(f))
  1492. },
  1493. partition: function (fga, p) {
  1494. return function_pipe(fga, _partition(p))
  1495. },
  1496. partitionMap: function (fga, f) {
  1497. return function_pipe(fga, _partitionMap(f))
  1498. },
  1499. }
  1500. })(IO_io, Option_option),
  1501. IOOption_some = (T.none(), T.of),
  1502. IOOption_fromIO = T.fromM,
  1503. fromOption = IO_of,
  1504. IOOption_map = function (f) {
  1505. return function (fa) {
  1506. return T.map(fa, f)
  1507. }
  1508. },
  1509. IOOption_chain = function (f) {
  1510. return function (ma) {
  1511. return T.chain(ma, f)
  1512. }
  1513. },
  1514. IOOption_chainFirst = function (f) {
  1515. return function (ma) {
  1516. return T.chain(ma, function (a) {
  1517. return T.map(f(a), function () {
  1518. return a
  1519. })
  1520. })
  1521. }
  1522. },
  1523. IOOption_chainOptionK = function (f) {
  1524. return IOOption_chain(
  1525. (function (f) {
  1526. return function () {
  1527. for (var a = [], _i = 0; _i < arguments.length; _i++)
  1528. a[_i] = arguments[_i]
  1529. return fromOption(f.apply(void 0, a))
  1530. }
  1531. })(f)
  1532. )
  1533. },
  1534. IOOption_filter =
  1535. (F.compact,
  1536. F.separate,
  1537. function (predicate) {
  1538. return function (fa) {
  1539. return F.filter(fa, predicate)
  1540. }
  1541. }),
  1542. eqStrict =
  1543. (T.map,
  1544. T.map,
  1545. T.ap,
  1546. T.map,
  1547. T.ap,
  1548. T.map,
  1549. T.ap,
  1550. T.chain,
  1551. T.map,
  1552. T.alt,
  1553. T.map,
  1554. T.ap,
  1555. T.alt,
  1556. T.map,
  1557. F.filter,
  1558. F.filterMap,
  1559. F.partition,
  1560. F.partitionMap,
  1561. __assign(
  1562. {
  1563. URI: "IOOption",
  1564. of: IOOption_some,
  1565. ap: T.ap,
  1566. chain: T.chain,
  1567. alt: T.alt,
  1568. fromIO: IOOption_fromIO,
  1569. },
  1570. F
  1571. ),
  1572. {
  1573. equals: function (a, b) {
  1574. return a === b
  1575. },
  1576. }),
  1577. ReadonlyNonEmptyArray_spreadArray = function (to, from) {
  1578. for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
  1579. to[j] = from[i]
  1580. return to
  1581. },
  1582. ReadonlyNonEmptyArray_empty = emptyReadonlyArray,
  1583. ReadonlyNonEmptyArray_isNonEmpty = internal_isNonEmpty,
  1584. isOutOfBound = function (i, as) {
  1585. return i < 0 || i >= as.length
  1586. },
  1587. appendW = function (end) {
  1588. return function (init) {
  1589. return ReadonlyNonEmptyArray_spreadArray(
  1590. ReadonlyNonEmptyArray_spreadArray([], init),
  1591. [end]
  1592. )
  1593. }
  1594. },
  1595. append = appendW,
  1596. uniq = function (E) {
  1597. return function (as) {
  1598. if (1 === as.length) return as
  1599. for (
  1600. var out = [ReadonlyNonEmptyArray_head(as)],
  1601. _loop_1 = function (a) {
  1602. out.every(function (o) {
  1603. return !E.equals(o, a)
  1604. }) && out.push(a)
  1605. },
  1606. _i = 0,
  1607. rest_1 = ReadonlyNonEmptyArray_tail(as);
  1608. _i < rest_1.length;
  1609. _i++
  1610. ) {
  1611. _loop_1(rest_1[_i])
  1612. }
  1613. return out
  1614. }
  1615. },
  1616. makeBy = function (f) {
  1617. return function (n) {
  1618. for (
  1619. var j = Math.max(0, Math.floor(n)), out = [f(0)], i = 1;
  1620. i < j;
  1621. i++
  1622. )
  1623. out.push(f(i))
  1624. return out
  1625. }
  1626. }
  1627. var ReadonlyNonEmptyArray_map = function (fa, f) {
  1628. return function_pipe(fa, es6_ReadonlyNonEmptyArray_map(f))
  1629. },
  1630. es6_ReadonlyNonEmptyArray_map = function (f) {
  1631. return mapWithIndex(function (_, a) {
  1632. return f(a)
  1633. })
  1634. },
  1635. mapWithIndex = function (f) {
  1636. return function (as) {
  1637. for (
  1638. var out = [f(0, ReadonlyNonEmptyArray_head(as))], i = 1;
  1639. i < as.length;
  1640. i++
  1641. )
  1642. out.push(f(i, as[i]))
  1643. return out
  1644. }
  1645. },
  1646. extract = head,
  1647. ReadonlyNonEmptyArray_Functor = {
  1648. URI: "ReadonlyNonEmptyArray",
  1649. map: ReadonlyNonEmptyArray_map,
  1650. },
  1651. ReadonlyNonEmptyArray_head =
  1652. (flap(ReadonlyNonEmptyArray_Functor), extract),
  1653. ReadonlyNonEmptyArray_tail = function (as) {
  1654. return as.slice(1)
  1655. }
  1656. var isEmpty = function (as) {
  1657. return 0 === as.length
  1658. },
  1659. ReadonlyArray_isNonEmpty = ReadonlyNonEmptyArray_isNonEmpty,
  1660. ReadonlyArray_append = append,
  1661. ReadonlyArray_makeBy = function (n, f) {
  1662. return n <= 0 ? ReadonlyArray_empty : makeBy(f)(n)
  1663. }
  1664. var ReadonlyArray_isOutOfBound = isOutOfBound
  1665. var findIndex = function (predicate) {
  1666. return function (as) {
  1667. for (var i = 0; i < as.length; i++)
  1668. if (predicate(as[i])) return some(i)
  1669. return none
  1670. }
  1671. }
  1672. var ReadonlyArray_reverse = function (as) {
  1673. return as.length <= 1 ? as : as.slice().reverse()
  1674. }
  1675. var ReadonlyArray_map = function (fa, f) {
  1676. return function_pipe(fa, es6_ReadonlyArray_map(f))
  1677. },
  1678. ReadonlyArray_reduce = function (fa, b, f) {
  1679. return function_pipe(fa, es6_ReadonlyArray_reduce(b, f))
  1680. },
  1681. ReadonlyArray_foldMap = function (M) {
  1682. var foldMapM = es6_ReadonlyArray_foldMap(M)
  1683. return function (fa, f) {
  1684. return function_pipe(fa, foldMapM(f))
  1685. }
  1686. },
  1687. ReadonlyArray_reduceRight = function (fa, b, f) {
  1688. return function_pipe(fa, es6_ReadonlyArray_reduceRight(b, f))
  1689. },
  1690. ReadonlyArray_traverse = function (F) {
  1691. var traverseF = es6_ReadonlyArray_traverse(F)
  1692. return function (ta, f) {
  1693. return function_pipe(ta, traverseF(f))
  1694. }
  1695. },
  1696. ReadonlyArray_zero = function () {
  1697. return ReadonlyArray_empty
  1698. },
  1699. es6_ReadonlyArray_chain = function (f) {
  1700. return function (ma) {
  1701. return function_pipe(
  1702. ma,
  1703. (function (f) {
  1704. return function (as) {
  1705. if (isEmpty(as)) return ReadonlyArray_empty
  1706. for (var out = [], i = 0; i < as.length; i++)
  1707. out.push.apply(out, f(i, as[i]))
  1708. return out
  1709. }
  1710. })(function (_, a) {
  1711. return f(a)
  1712. })
  1713. )
  1714. }
  1715. },
  1716. es6_ReadonlyArray_map = function (f) {
  1717. return function (fa) {
  1718. return fa.map(function (a) {
  1719. return f(a)
  1720. })
  1721. }
  1722. },
  1723. es6_ReadonlyArray_mapWithIndex = function (f) {
  1724. return function (fa) {
  1725. return fa.map(function (a, i) {
  1726. return f(i, a)
  1727. })
  1728. }
  1729. },
  1730. ReadonlyArray_separate = function (fa) {
  1731. for (
  1732. var left = [], right = [], _i = 0, fa_1 = fa;
  1733. _i < fa_1.length;
  1734. _i++
  1735. ) {
  1736. var e = fa_1[_i]
  1737. "Left" === e._tag ? left.push(e.left) : right.push(e.right)
  1738. }
  1739. return Separated_separated(left, right)
  1740. },
  1741. es6_ReadonlyArray_filter = function (predicate) {
  1742. return function (as) {
  1743. return as.filter(predicate)
  1744. }
  1745. },
  1746. filterMapWithIndex = function (f) {
  1747. return function (fa) {
  1748. for (var out = [], i = 0; i < fa.length; i++) {
  1749. var optionB = f(i, fa[i])
  1750. isSome(optionB) && out.push(optionB.value)
  1751. }
  1752. return out
  1753. }
  1754. },
  1755. es6_ReadonlyArray_filterMap = function (f) {
  1756. return filterMapWithIndex(function (_, a) {
  1757. return f(a)
  1758. })
  1759. },
  1760. ReadonlyArray_compact =
  1761. es6_ReadonlyArray_filterMap(function_identity),
  1762. es6_ReadonlyArray_foldMapWithIndex = function (M) {
  1763. return function (f) {
  1764. return function (fa) {
  1765. return fa.reduce(function (b, a, i) {
  1766. return M.concat(b, f(i, a))
  1767. }, M.empty)
  1768. }
  1769. }
  1770. },
  1771. es6_ReadonlyArray_reduce = function (b, f) {
  1772. return es6_ReadonlyArray_reduceWithIndex(b, function (_, b, a) {
  1773. return f(b, a)
  1774. })
  1775. },
  1776. es6_ReadonlyArray_foldMap = function (M) {
  1777. var foldMapWithIndexM = es6_ReadonlyArray_foldMapWithIndex(M)
  1778. return function (f) {
  1779. return foldMapWithIndexM(function (_, a) {
  1780. return f(a)
  1781. })
  1782. }
  1783. },
  1784. es6_ReadonlyArray_reduceWithIndex = function (b, f) {
  1785. return function (fa) {
  1786. for (var len = fa.length, out = b, i = 0; i < len; i++)
  1787. out = f(i, out, fa[i])
  1788. return out
  1789. }
  1790. },
  1791. es6_ReadonlyArray_reduceRight = function (b, f) {
  1792. return es6_ReadonlyArray_reduceRightWithIndex(
  1793. b,
  1794. function (_, a, b) {
  1795. return f(a, b)
  1796. }
  1797. )
  1798. },
  1799. es6_ReadonlyArray_reduceRightWithIndex = function (b, f) {
  1800. return function (fa) {
  1801. return fa.reduceRight(function (b, a, i) {
  1802. return f(i, a, b)
  1803. }, b)
  1804. }
  1805. },
  1806. es6_ReadonlyArray_traverse = function (F) {
  1807. var traverseWithIndexF = es6_ReadonlyArray_traverseWithIndex(F)
  1808. return function (f) {
  1809. return traverseWithIndexF(function (_, a) {
  1810. return f(a)
  1811. })
  1812. }
  1813. },
  1814. ReadonlyArray_sequence = function (F) {
  1815. return function (ta) {
  1816. return ReadonlyArray_reduce(
  1817. ta,
  1818. F.of(ReadonlyArray_zero()),
  1819. function (fas, fa) {
  1820. return F.ap(
  1821. F.map(fas, function (as) {
  1822. return function (a) {
  1823. return function_pipe(as, ReadonlyArray_append(a))
  1824. }
  1825. }),
  1826. fa
  1827. )
  1828. }
  1829. )
  1830. }
  1831. },
  1832. es6_ReadonlyArray_traverseWithIndex = function (F) {
  1833. return function (f) {
  1834. return es6_ReadonlyArray_reduceWithIndex(
  1835. F.of(ReadonlyArray_zero()),
  1836. function (i, fbs, a) {
  1837. return F.ap(
  1838. F.map(fbs, function (bs) {
  1839. return function (b) {
  1840. return function_pipe(bs, ReadonlyArray_append(b))
  1841. }
  1842. }),
  1843. f(i, a)
  1844. )
  1845. }
  1846. )
  1847. }
  1848. },
  1849. ReadonlyArray_Functor = {
  1850. URI: "ReadonlyArray",
  1851. map: ReadonlyArray_map,
  1852. },
  1853. ReadonlyArray_Compactable =
  1854. (flap(ReadonlyArray_Functor),
  1855. {
  1856. URI: "ReadonlyArray",
  1857. compact: ReadonlyArray_compact,
  1858. separate: ReadonlyArray_separate,
  1859. }),
  1860. ReadonlyArray_Traversable = {
  1861. URI: "ReadonlyArray",
  1862. map: ReadonlyArray_map,
  1863. reduce: ReadonlyArray_reduce,
  1864. foldMap: ReadonlyArray_foldMap,
  1865. reduceRight: ReadonlyArray_reduceRight,
  1866. traverse: ReadonlyArray_traverse,
  1867. sequence: ReadonlyArray_sequence,
  1868. },
  1869. toArray =
  1870. (Witherable_witherDefault(
  1871. ReadonlyArray_Traversable,
  1872. ReadonlyArray_Compactable
  1873. ),
  1874. Witherable_wiltDefault(
  1875. ReadonlyArray_Traversable,
  1876. ReadonlyArray_Compactable
  1877. ),
  1878. function (as) {
  1879. return as.slice()
  1880. }),
  1881. ReadonlyArray_empty = ReadonlyNonEmptyArray_empty,
  1882. ReadonlyArray_some = function (predicate) {
  1883. return function (as) {
  1884. return as.some(predicate)
  1885. }
  1886. },
  1887. ReadonlyArray_bindTo = bindTo(ReadonlyArray_Functor)
  1888. const external_rxjs_namespaceObject = rxjs,
  1889. package_namespaceObject_i8 = "1.15.7",
  1890. appendLog =
  1891. log =>
  1892. (a, ...b) =>
  1893. function_pipe(
  1894. [...log, `${a}${b.length > 0 ? ": " : ""}${b.join(", ")}`],
  1895. x => (x.length > 1e3 ? x.slice(0, 100) : x)
  1896. ),
  1897. consoleLog = (...[a, ...b]) =>
  1898. function_pipe(
  1899. () =>
  1900. external_log_default().info(
  1901. ...("string" == typeof a ? [`【FYC ${a}`] : ["【FYC】", a])
  1902. ),
  1903. IO_apSecond(
  1904. b.length > 0
  1905. ? () => external_log_default().info(...b)
  1906. : () => {}
  1907. )
  1908. ),
  1909. external_jsep_namespaceObject = jsep
  1910. var external_jsep_default = __webpack_require__.n(
  1911. external_jsep_namespaceObject
  1912. ),
  1913. u = {
  1914. "||": function (r, e) {
  1915. return r || e
  1916. },
  1917. "&&": function (r, e) {
  1918. return r && e
  1919. },
  1920. "|": function (r, e) {
  1921. return r | e
  1922. },
  1923. "^": function (r, e) {
  1924. return r ^ e
  1925. },
  1926. "&": function (r, e) {
  1927. return r & e
  1928. },
  1929. "==": function (r, e) {
  1930. return r == e
  1931. },
  1932. "!=": function (r, e) {
  1933. return r != e
  1934. },
  1935. "===": function (r, e) {
  1936. return r === e
  1937. },
  1938. "!==": function (r, e) {
  1939. return r !== e
  1940. },
  1941. "<": function (r, e) {
  1942. return r < e
  1943. },
  1944. ">": function (r, e) {
  1945. return r > e
  1946. },
  1947. "<=": function (r, e) {
  1948. return r <= e
  1949. },
  1950. ">=": function (r, e) {
  1951. return r >= e
  1952. },
  1953. "<<": function (r, e) {
  1954. return r << e
  1955. },
  1956. ">>": function (r, e) {
  1957. return r >> e
  1958. },
  1959. ">>>": function (r, e) {
  1960. return r >>> e
  1961. },
  1962. "+": function (r, e) {
  1963. return r + e
  1964. },
  1965. "-": function (r, e) {
  1966. return r - e
  1967. },
  1968. "*": function (r, e) {
  1969. return r * e
  1970. },
  1971. "/": function (r, e) {
  1972. return r / e
  1973. },
  1974. "%": function (r, e) {
  1975. return r % e
  1976. },
  1977. },
  1978. i = {
  1979. "-": function (r) {
  1980. return -r
  1981. },
  1982. "+": function (r) {
  1983. return +r
  1984. },
  1985. "~": function (r) {
  1986. return ~r
  1987. },
  1988. "!": function (r) {
  1989. return !r
  1990. },
  1991. }
  1992. function s(r, e) {
  1993. return r.map(function (r) {
  1994. return a(r, e)
  1995. })
  1996. }
  1997. function c(r, e) {
  1998. var n,
  1999. t = a(r.object, e)
  2000. if (
  2001. ((n = r.computed ? a(r.property, e) : r.property.name),
  2002. /^__proto__|prototype|constructor$/.test(n))
  2003. )
  2004. throw Error('Access to member "' + n + '" disallowed.')
  2005. return [t, t[n]]
  2006. }
  2007. function a(r, e) {
  2008. var n = r
  2009. switch (n.type) {
  2010. case "ArrayExpression":
  2011. return s(n.elements, e)
  2012. case "BinaryExpression":
  2013. return u[n.operator](a(n.left, e), a(n.right, e))
  2014. case "CallExpression":
  2015. var t, o, l
  2016. if (
  2017. ("MemberExpression" === n.callee.type
  2018. ? ((t = (l = c(n.callee, e))[0]), (o = l[1]))
  2019. : (o = a(n.callee, e)),
  2020. "function" != typeof o)
  2021. )
  2022. return
  2023. return o.apply(t, s(n.arguments, e))
  2024. case "ConditionalExpression":
  2025. return a(n.test, e) ? a(n.consequent, e) : a(n.alternate, e)
  2026. case "Identifier":
  2027. return e[n.name]
  2028. case "Literal":
  2029. return n.value
  2030. case "LogicalExpression":
  2031. return "||" === n.operator
  2032. ? a(n.left, e) || a(n.right, e)
  2033. : "&&" === n.operator
  2034. ? a(n.left, e) && a(n.right, e)
  2035. : u[n.operator](a(n.left, e), a(n.right, e))
  2036. case "MemberExpression":
  2037. return c(n, e)[1]
  2038. case "ThisExpression":
  2039. return e
  2040. case "UnaryExpression":
  2041. return i[n.operator](a(n.argument, e))
  2042. default:
  2043. return
  2044. }
  2045. }
  2046. const fycKey = key => `FYC_${key}`,
  2047. stringsArgs = [
  2048. [],
  2049. x => x.split(/\r\n|\n/).filter(s => "" !== s),
  2050. x => x.join("\n"),
  2051. ],
  2052. sc = (k, d) =>
  2053. (async (key, defaultVal) => ({
  2054. gmKey: key,
  2055. val: (await GM.getValue(key)) ?? defaultVal,
  2056. defaultVal,
  2057. toGm: x => x,
  2058. }))(fycKey(k), d),
  2059. ic = (k, d, i, g) =>
  2060. (async (key, defaultVal, toItem, toGm) => {
  2061. const val = await GM.getValue(key)
  2062. return {
  2063. gmKey: key,
  2064. val: void 0 !== val ? toItem(val) : defaultVal,
  2065. defaultVal,
  2066. toGm,
  2067. }
  2068. })(fycKey(k), d, i, g),
  2069. chatApp = () =>
  2070. function_pipe(
  2071. fromNullable(document.querySelector("#chatframe")),
  2072. filter(x => {
  2073. const state = x.contentDocument?.readyState
  2074. return "loading" === state || "complete" === state
  2075. }),
  2076. chainNullableK(x => x.contentDocument),
  2077. alt(() => Option_some(document)),
  2078. chainNullableK(x => x.querySelector("yt-live-chat-app"))
  2079. ),
  2080. observePair = con => {
  2081. const subject = new external_rxjs_namespaceObject.Subject()
  2082. return { subject, observer: new con(lib(subject)) }
  2083. }
  2084. var Eq = {
  2085. equals: function (first, second) {
  2086. return first === second
  2087. },
  2088. }
  2089. const external_Swal_namespaceObject = Swal
  2090. var external_Swal_default = __webpack_require__.n(
  2091. external_Swal_namespaceObject
  2092. )
  2093. const addBanButton_button = document.createElement("button")
  2094. addBanButton_button.classList.add(
  2095. "style-scope",
  2096. "yt-icon-button",
  2097. "fyc_button"
  2098. )
  2099. Object.assign(addBanButton_button.style, {
  2100. padding: "0px",
  2101. width: "20px",
  2102. height: "20px",
  2103. fill: "#fff",
  2104. })
  2105. addBanButton_button.setAttribute(
  2106. "aria-label",
  2107. "NGに入れる(Ban this user)"
  2108. )
  2109. addBanButton_button.innerHTML =
  2110. '<svg class="style-scope yt-icon" style="width: 100%; height: 75%; fill: var(--yt-spec-text-secondary);" viewBox="0 0 512 512"><path d="M440 78A256 256 0 1 0 73 435 256 256 0 0 0 440 78zm-99 35L113 341C37 179 212 44 341 113zM177 405l228-228c76 162-99 297-228 228z" fill-rule="evenodd"/></svg>'
  2111. const addBanButton = (chat, id, getConfig, setConfig) =>
  2112. chat.children.namedItem("card")
  2113. ? () => {}
  2114. : () => {
  2115. const clone = addBanButton_button.cloneNode(!0)
  2116. clone.onclick = function_pipe(
  2117. getConfig.bannedUsers,
  2118. IOOption_fromIO,
  2119. IOOption_filter(x => !x.includes(id)),
  2120. IOOption_map(
  2121. function_flow(
  2122. (function (E) {
  2123. var f = uniq(E)
  2124. return function (as) {
  2125. return ReadonlyArray_isNonEmpty(as) ? f(as) : as
  2126. }
  2127. })(Eq),
  2128. ReadonlyArray_append(id),
  2129. toArray
  2130. )
  2131. ),
  2132. IOOption_chain(x =>
  2133. IOOption_fromIO(() => {
  2134. setConfig.bannedUsers(x)
  2135. external_Swal_default()
  2136. .mixin({
  2137. toast: !0,
  2138. position: "bottom-left",
  2139. timer: 2500,
  2140. timerProgressBar: !0,
  2141. showConfirmButton: !1,
  2142. didOpen: toast => {
  2143. toast.addEventListener(
  2144. "pointerenter",
  2145. external_Swal_default().stopTimer
  2146. )
  2147. toast.addEventListener(
  2148. "pointerleave",
  2149. external_Swal_default().resumeTimer
  2150. )
  2151. },
  2152. })
  2153. .fire({
  2154. title: `Added Banned User: ${id}`,
  2155. icon: "success",
  2156. })
  2157. })
  2158. ),
  2159. IO_apSecond(() => {
  2160. chat.style.display = "none"
  2161. })
  2162. )
  2163. chat.querySelector("#content #message")?.append(clone)
  2164. },
  2165. getChatFontSize = mainState =>
  2166. Math.round(
  2167. ((Math.max(mainState.getConfig.fontSize() - 0.2, 0.01) *
  2168. mainState.playerRect.height) /
  2169. mainState.getConfig.laneCount()) *
  2170. (mainState.getConfig.flowY2() - mainState.getConfig.flowY1()) *
  2171. 100
  2172. ) / 100
  2173. var equalsDefault = function (compare) {
  2174. return function (first, second) {
  2175. return first === second || 0 === compare(first, second)
  2176. }
  2177. },
  2178. Ord_fromCompare = function (compare) {
  2179. return {
  2180. equals: equalsDefault(compare),
  2181. compare: function (first, second) {
  2182. return first === second ? 0 : compare(first, second)
  2183. },
  2184. }
  2185. },
  2186. Ord_contramap = function (f) {
  2187. return function (fa) {
  2188. return Ord_fromCompare(function (first, second) {
  2189. return fa.compare(f(first), f(second))
  2190. })
  2191. }
  2192. }
  2193. constant(0)
  2194. var number_Eq = {
  2195. equals: function (first, second) {
  2196. return first === second
  2197. },
  2198. },
  2199. number_Ord = {
  2200. equals: number_Eq.equals,
  2201. compare: function (first, second) {
  2202. return first < second ? -1 : first > second ? 1 : 0
  2203. },
  2204. }
  2205. const external_window_micro_memoize_namespaceObject =
  2206. window["micro-memoize"]
  2207. var external_window_micro_memoize_default = __webpack_require__.n(
  2208. external_window_micro_memoize_namespaceObject
  2209. )
  2210. const getFlowChatProgress = chat =>
  2211. function_pipe(
  2212. chat.animation,
  2213. chainNullableK(x => x.currentTime),
  2214. getOrElse(() => 0)
  2215. ) / chat.animationDuration,
  2216. getFlowChatRect = (chat, mainState) => {
  2217. const x =
  2218. mainState.playerRect.width -
  2219. (chat.width + mainState.playerRect.width) *
  2220. getFlowChatProgress(chat)
  2221. return new DOMRect(x, chat.y, chat.width, chat.height)
  2222. },
  2223. getChatLane = (flowChat, progress, flowChats) => mainState => {
  2224. const playerWidth = mainState.playerRect.width,
  2225. chatRect = getFlowChatRect(flowChat, mainState),
  2226. chatWidth = chatRect.width,
  2227. chatHeight = chatRect.height,
  2228. chatX = chatRect.x,
  2229. chatIndex = flowChats.indexOf(flowChat),
  2230. movingChats = function_pipe(
  2231. flowChats,
  2232. (function (n) {
  2233. return function (as) {
  2234. return ReadonlyArray_isOutOfBound(n, as)
  2235. ? as
  2236. : 0 === n
  2237. ? ReadonlyArray_empty
  2238. : as.slice(0, n)
  2239. }
  2240. })(chatIndex >= 0 ? chatIndex : -1),
  2241. es6_ReadonlyArray_filter(
  2242. chat => !chat.animationEnded && chat.width > 0
  2243. ),
  2244. (function (O) {
  2245. return function (as) {
  2246. return as.length <= 1 ? as : as.slice().sort(O.compare)
  2247. }
  2248. })(Ord_contramap(x => x.lane)(number_Ord))
  2249. ),
  2250. tooCloseTo = external_window_micro_memoize_default()(
  2251. i => {
  2252. const otherRect = getFlowChatRect(movingChats[i], mainState),
  2253. otherWidth = otherRect.width,
  2254. otherX = otherRect.x,
  2255. gap =
  2256. (chatHeight * otherWidth * chatWidth) ** 0.333 *
  2257. mainState.getConfig.minSpacing()
  2258. return (
  2259. (playerWidth - otherX) / (playerWidth + otherWidth) -
  2260. progress <
  2261. (chatWidth + gap) / (playerWidth + chatWidth) ||
  2262. otherX + otherWidth + gap > chatX
  2263. )
  2264. },
  2265. { maxSize: 1e3 }
  2266. ),
  2267. occupyInfo = [
  2268. ...movingChats.map((x, i) => ({
  2269. tooClose: () => tooCloseTo(i),
  2270. lane: x.lane,
  2271. })),
  2272. { tooClose: () => !0, lane: mainState.getConfig.laneCount() },
  2273. ],
  2274. index = occupyInfo.findIndex(x => x.lane >= flowChat.lane),
  2275. rightFreeLane = function_pipe(
  2276. occupyInfo.slice(index),
  2277. ((predicate = x => x.tooClose()),
  2278. function (as) {
  2279. for (var i = 0; i < as.length; i++)
  2280. if (predicate(as[i])) return some(as[i])
  2281. return none
  2282. }),
  2283. es6_Option_map(x => x.lane),
  2284. getOrElse(() => mainState.getConfig.laneCount())
  2285. )
  2286. var predicate
  2287. const leftFreeLane = function_pipe(
  2288. occupyInfo.slice(0, index),
  2289. (function (predicate) {
  2290. return function (as) {
  2291. for (var i = as.length - 1; i >= 0; i--)
  2292. if (predicate(as[i])) return some(as[i])
  2293. return none
  2294. }
  2295. })(x => x.tooClose()),
  2296. es6_Option_map(x => x.lane),
  2297. getOrElse(() => -1)
  2298. ),
  2299. formerLaneInterval = Math.min(
  2300. flowChat.lane - leftFreeLane,
  2301. rightFreeLane - flowChat.lane,
  2302. 1
  2303. )
  2304. return function_pipe(
  2305. occupyInfo,
  2306. es6_ReadonlyArray_reduce(
  2307. { maxInterval: 0, maxIntervalLane: 0, lastLane: -1 },
  2308. ({ maxInterval, maxIntervalLane, lastLane }, info) =>
  2309. maxInterval > 0.999 || !info.tooClose()
  2310. ? { maxInterval, maxIntervalLane, lastLane }
  2311. : (() => {
  2312. const nextLane = info.lane,
  2313. interLane = Math.min(
  2314. Math.max((lastLane + nextLane) / 2, 0),
  2315. mainState.getConfig.laneCount() - 1
  2316. ),
  2317. newInterval = Math.min(
  2318. interLane - lastLane,
  2319. nextLane - interLane,
  2320. 1
  2321. )
  2322. return newInterval - maxInterval > 0.001
  2323. ? {
  2324. maxInterval: newInterval,
  2325. maxIntervalLane: Math.max(
  2326. lastLane + newInterval,
  2327. 0
  2328. ),
  2329. lastLane: nextLane,
  2330. }
  2331. : { maxInterval, maxIntervalLane, lastLane: nextLane }
  2332. })()
  2333. ),
  2334. x => ({
  2335. lane:
  2336. Math.abs(formerLaneInterval - x.maxInterval) < 0.001
  2337. ? flowChat.lane
  2338. : x.maxIntervalLane,
  2339. interval: x.maxInterval,
  2340. })
  2341. )
  2342. },
  2343. intervalTooSmall = interval => getConfig =>
  2344. getConfig.noOverlap() && interval < 0.999,
  2345. external_m_namespaceObject = m
  2346. var external_m_default = __webpack_require__.n(
  2347. external_m_namespaceObject
  2348. )
  2349. const textShadow = shadowColor =>
  2350. function_flow(
  2351. x => `${x}px`,
  2352. x => (a, b) => `${a}${x} ${b}${x} ${shadowColor}99`,
  2353. x => [x("-", "-"), x("", "-"), x("-", ""), x("", "")].join(", ")
  2354. ),
  2355. textStyle = { fontFamily: "inherit" },
  2356. chatNode = (chat, mainState) => {
  2357. const { getConfig } = mainState,
  2358. data = chat.getData(getConfig)
  2359. return external_m_default()(
  2360. "span",
  2361. {
  2362. style: {
  2363. fontSize: `${getChatFontSize(mainState)}px`,
  2364. visibility: getConfig.displayChats() ? "visible" : "hidden",
  2365. color:
  2366. "owner" === data.authorType
  2367. ? getConfig.ownerColor()
  2368. : "moderator" === data.authorType
  2369. ? getConfig.moderatorColor()
  2370. : "member" === data.authorType
  2371. ? getConfig.memberColor()
  2372. : getConfig.color(),
  2373. fontWeight: getConfig.fontWeight().toString(),
  2374. fontFamily: getConfig.font(),
  2375. opacity: getConfig.chatOpacity().toString(),
  2376. textShadow: textShadow(getConfig.shadowColor())(
  2377. getConfig.shadowFontWeight()
  2378. ),
  2379. },
  2380. },
  2381. function_pipe(
  2382. [
  2383. function_pipe(
  2384. data.authorName,
  2385. filter(x => x.visible),
  2386. es6_Option_map(x =>
  2387. external_m_default()(
  2388. "span",
  2389. {
  2390. style: {
  2391. color: toUndefined(data.textColor),
  2392. fontSize: "0.84em",
  2393. ...textStyle,
  2394. },
  2395. },
  2396. `${x.content}: `
  2397. )
  2398. )
  2399. ),
  2400. function_pipe(
  2401. data.messageElement,
  2402. es6_Option_map(x =>
  2403. ((message, getConfig) => {
  2404. const eleWin =
  2405. message.ownerDocument.defaultView ?? window,
  2406. maxChatLength = getConfig.maxChatLength()
  2407. return function_pipe(
  2408. Array.from(message.childNodes),
  2409. es6_ReadonlyArray_reduce(
  2410. { vnodes: [], length: 0 },
  2411. ({ vnodes, length }, node) => {
  2412. return length >= maxChatLength
  2413. ? { vnodes, length }
  2414. : !getConfig.textOnly() &&
  2415. node instanceof eleWin.HTMLImageElement
  2416. ? {
  2417. vnodes: [
  2418. ...vnodes,
  2419. external_m_default()("img", {
  2420. style: {
  2421. height: "1em",
  2422. width: "1em",
  2423. verticalAlign: "text-top",
  2424. },
  2425. src: node.src,
  2426. alt: node.alt,
  2427. }),
  2428. ],
  2429. length: length + 1,
  2430. }
  2431. : function_pipe(
  2432. node.textContent ?? "",
  2433. ((start = 0),
  2434. (end = maxChatLength),
  2435. function (s) {
  2436. return s.slice(start, end)
  2437. }),
  2438. x =>
  2439. node instanceof eleWin.HTMLAnchorElement
  2440. ? {
  2441. vnodes: [
  2442. ...vnodes,
  2443. external_m_default()(
  2444. "span",
  2445. {
  2446. style: {
  2447. fontSize: "0.84em",
  2448. textDecoration: "underline",
  2449. ...textStyle,
  2450. },
  2451. },
  2452. x
  2453. ),
  2454. ],
  2455. length: length + x.length,
  2456. }
  2457. : {
  2458. vnodes: [
  2459. ...vnodes,
  2460. external_m_default().fragment(
  2461. {},
  2462. x
  2463. ),
  2464. ],
  2465. length: length + x.length,
  2466. }
  2467. )
  2468. var start, end
  2469. }
  2470. )
  2471. )
  2472. })(x, getConfig)
  2473. ),
  2474. es6_Option_map(x =>
  2475. external_m_default()(
  2476. "span",
  2477. {
  2478. style: {
  2479. color: toUndefined(data.textColor),
  2480. ...textStyle,
  2481. },
  2482. },
  2483. x.vnodes
  2484. )
  2485. )
  2486. ),
  2487. function_pipe(
  2488. data.paymentInfo,
  2489. filter(x => x.visible),
  2490. es6_Option_map(x =>
  2491. external_m_default()(
  2492. "span",
  2493. {
  2494. style: {
  2495. color: toUndefined(data.paidColor),
  2496. fontSize: "0.84em",
  2497. ...textStyle,
  2498. },
  2499. },
  2500. external_m_default()(
  2501. "strong",
  2502. { style: textStyle },
  2503. x.content
  2504. )
  2505. )
  2506. )
  2507. ),
  2508. ],
  2509. ReadonlyArray_compact,
  2510. toArray
  2511. )
  2512. )
  2513. },
  2514. renderChat = chat => mainState => () =>
  2515. external_m_default().render(
  2516. chat.element,
  2517. chatNode(chat, mainState)
  2518. ),
  2519. external_window_hash_it_namespaceObject = window["hash-it"]
  2520. var external_window_hash_it_default = __webpack_require__.n(
  2521. external_window_hash_it_namespaceObject
  2522. )
  2523. const getLaneY = (lane, mainState) =>
  2524. mainState.playerRect.height *
  2525. ((lane / mainState.getConfig.laneCount() + 0.005) *
  2526. (mainState.getConfig.flowY2() - mainState.getConfig.flowY1()) +
  2527. mainState.getConfig.flowY1()),
  2528. setChatPlayState = chat => mainState =>
  2529. function_pipe(
  2530. chat,
  2531. fromPredicate(x => !x.animationEnded),
  2532. x => x,
  2533. fromOption,
  2534. IOOption_chainOptionK(x => x.animation),
  2535. IOOption_chainFirst(x =>
  2536. IOOption_fromIO(
  2537. mainState.chatPlaying ? () => x.play() : () => x.pause()
  2538. )
  2539. ),
  2540. IOOption_chain(x =>
  2541. IOOption_fromIO(() => {
  2542. x.playbackRate = mainState.getConfig.flowSpeed() / 15
  2543. })
  2544. )
  2545. ),
  2546. getWidth = external_window_micro_memoize_default()(
  2547. ele => ele?.getBoundingClientRect().width ?? 0,
  2548. {
  2549. maxSize: 2e3,
  2550. transformKey: args => args.map(external_window_hash_it_default()),
  2551. }
  2552. ),
  2553. setChatAnimation = (chat, chats) => mainState =>
  2554. function_pipe(
  2555. { fontSize: getChatFontSize(mainState) },
  2556. IO_of,
  2557. IO_chainFirst(x => () => {
  2558. chat.element.style.transform = `translate(${
  2559. mainState.playerRect.width
  2560. }px, -${2 * x.fontSize}px)`
  2561. }),
  2562. IOOption_fromIO,
  2563. IOOption_filter(() => !chat.animationEnded),
  2564. IOOption_chainFirst(x =>
  2565. IOOption_fromIO(() => {
  2566. chat.animationDuration = 6400
  2567. chat.width = getWidth(chat.element.firstElementChild)
  2568. chat.height = x.fontSize
  2569. })
  2570. ),
  2571. IOOption_map(() => ({ progress: getFlowChatProgress(chat) })),
  2572. IOOption_map(x => ({
  2573. ...x,
  2574. ...getChatLane(chat, x.progress, chats)(mainState),
  2575. })),
  2576. IOOption_chain(ctx =>
  2577. intervalTooSmall(ctx.interval)(mainState.getConfig)
  2578. ? function_pipe(
  2579. chat.animation,
  2580. fromOption,
  2581. IOOption_chain(x =>
  2582. IOOption_fromIO(() => {
  2583. x.finish()
  2584. chat.animation = Option_none
  2585. })
  2586. ),
  2587. es6_IO_map(() => Option_none)
  2588. )
  2589. : IOOption_some(ctx)
  2590. ),
  2591. IOOption_chainFirst(x =>
  2592. IOOption_fromIO(() => {
  2593. chat.lane = x.lane
  2594. })
  2595. ),
  2596. IOOption_map(x => ({
  2597. ...x,
  2598. laneY: getLaneY(chat.lane, mainState),
  2599. })),
  2600. IOOption_chain(ctx =>
  2601. function_pipe(
  2602. [
  2603. function_pipe(
  2604. chat.animation,
  2605. fromOption,
  2606. IOOption_chain(x => IOOption_fromIO(() => x.cancel()))
  2607. ),
  2608. function_pipe(
  2609. [
  2610. [mainState.playerRect.width, ctx.laneY],
  2611. [-chat.width, ctx.laneY],
  2612. ],
  2613. es6_ReadonlyArray_map(
  2614. es6_ReadonlyArray_map(x => `${x}px`)
  2615. ),
  2616. es6_ReadonlyArray_map(
  2617. ([x, y]) => `translate(${x}, ${y})`
  2618. ),
  2619. ReadonlyArray_bindTo("transform"),
  2620. toArray,
  2621. x =>
  2622. chat.element.animate(x, {
  2623. duration: 6400,
  2624. easing: mainState.getConfig.timingFunction(),
  2625. }),
  2626. x => {
  2627. x.onfinish = () => {
  2628. chat.animationEnded = !0
  2629. }
  2630. chat.y = ctx.laneY
  2631. const newTime = 6400 * ctx.progress
  2632. x.currentTime = newTime
  2633. return x
  2634. },
  2635. Option_some,
  2636. x => () => {
  2637. chat.animation = x
  2638. },
  2639. IO_apSecond(setChatPlayState(chat)(mainState))
  2640. ),
  2641. ],
  2642. IO_sequenceArray,
  2643. IOOption_fromIO
  2644. )
  2645. ),
  2646. es6_IO_map(Option_isSome)
  2647. ),
  2648. emptyElement = document.createElement("span")
  2649. var Semigroup_concatAll = function (M) {
  2650. return function (startWith) {
  2651. return function (as) {
  2652. return as.reduce(function (a, acc) {
  2653. return M.concat(a, acc)
  2654. }, startWith)
  2655. }
  2656. }
  2657. },
  2658. semigroupVoid = (function (a) {
  2659. return {
  2660. concat: function () {
  2661. return a
  2662. },
  2663. }
  2664. })(void 0)
  2665. var Monoid_concatAll = function (M) {
  2666. return Semigroup_concatAll(M)(M.empty)
  2667. },
  2668. MonoidAll =
  2669. (semigroupVoid.concat,
  2670. {
  2671. concat: function (first, second) {
  2672. return first && second
  2673. },
  2674. empty: !0,
  2675. }),
  2676. MonoidAny = {
  2677. concat: function (first, second) {
  2678. return first || second
  2679. },
  2680. empty: !1,
  2681. }
  2682. const operators = {
  2683. flip: x => b => a => x(a)(b),
  2684. flow: fns => function_flow(...fns),
  2685. and: Monoid_concatAll(MonoidAll),
  2686. or: Monoid_concatAll(MonoidAny),
  2687. RA: { some: ReadonlyArray_some, compact: ReadonlyArray_compact },
  2688. O: {
  2689. exists: function (predicate) {
  2690. return function (ma) {
  2691. return !Option_isNone(ma) && predicate(ma.value)
  2692. }
  2693. },
  2694. },
  2695. allPreds: Monoid_concatAll(function_getMonoid(MonoidAll)()),
  2696. anyPreds: Monoid_concatAll(function_getMonoid(MonoidAny)()),
  2697. inText: text => x => text.content.includes(x),
  2698. eqText: text => x => text.content === x,
  2699. matchedByText: text => x =>
  2700. Boolean(text.content.match(RegExp(x, "u"))),
  2701. isVisible: x => x.visible,
  2702. },
  2703. checkBannedWords = (data, mainState, mainLog) =>
  2704. function_pipe(
  2705. data,
  2706. fromPredicate(() =>
  2707. function_pipe(
  2708. mainState.filterExp,
  2709. es6_Option_map(x =>
  2710. a(
  2711. x,
  2712. (data => ({
  2713. ...operators,
  2714. authorName: data.authorName,
  2715. message: data.message,
  2716. messageText: data.messageText,
  2717. paymentInfo: data.paymentInfo,
  2718. authorID: function_pipe(
  2719. data.authorID,
  2720. es6_Option_map(x => ({ visible: !1, content: x }))
  2721. ),
  2722. }))(data)
  2723. )
  2724. ),
  2725. getOrElse(() => !1)
  2726. )
  2727. ),
  2728. es6_Option_map(x => [
  2729. function_pipe(
  2730. x.message,
  2731. es6_Option_map(m => m.content)
  2732. ),
  2733. function_pipe(
  2734. x.paymentInfo,
  2735. es6_Option_map(p => p.content)
  2736. ),
  2737. ]),
  2738. es6_Option_map(es6_ReadonlyArray_map(getOrElse(() => ""))),
  2739. es6_Option_map(JSON.stringify),
  2740. es6_Option_map(x => mainLog(`Banned: ${x}`)),
  2741. match(
  2742. () => () => !1,
  2743. es6_IO_map(() => !0)
  2744. )
  2745. )(),
  2746. assert_lib = check.assert,
  2747. tapNonNull = x => {
  2748. assert_lib(null != x)
  2749. return x
  2750. },
  2751. onChatFieldMutate = (
  2752. chatScrn,
  2753. flowChats,
  2754. mainState,
  2755. setConfig,
  2756. mainLog
  2757. ) =>
  2758. function_flow(
  2759. es6_ReadonlyArray_chain(e => Array.from(e.addedNodes)),
  2760. es6_ReadonlyArray_filter(x => x.children.length > 0),
  2761. ReadonlyArray_reverse,
  2762. es6_ReadonlyArray_map(chat => () => {
  2763. const getData = (chat => {
  2764. const chatType = chat.querySelector(
  2765. ".yt-live-chat-ticker-paid-message-item-renderer"
  2766. )
  2767. ? "ticker"
  2768. : chat.querySelector(
  2769. ".yt-live-chat-membership-item-renderer"
  2770. )
  2771. ? "membership"
  2772. : chat.querySelector(
  2773. ".yt-live-chat-viewer-engagement-message-renderer"
  2774. )
  2775. ? "engagement"
  2776. : "normal",
  2777. isPaid =
  2778. "ticker" === chatType ||
  2779. Boolean(chat.querySelector("#card")),
  2780. paymentInfo = function_pipe(
  2781. fromNullable(
  2782. isPaid
  2783. ? chat.querySelector(
  2784. [
  2785. "#purchase-amount",
  2786. "#purchase-amount-chip",
  2787. "#content>#text",
  2788. ].join(",")
  2789. )?.textContent
  2790. : void 0
  2791. ),
  2792. es6_Option_map(x => ({ visible: !0, content: x }))
  2793. ),
  2794. authorType = chat.querySelector(".owner")
  2795. ? "owner"
  2796. : chat.querySelector(".moderator")
  2797. ? "moderator"
  2798. : chat.querySelector(".member")
  2799. ? "member"
  2800. : "normal",
  2801. messageElement = fromNullable(
  2802. chat.querySelector("#message")
  2803. ),
  2804. isPaidNormal =
  2805. !!Option_isSome(paymentInfo) &&
  2806. Boolean(
  2807. chat.querySelector(
  2808. ".yt-live-chat-paid-message-renderer"
  2809. )
  2810. ),
  2811. isPaidSticker =
  2812. !(!Option_isSome(paymentInfo) || isPaidNormal) &&
  2813. Boolean(
  2814. chat.querySelector(
  2815. ".yt-live-chat-paid-sticker-renderer"
  2816. )
  2817. ),
  2818. textColor = fromNullable(
  2819. isPaidNormal
  2820. ? window
  2821. .getComputedStyle(
  2822. tapNonNull(chat.querySelector("#header"))
  2823. )
  2824. .getPropertyValue("background-color")
  2825. : isPaidSticker
  2826. ? window
  2827. .getComputedStyle(chat)
  2828. .getPropertyValue(
  2829. "--yt-live-chat-paid-sticker-chip-background-color"
  2830. )
  2831. : void 0
  2832. ),
  2833. paidColor = fromNullable(
  2834. isPaidNormal
  2835. ? window
  2836. .getComputedStyle(
  2837. tapNonNull(chat.querySelector("#content"))
  2838. )
  2839. .getPropertyValue("background-color")
  2840. : isPaidSticker
  2841. ? window
  2842. .getComputedStyle(chat)
  2843. .getPropertyValue(
  2844. "--yt-live-chat-paid-sticker-background-color"
  2845. )
  2846. : void 0
  2847. ),
  2848. authorPhotoMatches = chat
  2849. .querySelector(["#author-photo", "img"].join(" "))
  2850. ?.src.match(/ytc\/(.*)=/),
  2851. authorID = fromNullable(
  2852. authorPhotoMatches?.[authorPhotoMatches.length - 1]
  2853. ),
  2854. authorName = fromNullable(
  2855. chat.querySelector("#author-name")?.textContent
  2856. ),
  2857. message = function_pipe(
  2858. messageElement,
  2859. es6_Option_map(x => ({
  2860. visible: !0,
  2861. content: x.innerHTML,
  2862. }))
  2863. ),
  2864. messageText = function_pipe(
  2865. messageElement,
  2866. es6_Option_map(x => ({
  2867. visible: !0,
  2868. content: x.textContent ?? "",
  2869. }))
  2870. )
  2871. return getConfig => ({
  2872. chatType,
  2873. authorType,
  2874. authorID,
  2875. authorName: function_pipe(
  2876. authorName,
  2877. es6_Option_map(x => ({
  2878. visible:
  2879. ("moderator" === authorType &&
  2880. getConfig.displayModName()) ||
  2881. (Option_isSome(paymentInfo) &&
  2882. getConfig.displaySuperChatAuthor()),
  2883. content: x,
  2884. }))
  2885. ),
  2886. messageElement,
  2887. message,
  2888. messageText,
  2889. paymentInfo,
  2890. textColor,
  2891. paidColor,
  2892. })
  2893. })(chat),
  2894. { getConfig } = mainState,
  2895. data = getData(getConfig)
  2896. ;(checkBannedWords(data, mainState, mainLog)
  2897. ? () => {
  2898. chat.style.display = "none"
  2899. }
  2900. : function_pipe(
  2901. [
  2902. function_pipe(
  2903. void 0,
  2904. fromPredicate(getConfig.createChats),
  2905. filter(() => "normal" === data.chatType),
  2906. fromOption,
  2907. IOOption_chain(() =>
  2908. IOOption_fromIO(
  2909. ((getData, flowChats, chatScrn, mainState) =>
  2910. function_pipe(
  2911. {
  2912. getData,
  2913. element: emptyElement,
  2914. lane: -1,
  2915. animation: Option_none,
  2916. animationDuration: 0,
  2917. animationEnded: !1,
  2918. width: 2,
  2919. height: getChatFontSize(mainState),
  2920. y: 0,
  2921. },
  2922. x =>
  2923. getChatLane(x, 0, flowChats)(mainState)
  2924. .interval,
  2925. intervalTooSmall,
  2926. x => x(mainState.getConfig)
  2927. )
  2928. ? () => {}
  2929. : () => {
  2930. const offScreenIndex = function_pipe(
  2931. flowChats,
  2932. findIndex(
  2933. chat =>
  2934. chat.animationEnded ||
  2935. flowChats.length >=
  2936. mainState.getConfig.maxChatCount()
  2937. )
  2938. ),
  2939. element = function_pipe(
  2940. offScreenIndex,
  2941. es6_Option_map(
  2942. x => flowChats[x].element
  2943. ),
  2944. getOrElseW(() =>
  2945. document.createElement("span")
  2946. )
  2947. )
  2948. function_pipe(
  2949. offScreenIndex,
  2950. match(
  2951. () => () => {
  2952. external_log_default().debug(
  2953. "CreateFlowChat"
  2954. )
  2955. chatScrn.append(element)
  2956. },
  2957. i =>
  2958. function_pipe(
  2959. () =>
  2960. flowChats.splice(i, 1)[0]
  2961. .animation,
  2962. IOOption_chain(oldAnimation =>
  2963. IOOption_fromIO(() =>
  2964. oldAnimation.cancel()
  2965. )
  2966. )
  2967. )
  2968. )
  2969. )()
  2970. const flowChat = {
  2971. getData,
  2972. element,
  2973. lane: -1,
  2974. animation: Option_none,
  2975. animationDuration: 0,
  2976. animationEnded: !1,
  2977. width: 2,
  2978. height: getChatFontSize(mainState),
  2979. y: 0,
  2980. }
  2981. element.classList.add("fyc_chat")
  2982. function_pipe(
  2983. mainState,
  2984. IO_of,
  2985. IO_chainFirst(renderChat(flowChat)),
  2986. es6_IO_chain(
  2987. setChatAnimation(flowChat, flowChats)
  2988. ),
  2989. es6_IO_chain(x =>
  2990. x
  2991. ? () => flowChats.push(flowChat)
  2992. : () => flowChat.element.remove()
  2993. )
  2994. )()
  2995. })(getData, flowChats, chatScrn, mainState)
  2996. )
  2997. )
  2998. ),
  2999. function_pipe(
  3000. data.authorID,
  3001. fromOption,
  3002. IOOption_filter(getConfig.createBanButton),
  3003. IOOption_chain(x =>
  3004. IOOption_fromIO(
  3005. addBanButton(chat, x, getConfig, setConfig)
  3006. )
  3007. ),
  3008. es6_IO_map(() => Option_some(void 0)),
  3009. IOOption_filter(getConfig.simplifyChatField),
  3010. IOOption_chain(() =>
  3011. IOOption_fromIO(
  3012. (chat =>
  3013. chat.querySelector(
  3014. ".style-scope.yt-live-chat-paid-message-renderer"
  3015. )
  3016. ? () => {}
  3017. : function_pipe(
  3018. [
  3019. "#author-photo",
  3020. "yt-live-chat-author-chip.style-scope.yt-live-chat-text-message-renderer",
  3021. ],
  3022. es6_ReadonlyArray_map(x =>
  3023. fromNullable(chat.querySelector(x))
  3024. ),
  3025. ReadonlyArray_compact,
  3026. es6_ReadonlyArray_map(x => () => {
  3027. x.style.display = "none"
  3028. }),
  3029. ReadonlyArray_append(() => {
  3030. chat.style.borderBottom =
  3031. "1px solid var(--yt-spec-text-secondary)"
  3032. }),
  3033. IO_sequenceArray
  3034. ))(chat)
  3035. )
  3036. )
  3037. ),
  3038. ],
  3039. IO_sequenceArray
  3040. ))()
  3041. }),
  3042. IO_sequenceArray
  3043. ),
  3044. removeOldChats = (flowChats, maxChatCount) => {
  3045. flowChats.sort((a, b) =>
  3046. a.animationEnded === b.animationEnded
  3047. ? 0
  3048. : a.animationEnded
  3049. ? -1
  3050. : 1
  3051. )
  3052. flowChats
  3053. .splice(0, Math.max(0, flowChats.length - maxChatCount))
  3054. .forEach(x => {
  3055. external_log_default().debug("RemoveChat")
  3056. x.element.remove()
  3057. })
  3058. }
  3059. var EMPTY_OBJ = {},
  3060. EMPTY_ARR = [],
  3061. id = a => a,
  3062. hyperapp_map = EMPTY_ARR.map,
  3063. isArray = Array.isArray,
  3064. enqueue =
  3065. "undefined" != typeof requestAnimationFrame
  3066. ? requestAnimationFrame
  3067. : setTimeout,
  3068. createClass = obj => {
  3069. var out = ""
  3070. if ("string" == typeof obj) return obj
  3071. if (isArray(obj))
  3072. for (var tmp, k = 0; k < obj.length; k++)
  3073. (tmp = createClass(obj[k])) && (out += (out && " ") + tmp)
  3074. else for (var k in obj) obj[k] && (out += (out && " ") + k)
  3075. return out
  3076. },
  3077. shouldRestart = (a, b) => {
  3078. for (var k in { ...a, ...b })
  3079. if ("function" == typeof (isArray(a[k]) ? a[k][0] : a[k]))
  3080. b[k] = a[k]
  3081. else if (a[k] !== b[k]) return !0
  3082. },
  3083. getKey = vdom => (null == vdom ? vdom : vdom.key),
  3084. patchProperty = (node, key, oldValue, newValue, listener, isSvg) => {
  3085. if ("key" === key);
  3086. else if ("style" === key)
  3087. for (var k in { ...oldValue, ...newValue }) {
  3088. oldValue =
  3089. null == newValue || null == newValue[k] ? "" : newValue[k]
  3090. "-" === k[0]
  3091. ? node[key].setProperty(k, oldValue)
  3092. : (node[key][k] = oldValue)
  3093. }
  3094. else
  3095. "o" === key[0] && "n" === key[1]
  3096. ? ((node.events || (node.events = {}))[(key = key.slice(2))] =
  3097. newValue)
  3098. ? oldValue || node.addEventListener(key, listener)
  3099. : node.removeEventListener(key, listener)
  3100. : !isSvg && "list" !== key && "form" !== key && key in node
  3101. ? (node[key] = null == newValue ? "" : newValue)
  3102. : null == newValue ||
  3103. !1 === newValue ||
  3104. ("class" === key && !(newValue = createClass(newValue)))
  3105. ? node.removeAttribute(key)
  3106. : node.setAttribute(key, newValue)
  3107. },
  3108. createNode = (vdom, listener, isSvg) => {
  3109. var props = vdom.props,
  3110. node =
  3111. 3 === vdom.type
  3112. ? document.createTextNode(vdom.tag)
  3113. : (isSvg = isSvg || "svg" === vdom.tag)
  3114. ? document.createElementNS(
  3115. "http://www.w3.org/2000/svg",
  3116. vdom.tag,
  3117. { is: props.is }
  3118. )
  3119. : document.createElement(vdom.tag, { is: props.is })
  3120. for (var k in props)
  3121. patchProperty(node, k, null, props[k], listener, isSvg)
  3122. for (var i = 0; i < vdom.children.length; i++)
  3123. node.appendChild(
  3124. createNode(
  3125. (vdom.children[i] = maybeVNode(vdom.children[i])),
  3126. listener,
  3127. isSvg
  3128. )
  3129. )
  3130. return (vdom.node = node)
  3131. },
  3132. patch = (parent, node, oldVNode, newVNode, listener, isSvg) => {
  3133. if (oldVNode === newVNode);
  3134. else if (
  3135. null != oldVNode &&
  3136. 3 === oldVNode.type &&
  3137. 3 === newVNode.type
  3138. )
  3139. oldVNode.tag !== newVNode.tag && (node.nodeValue = newVNode.tag)
  3140. else if (null == oldVNode || oldVNode.tag !== newVNode.tag) {
  3141. node = parent.insertBefore(
  3142. createNode((newVNode = maybeVNode(newVNode)), listener, isSvg),
  3143. node
  3144. )
  3145. null != oldVNode && parent.removeChild(oldVNode.node)
  3146. } else {
  3147. var tmpVKid,
  3148. oldVKid,
  3149. oldKey,
  3150. newKey,
  3151. oldProps = oldVNode.props,
  3152. newProps = newVNode.props,
  3153. oldVKids = oldVNode.children,
  3154. newVKids = newVNode.children,
  3155. oldHead = 0,
  3156. newHead = 0,
  3157. oldTail = oldVKids.length - 1,
  3158. newTail = newVKids.length - 1
  3159. isSvg = isSvg || "svg" === newVNode.tag
  3160. for (var i in { ...oldProps, ...newProps })
  3161. ("value" === i || "selected" === i || "checked" === i
  3162. ? node[i]
  3163. : oldProps[i]) !== newProps[i] &&
  3164. patchProperty(
  3165. node,
  3166. i,
  3167. oldProps[i],
  3168. newProps[i],
  3169. listener,
  3170. isSvg
  3171. )
  3172. for (
  3173. ;
  3174. newHead <= newTail &&
  3175. oldHead <= oldTail &&
  3176. null != (oldKey = getKey(oldVKids[oldHead])) &&
  3177. oldKey === getKey(newVKids[newHead]);
  3178.  
  3179. )
  3180. patch(
  3181. node,
  3182. oldVKids[oldHead].node,
  3183. oldVKids[oldHead],
  3184. (newVKids[newHead] = maybeVNode(
  3185. newVKids[newHead++],
  3186. oldVKids[oldHead++]
  3187. )),
  3188. listener,
  3189. isSvg
  3190. )
  3191. for (
  3192. ;
  3193. newHead <= newTail &&
  3194. oldHead <= oldTail &&
  3195. null != (oldKey = getKey(oldVKids[oldTail])) &&
  3196. oldKey === getKey(newVKids[newTail]);
  3197.  
  3198. )
  3199. patch(
  3200. node,
  3201. oldVKids[oldTail].node,
  3202. oldVKids[oldTail],
  3203. (newVKids[newTail] = maybeVNode(
  3204. newVKids[newTail--],
  3205. oldVKids[oldTail--]
  3206. )),
  3207. listener,
  3208. isSvg
  3209. )
  3210. if (oldHead > oldTail)
  3211. for (; newHead <= newTail; )
  3212. node.insertBefore(
  3213. createNode(
  3214. (newVKids[newHead] = maybeVNode(newVKids[newHead++])),
  3215. listener,
  3216. isSvg
  3217. ),
  3218. (oldVKid = oldVKids[oldHead]) && oldVKid.node
  3219. )
  3220. else if (newHead > newTail)
  3221. for (; oldHead <= oldTail; )
  3222. node.removeChild(oldVKids[oldHead++].node)
  3223. else {
  3224. var keyed = {},
  3225. newKeyed = {}
  3226. for (i = oldHead; i <= oldTail; i++)
  3227. null != (oldKey = oldVKids[i].key) &&
  3228. (keyed[oldKey] = oldVKids[i])
  3229. for (; newHead <= newTail; ) {
  3230. oldKey = getKey((oldVKid = oldVKids[oldHead]))
  3231. newKey = getKey(
  3232. (newVKids[newHead] = maybeVNode(newVKids[newHead], oldVKid))
  3233. )
  3234. if (
  3235. newKeyed[oldKey] ||
  3236. (null != newKey && newKey === getKey(oldVKids[oldHead + 1]))
  3237. ) {
  3238. null == oldKey && node.removeChild(oldVKid.node)
  3239. oldHead++
  3240. } else if (null == newKey || 1 === oldVNode.type) {
  3241. if (null == oldKey) {
  3242. patch(
  3243. node,
  3244. oldVKid && oldVKid.node,
  3245. oldVKid,
  3246. newVKids[newHead],
  3247. listener,
  3248. isSvg
  3249. )
  3250. newHead++
  3251. }
  3252. oldHead++
  3253. } else {
  3254. if (oldKey === newKey) {
  3255. patch(
  3256. node,
  3257. oldVKid.node,
  3258. oldVKid,
  3259. newVKids[newHead],
  3260. listener,
  3261. isSvg
  3262. )
  3263. newKeyed[newKey] = !0
  3264. oldHead++
  3265. } else if (null != (tmpVKid = keyed[newKey])) {
  3266. patch(
  3267. node,
  3268. node.insertBefore(
  3269. tmpVKid.node,
  3270. oldVKid && oldVKid.node
  3271. ),
  3272. tmpVKid,
  3273. newVKids[newHead],
  3274. listener,
  3275. isSvg
  3276. )
  3277. newKeyed[newKey] = !0
  3278. } else
  3279. patch(
  3280. node,
  3281. oldVKid && oldVKid.node,
  3282. null,
  3283. newVKids[newHead],
  3284. listener,
  3285. isSvg
  3286. )
  3287. newHead++
  3288. }
  3289. }
  3290. for (; oldHead <= oldTail; )
  3291. null == getKey((oldVKid = oldVKids[oldHead++])) &&
  3292. node.removeChild(oldVKid.node)
  3293. for (var i in keyed)
  3294. null == newKeyed[i] && node.removeChild(keyed[i].node)
  3295. }
  3296. }
  3297. return (newVNode.node = node)
  3298. },
  3299. maybeVNode = (newVNode, oldVNode) =>
  3300. !0 !== newVNode && !1 !== newVNode && newVNode
  3301. ? "function" == typeof newVNode.tag
  3302. ? ((!oldVNode ||
  3303. null == oldVNode.memo ||
  3304. ((a, b) => {
  3305. for (var k in a) if (a[k] !== b[k]) return !0
  3306. for (var k in b) if (a[k] !== b[k]) return !0
  3307. })(oldVNode.memo, newVNode.memo)) &&
  3308. ((oldVNode = newVNode.tag(newVNode.memo)).memo =
  3309. newVNode.memo),
  3310. oldVNode)
  3311. : newVNode
  3312. : hyperapp_text(""),
  3313. recycleNode = node =>
  3314. 3 === node.nodeType
  3315. ? hyperapp_text(node.nodeValue, node)
  3316. : createVNode(
  3317. node.nodeName.toLowerCase(),
  3318. EMPTY_OBJ,
  3319. hyperapp_map.call(node.childNodes, recycleNode),
  3320. 1,
  3321. node
  3322. ),
  3323. createVNode = (tag, props, children, type, node) => ({
  3324. tag,
  3325. props,
  3326. key: props.key,
  3327. children,
  3328. type,
  3329. node,
  3330. }),
  3331. hyperapp_text = (value, node) =>
  3332. createVNode(value, EMPTY_OBJ, EMPTY_ARR, 3, node),
  3333. h = (tag, props, children = EMPTY_ARR) =>
  3334. createVNode(tag, props, isArray(children) ? children : [children]),
  3335. app = ({
  3336. node,
  3337. view,
  3338. subscriptions,
  3339. dispatch = id,
  3340. init = EMPTY_OBJ,
  3341. }) => {
  3342. var state,
  3343. busy,
  3344. vdom = node && recycleNode(node),
  3345. subs = [],
  3346. update = newState => {
  3347. if (state !== newState) {
  3348. null == (state = newState) &&
  3349. (dispatch = subscriptions = render = id)
  3350. subscriptions &&
  3351. (subs = ((oldSubs, newSubs = EMPTY_ARR, dispatch) => {
  3352. for (
  3353. var oldSub, newSub, subs = [], i = 0;
  3354. i < oldSubs.length || i < newSubs.length;
  3355. i++
  3356. ) {
  3357. oldSub = oldSubs[i]
  3358. newSub = newSubs[i]
  3359. subs.push(
  3360. newSub && !0 !== newSub
  3361. ? !oldSub ||
  3362. newSub[0] !== oldSub[0] ||
  3363. shouldRestart(newSub[1], oldSub[1])
  3364. ? [
  3365. newSub[0],
  3366. newSub[1],
  3367. (oldSub && oldSub[2](),
  3368. newSub[0](dispatch, newSub[1])),
  3369. ]
  3370. : oldSub
  3371. : oldSub && oldSub[2]()
  3372. )
  3373. }
  3374. return subs
  3375. })(subs, subscriptions(state), dispatch))
  3376. view && !busy && enqueue(render, (busy = !0))
  3377. }
  3378. },
  3379. render = () =>
  3380. (node = patch(
  3381. node.parentNode,
  3382. node,
  3383. vdom,
  3384. (vdom = view(state)),
  3385. listener,
  3386. (busy = !1)
  3387. )),
  3388. listener = function (event) {
  3389. dispatch(this.events[event.type], event)
  3390. }
  3391. return (
  3392. (dispatch = dispatch((action, props) =>
  3393. "function" == typeof action
  3394. ? dispatch(action(state, props))
  3395. : isArray(action)
  3396. ? "function" == typeof action[0]
  3397. ? dispatch(action[0], action[1])
  3398. : action
  3399. .slice(1)
  3400. .map(
  3401. fx => fx && !0 !== fx && fx[0](dispatch, fx[1]),
  3402. update(action[0])
  3403. )
  3404. : update(action)
  3405. ))(init),
  3406. dispatch
  3407. )
  3408. }
  3409. const src_defaultSettingText = {
  3410. setting: ["Settings", "設定"],
  3411. font: ["Font", "フォント"],
  3412. color: ["Color(Normal)", "色(通常)"],
  3413. ownerColor: ["Color(Owner)", "色(オーナー)"],
  3414. moderatorColor: ["Color(Moderator)", "色(モデレーター)"],
  3415. memberColor: ["Color(Member)", "色(メンバー)"],
  3416. feedback: ["Feedback", "バグ報告と要望"],
  3417. eventLog: ["Event log", "イベントログ"],
  3418. giveFeedback: [
  3419. "Give your feedbacks here(Please attach the event log if they're bug related)",
  3420. "バグ報告、要望はこちら(バグの場合は、イベントログを添付してください)",
  3421. ],
  3422. chatOpacity: ["Opacity", "不透明度"],
  3423. fontSize: ["Size", "サイズ"],
  3424. fontWeight: ["Weight", "太さ"],
  3425. shadowFontWeight: ["Weight(Shadow)", "太さ(影)"],
  3426. flowSpeed: ["Speed", "速度"],
  3427. maxChatCount: ["Max number of chats", "最大表示数"],
  3428. maxChatLength: ["Max number of characters", "最大文字数"],
  3429. laneCount: ["Number of rows", "行数"],
  3430. bannedWords: ["Banned Words", "NGワード"],
  3431. bannedWordRegexs: ["Banned Words(Regex)", "NGワード(正規表現)"],
  3432. bannedUsers: ["Banned Users", "NGユーザー"],
  3433. simplifyChatField: ["Simplify", "簡略化する"],
  3434. createBanButton: ["Show ban button", "NGボタンを表示する"],
  3435. displayModName: [
  3436. "Show moderator's name",
  3437. "モデレータの名前を表示する",
  3438. ],
  3439. displaySuperChatAuthor: [
  3440. "Show super chat author",
  3441. "スパチャの作成者を表示する",
  3442. ],
  3443. createChats: ["Display flowing chats", "チャットを流す"],
  3444. textOnly: [
  3445. "Text only(ignore emojis)",
  3446. "文字のみ(絵文字を無視する)",
  3447. ],
  3448. error: ["Error", "エラー"],
  3449. video: ["Video", "画面"],
  3450. chatField: ["Chat Window", "チャット欄"],
  3451. useStepTiming: ["Move chat in steps", "チャットを段階的に動かす"],
  3452. timingStepCount: ["└Step Count", "└段階数"],
  3453. chatFilter: ["Chat Filter", "チャットフィルター"],
  3454. flowChat: ["Flow Chat", "チャット流れ"],
  3455. clearFlowChats: [
  3456. "Clear Flowing Chats",
  3457. "流れるチャットをクリアする",
  3458. ],
  3459. flowNewChatIf: [
  3460. "A new chat will appear if all of the followings are met:",
  3461. "新しいチャットは以下のすべてを満たす場合に流れます:",
  3462. ],
  3463. noOverlap: ["└Chats won't overlap", "└他のチャットと重ならない"],
  3464. minSpacing: ["Min spacing between chats", "チャットの最小間隔"],
  3465. fieldScale: ["Scale", "拡大率"],
  3466. copy: ["Copy", "コピーする"],
  3467. showChat: ["Show chats", "チャット非表示"],
  3468. hideChat: ["Hide chats", "チャット表示"],
  3469. flowY1: ["Flow area top edge", "流れ範囲の上端"],
  3470. flowY2: ["Flow area bottom edge", "流れ範囲の下端"],
  3471. shadowColor: ["Color(Shadow)", "色(影)"],
  3472. },
  3473. getLang = lang => key =>
  3474. src_defaultSettingText[key]["FYC_EN" === lang ? 0 : 1],
  3475. colorInput = action => color =>
  3476. h("input", {
  3477. style: { verticalAlign: "middle", width: "5.5em" },
  3478. maxlength: 20,
  3479. value: color,
  3480. ...action,
  3481. }),
  3482. colorPicker = action => color =>
  3483. h("input", {
  3484. style: { width: "36px", verticalAlign: "middle" },
  3485. type: "color",
  3486. value: color,
  3487. oninput: action.onchange,
  3488. }),
  3489. colorTextOutput = textStyle => color =>
  3490. h(
  3491. "span",
  3492. { style: { ...textStyle, color } },
  3493. hyperapp_text("Aa1あア亜")
  3494. ),
  3495. tapIs = (constructor, x) => {
  3496. assert_lib(x instanceof constructor)
  3497. return x
  3498. },
  3499. getValue = e => {
  3500. const target = e.currentTarget ?? e.__target
  3501. if (
  3502. target instanceof HTMLSelectElement ||
  3503. target instanceof HTMLTextAreaElement ||
  3504. target instanceof HTMLInputElement
  3505. )
  3506. return target.value
  3507. throw Error("Event target type isn't acceptable.")
  3508. },
  3509. ui_option = (value, label, selected) =>
  3510. h("option", { value, selected }, hyperapp_text(label)),
  3511. rangeRow = (min, max, step, value, editing, action) =>
  3512. h("div", {}, [
  3513. h("input", {
  3514. style: { width: "150px", verticalAlign: "middle" },
  3515. type: "range",
  3516. min,
  3517. max,
  3518. step,
  3519. value,
  3520. oninput: action.onchange,
  3521. }),
  3522. h("input", {
  3523. style: {
  3524. width: "30px",
  3525. backgroundColor: "transparent",
  3526. color: "inherit",
  3527. borderWidth: "1px",
  3528. verticalAlign: "middle",
  3529. },
  3530. inputmode: "decimal",
  3531. value: editing
  3532. ? value
  3533. : Number.parseFloat(value)
  3534. .toFixed(4)
  3535. .replace(/\.?0+$/, ""),
  3536. ...action,
  3537. }),
  3538. ]),
  3539. settingRow = (label, content) =>
  3540. h("div", {}, [
  3541. h("span", {}, hyperapp_text(label)),
  3542. h("div", {}, content),
  3543. ]),
  3544. tabContainer = (style, labels, tabs, mainTab, ontabSelect) =>
  3545. h("div", {}, [
  3546. h(
  3547. "div",
  3548. {},
  3549. labels.map((x, i) =>
  3550. h(
  3551. "span",
  3552. {
  3553. style: {
  3554. ...style.label,
  3555. ...(mainTab === i ? style.labelFocus : {}),
  3556. display: "inline-block",
  3557. },
  3558. onpointerdown: [ontabSelect, i],
  3559. },
  3560. hyperapp_text(x)
  3561. )
  3562. )
  3563. ),
  3564. h(
  3565. "div",
  3566. { style: { ...style.container, overflow: "hidden auto" } },
  3567. h(
  3568. "div",
  3569. { style: { ...style.tab } },
  3570. tabs.find((_, i) => i === mainTab)?.()
  3571. )
  3572. ),
  3573. ]),
  3574. style = {
  3575. resize: "horizontal",
  3576. boxSizing: "border-box",
  3577. width: "100%",
  3578. },
  3579. textAreaRow = (rows, value, readOnly, action) =>
  3580. h("textarea", { rows, value, readOnly, style, ...action })
  3581. var Either_right = right,
  3582. Either_map = function (fa, f) {
  3583. return function_pipe(fa, es6_Either_map(f))
  3584. },
  3585. es6_Either_map = function (f) {
  3586. return function (fa) {
  3587. return Either_isLeft(fa) ? fa : Either_right(f(fa.right))
  3588. }
  3589. },
  3590. Either_Functor = { URI: "Either", map: Either_map },
  3591. Either_of = Either_right,
  3592. Either_isLeft = isLeft
  3593. flap(Either_Functor)
  3594. Either_of(emptyReadonlyArray)
  3595. var Reader_map = function (fa, f) {
  3596. return function_pipe(fa, es6_Reader_map(f))
  3597. },
  3598. es6_Reader_map = function (f) {
  3599. return function (fa) {
  3600. return function (r) {
  3601. return f(fa(r))
  3602. }
  3603. }
  3604. },
  3605. Reader_of = constant,
  3606. Reader_Functor = { URI: "Reader", map: Reader_map },
  3607. Reader_ApT = (flap(Reader_Functor), Reader_of(emptyReadonlyArray)),
  3608. Reader_traverseReadonlyArrayWithIndex = function (f) {
  3609. var g = (function (f) {
  3610. return function (as) {
  3611. return function (r) {
  3612. for (var out = [f(0, head(as))(r)], i = 1; i < as.length; i++)
  3613. out.push(f(i, as[i])(r))
  3614. return out
  3615. }
  3616. }
  3617. })(f)
  3618. return function (as) {
  3619. return internal_isNonEmpty(as) ? g(as) : Reader_ApT
  3620. }
  3621. },
  3622. Reader_sequenceArray = (function (f) {
  3623. return Reader_traverseReadonlyArrayWithIndex(function (_, a) {
  3624. return f(a)
  3625. })
  3626. })(function_identity)
  3627. const textColorRow = colorNodes =>
  3628. function_pipe(
  3629. colorNodes,
  3630. Reader_sequenceArray,
  3631. es6_Reader_map(x => h("div", {}, x))
  3632. ),
  3633. panelBoxStyle = width => ({ flex: `0 0 ${width}px`, margin: "2px" }),
  3634. textRowStyle = { width: "70%", boxSizing: "border-box" },
  3635. langs = [
  3636. ["FYC_EN", "English"],
  3637. ["FYC_JA", "日本語"],
  3638. ],
  3639. exampleTextStyle = s => ({
  3640. fontFamily: s.font,
  3641. fontWeight: s.fontWeight.toString(),
  3642. textShadow: textShadow(s.shadowColor)(s.shadowFontWeight),
  3643. }),
  3644. computed = {
  3645. useStepTiming: s => Boolean(s.timingFunction.match(/^steps\(.+/)),
  3646. },
  3647. stepTiming = stepCount => `steps(${stepCount}, jump-end)`,
  3648. settingPanel = command => {
  3649. const { setConfig, act } = command,
  3650. configFx = (k, v) => [() => setConfig[k](v), void 0],
  3651. setState = {
  3652. flowY1: (s, v) => {
  3653. const flowY2 = Math.max(s.flowY2, v + 0.05)
  3654. return [
  3655. { ...s, flowY1: v, flowY2 },
  3656. configFx("flowY1", v),
  3657. configFx("flowY2", flowY2),
  3658. ]
  3659. },
  3660. flowY2: (s, v) => {
  3661. const flowY1 = Math.min(s.flowY1, v - 0.05)
  3662. return [
  3663. { ...s, flowY2: v, flowY1 },
  3664. configFx("flowY2", v),
  3665. configFx("flowY1", flowY1),
  3666. ]
  3667. },
  3668. timingStepCount: (s, v) => {
  3669. const timingFunction = stepTiming(v)
  3670. return [
  3671. { ...s, timingStepCount: v, timingFunction },
  3672. configFx("timingFunction", timingFunction),
  3673. ]
  3674. },
  3675. bannedWordRegexs: (s, v) =>
  3676. function_pipe(
  3677. v,
  3678. es6_ReadonlyArray_reduce(
  3679. { valid: !0, error: "" },
  3680. (acc, cur) => {
  3681. try {
  3682. RegExp(cur, "u")
  3683. return acc
  3684. } catch (e) {
  3685. return {
  3686. valid: !1,
  3687. error: `${acc.error}${e} in ${cur};`,
  3688. }
  3689. }
  3690. }
  3691. ),
  3692. x => [
  3693. {
  3694. ...s,
  3695. bannedWordRegexs: v,
  3696. bannedWordRegexsError: x.error,
  3697. bannedWordRegexsValid: x.valid,
  3698. },
  3699. ...(x.valid ? [configFx("bannedWordRegexs", v)] : []),
  3700. ]
  3701. ),
  3702. },
  3703. setComputed = {
  3704. useStepTiming: (s, v) => {
  3705. const timingFunction = v
  3706. ? stepTiming(s.timingStepCount)
  3707. : "linear"
  3708. return [
  3709. { ...s, timingFunction },
  3710. configFx("timingFunction", timingFunction),
  3711. ]
  3712. },
  3713. },
  3714. doAct = {
  3715. copy: async s => {
  3716. GM.setClipboard(s.eventLog.join("\n"))
  3717. },
  3718. clearFlowChats: async s => {
  3719. act.clearFlowChats()
  3720. },
  3721. },
  3722. getTrueState = (k, s) => (k in computed ? computed[k](s) : s[k]),
  3723. getState = (k, s) =>
  3724. s.editingInput.id === k
  3725. ? s.editingInput.committedState
  3726. : getTrueState(k, s),
  3727. updateAt = (k, v, s) =>
  3728. k in setComputed
  3729. ? setComputed[k](s, v)
  3730. : k in setState
  3731. ? setState[k](s, v)
  3732. : [
  3733. { ...s, [k]: v },
  3734. ...(k in setConfig ? [configFx(k, v)] : []),
  3735. ],
  3736. updateString = key => (s, e) =>
  3737. function_pipe(getValue(e), x => updateAt(key, x, s)),
  3738. updateNumber = key => (s, e) =>
  3739. function_pipe(getValue(e), parseFloat, x =>
  3740. updateAt(key, x, s)
  3741. ),
  3742. updateInt = key => (s, e) =>
  3743. function_pipe(
  3744. getValue(e),
  3745. x => parseInt(x, 10),
  3746. x => updateAt(key, x, s)
  3747. ),
  3748. updateBool = key => (s, e) =>
  3749. function_pipe(
  3750. (e => tapIs(HTMLInputElement, e.currentTarget).checked)(e),
  3751. x => updateAt(key, x, s)
  3752. ),
  3753. updateStrings = key => (s, e) =>
  3754. function_pipe(
  3755. getValue(e),
  3756. x => x.split(/\r\n|\n/).filter(str => "" !== str),
  3757. x => updateAt(key, x, s)
  3758. ),
  3759. editAction = (key, onchange) => ({
  3760. onfocus: (s, e) =>
  3761. updateAt(
  3762. "editingInput",
  3763. {
  3764. id: key,
  3765. committedState: getTrueState(key, s),
  3766. value: getValue(e),
  3767. },
  3768. s
  3769. ),
  3770. onblur: s =>
  3771. updateAt(
  3772. "editingInput",
  3773. { id: "", committedState: "", value: "" },
  3774. s
  3775. ),
  3776. oninput: (s, e) =>
  3777. updateAt(
  3778. "editingInput",
  3779. {
  3780. id: key,
  3781. committedState: s.editingInput.committedState,
  3782. value: getValue(e),
  3783. },
  3784. s
  3785. ),
  3786. onchange: (s, e) => {
  3787. const [s1, ...es1] = onchange(key)(s, e),
  3788. x =
  3789. s1.editingInput.id === key
  3790. ? {
  3791. id: key,
  3792. committedState: getTrueState(key, s1),
  3793. value: getValue(e),
  3794. }
  3795. : s1.editingInput,
  3796. [s2, ...es2] = updateAt("editingInput", x, s1)
  3797. return [s2, ...es1, ...es2]
  3798. },
  3799. }),
  3800. getEditValue = (s, k, t) =>
  3801. s.editingInput.id === k
  3802. ? s.editingInput.value
  3803. : t(getState(k, s))
  3804. return state => {
  3805. const getText = getLang(state.lang),
  3806. checkboxNode = label =>
  3807. ((label, checked, onchange) =>
  3808. h(
  3809. "div",
  3810. {},
  3811. h("label", {}, [
  3812. hyperapp_text(label),
  3813. h("input", { type: "checkbox", checked, onchange }),
  3814. ])
  3815. ))(
  3816. getText(label),
  3817. getState(label, state),
  3818. updateBool(label)
  3819. ),
  3820. textColorNode = label =>
  3821. settingRow(getText(label), [
  3822. textColorRow(
  3823. function_pipe(editAction(label, updateString), x => [
  3824. colorPicker(x),
  3825. colorInput(x),
  3826. colorTextOutput(exampleTextStyle(state)),
  3827. ])
  3828. )(getEditValue(state, label, x => x)),
  3829. ]),
  3830. intNode = (label, min, max, step) =>
  3831. settingRow(getText(label), [
  3832. rangeRow(
  3833. min,
  3834. max,
  3835. step,
  3836. getEditValue(state, label, x => x.toString()),
  3837. state.editingInput.id === label,
  3838. editAction(label, updateInt)
  3839. ),
  3840. ]),
  3841. numberNode = (label, min, max, step) =>
  3842. settingRow(getText(label), [
  3843. rangeRow(
  3844. min,
  3845. max,
  3846. step,
  3847. getEditValue(state, label, x => x.toString()),
  3848. state.editingInput.id === label,
  3849. editAction(label, updateNumber)
  3850. ),
  3851. ]),
  3852. buttonNode = label =>
  3853. h(
  3854. "button",
  3855. {
  3856. type: "button",
  3857. onclick: s => [s, [() => doAct[label](s), void 0]],
  3858. },
  3859. hyperapp_text(getText(label))
  3860. ),
  3861. textAreaNode = (label, rows) =>
  3862. settingRow(getText(label), [
  3863. textAreaRow(
  3864. rows,
  3865. getEditValue(state, label, x => x.join("\n")),
  3866. !1,
  3867. editAction(label, updateStrings)
  3868. ),
  3869. ]),
  3870. currentFonts = [
  3871. ["", "Default", "デフォルト"],
  3872. ["arial", "Arial", "Arial"],
  3873. ["arial black", "Arial Black", "Arial Black"],
  3874. ["arial narrow", "Arial Narrow", "Arial Narrow"],
  3875. ["Century", "Century", "Century"],
  3876. ["Comic Sans MS", "Comic Sans MS", "Comic Sans MS"],
  3877. ["Courier", "Courier", "Courier"],
  3878. ["cursive", "cursive", "cursive"],
  3879. ["fantasy", "fantasy", "fantasy"],
  3880. ["Impact", "Impact", "Impact"],
  3881. ["Meiryo", "Meiryo", "メイリオ"],
  3882. ["Meiryo UI", "Meiryo UI", "メイリオ UI"],
  3883. ["monospace", "monospace", "monospace"],
  3884. ["Monotype Corsiva", "Monotype Corsiva", "Monotype Corsiva"],
  3885. ["MS PGothic", "MS PGothic", "MS Pゴシック"],
  3886. ["MS Gothic", "MS Gothic", "MS ゴシック"],
  3887. ["MS Sans Serif", "MS Sans Serif", "MS Sans Serif"],
  3888. ["MS Serif", "MS Serif", "MS Serif"],
  3889. ["MS UI Gothic", "MS UI Gothic", "MS UI Gothic"],
  3890. ["sans-serif", "Sans-serif", "Sans-serif"],
  3891. ["serif", "Serif", "Serif"],
  3892. ["Times New Roman", "Times New Roman", "Times New Roman"],
  3893. ["Yu Gothic", "Yu Gothic", "遊ゴシック"],
  3894. ["YuGothic", "YuGothic", "游ゴシック体"],
  3895. [state.font, "Custom", "カスタム"],
  3896. ]
  3897. const logPageLength =
  3898. Math.trunc(getState("eventLog", state).length / 100) + 1
  3899. return state.showPanel
  3900. ? h(
  3901. "div",
  3902. {
  3903. class: "fyc_panel",
  3904. style: {
  3905. backgroundColor: "rgba(30,30,30,0.9)",
  3906. zIndex: "10000",
  3907. position: "absolute",
  3908. bottom: "40px",
  3909. right: "0px",
  3910. color: "#fff",
  3911. fontSize: "14px",
  3912. width: "660px",
  3913. border: "solid 1px #666",
  3914. fontFamily: "MS PGothic",
  3915. lineHeight: "1.2",
  3916. },
  3917. },
  3918. [
  3919. h(
  3920. "div",
  3921. { style: { float: "right", margin: "3px 3px 0 0" } },
  3922. [
  3923. hyperapp_text("🌐"),
  3924. h(
  3925. "select",
  3926. { onchange: updateString("lang") },
  3927. langs.map(x => ui_option(...x, x[0] === state.lang))
  3928. ),
  3929. ]
  3930. ),
  3931. tabContainer(
  3932. {
  3933. container: { height: "364px" },
  3934. label: { padding: "6px" },
  3935. labelFocus: { background: "#666" },
  3936. tab: { display: "flex", padding: "6px" },
  3937. },
  3938. [
  3939. getText("flowChat"),
  3940. getText("chatFilter"),
  3941. getText("chatField"),
  3942. getText("feedback"),
  3943. ],
  3944. [
  3945. () => {
  3946. return [
  3947. h("div", { style: panelBoxStyle(212) }, [
  3948. settingRow(getText("font"), [
  3949. h(
  3950. "select",
  3951. {
  3952. style: textRowStyle,
  3953. onchange: updateString("font"),
  3954. },
  3955. function_pipe(
  3956. currentFonts,
  3957. findIndex(x => x[0] === state.font),
  3958. getOrElse(() => 0),
  3959. index =>
  3960. currentFonts.map((x, i) =>
  3961. ui_option(
  3962. x[0],
  3963. "FYC_JA" === state.lang
  3964. ? x[2]
  3965. : x[1],
  3966. i === index
  3967. )
  3968. )
  3969. )
  3970. ),
  3971. ]),
  3972. h("input", {
  3973. style: textRowStyle,
  3974. maxlength: 20,
  3975. value: state.font,
  3976. oninput: updateString("font"),
  3977. }),
  3978. textColorNode("color"),
  3979. textColorNode("ownerColor"),
  3980. textColorNode("moderatorColor"),
  3981. textColorNode("memberColor"),
  3982. ((label = "shadowColor"),
  3983. settingRow(getText(label), [
  3984. textColorRow(
  3985. function_pipe(
  3986. [colorPicker, colorInput],
  3987. es6_ReadonlyArray_map(f =>
  3988. f(editAction(label, updateString))
  3989. )
  3990. )
  3991. )(getEditValue(state, label, x => x)),
  3992. ])),
  3993. ]),
  3994. h("div", { style: panelBoxStyle(212) }, [
  3995. numberNode("chatOpacity", 0, 1, 0.05),
  3996. numberNode("fontSize", 0.3, 2, 0.05),
  3997. numberNode("fontWeight", 10, 1e3, 10),
  3998. numberNode("shadowFontWeight", 0, 3, 0.1),
  3999. numberNode("flowSpeed", 1, 50, 1),
  4000. intNode("maxChatCount", 5, 200, 5),
  4001. intNode("maxChatLength", 5, 200, 5),
  4002. intNode("laneCount", 1, 25, 1),
  4003. ]),
  4004. h("div", { style: panelBoxStyle(212) }, [
  4005. numberNode("flowY1", 0, 0.95, 0.05),
  4006. numberNode("flowY2", 0.05, 1, 0.05),
  4007. numberNode("minSpacing", 0, 2.5, 0.1),
  4008. checkboxNode("useStepTiming"),
  4009. h(
  4010. "div",
  4011. {
  4012. style: {
  4013. ...(getState("useStepTiming", state)
  4014. ? {}
  4015. : { opacity: "0.5" }),
  4016. },
  4017. },
  4018. intNode("timingStepCount", 1, 400, 1)
  4019. ),
  4020. checkboxNode("createChats"),
  4021. checkboxNode("displayModName"),
  4022. checkboxNode("displaySuperChatAuthor"),
  4023. checkboxNode("textOnly"),
  4024. h(
  4025. "span",
  4026. {},
  4027. hyperapp_text(getText("flowNewChatIf"))
  4028. ),
  4029. checkboxNode("noOverlap"),
  4030. buttonNode("clearFlowChats"),
  4031. ]),
  4032. ]
  4033. var label
  4034. },
  4035. () => [
  4036. h(
  4037. "div",
  4038. { style: panelBoxStyle(212) },
  4039. textAreaNode("bannedWords", 18)
  4040. ),
  4041. h(
  4042. "div",
  4043. { style: panelBoxStyle(212) },
  4044. settingRow(getText("bannedWordRegexs"), [
  4045. h(
  4046. "span",
  4047. {},
  4048. hyperapp_text(
  4049. state.bannedWordRegexsValid
  4050. ? ""
  4051. : `${getText("error")}: ${
  4052. state.bannedWordRegexsError
  4053. }`
  4054. )
  4055. ),
  4056. textAreaRow(
  4057. 18,
  4058. getEditValue(state, "bannedWordRegexs", x =>
  4059. x.join("\n")
  4060. ),
  4061. !1,
  4062. editAction("bannedWordRegexs", updateStrings)
  4063. ),
  4064. ])
  4065. ),
  4066. h(
  4067. "div",
  4068. { style: panelBoxStyle(212) },
  4069. textAreaNode("bannedUsers", 18)
  4070. ),
  4071. ],
  4072. () => [
  4073. h("div", { style: panelBoxStyle(644) }, [
  4074. numberNode("fieldScale", 0.7, 1.5, 0.05),
  4075. checkboxNode("simplifyChatField"),
  4076. checkboxNode("createBanButton"),
  4077. ]),
  4078. ],
  4079. () => [
  4080. h("div", { style: panelBoxStyle(644) }, [
  4081. h(
  4082. "div",
  4083. { style: { float: "right" } },
  4084. h(
  4085. "a",
  4086. {
  4087. style: { color: "#f0f" },
  4088. href: "https://greasyfork.org/en/scripts/411442-flow-youtube-chat/feedback",
  4089. target: "_blank",
  4090. },
  4091. hyperapp_text(getText("giveFeedback"))
  4092. )
  4093. ),
  4094. h("div", {}, [
  4095. h(
  4096. "span",
  4097. {},
  4098. hyperapp_text(getText("eventLog"))
  4099. ),
  4100. buttonNode("copy"),
  4101. tabContainer(
  4102. {
  4103. container: { height: "276px" },
  4104. label: {
  4105. padding: "4px",
  4106. width: "2em",
  4107. textAlign: "center",
  4108. },
  4109. labelFocus: { background: "#666" },
  4110. tab: {
  4111. display: "flex",
  4112. flexDirection: "column",
  4113. padding: "6px",
  4114. },
  4115. },
  4116. function_pipe(
  4117. ReadonlyArray_makeBy(logPageLength, i =>
  4118. i.toString()
  4119. )
  4120. ),
  4121. function_pipe(
  4122. ReadonlyArray_makeBy(
  4123. logPageLength,
  4124. i => () =>
  4125. function_pipe(
  4126. getState("eventLog", state).slice(
  4127. 100 * i,
  4128. 100 * (i + 1)
  4129. ),
  4130. es6_ReadonlyArray_mapWithIndex(
  4131. (j, x) =>
  4132. h(
  4133. "div",
  4134. { style: { display: "flex" } },
  4135. [
  4136. h(
  4137. "div",
  4138. {
  4139. style: {
  4140. userSelect: "none",
  4141. flex: "0 0 2em",
  4142. },
  4143. },
  4144. [hyperapp_text(100 * i + j)]
  4145. ),
  4146. h(
  4147. "div",
  4148. {
  4149. style: {
  4150. background:
  4151. j % 2 == 0
  4152. ? "#fff"
  4153. : "#ddd",
  4154. color: "#000",
  4155. flex: "auto",
  4156. wordBreak: "break-all",
  4157. padding: "0 2px",
  4158. },
  4159. },
  4160. [hyperapp_text(x)]
  4161. ),
  4162. ]
  4163. )
  4164. )
  4165. )
  4166. )
  4167. ),
  4168. getState("logTab", state),
  4169. (s, n) => updateAt("logTab", n, s)
  4170. ),
  4171. ]),
  4172. ]),
  4173. ],
  4174. ],
  4175. getState("mainTab", state),
  4176. (s, n) => updateAt("mainTab", n, s)
  4177. ),
  4178. ]
  4179. )
  4180. : h("div", {})
  4181. }
  4182. },
  4183. togglePanel = (x, e) => [
  4184. { ...x, showPanel: !x.showPanel },
  4185. [
  4186. x.showPanel
  4187. ? () => tapIs(HTMLElement, e.currentTarget).blur()
  4188. : () => {},
  4189. void 0,
  4190. ],
  4191. ],
  4192. simpleWrap = (comp, init) => {
  4193. const node = document.createElement(comp.tag)
  4194. return { node, dispatch: app({ init, view: comp.view, node }) }
  4195. },
  4196. initialize = async () => {
  4197. const userConfig = await (async () => ({
  4198. lang: await sc("LANG", "FYC_EN"),
  4199. font: await sc("FONT", "MS PGothic"),
  4200. chatOpacity: await sc("OPACITY", 0.8),
  4201. color: await sc("COLOR", "#ffffff"),
  4202. ownerColor: await sc("COLOR_OWNER", "#ffd600"),
  4203. moderatorColor: await sc("COLOR_MODERATOR", "#a74fff"),
  4204. memberColor: await sc("COLOR_MEMBER", "#9fffff"),
  4205. fontSize: await sc("SIZE", 1),
  4206. fontWeight: await sc("WEIGHT", 730),
  4207. shadowFontWeight: await sc("WEIGHT_SHADOW", 1),
  4208. maxChatCount: await sc("LIMIT", 40),
  4209. flowSpeed: await sc("SPEED", 18),
  4210. maxChatLength: await sc("MAX", 100),
  4211. laneCount: await sc("LANE_DIV", 12),
  4212. bannedWords: await ic("NG_WORDS", ...stringsArgs),
  4213. bannedWordRegexs: await ic("NG_REG_WORDS", ...stringsArgs),
  4214. bannedUsers: await ic("NG_USERS", ...stringsArgs),
  4215. createChats: await sc("TOGGLE_CREATE_COMMENTS", !0),
  4216. noOverlap: await sc("NO_OVERLAP", !0),
  4217. createBanButton: await sc("NG_BUTTON", !0),
  4218. simplifyChatField: await sc("SIMPLE_CHAT_FIELD", !1),
  4219. displayModName: await sc("DISPLAY_MODERATOR_NAME", !0),
  4220. displaySuperChatAuthor: await sc(
  4221. "DISPLAY_SUPER_CHAT_AUTHOR",
  4222. !0
  4223. ),
  4224. textOnly: await sc("TEXT_ONLY", !1),
  4225. timingFunction: await sc("TIMING_FUNCTION", "linear"),
  4226. displayChats: await sc("DISPLAY_COMMENTS", !0),
  4227. minSpacing: await sc("MIN_SPACING", 0.5),
  4228. fieldScale: await sc("FIELD_SCALE", 1),
  4229. flowY1: await sc("flowY1", 0),
  4230. flowY2: await sc("flowY2", 1),
  4231. shadowColor: await sc("shadowColor", "#000000"),
  4232. }))(),
  4233. configKeys = Object.keys(userConfig),
  4234. getConfig = function_pipe(
  4235. configKeys,
  4236. es6_ReadonlyArray_map(x => [x, () => userConfig[x].val]),
  4237. Object.fromEntries
  4238. ),
  4239. mainState = {
  4240. chatPlaying: !0,
  4241. playerRect: new DOMRect(24, 80, 839, 472),
  4242. filterExp: Option_none,
  4243. getConfig,
  4244. },
  4245. configSubject = function_pipe(
  4246. configKeys,
  4247. es6_ReadonlyArray_map(x => [
  4248. x,
  4249. new external_rxjs_namespaceObject.Subject(),
  4250. ]),
  4251. Object.fromEntries
  4252. ),
  4253. channel = new broadcast_channel_BroadcastChannel(
  4254. "fyc-0615654655528523"
  4255. ),
  4256. setConfigPlain = function_pipe(
  4257. configKeys,
  4258. es6_ReadonlyArray_map(x => [
  4259. x,
  4260. async val => {
  4261. userConfig[x].val = val
  4262. configSubject[x].next(val)
  4263. },
  4264. ]),
  4265. Object.fromEntries
  4266. ),
  4267. setConfig = function_pipe(
  4268. configKeys,
  4269. es6_ReadonlyArray_map(x => [
  4270. x,
  4271. async val => {
  4272. setConfigPlain[x](val)
  4273. const item = userConfig[x]
  4274. channel.postMessage([x, val])
  4275. GM.setValue(item.gmKey, item.toGm(val))
  4276. },
  4277. ]),
  4278. Object.fromEntries
  4279. ),
  4280. reinitSubject = new external_rxjs_namespaceObject.Subject(),
  4281. reinitialize = () => {
  4282. requestAnimationFrame(() => lib(reinitSubject)())
  4283. },
  4284. chatScreen = (() => {
  4285. const element = document.createElement("div")
  4286. element.style.pointerEvents = "none"
  4287. element.style.zIndex = "30"
  4288. return element
  4289. })(),
  4290. css = (() => {
  4291. const element = document.createElement("style")
  4292. element.innerHTML =
  4293. ".fyc_chat {\n line-height: 1;\n z-index: 30;\n position: absolute;\n user-select: none;\n white-space: nowrap;\n will-change: transform;\n }\n .fyc_button {\n display: inline-block;\n border-style: none;\n z-index: 4;\n font-weight: 500;\n color: var(--yt-spec-text-secondary);\n }"
  4294. return element
  4295. })(),
  4296. flowChats = [],
  4297. documentMutationPair = observePair(MutationObserver),
  4298. chatMutationPair = observePair(MutationObserver),
  4299. playerResizePair = observePair(ResizeObserver),
  4300. toggleChatButtonInit = {
  4301. lang: getConfig.lang(),
  4302. displayChats: getConfig.displayChats(),
  4303. },
  4304. wrappedToggleChatBtn = simpleWrap(
  4305. (setConfig => ({
  4306. tag: "button",
  4307. view: state => {
  4308. const label = getLang(state.lang)(
  4309. state.displayChats ? "hideChat" : "showChat"
  4310. )
  4311. return h(
  4312. "button",
  4313. {
  4314. class: "ytp-button",
  4315. style: {
  4316. background: "none",
  4317. border: "none",
  4318. cursor: "pointer",
  4319. float: "left",
  4320. fontSize: "1em",
  4321. height: "4em",
  4322. outline: "none",
  4323. overflow: "visible",
  4324. padding: "0 0 0em",
  4325. position: "relative",
  4326. width: "3em",
  4327. },
  4328. type: "button",
  4329. "aria-label": label,
  4330. title: label,
  4331. onclick: s => {
  4332. const displayChats = !s.displayChats
  4333. return [
  4334. { ...s, displayChats },
  4335. [
  4336. () => setConfig.displayChats(displayChats),
  4337. void 0,
  4338. ],
  4339. ]
  4340. },
  4341. },
  4342. [
  4343. h(
  4344. "svg",
  4345. { style: { width: "100%" }, viewBox: "0 0 36 36" },
  4346. [
  4347. h("path", {
  4348. class: "chat-button-path",
  4349. d: "m11 12h17q1 0 1 1v9q0 1-1 1h-1v2l-4-2h-12q-1 0-1-1v-9q0-1 1-1z",
  4350. fill: "#fff",
  4351. "fill-opacity": state.displayChats ? "1" : "0",
  4352. stroke: "#fff",
  4353. "stroke-width": "2",
  4354. }),
  4355. ]
  4356. ),
  4357. ]
  4358. )
  4359. },
  4360. }))(setConfig),
  4361. toggleChatButtonInit
  4362. ),
  4363. wrappedSetting = simpleWrap(
  4364. (command => {
  4365. const panel = settingPanel(command)
  4366. return {
  4367. tag: "span",
  4368. view: s => {
  4369. return h("span", { style: { display: "contents" } }, [
  4370. panel(s),
  4371. ((state = s),
  4372. h(
  4373. "button",
  4374. {
  4375. class: "fyc_button",
  4376. style: {
  4377. background: "rgba(0,0,0,0)",
  4378. marginLeft: "10px",
  4379. whiteSpace: "nowrap",
  4380. },
  4381. onclick: togglePanel,
  4382. },
  4383. [
  4384. h(
  4385. "svg",
  4386. {
  4387. preserveAspectRatio: "xMidYMid meet",
  4388. viewBox: "0 0 640 640",
  4389. width: "15",
  4390. height: "15",
  4391. style: { position: "relative", top: "1px" },
  4392. },
  4393. [
  4394. h(
  4395. "defs",
  4396. {},
  4397. h("path", {
  4398. id: "d1TbzTC1zI",
  4399. d: "M135 58c25 14 67 30 82 35-7 49 16 109-15 149-50 71-19 184 64 213 74 31 165-18 183-95-3-38 23-62 58-36l120 55c-39 10-106 35-72 85 40 38 1 71-29 98-29 53-70-17-109-5-46 22-25 109-96 85h-55c-24-31-21-103-80-84-32 32-70 31-93-9l-35-36c4-40 57-96-6-120-45 5-58-32-52-68 2-19-4-41 3-59 35-15 100-22 77-79-48-43 1-84 35-115 5-6 12-12 20-14zM577 2c52 3 72 62 62 106-5 51 19 117-27 155-18 24 8 49 11 74-39-8-98-46-146-60-55-1-111 2-167-2-52-15-57-76-52-121S242 52 282 18c38-30 88-11 132-16h163z",
  4400. })
  4401. ),
  4402. h("use", {
  4403. href: "#d1TbzTC1zI",
  4404. opacity: "1",
  4405. fill: "var(--iron-icon-fill-color, currentcolor)",
  4406. "fill-opacity": "1",
  4407. }),
  4408. ]
  4409. ),
  4410. h(
  4411. "span",
  4412. {
  4413. style: {
  4414. position: "relative",
  4415. top: "-2px",
  4416. marginLeft: "8px,",
  4417. },
  4418. },
  4419. hyperapp_text(getLang(state.lang)("setting"))
  4420. ),
  4421. ]
  4422. )),
  4423. ])
  4424. var state
  4425. },
  4426. }
  4427. })({
  4428. setConfig,
  4429. act: {
  4430. clearFlowChats: async () => removeOldChats(flowChats, 0),
  4431. },
  4432. }),
  4433. (getConfig => ({
  4434. ...function_pipe(
  4435. Object.entries(getConfig),
  4436. es6_ReadonlyArray_map(([k, v]) => [k, v()]),
  4437. Object.fromEntries
  4438. ),
  4439. showPanel: !1,
  4440. bannedWordRegexsValid: !0,
  4441. bannedWordRegexsError: "",
  4442. mainTab: 0,
  4443. logTab: 0,
  4444. timingStepCount: parseInt(
  4445. getConfig.timingFunction().match(/^steps\((\d+),.+/)?.[1] ??
  4446. "150",
  4447. 10
  4448. ),
  4449. eventLog: [],
  4450. editingInput: { id: "", committedState: void 0, value: "" },
  4451. }))(getConfig)
  4452. ),
  4453. mainLog =
  4454. (...x) =>
  4455. () =>
  4456. wrappedSetting.dispatch(s => ({
  4457. ...s,
  4458. eventLog: appendLog(s.eventLog)(...x),
  4459. })),
  4460. mixLog = (...x) =>
  4461. function_pipe(
  4462. [mainLog, consoleLog],
  4463. es6_ReadonlyArray_map(f => f(...x)),
  4464. IO_sequenceArray
  4465. )
  4466. mainLog("Version", package_namespaceObject_i8)()
  4467. mainLog("User Agent", window.navigator.userAgent)()
  4468. mainLog("UserConfig", JSON.stringify(userConfig))()
  4469. const cs = function_pipe(
  4470. configSubject,
  4471. Object.entries,
  4472. es6_ReadonlyArray_map(([k, v]) => [
  4473. k,
  4474. v.pipe(
  4475. (0, external_rxjs_namespaceObject.tap)(x =>
  4476. function_pipe(
  4477. () => wrappedSetting.dispatch(s => ({ ...s, [k]: x })),
  4478. IO_apSecond(
  4479. k in toggleChatButtonInit
  4480. ? () =>
  4481. wrappedToggleChatBtn.dispatch(s => ({
  4482. ...s,
  4483. [k]: x,
  4484. }))
  4485. : () => {}
  4486. ),
  4487. requestAnimationFrame
  4488. )
  4489. )
  4490. ),
  4491. ]),
  4492. Object.fromEntries
  4493. ),
  4494. livePage = {
  4495. toggleChatBtnParent: () =>
  4496. fromNullable(document.querySelector(".ytp-right-controls")),
  4497. settingNextElement: () =>
  4498. fromNullable(
  4499. document.querySelector(
  4500. "#menu-container .dropdown-trigger.ytd-menu-renderer"
  4501. )
  4502. ),
  4503. player: () =>
  4504. fromNullable(document.querySelector("#movie_player")),
  4505. video: () =>
  4506. fromNullable(
  4507. document.querySelector(
  4508. "video.video-stream.html5-main-video"
  4509. )
  4510. ),
  4511. chatField: () =>
  4512. function_pipe(
  4513. chatApp(),
  4514. chainNullableK(x =>
  4515. x.querySelector("#items.yt-live-chat-item-list-renderer")
  4516. )
  4517. ),
  4518. chatTicker: () =>
  4519. function_pipe(
  4520. chatApp(),
  4521. chainNullableK(x =>
  4522. x.querySelector("#items.yt-live-chat-ticker-renderer")
  4523. )
  4524. ),
  4525. chatScroller: () =>
  4526. function_pipe(
  4527. chatApp(),
  4528. chainNullableK(x =>
  4529. x.querySelector(
  4530. "#item-scroller.yt-live-chat-item-list-renderer"
  4531. )
  4532. )
  4533. ),
  4534. offlineSlate: () =>
  4535. fromNullable(document.querySelector(".ytp-offline-slate")),
  4536. },
  4537. liveElementKeys = Object.keys(livePage),
  4538. live = function_pipe(
  4539. liveElementKeys,
  4540. es6_ReadonlyArray_map(x => {
  4541. return [
  4542. x,
  4543. ((key = x), { ele: Option_none, read: livePage[key] }),
  4544. ]
  4545. var key
  4546. }),
  4547. Object.fromEntries
  4548. ),
  4549. config$ = (0, external_rxjs_namespaceObject.merge)(
  4550. (0, external_rxjs_namespaceObject.merge)(
  4551. cs.bannedWordRegexs,
  4552. cs.bannedWords,
  4553. cs.bannedUsers
  4554. ).pipe(
  4555. (0, external_rxjs_namespaceObject.startWith)(void 0),
  4556. (0, external_rxjs_namespaceObject.tap)(() => {
  4557. mainState.filterExp = Option_some(
  4558. (getConfig =>
  4559. external_jsep_default()(
  4560. `\nor([\nRA.some(anyPreds([\n flip(flow([matchedByText, RA.some]))(${JSON.stringify(
  4561. getConfig.bannedWordRegexs()
  4562. )}),\n flip(flow([inText, RA.some]))(${JSON.stringify(
  4563. getConfig.bannedWords()
  4564. )})\n]))(RA.compact([\n messageText,\n paymentInfo\n])),\nO.exists(\n flip(flow([eqText, RA.some]))(${JSON.stringify(
  4565. getConfig.bannedUsers()
  4566. )})\n)(authorID)\n])\n`
  4567. ))(getConfig)
  4568. )
  4569. })
  4570. ),
  4571. cs.fieldScale.pipe(
  4572. (0, external_rxjs_namespaceObject.startWith)(
  4573. getConfig.fieldScale()
  4574. ),
  4575. (0, external_rxjs_namespaceObject.tap)(scale =>
  4576. function_pipe(
  4577. live.chatField.ele,
  4578. fromOption,
  4579. IOOption_chain(field =>
  4580. IOOption_fromIO(() =>
  4581. function_pipe(
  4582. [
  4583. function_pipe(
  4584. fromNullable(field.parentElement),
  4585. es6_Option_map(x => () => {
  4586. x.style.transformOrigin =
  4587. (scale >= 1 ? "top" : "bottom") + " left"
  4588. x.style.transform = `scale(${scale})`
  4589. x.style.width = 100 / scale + "%"
  4590. x.style.height = `${field.offsetHeight}px`
  4591. })
  4592. ),
  4593. function_pipe(
  4594. live.chatScroller.ele,
  4595. es6_Option_map(scroller => () => {
  4596. scroller.scrollTop = scroller.scrollHeight
  4597. })
  4598. ),
  4599. ],
  4600. ReadonlyArray_compact,
  4601. IO_sequenceArray
  4602. )
  4603. )
  4604. )
  4605. )()
  4606. )
  4607. ),
  4608. (0, external_rxjs_namespaceObject.merge)(
  4609. (0, external_rxjs_namespaceObject.merge)(
  4610. cs.font,
  4611. cs.fontSize,
  4612. cs.fontWeight,
  4613. cs.laneCount,
  4614. cs.minSpacing,
  4615. cs.flowY1,
  4616. cs.flowY2,
  4617. cs.textOnly
  4618. ).pipe(
  4619. (0, external_rxjs_namespaceObject.mapTo)({
  4620. render: !0,
  4621. setAnimation: !0,
  4622. })
  4623. ),
  4624. (0, external_rxjs_namespaceObject.merge)(
  4625. cs.color,
  4626. cs.ownerColor,
  4627. cs.moderatorColor,
  4628. cs.memberColor,
  4629. cs.shadowColor,
  4630. cs.chatOpacity,
  4631. cs.shadowFontWeight,
  4632. cs.displayChats
  4633. ).pipe(
  4634. (0, external_rxjs_namespaceObject.mapTo)({ render: !0 })
  4635. ),
  4636. (0, external_rxjs_namespaceObject.merge)(cs.flowSpeed).pipe(
  4637. (0, external_rxjs_namespaceObject.mapTo)({
  4638. setPlayState: !0,
  4639. })
  4640. ),
  4641. (0, external_rxjs_namespaceObject.merge)(
  4642. cs.maxChatCount.pipe(
  4643. (0, external_rxjs_namespaceObject.tap)(x =>
  4644. removeOldChats(flowChats, x)
  4645. )
  4646. ),
  4647. cs.noOverlap,
  4648. cs.timingFunction
  4649. ).pipe(
  4650. (0, external_rxjs_namespaceObject.mapTo)({
  4651. setAnimation: !0,
  4652. })
  4653. )
  4654. ).pipe(
  4655. (0, external_rxjs_namespaceObject.throttleTime)(180, void 0, {
  4656. leading: !0,
  4657. trailing: !0,
  4658. }),
  4659. (0, external_rxjs_namespaceObject.tap)(config =>
  4660. function_pipe(
  4661. flowChats,
  4662. es6_ReadonlyArray_filter(x => !x.animationEnded),
  4663. es6_ReadonlyArray_map(chat =>
  4664. function_pipe(
  4665. {
  4666. render: !1,
  4667. setAnimation: !1,
  4668. setPlayState: !1,
  4669. ...config,
  4670. },
  4671. x =>
  4672. function_pipe(
  4673. [
  4674. function_pipe(
  4675. renderChat(chat),
  4676. fromPredicate(() => x.render)
  4677. ),
  4678. function_pipe(
  4679. setChatAnimation(chat, flowChats),
  4680. fromPredicate(() => x.setAnimation),
  4681. alt(() =>
  4682. function_pipe(
  4683. setChatPlayState(chat),
  4684. fromPredicate(() => x.setPlayState)
  4685. )
  4686. )
  4687. ),
  4688. ],
  4689. ReadonlyArray_compact,
  4690. es6_ReadonlyArray_map(
  4691. (function (a) {
  4692. return function (f) {
  4693. return f(a)
  4694. }
  4695. })(mainState)
  4696. ),
  4697. IO_sequenceArray
  4698. )
  4699. )
  4700. ),
  4701. IO_sequenceArray
  4702. )()
  4703. )
  4704. ),
  4705. cs.lang,
  4706. cs.maxChatLength,
  4707. cs.simplifyChatField,
  4708. cs.createBanButton,
  4709. cs.createChats,
  4710. cs.displayModName,
  4711. cs.displaySuperChatAuthor,
  4712. cs.fieldScale,
  4713. cs.bannedWords,
  4714. cs.bannedWordRegexs,
  4715. cs.bannedUsers
  4716. ),
  4717. eq = getEq(eqStrict).equals
  4718. reinitSubject
  4719. .pipe(
  4720. (0, external_rxjs_namespaceObject.observeOn)(
  4721. external_rxjs_namespaceObject.asyncScheduler
  4722. ),
  4723. (0, external_rxjs_namespaceObject.delay)(100),
  4724. (0, external_rxjs_namespaceObject.tap)(mixLog("Init")),
  4725. (0, external_rxjs_namespaceObject.switchMap)(() =>
  4726. (0, external_rxjs_namespaceObject.interval)(700).pipe(
  4727. (0, external_rxjs_namespaceObject.filter)(() =>
  4728. function_pipe(
  4729. liveElementKeys,
  4730. es6_ReadonlyArray_map(key =>
  4731. function_pipe(
  4732. live[key].read(),
  4733. fromPredicate(newEle => !eq(live[key].ele, newEle)),
  4734. es6_Option_map(x => () => {
  4735. live[key].ele = x
  4736. }),
  4737. es6_Option_map(
  4738. IO_apSecond(mixLog(`${key} changed`))
  4739. )
  4740. )
  4741. ),
  4742. ReadonlyArray_compact,
  4743. IO_sequenceArray,
  4744. es6_IO_map(ReadonlyArray_isNonEmpty)
  4745. )()
  4746. ),
  4747. (0, external_rxjs_namespaceObject.startWith)(0)
  4748. )
  4749. ),
  4750. (0, external_rxjs_namespaceObject.tap)(mixLog("Loading...")),
  4751. (0, external_rxjs_namespaceObject.tap)(() => {
  4752. removeOldChats(flowChats, 0)
  4753. documentMutationPair.observer.disconnect()
  4754. documentMutationPair.observer.observe(document, {
  4755. childList: !0,
  4756. subtree: !0,
  4757. })
  4758. chatMutationPair.observer.disconnect()
  4759. playerResizePair.observer.disconnect()
  4760. document.head.append(css)
  4761. function_pipe(
  4762. [
  4763. function_pipe(
  4764. live.chatField.ele,
  4765. es6_Option_map(x => () => {
  4766. ;((chatField = x),
  4767. () =>
  4768. function_pipe(
  4769. fromNullable(chatField.parentElement),
  4770. es6_Option_map(x => () => {
  4771. x.style.overflow = "unset"
  4772. })
  4773. ))()
  4774. var chatField
  4775. chatMutationPair.observer.observe(x, {
  4776. childList: !0,
  4777. })
  4778. })
  4779. ),
  4780. function_pipe(
  4781. live.chatTicker.ele,
  4782. es6_Option_map(
  4783. x => () =>
  4784. chatMutationPair.observer.observe(x, {
  4785. childList: !0,
  4786. })
  4787. )
  4788. ),
  4789. function_pipe(
  4790. live.player.ele,
  4791. es6_Option_map(x => () => {
  4792. playerResizePair.observer.observe(x)
  4793. x.insertAdjacentElement("afterbegin", chatScreen)
  4794. })
  4795. ),
  4796. function_pipe(
  4797. live.toggleChatBtnParent.ele,
  4798. es6_Option_map(
  4799. x => () => x.append(wrappedToggleChatBtn.node)
  4800. )
  4801. ),
  4802. function_pipe(
  4803. live.settingNextElement.ele,
  4804. es6_Option_map(x => () => {
  4805. x.insertAdjacentElement(
  4806. "beforebegin",
  4807. wrappedSetting.node
  4808. )
  4809. })
  4810. ),
  4811. ],
  4812. ReadonlyArray_compact,
  4813. ReadonlyArray_append(
  4814. function_pipe(
  4815. live.video.ele,
  4816. filter(x => !x.paused),
  4817. alt(() => live.offlineSlate.ele),
  4818. Option_isSome,
  4819. x => () => {
  4820. mainState.chatPlaying = x
  4821. }
  4822. )
  4823. ),
  4824. IO_sequenceArray
  4825. )()
  4826. }),
  4827. (0, external_rxjs_namespaceObject.switchMap)(() =>
  4828. (0, external_rxjs_namespaceObject.merge)(
  4829. (0, external_rxjs_namespaceObject.fromEvent)(
  4830. channel,
  4831. "message"
  4832. ).pipe(
  4833. (0, external_rxjs_namespaceObject.tap)(([key, val]) =>
  4834. function_pipe(
  4835. [
  4836. "lang",
  4837. "bannedWords",
  4838. "bannedWordRegexs",
  4839. "bannedUsers",
  4840. "simplifyChatField",
  4841. "createBanButton",
  4842. "fieldScale",
  4843. ].includes(key),
  4844. x => (x ? () => setConfigPlain[key](val) : () => {})
  4845. )()
  4846. )
  4847. ),
  4848. ...function_pipe(
  4849. configKeys,
  4850. es6_ReadonlyArray_map(key =>
  4851. cs[key].pipe(
  4852. (0, external_rxjs_namespaceObject.startWith)(
  4853. getConfig[key]()
  4854. ),
  4855. (0, external_rxjs_namespaceObject.bufferCount)(2, 1),
  4856. (0, external_rxjs_namespaceObject.map)(([x, y]) =>
  4857. (0, external_DeepDiff_namespaceObject.diff)(x, y)
  4858. ),
  4859. (0, external_rxjs_namespaceObject.tap)(x =>
  4860. mainLog(
  4861. `Config ${key}`,
  4862. JSON.stringify(x, void 0, 2)
  4863. )()
  4864. )
  4865. )
  4866. )
  4867. ),
  4868. config$,
  4869. function_pipe(
  4870. live.video.ele,
  4871. match(
  4872. () => external_rxjs_namespaceObject.EMPTY,
  4873. x => {
  4874. return ((video = x),
  4875. (0, external_rxjs_namespaceObject.merge)(
  4876. (0, external_rxjs_namespaceObject.fromEvent)(
  4877. video,
  4878. "playing"
  4879. ).pipe(
  4880. (0, external_rxjs_namespaceObject.mapTo)(!0)
  4881. ),
  4882. (0, external_rxjs_namespaceObject.fromEvent)(
  4883. video,
  4884. "waiting"
  4885. ).pipe(
  4886. (0, external_rxjs_namespaceObject.mapTo)(!1)
  4887. ),
  4888. (0, external_rxjs_namespaceObject.fromEvent)(
  4889. video,
  4890. "pause"
  4891. ).pipe((0, external_rxjs_namespaceObject.mapTo)(!1))
  4892. )).pipe(
  4893. (0, external_rxjs_namespaceObject.map)(
  4894. playing =>
  4895. playing || Option_isSome(live.offlineSlate.ele)
  4896. ),
  4897. (0, external_rxjs_namespaceObject.tap)(
  4898. chatPlaying => {
  4899. mainState.chatPlaying = chatPlaying
  4900. flowChats.forEach(chat =>
  4901. setChatPlayState(chat)(mainState)()
  4902. )
  4903. }
  4904. )
  4905. )
  4906. var video
  4907. }
  4908. )
  4909. ),
  4910. chatMutationPair.subject.pipe(
  4911. (0, external_rxjs_namespaceObject.map)(
  4912. onChatFieldMutate(
  4913. chatScreen,
  4914. flowChats,
  4915. mainState,
  4916. setConfig,
  4917. mainLog
  4918. )
  4919. ),
  4920. (0, external_rxjs_namespaceObject.tap)(x => x())
  4921. ),
  4922. documentMutationPair.subject.pipe(
  4923. (0, external_rxjs_namespaceObject.map)(
  4924. () => window.location.href
  4925. ),
  4926. (0, external_rxjs_namespaceObject.distinctUntilChanged)(),
  4927. (0, external_rxjs_namespaceObject.skip)(1),
  4928. (0, external_rxjs_namespaceObject.tap)(x => {
  4929. mixLog("URL Changed", x)()
  4930. removeOldChats(flowChats, 0)
  4931. mixLog("Wait for 1700ms...")()
  4932. }),
  4933. (0, external_rxjs_namespaceObject.delay)(1700),
  4934. (0, external_rxjs_namespaceObject.tap)(() =>
  4935. reinitialize()
  4936. )
  4937. ),
  4938. playerResizePair.subject.pipe(
  4939. (0, external_rxjs_namespaceObject.throttleTime)(
  4940. 500,
  4941. void 0,
  4942. { leading: !0, trailing: !0 }
  4943. ),
  4944. (0, external_rxjs_namespaceObject.startWith)([]),
  4945. (0, external_rxjs_namespaceObject.map)(
  4946. () => live.player.ele
  4947. ),
  4948. (0, external_rxjs_namespaceObject.map)(
  4949. es6_Option_map(x => x.getBoundingClientRect())
  4950. ),
  4951. (0, external_rxjs_namespaceObject.tap)(x =>
  4952. ((rect, flowChats, mainState, mainLog) =>
  4953. function_pipe(
  4954. rect,
  4955. match(
  4956. () => () => {},
  4957. x => () => {
  4958. mainLog("Resize detected")()
  4959. mainState.playerRect = x
  4960. flowChats.forEach(chat => {
  4961. renderChat(chat)(mainState)()
  4962. setChatAnimation(chat, flowChats)(mainState)()
  4963. })
  4964. }
  4965. )
  4966. )())(x, flowChats, mainState, mainLog)
  4967. )
  4968. )
  4969. )
  4970. ),
  4971. (0, external_rxjs_namespaceObject.retryWhen)(e =>
  4972. e.pipe(
  4973. (0, external_rxjs_namespaceObject.tap)(
  4974. mixLog("Errored", e)
  4975. ),
  4976. (0, external_rxjs_namespaceObject.delay)(5e3),
  4977. (0, external_rxjs_namespaceObject.tap)(x => {
  4978. mixLog(x)()
  4979. reinitialize()
  4980. })
  4981. )
  4982. )
  4983. )
  4984. .subscribe({
  4985. error: x => mixLog("Stream error", x)(),
  4986. complete: mixLog("Stream complete"),
  4987. })
  4988. reinitialize()
  4989. }
  4990. ;(async () => {
  4991. external_log_namespaceObject.setLevel("info")
  4992. try {
  4993. await initialize()
  4994. } catch (error) {
  4995. external_log_namespaceObject.info("【FYC】 Error", error)
  4996. }
  4997. })()
  4998. },
  4999. 633: () => {},
  5000. },
  5001. __webpack_module_cache__ = {}
  5002. function __webpack_require__(moduleId) {
  5003. var cachedModule = __webpack_module_cache__[moduleId]
  5004. if (void 0 !== cachedModule) return cachedModule.exports
  5005. var module = (__webpack_module_cache__[moduleId] = { exports: {} })
  5006. __webpack_modules__[moduleId](module, module.exports, __webpack_require__)
  5007. return module.exports
  5008. }
  5009. __webpack_require__.n = module => {
  5010. var getter =
  5011. module && module.__esModule ? () => module.default : () => module
  5012. __webpack_require__.d(getter, { a: getter })
  5013. return getter
  5014. }
  5015. __webpack_require__.d = (exports, definition) => {
  5016. for (var key in definition)
  5017. __webpack_require__.o(definition, key) &&
  5018. !__webpack_require__.o(exports, key) &&
  5019. Object.defineProperty(exports, key, {
  5020. enumerable: !0,
  5021. get: definition[key],
  5022. })
  5023. }
  5024. __webpack_require__.o = (obj, prop) =>
  5025. Object.prototype.hasOwnProperty.call(obj, prop)
  5026. __webpack_require__(73)
  5027. })()