summaryrefslogtreecommitdiff
path: root/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar
blob: 78f8ebef4019fd8ce6871152e1194f2dd0bdc687 (plain) (blame)
ofshex dumpascii
0000 04 00 00 00 a4 0e 00 00 a0 0e 00 00 9c 0e 00 00 7b 22 66 69 6c 65 73 22 3a 7b 22 62 72 6f 77 73 ................{"files":{"brows
0020 65 72 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 61 70 69 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 61 er":{"files":{"api":{"files":{"a
0040 70 70 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 35 35 31 2c 22 6f 66 66 73 65 74 22 3a 22 30 22 pp.js":{"size":2551,"offset":"0"
0060 7d 2c 22 61 75 74 6f 2d 75 70 64 61 74 65 72 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 61 75 74 6f },"auto-updater":{"files":{"auto
0080 2d 75 70 64 61 74 65 72 2d 6e 61 74 69 76 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 38 39 2c -updater-native.js":{"size":289,
00a0 22 6f 66 66 73 65 74 22 3a 22 32 37 32 35 22 7d 2c 22 61 75 74 6f 2d 75 70 64 61 74 65 72 2d 77 "offset":"2725"},"auto-updater-w
00c0 69 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 36 39 30 2c 22 6f 66 66 73 65 74 22 3a 22 33 30 in.js":{"size":1690,"offset":"30
00e0 31 34 22 7d 2c 22 73 71 75 69 72 72 65 6c 2d 75 70 64 61 74 65 2d 77 69 6e 2e 6a 73 22 3a 7b 22 14"},"squirrel-update-win.js":{"
0100 73 69 7a 65 22 3a 33 34 34 34 2c 22 6f 66 66 73 65 74 22 3a 22 34 37 30 34 22 7d 7d 7d 2c 22 61 size":3444,"offset":"4704"}}},"a
0120 75 74 6f 2d 75 70 64 61 74 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 37 34 2c 22 6f 66 66 uto-updater.js":{"size":174,"off
0140 73 65 74 22 3a 22 32 35 35 31 22 7d 2c 22 62 72 6f 77 73 65 72 2d 76 69 65 77 2e 6a 73 22 3a 7b set":"2551"},"browser-view.js":{
0160 22 73 69 7a 65 22 3a 33 39 31 2c 22 6f 66 66 73 65 74 22 3a 22 38 31 34 38 22 7d 2c 22 62 72 6f "size":391,"offset":"8148"},"bro
0180 77 73 65 72 2d 77 69 6e 64 6f 77 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 36 35 37 34 2c 22 6f 66 wser-window.js":{"size":6574,"of
01a0 66 73 65 74 22 3a 22 38 35 33 39 22 7d 2c 22 63 6f 6e 74 65 6e 74 2d 74 72 61 63 69 6e 67 2e 6a fset":"8539"},"content-tracing.j
01c0 73 22 3a 7b 22 73 69 7a 65 22 3a 35 36 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 31 31 33 22 7d 2c s":{"size":56,"offset":"15113"},
01e0 22 64 69 61 6c 6f 67 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 38 34 39 35 2c 22 6f 66 66 73 65 74 "dialog.js":{"size":8495,"offset
0200 22 3a 22 31 35 31 36 39 22 7d 2c 22 65 78 70 6f 72 74 73 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 ":"15169"},"exports":{"files":{"
0220 65 6c 65 63 74 72 6f 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 34 30 39 2c 22 6f 66 66 73 65 74 electron.js":{"size":409,"offset
0240 22 3a 22 32 33 36 36 34 22 7d 7d 7d 2c 22 67 6c 6f 62 61 6c 2d 73 68 6f 72 74 63 75 74 2e 6a 73 ":"23664"}}},"global-shortcut.js
0260 22 3a 7b 22 73 69 7a 65 22 3a 37 31 2c 22 6f 66 66 73 65 74 22 3a 22 32 34 30 37 33 22 7d 2c 22 ":{"size":71,"offset":"24073"},"
0280 69 70 63 2d 6d 61 69 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 31 34 2c 22 6f 66 66 73 65 74 ipc-main.js":{"size":514,"offset
02a0 22 3a 22 32 34 31 34 34 22 7d 2c 22 6d 65 6e 75 2d 69 74 65 6d 2d 72 6f 6c 65 73 2e 6a 73 22 3a ":"24144"},"menu-item-roles.js":
02c0 7b 22 73 69 7a 65 22 3a 36 30 35 37 2c 22 6f 66 66 73 65 74 22 3a 22 32 34 36 35 38 22 7d 2c 22 {"size":6057,"offset":"24658"},"
02e0 6d 65 6e 75 2d 69 74 65 6d 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 34 38 30 2c 22 6f 66 66 73 menu-item.js":{"size":2480,"offs
0300 65 74 22 3a 22 33 30 37 31 35 22 7d 2c 22 6d 65 6e 75 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 38 et":"30715"},"menu.js":{"size":8
0320 36 35 37 2c 22 6f 66 66 73 65 74 22 3a 22 33 33 31 39 35 22 7d 2c 22 6d 6f 64 75 6c 65 2d 6c 69 657,"offset":"33195"},"module-li
0340 73 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 31 32 36 2c 22 6f 66 66 73 65 74 22 3a 22 34 31 st.js":{"size":1126,"offset":"41
0360 38 35 32 22 7d 2c 22 6e 61 76 69 67 61 74 69 6f 6e 2d 63 6f 6e 74 72 6f 6c 6c 65 72 2e 6a 73 22 852"},"navigation-controller.js"
0380 3a 7b 22 73 69 7a 65 22 3a 35 32 37 32 2c 22 6f 66 66 73 65 74 22 3a 22 34 32 39 37 38 22 7d 2c :{"size":5272,"offset":"42978"},
03a0 22 6e 65 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 39 38 30 35 2c 22 6f 66 66 73 65 74 22 3a 22 "net.js":{"size":9805,"offset":"
03c0 34 38 32 35 30 22 7d 2c 22 6e 6f 74 69 66 69 63 61 74 69 6f 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 48250"},"notification.js":{"size
03e0 22 3a 32 35 35 2c 22 6f 66 66 73 65 74 22 3a 22 35 38 30 35 35 22 7d 2c 22 70 6f 77 65 72 2d 6d ":255,"offset":"58055"},"power-m
0400 6f 6e 69 74 6f 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 38 35 2c 22 6f 66 66 73 65 74 22 3a onitor.js":{"size":285,"offset":
0420 22 35 38 33 31 30 22 7d 2c 22 70 6f 77 65 72 2d 73 61 76 65 2d 62 6c 6f 63 6b 65 72 2e 6a 73 22 "58310"},"power-save-blocker.js"
0440 3a 7b 22 73 69 7a 65 22 3a 37 36 2c 22 6f 66 66 73 65 74 22 3a 22 35 38 35 39 35 22 7d 2c 22 70 :{"size":76,"offset":"58595"},"p
0460 72 6f 74 6f 63 6f 6c 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 37 37 35 2c 22 6f 66 66 73 65 74 22 rotocol.js":{"size":775,"offset"
0480 3a 22 35 38 36 37 31 22 7d 2c 22 73 63 72 65 65 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 34 :"58671"},"screen.js":{"size":24
04a0 32 2c 22 6f 66 66 73 65 74 22 3a 22 35 39 34 34 36 22 7d 2c 22 73 65 73 73 69 6f 6e 2e 6a 73 22 2,"offset":"59446"},"session.js"
04c0 3a 7b 22 73 69 7a 65 22 3a 31 30 32 32 2c 22 6f 66 66 73 65 74 22 3a 22 35 39 36 38 38 22 7d 2c :{"size":1022,"offset":"59688"},
04e0 22 73 79 73 74 65 6d 2d 70 72 65 66 65 72 65 6e 63 65 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a "system-preferences.js":{"size":
0500 33 32 30 2c 22 6f 66 66 73 65 74 22 3a 22 36 30 37 31 30 22 7d 2c 22 74 6f 75 63 68 2d 62 61 72 320,"offset":"60710"},"touch-bar
0520 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 38 39 35 35 2c 22 6f 66 66 73 65 74 22 3a 22 36 31 30 33 .js":{"size":8955,"offset":"6103
0540 30 22 7d 2c 22 74 72 61 79 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 37 30 2c 22 6f 66 66 73 65 0"},"tray.js":{"size":170,"offse
0560 74 22 3a 22 36 39 39 38 35 22 7d 2c 22 77 65 62 2d 63 6f 6e 74 65 6e 74 73 2e 6a 73 22 3a 7b 22 t":"69985"},"web-contents.js":{"
0580 73 69 7a 65 22 3a 39 33 33 36 2c 22 6f 66 66 73 65 74 22 3a 22 37 30 31 35 35 22 7d 7d 7d 2c 22 size":9336,"offset":"70155"}}},"
05a0 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 33 35 chrome-extension.js":{"size":135
05c0 39 33 2c 22 6f 66 66 73 65 74 22 3a 22 37 39 34 39 31 22 7d 2c 22 64 65 73 6b 74 6f 70 2d 63 61 93,"offset":"79491"},"desktop-ca
05e0 70 74 75 72 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 32 37 31 2c 22 6f 66 66 73 65 74 22 pturer.js":{"size":2271,"offset"
0600 3a 22 39 33 30 38 34 22 7d 2c 22 67 75 65 73 74 2d 76 69 65 77 2d 6d 61 6e 61 67 65 72 2e 6a 73 :"93084"},"guest-view-manager.js
0620 22 3a 7b 22 73 69 7a 65 22 3a 31 30 39 34 38 2c 22 6f 66 66 73 65 74 22 3a 22 39 35 33 35 35 22 ":{"size":10948,"offset":"95355"
0640 7d 2c 22 67 75 65 73 74 2d 77 69 6e 64 6f 77 2d 6d 61 6e 61 67 65 72 2e 6a 73 22 3a 7b 22 73 69 },"guest-window-manager.js":{"si
0660 7a 65 22 3a 31 31 38 38 37 2c 22 6f 66 66 73 65 74 22 3a 22 31 30 36 33 30 33 22 7d 2c 22 69 6e ze":11887,"offset":"106303"},"in
0680 69 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 30 35 32 2c 22 6f 66 66 73 65 74 22 3a 22 31 31 it.js":{"size":5052,"offset":"11
06a0 38 31 39 30 22 7d 2c 22 6f 62 6a 65 63 74 73 2d 72 65 67 69 73 74 72 79 2e 6a 73 22 3a 7b 22 73 8190"},"objects-registry.js":{"s
06c0 69 7a 65 22 3a 32 38 33 37 2c 22 6f 66 66 73 65 74 22 3a 22 31 32 33 32 34 32 22 7d 2c 22 72 70 ize":2837,"offset":"123242"},"rp
06e0 63 2d 73 65 72 76 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 35 32 32 32 2c 22 6f 66 66 73 c-server.js":{"size":15222,"offs
0700 65 74 22 3a 22 31 32 36 30 37 39 22 7d 7d 7d 2c 22 63 6f 6d 6d 6f 6e 22 3a 7b 22 66 69 6c 65 73 et":"126079"}}},"common":{"files
0720 22 3a 7b 22 61 70 69 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 63 61 6c 6c 62 61 63 6b 73 2d 72 65 ":{"api":{"files":{"callbacks-re
0740 67 69 73 74 72 79 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 33 39 34 2c 22 6f 66 66 73 65 74 22 gistry.js":{"size":1394,"offset"
0760 3a 22 31 34 31 33 30 31 22 7d 2c 22 63 6c 69 70 62 6f 61 72 64 2e 6a 73 22 3a 7b 22 73 69 7a 65 :"141301"},"clipboard.js":{"size
0780 22 3a 36 31 33 2c 22 6f 66 66 73 65 74 22 3a 22 31 34 32 36 39 35 22 7d 2c 22 63 72 61 73 68 2d ":613,"offset":"142695"},"crash-
07a0 72 65 70 6f 72 74 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 37 38 32 2c 22 6f 66 66 73 65 reporter.js":{"size":3782,"offse
07c0 74 22 3a 22 31 34 33 33 30 38 22 7d 2c 22 64 65 70 72 65 63 61 74 65 2e 6a 73 22 3a 7b 22 73 69 t":"143308"},"deprecate.js":{"si
07e0 7a 65 22 3a 32 39 30 35 2c 22 6f 66 66 73 65 74 22 3a 22 31 34 37 30 39 30 22 7d 2c 22 64 65 70 ze":2905,"offset":"147090"},"dep
0800 72 65 63 61 74 69 6f 6e 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 33 31 2c 22 6f 66 66 73 65 recations.js":{"size":231,"offse
0820 74 22 3a 22 31 34 39 39 39 35 22 7d 2c 22 65 78 70 6f 72 74 73 22 3a 7b 22 66 69 6c 65 73 22 3a t":"149995"},"exports":{"files":
0840 7b 22 65 6c 65 63 74 72 6f 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 37 34 2c 22 6f 66 66 73 {"electron.js":{"size":374,"offs
0860 65 74 22 3a 22 31 35 30 32 32 36 22 7d 7d 7d 2c 22 69 73 2d 70 72 6f 6d 69 73 65 2e 6a 73 22 3a et":"150226"}}},"is-promise.js":
0880 7b 22 73 69 7a 65 22 3a 33 32 30 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 30 36 30 30 22 7d 2c 22 {"size":320,"offset":"150600"},"
08a0 6d 6f 64 75 6c 65 2d 6c 69 73 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 35 38 2c 22 6f 66 66 module-list.js":{"size":558,"off
08c0 73 65 74 22 3a 22 31 35 30 39 32 30 22 7d 2c 22 6e 61 74 69 76 65 2d 69 6d 61 67 65 2e 6a 73 22 set":"150920"},"native-image.js"
08e0 3a 7b 22 73 69 7a 65 22 3a 35 33 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 31 34 37 38 22 7d 2c 22 :{"size":53,"offset":"151478"},"
0900 73 68 65 6c 6c 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 34 36 2c 22 6f 66 66 73 65 74 22 3a 22 31 shell.js":{"size":46,"offset":"1
0920 35 31 35 33 31 22 7d 7d 7d 2c 22 61 74 6f 6d 2d 62 69 6e 64 69 6e 67 2d 73 65 74 75 70 2e 6a 73 51531"}}},"atom-binding-setup.js
0940 22 3a 7b 22 73 69 7a 65 22 3a 33 34 32 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 31 35 37 37 22 7d ":{"size":342,"offset":"151577"}
0960 2c 22 69 6e 69 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 38 33 36 2c 22 6f 66 66 73 65 74 22 ,"init.js":{"size":1836,"offset"
0980 3a 22 31 35 31 39 31 39 22 7d 2c 22 70 61 72 73 65 2d 66 65 61 74 75 72 65 73 2d 73 74 72 69 6e :"151919"},"parse-features-strin
09a0 67 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 37 31 32 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 33 37 g.js":{"size":712,"offset":"1537
09c0 35 35 22 7d 2c 22 72 65 73 65 74 2d 73 65 61 72 63 68 2d 70 61 74 68 73 2e 6a 73 22 3a 7b 22 73 55"},"reset-search-paths.js":{"s
09e0 69 7a 65 22 3a 31 32 38 35 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 34 34 36 37 22 7d 7d 7d 2c 22 ize":1285,"offset":"154467"}}},"
0a00 72 65 6e 64 65 72 65 72 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 61 70 69 22 3a 7b 22 66 69 6c 65 renderer":{"files":{"api":{"file
0a20 73 22 3a 7b 22 64 65 73 6b 74 6f 70 2d 63 61 70 74 75 72 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 s":{"desktop-capturer.js":{"size
0a40 22 3a 31 32 34 38 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 35 37 35 32 22 7d 2c 22 65 78 70 6f 72 ":1248,"offset":"155752"},"expor
0a60 74 73 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 65 6c 65 63 74 72 6f 6e 2e 6a 73 22 3a 7b 22 73 69 ts":{"files":{"electron.js":{"si
0a80 7a 65 22 3a 33 33 36 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 37 30 30 30 22 7d 7d 7d 2c 22 69 70 ze":336,"offset":"157000"}}},"ip
0aa0 63 2d 72 65 6e 64 65 72 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 33 37 39 2c 22 6f 66 66 c-renderer.js":{"size":1379,"off
0ac0 73 65 74 22 3a 22 31 35 37 33 33 36 22 7d 2c 22 6d 6f 64 75 6c 65 2d 6c 69 73 74 2e 6a 73 22 3a set":"157336"},"module-list.js":
0ae0 7b 22 73 69 7a 65 22 3a 32 38 39 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 38 37 31 35 22 7d 2c 22 {"size":289,"offset":"158715"},"
0b00 72 65 6d 6f 74 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 30 33 35 35 2c 22 6f 66 66 73 65 74 remote.js":{"size":10355,"offset
0b20 22 3a 22 31 35 39 30 30 34 22 7d 2c 22 73 63 72 65 65 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a ":"159004"},"screen.js":{"size":
0b40 35 31 2c 22 6f 66 66 73 65 74 22 3a 22 31 36 39 33 35 39 22 7d 2c 22 77 65 62 2d 66 72 61 6d 65 51,"offset":"169359"},"web-frame
0b60 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 35 37 2c 22 6f 66 66 73 65 74 22 3a 22 31 36 39 34 31 .js":{"size":357,"offset":"16941
0b80 30 22 7d 7d 7d 2c 22 63 68 72 6f 6d 65 2d 61 70 69 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 36 0"}}},"chrome-api.js":{"size":56
0ba0 39 35 2c 22 6f 66 66 73 65 74 22 3a 22 31 36 39 37 36 37 22 7d 2c 22 63 6f 6e 74 65 6e 74 2d 73 95,"offset":"169767"},"content-s
0bc0 63 72 69 70 74 73 2d 69 6e 6a 65 63 74 6f 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 30 30 36 cripts-injector.js":{"size":3006
0be0 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 35 34 36 32 22 7d 2c 22 65 78 74 65 6e 73 69 6f 6e 73 22 ,"offset":"175462"},"extensions"
0c00 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 65 76 65 6e 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 34 30 :{"files":{"event.js":{"size":40
0c20 36 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 38 34 36 38 22 7d 2c 22 69 31 38 6e 2e 6a 73 22 3a 7b 6,"offset":"178468"},"i18n.js":{
0c40 22 73 69 7a 65 22 3a 32 35 32 30 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 38 38 37 34 22 7d 2c 22 "size":2520,"offset":"178874"},"
0c60 73 74 6f 72 61 67 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 33 33 38 2c 22 6f 66 66 73 65 74 storage.js":{"size":3338,"offset
0c80 22 3a 22 31 38 31 33 39 34 22 7d 2c 22 77 65 62 2d 6e 61 76 69 67 61 74 69 6f 6e 2e 6a 73 22 3a ":"181394"},"web-navigation.js":
0ca0 7b 22 73 69 7a 65 22 3a 35 30 38 2c 22 6f 66 66 73 65 74 22 3a 22 31 38 34 37 33 32 22 7d 7d 7d {"size":508,"offset":"184732"}}}
0cc0 2c 22 69 6e 69 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 36 34 30 31 2c 22 6f 66 66 73 65 74 22 ,"init.js":{"size":6401,"offset"
0ce0 3a 22 31 38 35 32 34 30 22 7d 2c 22 69 6e 73 70 65 63 74 6f 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 :"185240"},"inspector.js":{"size
0d00 22 3a 33 30 34 35 2c 22 6f 66 66 73 65 74 22 3a 22 31 39 31 36 34 31 22 7d 2c 22 6f 76 65 72 72 ":3045,"offset":"191641"},"overr
0d20 69 64 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 33 35 2c 22 6f 66 66 73 65 74 22 3a 22 31 39 ide.js":{"size":335,"offset":"19
0d40 34 36 38 36 22 7d 2c 22 77 65 62 2d 76 69 65 77 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 67 75 65 4686"},"web-view":{"files":{"gue
0d60 73 74 2d 76 69 65 77 2d 69 6e 74 65 72 6e 61 6c 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 34 33 30 st-view-internal.js":{"size":430
0d80 30 2c 22 6f 66 66 73 65 74 22 3a 22 31 39 35 30 32 31 22 7d 2c 22 77 65 62 2d 76 69 65 77 2d 61 0,"offset":"195021"},"web-view-a
0da0 74 74 72 69 62 75 74 65 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 31 37 31 32 2c 22 6f 66 66 ttributes.js":{"size":11712,"off
0dc0 73 65 74 22 3a 22 31 39 39 33 32 31 22 7d 2c 22 77 65 62 2d 76 69 65 77 2d 63 6f 6e 73 74 61 6e set":"199321"},"web-view-constan
0de0 74 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 33 32 36 2c 22 6f 66 66 73 65 74 22 3a 22 32 31 ts.js":{"size":1326,"offset":"21
0e00 31 30 33 33 22 7d 2c 22 77 65 62 2d 76 69 65 77 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 35 34 1033"},"web-view.js":{"size":154
0e20 38 32 2c 22 6f 66 66 73 65 74 22 3a 22 32 31 32 33 35 39 22 7d 7d 7d 2c 22 77 69 6e 64 6f 77 2d 82,"offset":"212359"}}},"window-
0e40 73 65 74 75 70 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 36 35 33 32 2c 22 6f 66 66 73 65 74 22 3a setup.js":{"size":6532,"offset":
0e60 22 32 32 37 38 34 31 22 7d 7d 7d 2c 22 77 6f 72 6b 65 72 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 "227841"}}},"worker":{"files":{"
0e80 69 6e 69 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 31 38 39 2c 22 6f 66 66 73 65 74 22 3a 22 init.js":{"size":1189,"offset":"
0ea0 32 33 34 33 37 33 22 7d 7d 7d 7d 7d 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 234373"}}}}}'use.strict'..const.
0ec0 62 69 6e 64 69 6e 67 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 bindings.=.process.atomBinding('
0ee0 61 70 70 27 29 0a 63 6f 6e 73 74 20 7b 61 70 70 2c 20 41 70 70 7d 20 3d 20 62 69 6e 64 69 6e 67 app').const.{app,.App}.=.binding
0f00 73 0a 0a 2f 2f 20 4f 6e 6c 79 20 6f 6e 65 20 61 70 70 20 6f 62 6a 65 63 74 20 70 65 72 6d 69 74 s..//.Only.one.app.object.permit
0f20 74 65 64 2e 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 61 70 70 0a 0a 63 6f 6e 73 74 ted..module.exports.=.app..const
0f40 20 65 6c 65 63 74 72 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a .electron.=.require('electron').
0f60 63 6f 6e 73 74 20 7b 64 65 70 72 65 63 61 74 65 2c 20 4d 65 6e 75 7d 20 3d 20 65 6c 65 63 74 72 const.{deprecate,.Menu}.=.electr
0f80 6f 6e 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 on.const.{EventEmitter}.=.requir
0fa0 65 28 27 65 76 65 6e 74 73 27 29 0a 0a 2f 2f 20 41 70 70 20 69 73 20 61 6e 20 45 76 65 6e 74 45 e('events')..//.App.is.an.EventE
0fc0 6d 69 74 74 65 72 2e 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 41 70 mitter..Object.setPrototypeOf(Ap
0fe0 70 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 p.prototype,.EventEmitter.protot
1000 79 70 65 29 0a 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 61 70 70 29 0a 0a 4f 62 6a ype).EventEmitter.call(app)..Obj
1020 65 63 74 2e 61 73 73 69 67 6e 28 61 70 70 2c 20 7b 0a 20 20 73 65 74 41 70 70 6c 69 63 61 74 69 ect.assign(app,.{...setApplicati
1040 6f 6e 4d 65 6e 75 20 28 6d 65 6e 75 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 4d 65 6e 75 2e onMenu.(menu).{.....return.Menu.
1060 73 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 28 6d 65 6e 75 29 0a 20 20 7d 2c 0a 20 20 setApplicationMenu(menu)...},...
1080 67 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 getApplicationMenu.().{.....retu
10a0 72 6e 20 4d 65 6e 75 2e 67 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 28 29 0a 20 20 7d rn.Menu.getApplicationMenu()...}
10c0 2c 0a 20 20 63 6f 6d 6d 61 6e 64 4c 69 6e 65 3a 20 7b 0a 20 20 20 20 61 70 70 65 6e 64 53 77 69 ,...commandLine:.{.....appendSwi
10e0 74 63 68 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 63 61 73 74 tch.(...args).{.......const.cast
1100 65 64 41 72 67 73 20 3d 20 61 72 67 73 2e 6d 61 70 28 28 61 72 67 29 20 3d 3e 20 7b 0a 20 20 20 edArgs.=.args.map((arg).=>.{....
1120 20 20 20 20 20 72 65 74 75 72 6e 20 74 79 70 65 6f 66 20 61 72 67 20 21 3d 3d 20 27 73 74 72 69 .....return.typeof.arg.!==.'stri
1140 6e 67 27 20 3f 20 60 24 7b 61 72 67 7d 60 20 3a 20 61 72 67 0a 20 20 20 20 20 20 7d 29 0a 20 20 ng'.?.`${arg}`.:.arg.......})...
1160 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 73 2e 61 70 70 65 6e 64 53 77 69 74 63 68 ....return.bindings.appendSwitch
1180 28 2e 2e 2e 63 61 73 74 65 64 41 72 67 73 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 61 70 70 65 6e (...castedArgs).....},.....appen
11a0 64 41 72 67 75 6d 65 6e 74 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 dArgument.(...args).{.......cons
11c0 74 20 63 61 73 74 65 64 41 72 67 73 20 3d 20 61 72 67 73 2e 6d 61 70 28 28 61 72 67 29 20 3d 3e t.castedArgs.=.args.map((arg).=>
11e0 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 79 70 65 6f 66 20 61 72 67 20 21 3d 3d .{.........return.typeof.arg.!==
1200 20 27 73 74 72 69 6e 67 27 20 3f 20 60 24 7b 61 72 67 7d 60 20 3a 20 61 72 67 0a 20 20 20 20 20 .'string'.?.`${arg}`.:.arg......
1220 20 7d 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 73 2e 61 70 70 65 6e 64 .}).......return.bindings.append
1240 41 72 67 75 6d 65 6e 74 28 2e 2e 2e 63 61 73 74 65 64 41 72 67 73 29 0a 20 20 20 20 7d 0a 20 20 Argument(...castedArgs).....}...
1260 7d 0a 7d 29 0a 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 }.})..if.(process.platform.===.'
1280 64 61 72 77 69 6e 27 29 20 7b 0a 20 20 61 70 70 2e 64 6f 63 6b 20 3d 20 7b 0a 20 20 20 20 62 6f darwin').{...app.dock.=.{.....bo
12a0 75 6e 63 65 20 28 74 79 70 65 20 3d 20 27 69 6e 66 6f 72 6d 61 74 69 6f 6e 61 6c 27 29 20 7b 0a unce.(type.=.'informational').{.
12c0 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 42 6f 75 6e 63 65 ......return.bindings.dockBounce
12e0 28 74 79 70 65 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 63 61 6e 63 65 6c 42 6f 75 6e 63 65 3a 20 (type).....},.....cancelBounce:.
1300 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 43 61 6e 63 65 6c 42 6f 75 6e 63 65 2c 0a 20 20 20 20 64 bindings.dockCancelBounce,.....d
1320 6f 77 6e 6c 6f 61 64 46 69 6e 69 73 68 65 64 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 44 6f ownloadFinished:.bindings.dockDo
1340 77 6e 6c 6f 61 64 46 69 6e 69 73 68 65 64 2c 0a 20 20 20 20 73 65 74 42 61 64 67 65 3a 20 62 69 wnloadFinished,.....setBadge:.bi
1360 6e 64 69 6e 67 73 2e 64 6f 63 6b 53 65 74 42 61 64 67 65 54 65 78 74 2c 0a 20 20 20 20 67 65 74 ndings.dockSetBadgeText,.....get
1380 42 61 64 67 65 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 47 65 74 42 61 64 67 65 54 65 78 74 Badge:.bindings.dockGetBadgeText
13a0 2c 0a 20 20 20 20 68 69 64 65 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 48 69 64 65 2c 0a 20 ,.....hide:.bindings.dockHide,..
13c0 20 20 20 73 68 6f 77 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 53 68 6f 77 2c 0a 20 20 20 20 ...show:.bindings.dockShow,.....
13e0 69 73 56 69 73 69 62 6c 65 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 49 73 56 69 73 69 62 6c isVisible:.bindings.dockIsVisibl
1400 65 2c 0a 20 20 20 20 73 65 74 4d 65 6e 75 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 53 65 74 e,.....setMenu:.bindings.dockSet
1420 4d 65 6e 75 2c 0a 20 20 20 20 73 65 74 49 63 6f 6e 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b Menu,.....setIcon:.bindings.dock
1440 53 65 74 49 63 6f 6e 0a 20 20 7d 0a 7d 0a 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 SetIcon...}.}..if.(process.platf
1460 6f 72 6d 20 3d 3d 3d 20 27 6c 69 6e 75 78 27 29 20 7b 0a 20 20 61 70 70 2e 6c 61 75 6e 63 68 65 orm.===.'linux').{...app.launche
1480 72 20 3d 20 7b 0a 20 20 20 20 73 65 74 42 61 64 67 65 43 6f 75 6e 74 3a 20 62 69 6e 64 69 6e 67 r.=.{.....setBadgeCount:.binding
14a0 73 2e 75 6e 69 74 79 4c 61 75 6e 63 68 65 72 53 65 74 42 61 64 67 65 43 6f 75 6e 74 2c 0a 20 20 s.unityLauncherSetBadgeCount,...
14c0 20 20 67 65 74 42 61 64 67 65 43 6f 75 6e 74 3a 20 62 69 6e 64 69 6e 67 73 2e 75 6e 69 74 79 4c ..getBadgeCount:.bindings.unityL
14e0 61 75 6e 63 68 65 72 47 65 74 42 61 64 67 65 43 6f 75 6e 74 2c 0a 20 20 20 20 69 73 43 6f 75 6e auncherGetBadgeCount,.....isCoun
1500 74 65 72 42 61 64 67 65 41 76 61 69 6c 61 62 6c 65 3a 20 62 69 6e 64 69 6e 67 73 2e 75 6e 69 74 terBadgeAvailable:.bindings.unit
1520 79 4c 61 75 6e 63 68 65 72 41 76 61 69 6c 61 62 6c 65 2c 0a 20 20 20 20 69 73 55 6e 69 74 79 52 yLauncherAvailable,.....isUnityR
1540 75 6e 6e 69 6e 67 3a 20 62 69 6e 64 69 6e 67 73 2e 75 6e 69 74 79 4c 61 75 6e 63 68 65 72 41 76 unning:.bindings.unityLauncherAv
1560 61 69 6c 61 62 6c 65 0a 20 20 7d 0a 7d 0a 0a 61 70 70 2e 61 6c 6c 6f 77 4e 54 4c 4d 43 72 65 64 ailable...}.}..app.allowNTLMCred
1580 65 6e 74 69 61 6c 73 46 6f 72 41 6c 6c 44 6f 6d 61 69 6e 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 entialsForAllDomains.=.function.
15a0 28 61 6c 6c 6f 77 29 20 7b 0a 20 20 69 66 20 28 21 70 72 6f 63 65 73 73 2e 6e 6f 44 65 70 72 65 (allow).{...if.(!process.noDepre
15c0 63 61 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 64 65 70 72 65 63 61 74 65 2e 77 61 72 6e 28 27 61 cations).{.....deprecate.warn('a
15e0 70 70 2e 61 6c 6c 6f 77 4e 54 4c 4d 43 72 65 64 65 6e 74 69 61 6c 73 46 6f 72 41 6c 6c 44 6f 6d pp.allowNTLMCredentialsForAllDom
1600 61 69 6e 73 27 2c 20 27 73 65 73 73 69 6f 6e 2e 61 6c 6c 6f 77 4e 54 4c 4d 43 72 65 64 65 6e 74 ains',.'session.allowNTLMCredent
1620 69 61 6c 73 46 6f 72 44 6f 6d 61 69 6e 73 27 29 0a 20 20 7d 0a 20 20 6c 65 74 20 64 6f 6d 61 69 ialsForDomains')...}...let.domai
1640 6e 73 20 3d 20 61 6c 6c 6f 77 20 3f 20 27 2a 27 20 3a 20 27 27 0a 20 20 69 66 20 28 21 74 68 69 ns.=.allow.?.'*'.:.''...if.(!thi
1660 73 2e 69 73 52 65 61 64 79 28 29 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 4c s.isReady()).{.....this.commandL
1680 69 6e 65 2e 61 70 70 65 6e 64 53 77 69 74 63 68 28 27 61 75 74 68 2d 73 65 72 76 65 72 2d 77 68 ine.appendSwitch('auth-server-wh
16a0 69 74 65 6c 69 73 74 27 2c 20 64 6f 6d 61 69 6e 73 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 itelist',.domains)...}.else.{...
16c0 20 20 65 6c 65 63 74 72 6f 6e 2e 73 65 73 73 69 6f 6e 2e 64 65 66 61 75 6c 74 53 65 73 73 69 6f ..electron.session.defaultSessio
16e0 6e 2e 61 6c 6c 6f 77 4e 54 4c 4d 43 72 65 64 65 6e 74 69 61 6c 73 46 6f 72 44 6f 6d 61 69 6e 73 n.allowNTLMCredentialsForDomains
1700 28 64 6f 6d 61 69 6e 73 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 52 6f 75 74 65 73 20 74 68 65 20 65 (domains)...}.}..//.Routes.the.e
1720 76 65 6e 74 73 20 74 6f 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 0a 63 6f 6e 73 74 20 65 76 65 6e vents.to.webContents..const.even
1740 74 73 20 3d 20 5b 27 6c 6f 67 69 6e 27 2c 20 27 63 65 72 74 69 66 69 63 61 74 65 2d 65 72 72 6f ts.=.['login',.'certificate-erro
1760 72 27 2c 20 27 73 65 6c 65 63 74 2d 63 6c 69 65 6e 74 2d 63 65 72 74 69 66 69 63 61 74 65 27 5d r',.'select-client-certificate']
1780 0a 66 6f 72 20 28 6c 65 74 20 6e 61 6d 65 20 6f 66 20 65 76 65 6e 74 73 29 20 7b 0a 20 20 61 70 .for.(let.name.of.events).{...ap
17a0 70 2e 6f 6e 28 6e 61 6d 65 2c 20 28 65 76 65 6e 74 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 p.on(name,.(event,.webContents,.
17c0 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 65 6d ...args).=>.{.....webContents.em
17e0 69 74 28 6e 61 6d 65 2c 20 65 76 65 6e 74 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 29 0a 7d 0a it(name,.event,....args)...}).}.
1800 0a 2f 2f 20 57 72 61 70 70 65 72 73 20 66 6f 72 20 6e 61 74 69 76 65 20 63 6c 61 73 73 65 73 2e .//.Wrappers.for.native.classes.
1820 0a 63 6f 6e 73 74 20 7b 44 6f 77 6e 6c 6f 61 64 49 74 65 6d 7d 20 3d 20 70 72 6f 63 65 73 73 2e .const.{DownloadItem}.=.process.
1840 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 64 6f 77 6e 6c 6f 61 64 5f 69 74 65 6d 27 29 0a 4f 62 6a atomBinding('download_item').Obj
1860 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 44 6f 77 6e 6c 6f 61 64 49 74 65 6d 2e ect.setPrototypeOf(DownloadItem.
1880 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 prototype,.EventEmitter.prototyp
18a0 65 29 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e e).if.(process.platform.===.'win
18c0 33 32 27 29 20 7b 0a 20 20 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 72 65 71 75 69 72 32').{...module.exports.=.requir
18e0 65 28 27 2e 2f 61 75 74 6f 2d 75 70 64 61 74 65 72 2f 61 75 74 6f 2d 75 70 64 61 74 65 72 2d 77 e('./auto-updater/auto-updater-w
1900 69 6e 27 29 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d in').}.else.{...module.exports.=
1920 20 72 65 71 75 69 72 65 28 27 2e 2f 61 75 74 6f 2d 75 70 64 61 74 65 72 2f 61 75 74 6f 2d 75 70 .require('./auto-updater/auto-up
1940 64 61 74 65 72 2d 6e 61 74 69 76 65 27 29 0a 7d 0a 63 6f 6e 73 74 20 45 76 65 6e 74 45 6d 69 74 dater-native').}.const.EventEmit
1960 74 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 2e 45 76 65 6e 74 45 6d 69 ter.=.require('events').EventEmi
1980 74 74 65 72 0a 63 6f 6e 73 74 20 7b 61 75 74 6f 55 70 64 61 74 65 72 2c 20 41 75 74 6f 55 70 64 tter.const.{autoUpdater,.AutoUpd
19a0 61 74 65 72 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 61 75 74 ater}.=.process.atomBinding('aut
19c0 6f 5f 75 70 64 61 74 65 72 27 29 0a 0a 2f 2f 20 41 75 74 6f 55 70 64 61 74 65 72 20 69 73 20 61 o_updater')..//.AutoUpdater.is.a
19e0 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 n.EventEmitter..Object.setProtot
1a00 79 70 65 4f 66 28 41 75 74 6f 55 70 64 61 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 ypeOf(AutoUpdater.prototype,.Eve
1a20 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 45 76 65 6e 74 45 6d 69 74 74 65 ntEmitter.prototype).EventEmitte
1a40 72 2e 63 61 6c 6c 28 61 75 74 6f 55 70 64 61 74 65 72 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f r.call(autoUpdater)..module.expo
1a60 72 74 73 20 3d 20 61 75 74 6f 55 70 64 61 74 65 72 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a rts.=.autoUpdater.'use.strict'..
1a80 63 6f 6e 73 74 20 7b 61 70 70 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 const.{app}.=.require('electron'
1aa0 29 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 65 ).const.{EventEmitter}.=.require
1ac0 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 73 71 75 69 72 72 65 6c 55 70 64 61 74 65 20 ('events').const.squirrelUpdate.
1ae0 3d 20 72 65 71 75 69 72 65 28 27 2e 2f 73 71 75 69 72 72 65 6c 2d 75 70 64 61 74 65 2d 77 69 6e =.require('./squirrel-update-win
1b00 27 29 0a 0a 63 6c 61 73 73 20 41 75 74 6f 55 70 64 61 74 65 72 20 65 78 74 65 6e 64 73 20 45 76 ')..class.AutoUpdater.extends.Ev
1b20 65 6e 74 45 6d 69 74 74 65 72 20 7b 0a 20 20 71 75 69 74 41 6e 64 49 6e 73 74 61 6c 6c 20 28 29 entEmitter.{...quitAndInstall.()
1b40 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 75 70 64 61 74 65 41 76 61 69 6c 61 62 6c 65 .{.....if.(!this.updateAvailable
1b60 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 28 ).{.......return.this.emitError(
1b80 27 4e 6f 20 75 70 64 61 74 65 20 61 76 61 69 6c 61 62 6c 65 2c 20 63 61 6e 5c 27 74 20 71 75 69 'No.update.available,.can\'t.qui
1ba0 74 20 61 6e 64 20 69 6e 73 74 61 6c 6c 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 73 71 75 69 72 72 t.and.install').....}.....squirr
1bc0 65 6c 55 70 64 61 74 65 2e 70 72 6f 63 65 73 73 53 74 61 72 74 28 29 0a 20 20 20 20 61 70 70 2e elUpdate.processStart().....app.
1be0 71 75 69 74 28 29 0a 20 20 7d 0a 0a 20 20 67 65 74 46 65 65 64 55 52 4c 20 28 29 20 7b 0a 20 20 quit()...}....getFeedURL.().{...
1c00 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 75 70 64 61 74 65 55 52 4c 0a 20 20 7d 0a 0a 20 20 73 ..return.this.updateURL...}....s
1c20 65 74 46 65 65 64 55 52 4c 20 28 75 70 64 61 74 65 55 52 4c 2c 20 68 65 61 64 65 72 73 29 20 7b etFeedURL.(updateURL,.headers).{
1c40 0a 20 20 20 20 74 68 69 73 2e 75 70 64 61 74 65 55 52 4c 20 3d 20 75 70 64 61 74 65 55 52 4c 0a .....this.updateURL.=.updateURL.
1c60 20 20 7d 0a 0a 20 20 63 68 65 63 6b 46 6f 72 55 70 64 61 74 65 73 20 28 29 20 7b 0a 20 20 20 20 ..}....checkForUpdates.().{.....
1c80 69 66 20 28 21 74 68 69 73 2e 75 70 64 61 74 65 55 52 4c 29 20 7b 0a 20 20 20 20 20 20 72 65 74 if.(!this.updateURL).{.......ret
1ca0 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 28 27 55 70 64 61 74 65 20 55 52 4c 20 69 urn.this.emitError('Update.URL.i
1cc0 73 20 6e 6f 74 20 73 65 74 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 21 73 71 75 69 72 s.not.set').....}.....if.(!squir
1ce0 72 65 6c 55 70 64 61 74 65 2e 73 75 70 70 6f 72 74 65 64 28 29 29 20 7b 0a 20 20 20 20 20 20 72 relUpdate.supported()).{.......r
1d00 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 28 27 43 61 6e 20 6e 6f 74 20 66 69 eturn.this.emitError('Can.not.fi
1d20 6e 64 20 53 71 75 69 72 72 65 6c 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 65 6d 69 nd.Squirrel').....}.....this.emi
1d40 74 28 27 63 68 65 63 6b 69 6e 67 2d 66 6f 72 2d 75 70 64 61 74 65 27 29 0a 20 20 20 20 73 71 75 t('checking-for-update').....squ
1d60 69 72 72 65 6c 55 70 64 61 74 65 2e 63 68 65 63 6b 46 6f 72 55 70 64 61 74 65 28 74 68 69 73 2e irrelUpdate.checkForUpdate(this.
1d80 75 70 64 61 74 65 55 52 4c 2c 20 28 65 72 72 6f 72 2c 20 75 70 64 61 74 65 29 20 3d 3e 20 7b 0a updateURL,.(error,.update).=>.{.
1da0 20 20 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 ......if.(error.!=.null).{......
1dc0 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 28 65 72 72 6f 72 29 0a ...return.this.emitError(error).
1de0 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 69 66 20 28 75 70 64 61 74 65 20 3d 3d 20 6e 75 6c 6c ......}.......if.(update.==.null
1e00 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 28 27 75 70 ).{.........return.this.emit('up
1e20 64 61 74 65 2d 6e 6f 74 2d 61 76 61 69 6c 61 62 6c 65 27 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 date-not-available').......}....
1e40 20 20 20 74 68 69 73 2e 75 70 64 61 74 65 41 76 61 69 6c 61 62 6c 65 20 3d 20 74 72 75 65 0a 20 ...this.updateAvailable.=.true..
1e60 20 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 27 75 70 64 61 74 65 2d 61 76 61 69 6c 61 62 6c 65 .....this.emit('update-available
1e80 27 29 0a 20 20 20 20 20 20 73 71 75 69 72 72 65 6c 55 70 64 61 74 65 2e 75 70 64 61 74 65 28 74 ').......squirrelUpdate.update(t
1ea0 68 69 73 2e 75 70 64 61 74 65 55 52 4c 2c 20 28 65 72 72 6f 72 29 20 3d 3e 20 7b 0a 20 20 20 20 his.updateURL,.(error).=>.{.....
1ec0 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 ....if.(error.!=.null).{........
1ee0 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 28 65 72 72 6f 72 29 0a ...return.this.emitError(error).
1f00 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 7b 72 65 6c 65 61 73 65 ........}.........const.{release
1f20 4e 6f 74 65 73 2c 20 76 65 72 73 69 6f 6e 7d 20 3d 20 75 70 64 61 74 65 0a 20 20 20 20 20 20 20 Notes,.version}.=.update........
1f40 20 2f 2f 20 44 61 74 65 20 69 73 20 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65 20 6f 6e 20 57 69 6e .//.Date.is.not.available.on.Win
1f60 64 6f 77 73 2c 20 73 6f 20 66 61 6b 65 20 69 74 2e 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 dows,.so.fake.it..........const.
1f80 64 61 74 65 20 3d 20 6e 65 77 20 44 61 74 65 28 29 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 65 date.=.new.Date().........this.e
1fa0 6d 69 74 28 27 75 70 64 61 74 65 2d 64 6f 77 6e 6c 6f 61 64 65 64 27 2c 20 7b 7d 2c 20 72 65 6c mit('update-downloaded',.{},.rel
1fc0 65 61 73 65 4e 6f 74 65 73 2c 20 76 65 72 73 69 6f 6e 2c 20 64 61 74 65 2c 20 74 68 69 73 2e 75 easeNotes,.version,.date,.this.u
1fe0 70 64 61 74 65 55 52 4c 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 69 73 pdateURL,.().=>.{...........this
2000 2e 71 75 69 74 41 6e 64 49 6e 73 74 61 6c 6c 28 29 0a 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 .quitAndInstall().........})....
2020 20 20 20 7d 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 50 72 69 76 61 74 65 3a 20 ...}).....})...}....//.Private:.
2040 45 6d 69 74 20 62 6f 74 68 20 65 72 72 6f 72 20 6f 62 6a 65 63 74 20 61 6e 64 20 6d 65 73 73 61 Emit.both.error.object.and.messa
2060 67 65 2c 20 74 68 69 73 20 69 73 20 74 6f 20 6b 65 65 70 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 ge,.this.is.to.keep.compatibilit
2080 79 0a 20 20 2f 2f 20 77 69 74 68 20 4f 6c 64 20 41 50 49 73 2e 0a 20 20 65 6d 69 74 45 72 72 6f y...//.with.Old.APIs....emitErro
20a0 72 20 28 6d 65 73 73 61 67 65 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 27 65 72 72 r.(message).{.....this.emit('err
20c0 6f 72 27 2c 20 6e 65 77 20 45 72 72 6f 72 28 6d 65 73 73 61 67 65 29 2c 20 6d 65 73 73 61 67 65 or',.new.Error(message),.message
20e0 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 6e 65 77 20 41 75 )...}.}..module.exports.=.new.Au
2100 74 6f 55 70 64 61 74 65 72 28 29 0a 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 toUpdater().const.fs.=.require('
2120 66 73 27 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 fs').const.path.=.require('path'
2140 29 0a 63 6f 6e 73 74 20 73 70 61 77 6e 20 3d 20 72 65 71 75 69 72 65 28 27 63 68 69 6c 64 5f 70 ).const.spawn.=.require('child_p
2160 72 6f 63 65 73 73 27 29 2e 73 70 61 77 6e 0a 0a 2f 2f 20 69 2e 65 2e 20 6d 79 2d 61 70 70 2f 61 rocess').spawn..//.i.e..my-app/a
2180 70 70 2d 30 2e 31 2e 31 33 2f 0a 63 6f 6e 73 74 20 61 70 70 46 6f 6c 64 65 72 20 3d 20 70 61 74 pp-0.1.13/.const.appFolder.=.pat
21a0 68 2e 64 69 72 6e 61 6d 65 28 70 72 6f 63 65 73 73 2e 65 78 65 63 50 61 74 68 29 0a 0a 2f 2f 20 h.dirname(process.execPath)..//.
21c0 69 2e 65 2e 20 6d 79 2d 61 70 70 2f 55 70 64 61 74 65 2e 65 78 65 0a 63 6f 6e 73 74 20 75 70 64 i.e..my-app/Update.exe.const.upd
21e0 61 74 65 45 78 65 20 3d 20 70 61 74 68 2e 72 65 73 6f 6c 76 65 28 61 70 70 46 6f 6c 64 65 72 2c ateExe.=.path.resolve(appFolder,
2200 20 27 2e 2e 27 2c 20 27 55 70 64 61 74 65 2e 65 78 65 27 29 0a 63 6f 6e 73 74 20 65 78 65 4e 61 .'..',.'Update.exe').const.exeNa
2220 6d 65 20 3d 20 70 61 74 68 2e 62 61 73 65 6e 61 6d 65 28 70 72 6f 63 65 73 73 2e 65 78 65 63 50 me.=.path.basename(process.execP
2240 61 74 68 29 0a 76 61 72 20 73 70 61 77 6e 65 64 41 72 67 73 20 3d 20 5b 5d 0a 76 61 72 20 73 70 ath).var.spawnedArgs.=.[].var.sp
2260 61 77 6e 65 64 50 72 6f 63 65 73 73 0a 0a 76 61 72 20 69 73 53 61 6d 65 41 72 67 73 20 3d 20 66 awnedProcess..var.isSameArgs.=.f
2280 75 6e 63 74 69 6f 6e 20 28 61 72 67 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 28 61 72 67 73 2e unction.(args).{...return.(args.
22a0 6c 65 6e 67 74 68 20 3d 3d 3d 20 73 70 61 77 6e 65 64 41 72 67 73 2e 6c 65 6e 67 74 68 29 20 26 length.===.spawnedArgs.length).&
22c0 26 20 61 72 67 73 2e 65 76 65 72 79 28 66 75 6e 63 74 69 6f 6e 20 28 65 2c 20 69 29 20 7b 0a 20 &.args.every(function.(e,.i).{..
22e0 20 20 20 72 65 74 75 72 6e 20 65 20 3d 3d 3d 20 73 70 61 77 6e 65 64 41 72 67 73 5b 69 5d 0a 20 ...return.e.===.spawnedArgs[i]..
2300 20 7d 29 0a 7d 0a 0a 2f 2f 20 53 70 61 77 6e 20 61 20 63 6f 6d 6d 61 6e 64 20 61 6e 64 20 69 6e .}).}..//.Spawn.a.command.and.in
2320 76 6f 6b 65 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 77 68 65 6e 20 69 74 20 63 6f 6d 70 6c 65 voke.the.callback.when.it.comple
2340 74 65 73 20 77 69 74 68 20 61 6e 20 65 72 72 6f 72 0a 2f 2f 20 61 6e 64 20 74 68 65 20 6f 75 74 tes.with.an.error.//.and.the.out
2360 70 75 74 20 66 72 6f 6d 20 73 74 61 6e 64 61 72 64 20 6f 75 74 2e 0a 76 61 72 20 73 70 61 77 6e put.from.standard.out..var.spawn
2380 55 70 64 61 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 61 72 67 73 2c 20 64 65 74 61 63 68 65 Update.=.function.(args,.detache
23a0 64 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 76 61 72 20 65 72 72 6f 72 2c 20 65 72 72 6f d,.callback).{...var.error,.erro
23c0 72 45 6d 69 74 74 65 64 2c 20 73 74 64 65 72 72 2c 20 73 74 64 6f 75 74 0a 0a 20 20 74 72 79 20 rEmitted,.stderr,.stdout....try.
23e0 7b 0a 20 20 20 20 2f 2f 20 45 6e 73 75 72 65 20 77 65 20 64 6f 6e 27 74 20 73 70 61 77 6e 20 6d {.....//.Ensure.we.don't.spawn.m
2400 75 6c 74 69 70 6c 65 20 73 71 75 69 72 72 65 6c 20 70 72 6f 63 65 73 73 65 73 0a 20 20 20 20 2f ultiple.squirrel.processes...../
2420 2f 20 50 72 6f 63 65 73 73 20 73 70 61 77 6e 65 64 2c 20 73 61 6d 65 20 61 72 67 73 3a 20 20 20 /.Process.spawned,.same.args:...
2440 20 20 20 20 20 41 74 74 61 63 68 20 65 76 65 6e 74 73 20 74 6f 20 61 6c 72 65 61 64 20 72 75 6e .....Attach.events.to.alread.run
2460 6e 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 2f 2f 20 50 72 6f 63 65 73 73 20 73 70 61 77 ning.process.....//.Process.spaw
2480 6e 65 64 2c 20 64 69 66 66 65 72 65 6e 74 20 61 72 67 73 3a 20 20 20 52 65 74 75 72 6e 20 77 69 ned,.different.args:...Return.wi
24a0 74 68 20 65 72 72 6f 72 0a 20 20 20 20 2f 2f 20 4e 6f 20 70 72 6f 63 65 73 73 20 73 70 61 77 6e th.error.....//.No.process.spawn
24c0 65 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 70 61 77 6e 20 6e 65 77 20 70 72 6f ed:................Spawn.new.pro
24e0 63 65 73 73 0a 20 20 20 20 69 66 20 28 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 20 26 26 20 21 cess.....if.(spawnedProcess.&&.!
2500 69 73 53 61 6d 65 41 72 67 73 28 61 72 67 73 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e isSameArgs(args)).{.......return
2520 20 63 61 6c 6c 62 61 63 6b 28 27 41 75 74 6f 55 70 64 61 74 65 72 20 70 72 6f 63 65 73 73 20 77 .callback('AutoUpdater.process.w
2540 69 74 68 20 61 72 67 75 6d 65 6e 74 73 20 27 20 2b 20 61 72 67 73 20 2b 20 27 20 69 73 20 61 6c ith.arguments.'.+.args.+.'.is.al
2560 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 27 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 21 ready.running').....}.else.if.(!
2580 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 29 20 7b 0a 20 20 20 20 20 20 73 70 61 77 6e 65 64 50 spawnedProcess).{.......spawnedP
25a0 72 6f 63 65 73 73 20 3d 20 73 70 61 77 6e 28 75 70 64 61 74 65 45 78 65 2c 20 61 72 67 73 2c 20 rocess.=.spawn(updateExe,.args,.
25c0 7b 0a 20 20 20 20 20 20 20 20 64 65 74 61 63 68 65 64 3a 20 64 65 74 61 63 68 65 64 0a 20 20 20 {.........detached:.detached....
25e0 20 20 20 7d 29 0a 20 20 20 20 20 20 73 70 61 77 6e 65 64 41 72 67 73 20 3d 20 61 72 67 73 20 7c ...}).......spawnedArgs.=.args.|
2600 7c 20 5b 5d 0a 20 20 20 20 7d 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 31 29 20 7b 0a |.[].....}...}.catch.(error1).{.
2620 20 20 20 20 65 72 72 6f 72 20 3d 20 65 72 72 6f 72 31 0a 0a 20 20 20 20 2f 2f 20 53 68 6f 75 6c ....error.=.error1......//.Shoul
2640 64 6e 27 74 20 68 61 70 70 65 6e 2c 20 62 75 74 20 73 74 69 6c 6c 20 67 75 61 72 64 20 69 74 2e dn't.happen,.but.still.guard.it.
2660 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 66 75 6e 63 74 69 6f 6e 20 28 .....process.nextTick(function.(
2680 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 65 72 72 6f 72 29 ).{.......return.callback(error)
26a0 0a 20 20 20 20 7d 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 20 20 73 74 64 6f 75 74 20 .....}).....return...}...stdout.
26c0 3d 20 27 27 0a 20 20 73 74 64 65 72 72 20 3d 20 27 27 0a 20 20 73 70 61 77 6e 65 64 50 72 6f 63 =.''...stderr.=.''...spawnedProc
26e0 65 73 73 2e 73 74 64 6f 75 74 2e 6f 6e 28 27 64 61 74 61 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 ess.stdout.on('data',.function.(
2700 64 61 74 61 29 20 7b 0a 20 20 20 20 73 74 64 6f 75 74 20 2b 3d 20 64 61 74 61 0a 20 20 7d 29 0a data).{.....stdout.+=.data...}).
2720 20 20 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 2e 73 74 64 65 72 72 2e 6f 6e 28 27 64 61 74 61 ..spawnedProcess.stderr.on('data
2740 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 64 61 74 61 29 20 7b 0a 20 20 20 20 73 74 64 65 72 72 20 ',.function.(data).{.....stderr.
2760 2b 3d 20 64 61 74 61 0a 20 20 7d 29 0a 20 20 65 72 72 6f 72 45 6d 69 74 74 65 64 20 3d 20 66 61 +=.data...})...errorEmitted.=.fa
2780 6c 73 65 0a 20 20 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 2e 6f 6e 28 27 65 72 72 6f 72 27 2c lse...spawnedProcess.on('error',
27a0 20 66 75 6e 63 74 69 6f 6e 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 65 72 72 6f 72 45 6d 69 .function.(error).{.....errorEmi
27c0 74 74 65 64 20 3d 20 74 72 75 65 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 65 72 72 6f 72 29 0a tted.=.true.....callback(error).
27e0 20 20 7d 29 0a 20 20 72 65 74 75 72 6e 20 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 2e 6f 6e 28 ..})...return.spawnedProcess.on(
2800 27 65 78 69 74 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 63 6f 64 65 2c 20 73 69 67 6e 61 6c 29 20 'exit',.function.(code,.signal).
2820 7b 0a 20 20 20 20 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 20 3d 20 75 6e 64 65 66 69 6e 65 64 {.....spawnedProcess.=.undefined
2840 0a 20 20 20 20 73 70 61 77 6e 65 64 41 72 67 73 20 3d 20 5b 5d 0a 0a 20 20 20 20 2f 2f 20 57 65 .....spawnedArgs.=.[]......//.We
2860 20 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 65 6d 69 74 74 65 64 20 61 6e 20 65 72 72 .may.have.already.emitted.an.err
2880 6f 72 2e 0a 20 20 20 20 69 66 20 28 65 72 72 6f 72 45 6d 69 74 74 65 64 29 20 7b 0a 20 20 20 20 or......if.(errorEmitted).{.....
28a0 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 50 72 6f 63 65 73 73 20 74 ..return.....}......//.Process.t
28c0 65 72 6d 69 6e 61 74 65 64 20 77 69 74 68 20 65 72 72 6f 72 2e 0a 20 20 20 20 69 66 20 28 63 6f erminated.with.error......if.(co
28e0 64 65 20 21 3d 3d 20 30 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 de.!==.0).{.......return.callbac
2900 6b 28 27 43 6f 6d 6d 61 6e 64 20 66 61 69 6c 65 64 3a 20 27 20 2b 20 28 73 69 67 6e 61 6c 20 21 k('Command.failed:.'.+.(signal.!
2920 3d 20 6e 75 6c 6c 20 3f 20 73 69 67 6e 61 6c 20 3a 20 63 6f 64 65 29 20 2b 20 27 5c 6e 27 20 2b =.null.?.signal.:.code).+.'\n'.+
2940 20 73 74 64 65 72 72 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 53 75 63 63 65 73 73 2e 0a .stderr).....}......//.Success..
2960 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 6e 75 6c 6c 2c 20 73 74 64 6f 75 74 29 0a 20 20 7d 29 0a ....callback(null,.stdout)...}).
2980 7d 0a 0a 2f 2f 20 53 74 61 72 74 20 61 6e 20 69 6e 73 74 61 6e 63 65 20 6f 66 20 74 68 65 20 69 }..//.Start.an.instance.of.the.i
29a0 6e 73 74 61 6c 6c 65 64 20 61 70 70 2e 0a 65 78 70 6f 72 74 73 2e 70 72 6f 63 65 73 73 53 74 61 nstalled.app..exports.processSta
29c0 72 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 73 70 61 77 rt.=.function.().{...return.spaw
29e0 6e 55 70 64 61 74 65 28 5b 27 2d 2d 70 72 6f 63 65 73 73 53 74 61 72 74 41 6e 64 57 61 69 74 27 nUpdate(['--processStartAndWait'
2a00 2c 20 65 78 65 4e 61 6d 65 5d 2c 20 74 72 75 65 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 7d ,.exeName],.true,.function.().{}
2a20 29 0a 7d 0a 0a 2f 2f 20 44 6f 77 6e 6c 6f 61 64 20 74 68 65 20 72 65 6c 65 61 73 65 73 20 73 70 ).}..//.Download.the.releases.sp
2a40 65 63 69 66 69 65 64 20 62 79 20 74 68 65 20 55 52 4c 20 61 6e 64 20 77 72 69 74 65 20 6e 65 77 ecified.by.the.URL.and.write.new
2a60 20 72 65 73 75 6c 74 73 20 74 6f 20 73 74 64 6f 75 74 2e 0a 65 78 70 6f 72 74 73 2e 63 68 65 63 .results.to.stdout..exports.chec
2a80 6b 46 6f 72 55 70 64 61 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 70 64 61 74 65 55 52 4c kForUpdate.=.function.(updateURL
2aa0 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 73 70 61 77 6e 55 70 64 61 ,.callback).{...return.spawnUpda
2ac0 74 65 28 5b 27 2d 2d 63 68 65 63 6b 46 6f 72 55 70 64 61 74 65 27 2c 20 75 70 64 61 74 65 55 52 te(['--checkForUpdate',.updateUR
2ae0 4c 5d 2c 20 66 61 6c 73 65 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 72 72 6f 72 2c 20 73 74 64 6f L],.false,.function.(error,.stdo
2b00 75 74 29 20 7b 0a 20 20 20 20 76 61 72 20 6a 73 6f 6e 2c 20 72 65 66 2c 20 72 65 66 31 2c 20 75 ut).{.....var.json,.ref,.ref1,.u
2b20 70 64 61 74 65 0a 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 pdate.....if.(error.!=.null).{..
2b40 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 65 72 72 6f 72 29 0a 20 20 20 20 .....return.callback(error).....
2b60 7d 0a 20 20 20 20 74 72 79 20 7b 0a 20 20 20 20 20 20 2f 2f 20 4c 61 73 74 20 6c 69 6e 65 20 6f }.....try.{.......//.Last.line.o
2b80 66 20 6f 75 74 70 75 74 20 69 73 20 74 68 65 20 4a 53 4f 4e 20 64 65 74 61 69 6c 73 20 61 62 6f f.output.is.the.JSON.details.abo
2ba0 75 74 20 74 68 65 20 72 65 6c 65 61 73 65 73 0a 20 20 20 20 20 20 6a 73 6f 6e 20 3d 20 73 74 64 ut.the.releases.......json.=.std
2bc0 6f 75 74 2e 74 72 69 6d 28 29 2e 73 70 6c 69 74 28 27 5c 6e 27 29 2e 70 6f 70 28 29 0a 20 20 20 out.trim().split('\n').pop()....
2be0 20 20 20 75 70 64 61 74 65 20 3d 20 28 72 65 66 20 3d 20 4a 53 4f 4e 2e 70 61 72 73 65 28 6a 73 ...update.=.(ref.=.JSON.parse(js
2c00 6f 6e 29 29 20 21 3d 20 6e 75 6c 6c 20 3f 20 28 72 65 66 31 20 3d 20 72 65 66 2e 72 65 6c 65 61 on)).!=.null.?.(ref1.=.ref.relea
2c20 73 65 73 54 6f 41 70 70 6c 79 29 20 21 3d 20 6e 75 6c 6c 20 3f 20 74 79 70 65 6f 66 20 72 65 66 sesToApply).!=.null.?.typeof.ref
2c40 31 2e 70 6f 70 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 3f 20 72 65 66 31 2e 70 6f 70 28 1.pop.===.'function'.?.ref1.pop(
2c60 29 20 3a 20 76 6f 69 64 20 30 20 3a 20 76 6f 69 64 20 30 20 3a 20 76 6f 69 64 20 30 0a 20 20 20 ).:.void.0.:.void.0.:.void.0....
2c80 20 7d 20 63 61 74 63 68 20 28 6a 73 6f 6e 45 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 72 65 74 .}.catch.(jsonError).{.......ret
2ca0 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 27 49 6e 76 61 6c 69 64 20 72 65 73 75 6c 74 3a 5c 6e 27 urn.callback('Invalid.result:\n'
2cc0 20 2b 20 73 74 64 6f 75 74 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c .+.stdout).....}.....return.call
2ce0 62 61 63 6b 28 6e 75 6c 6c 2c 20 75 70 64 61 74 65 29 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 55 70 back(null,.update)...}).}..//.Up
2d00 64 61 74 65 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 74 6f 20 74 68 65 20 6c 61 74 65 date.the.application.to.the.late
2d20 73 74 20 72 65 6d 6f 74 65 20 76 65 72 73 69 6f 6e 20 73 70 65 63 69 66 69 65 64 20 62 79 20 55 st.remote.version.specified.by.U
2d40 52 4c 2e 0a 65 78 70 6f 72 74 73 2e 75 70 64 61 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 RL..exports.update.=.function.(u
2d60 70 64 61 74 65 55 52 4c 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 73 pdateURL,.callback).{...return.s
2d80 70 61 77 6e 55 70 64 61 74 65 28 5b 27 2d 2d 75 70 64 61 74 65 27 2c 20 75 70 64 61 74 65 55 52 pawnUpdate(['--update',.updateUR
2da0 4c 5d 2c 20 66 61 6c 73 65 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 7d 0a 0a 2f 2f 20 49 73 20 74 68 L],.false,.callback).}..//.Is.th
2dc0 65 20 55 70 64 61 74 65 2e 65 78 65 20 69 6e 73 74 61 6c 6c 65 64 20 77 69 74 68 20 74 68 65 20 e.Update.exe.installed.with.the.
2de0 63 75 72 72 65 6e 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 3f 0a 65 78 70 6f 72 74 73 2e 73 75 70 current.application?.exports.sup
2e00 70 6f 72 74 65 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 ported.=.function.().{...try.{..
2e20 20 20 20 66 73 2e 61 63 63 65 73 73 53 79 6e 63 28 75 70 64 61 74 65 45 78 65 2c 20 66 73 2e 52 ...fs.accessSync(updateExe,.fs.R
2e40 5f 4f 4b 29 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 7d 20 63 61 74 63 68 20 28 _OK).....return.true...}.catch.(
2e60 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0a 20 20 7d 0a 7d 0a error).{.....return.false...}.}.
2e80 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d 69 74 74 65 'use.strict'..const.{EventEmitte
2ea0 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 42 72 r}.=.require('events').const.{Br
2ec0 6f 77 73 65 72 56 69 65 77 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 owserView}.=.process.atomBinding
2ee0 28 27 62 72 6f 77 73 65 72 5f 76 69 65 77 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 ('browser_view')..Object.setProt
2f00 6f 74 79 70 65 4f 66 28 42 72 6f 77 73 65 72 56 69 65 77 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 otypeOf(BrowserView.prototype,.E
2f20 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 42 72 6f 77 73 65 72 56 ventEmitter.prototype)..BrowserV
2f40 69 65 77 2e 66 72 6f 6d 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 28 77 65 62 43 6f 6e 74 65 6e iew.fromWebContents.=.(webConten
2f60 74 73 29 20 3d 3e 20 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 76 69 65 77 20 6f 66 20 42 72 ts).=>.{...for.(const.view.of.Br
2f80 6f 77 73 65 72 56 69 65 77 2e 67 65 74 41 6c 6c 56 69 65 77 73 28 29 29 20 7b 0a 20 20 20 20 69 owserView.getAllViews()).{.....i
2fa0 66 20 28 76 69 65 77 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 65 71 75 61 6c 28 77 65 62 43 6f 6e f.(view.webContents.equal(webCon
2fc0 74 65 6e 74 73 29 29 20 72 65 74 75 72 6e 20 76 69 65 77 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 tents)).return.view...}....retur
2fe0 6e 20 6e 75 6c 6c 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 42 72 6f 77 73 n.null.}..module.exports.=.Brows
3000 65 72 56 69 65 77 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 65 6c 65 63 74 erView.'use.strict'..const.elect
3020 72 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 ron.=.require('electron').const.
3040 7b 69 70 63 4d 61 69 6e 7d 20 3d 20 65 6c 65 63 74 72 6f 6e 0a 63 6f 6e 73 74 20 7b 45 76 65 6e {ipcMain}.=.electron.const.{Even
3060 74 45 6d 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f tEmitter}.=.require('events').co
3080 6e 73 74 20 7b 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 nst.{BrowserWindow}.=.process.at
30a0 6f 6d 42 69 6e 64 69 6e 67 28 27 77 69 6e 64 6f 77 27 29 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c omBinding('window').const.v8Util
30c0 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 .=.process.atomBinding('v8_util'
30e0 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 42 72 6f 77 73 65 72 )..Object.setPrototypeOf(Browser
3100 57 69 6e 64 6f 77 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 Window.prototype,.EventEmitter.p
3120 72 6f 74 6f 74 79 70 65 29 0a 0a 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 70 72 6f 74 6f 74 79 rototype)..BrowserWindow.prototy
3140 70 65 2e 5f 69 6e 69 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 2f 2f 20 41 76 pe._init.=.function.().{...//.Av
3160 6f 69 64 20 72 65 63 75 72 73 69 76 65 20 72 65 71 75 69 72 65 2e 0a 20 20 63 6f 6e 73 74 20 7b oid.recursive.require....const.{
3180 61 70 70 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 20 20 2f 2f app}.=.require('electron')....//
31a0 20 53 69 6d 75 6c 61 74 65 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6d 65 6e 75 20 6f .Simulate.the.application.menu.o
31c0 6e 20 70 6c 61 74 66 6f 72 6d 73 20 6f 74 68 65 72 20 74 68 61 6e 20 6d 61 63 4f 53 2e 0a 20 20 n.platforms.other.than.macOS....
31e0 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 21 3d 3d 20 27 64 61 72 77 69 6e if.(process.platform.!==.'darwin
3200 27 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 6e 75 20 3d 20 61 70 70 2e 67 65 74 41 70 70 ').{.....const.menu.=.app.getApp
3220 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 28 29 0a 20 20 20 20 69 66 20 28 6d 65 6e 75 29 20 74 68 69 licationMenu().....if.(menu).thi
3240 73 2e 73 65 74 4d 65 6e 75 28 6d 65 6e 75 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 4d 61 6b 65 20 6e s.setMenu(menu)...}....//.Make.n
3260 65 77 20 77 69 6e 64 6f 77 73 20 72 65 71 75 65 73 74 65 64 20 62 79 20 6c 69 6e 6b 73 20 62 65 ew.windows.requested.by.links.be
3280 68 61 76 65 20 6c 69 6b 65 20 22 77 69 6e 64 6f 77 2e 6f 70 65 6e 22 0a 20 20 74 68 69 73 2e 77 have.like."window.open"...this.w
32a0 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 2d 6e 65 77 2d 77 69 6e 64 6f 77 27 2c 20 28 65 76 ebContents.on('-new-window',.(ev
32c0 65 6e 74 2c 20 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 0a 20 20 20 20 20 20 20 20 20 20 20 ent,.url,.frameName,............
32e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 69 73 70 6f ...........................dispo
3300 73 69 74 69 6f 6e 2c 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 73 2c 0a 20 20 20 20 sition,.additionalFeatures,.....
3320 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ................................
3340 20 20 70 6f 73 74 44 61 74 61 29 20 3d 3e 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6f 70 74 69 6f ..postData).=>.{.....const.optio
3360 6e 73 20 3d 20 7b 0a 20 20 20 20 20 20 73 68 6f 77 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 77 ns.=.{.......show:.true,.......w
3380 69 64 74 68 3a 20 38 30 30 2c 0a 20 20 20 20 20 20 68 65 69 67 68 74 3a 20 36 30 30 0a 20 20 20 idth:.800,.......height:.600....
33a0 20 7d 0a 20 20 20 20 69 70 63 4d 61 69 6e 2e 65 6d 69 74 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 .}.....ipcMain.emit('ELECTRON_GU
33c0 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 49 4e 54 45 52 4e 41 4c 5f 57 49 4e 44 EST_WINDOW_MANAGER_INTERNAL_WIND
33e0 4f 57 5f 4f 50 45 4e 27 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 76 65 6e 74 OW_OPEN',..................event
3400 2c 20 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 64 69 73 70 6f 73 69 74 69 6f 6e 2c 0a 20 ,.url,.frameName,.disposition,..
3420 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2c 20 61 64 64 69 74 69 6f ................options,.additio
3440 6e 61 6c 46 65 61 74 75 72 65 73 2c 20 70 6f 73 74 44 61 74 61 29 0a 20 20 7d 29 0a 0a 20 20 74 nalFeatures,.postData)...})....t
3460 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 2d 77 65 62 2d 63 6f 6e 74 65 6e 74 his.webContents.on('-web-content
3480 73 2d 63 72 65 61 74 65 64 27 2c 20 28 65 76 65 6e 74 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 2c s-created',.(event,.webContents,
34a0 20 75 72 6c 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .url,...........................
34c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 72 61 6d 65 4e 61 6d 65 29 ......................frameName)
34e0 20 3d 3e 20 7b 0a 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 .=>.{.....v8Util.setHiddenValue(
3500 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 27 75 72 6c 2d 66 72 61 6d 65 6e 61 6d 65 27 2c 20 7b 75 webContents,.'url-framename',.{u
3520 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 7d 29 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 43 72 65 61 74 rl,.frameName})...})....//.Creat
3540 65 20 61 20 6e 65 77 20 62 72 6f 77 73 65 72 20 77 69 6e 64 6f 77 20 66 6f 72 20 74 68 65 20 6e e.a.new.browser.window.for.the.n
3560 61 74 69 76 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 0a 20 20 2f 2f 20 22 77 69 ative.implementation.of...//."wi
3580 6e 64 6f 77 2e 6f 70 65 6e 22 2c 20 75 73 65 64 20 69 6e 20 73 61 6e 64 62 6f 78 20 61 6e 64 20 ndow.open",.used.in.sandbox.and.
35a0 6e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 20 6d 6f 64 65 0a 20 20 74 68 69 73 2e 77 65 62 nativeWindowOpen.mode...this.web
35c0 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 2d 61 64 64 2d 6e 65 77 2d 63 6f 6e 74 65 6e 74 73 27 2c Contents.on('-add-new-contents',
35e0 20 28 65 76 65 6e 74 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 64 69 73 70 6f 73 69 74 69 6f .(event,.webContents,.dispositio
3600 6e 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 n,..............................
3620 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 75 73 65 72 47 65 73 74 75 72 65 2c 20 6c 65 66 74 ...............userGesture,.left
3640 2c 20 74 6f 70 2c 20 77 69 64 74 68 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ,.top,.width,...................
3660 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 68 65 69 67 68 74 ..........................height
3680 29 20 3d 3e 20 7b 0a 20 20 20 20 6c 65 74 20 75 72 6c 46 72 61 6d 65 4e 61 6d 65 20 3d 20 76 38 ).=>.{.....let.urlFrameName.=.v8
36a0 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c Util.getHiddenValue(webContents,
36c0 20 27 75 72 6c 2d 66 72 61 6d 65 6e 61 6d 65 27 29 0a 20 20 20 20 69 66 20 28 28 64 69 73 70 6f .'url-framename').....if.((dispo
36e0 73 69 74 69 6f 6e 20 21 3d 3d 20 27 66 6f 72 65 67 72 6f 75 6e 64 2d 74 61 62 27 20 26 26 20 64 sition.!==.'foreground-tab'.&&.d
3700 69 73 70 6f 73 69 74 69 6f 6e 20 21 3d 3d 20 27 6e 65 77 2d 77 69 6e 64 6f 77 27 20 26 26 0a 20 isposition.!==.'new-window'.&&..
3720 20 20 20 20 20 20 20 20 64 69 73 70 6f 73 69 74 69 6f 6e 20 21 3d 3d 20 27 62 61 63 6b 67 72 6f ........disposition.!==.'backgro
3740 75 6e 64 2d 74 61 62 27 29 20 7c 7c 20 21 75 72 6c 46 72 61 6d 65 4e 61 6d 65 29 20 7b 0a 20 20 und-tab').||.!urlFrameName).{...
3760 20 20 20 20 65 76 65 6e 74 2e 70 72 65 76 65 6e 74 44 65 66 61 75 6c 74 28 29 0a 20 20 20 20 20 ....event.preventDefault()......
3780 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 7b 75 72 6c 2c 20 66 72 61 .return.....}......let.{url,.fra
37a0 6d 65 4e 61 6d 65 7d 20 3d 20 75 72 6c 46 72 61 6d 65 4e 61 6d 65 0a 20 20 20 20 76 38 55 74 69 meName}.=.urlFrameName.....v8Uti
37c0 6c 2e 64 65 6c 65 74 65 48 69 64 64 65 6e 56 61 6c 75 65 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c l.deleteHiddenValue(webContents,
37e0 20 27 75 72 6c 2d 66 72 61 6d 65 6e 61 6d 65 27 29 0a 20 20 20 20 63 6f 6e 73 74 20 6f 70 74 69 .'url-framename').....const.opti
3800 6f 6e 73 20 3d 20 7b 0a 20 20 20 20 20 20 73 68 6f 77 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 ons.=.{.......show:.true,.......
3820 78 3a 20 6c 65 66 74 2c 0a 20 20 20 20 20 20 79 3a 20 74 6f 70 2c 0a 20 20 20 20 20 20 77 69 64 x:.left,.......y:.top,.......wid
3840 74 68 3a 20 77 69 64 74 68 20 7c 7c 20 38 30 30 2c 0a 20 20 20 20 20 20 68 65 69 67 68 74 3a 20 th:.width.||.800,.......height:.
3860 68 65 69 67 68 74 20 7c 7c 20 36 30 30 2c 0a 20 20 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 height.||.600,.......webContents
3880 3a 20 77 65 62 43 6f 6e 74 65 6e 74 73 0a 20 20 20 20 7d 0a 20 20 20 20 69 70 63 4d 61 69 6e 2e :.webContents.....}.....ipcMain.
38a0 65 6d 69 74 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 emit('ELECTRON_GUEST_WINDOW_MANA
38c0 47 45 52 5f 49 4e 54 45 52 4e 41 4c 5f 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 0a 20 20 20 20 20 GER_INTERNAL_WINDOW_OPEN',......
38e0 20 20 20 20 20 20 20 20 20 20 20 20 65 76 65 6e 74 2c 20 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d ............event,.url,.frameNam
3900 65 2c 20 64 69 73 70 6f 73 69 74 69 6f 6e 2c 20 6f 70 74 69 6f 6e 73 29 0a 20 20 7d 29 0a 0a 20 e,.disposition,.options)...})...
3920 20 2f 2f 20 77 69 6e 64 6f 77 2e 72 65 73 69 7a 65 54 6f 28 2e 2e 2e 29 0a 20 20 2f 2f 20 77 69 .//.window.resizeTo(...)...//.wi
3940 6e 64 6f 77 2e 6d 6f 76 65 54 6f 28 2e 2e 2e 29 0a 20 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 ndow.moveTo(...)...this.webConte
3960 6e 74 73 2e 6f 6e 28 27 6d 6f 76 65 27 2c 20 28 65 76 65 6e 74 2c 20 73 69 7a 65 29 20 3d 3e 20 nts.on('move',.(event,.size).=>.
3980 7b 0a 20 20 20 20 74 68 69 73 2e 73 65 74 42 6f 75 6e 64 73 28 73 69 7a 65 29 0a 20 20 7d 29 0a {.....this.setBounds(size)...}).
39a0 0a 20 20 2f 2f 20 48 69 64 65 20 74 68 65 20 61 75 74 6f 2d 68 69 64 65 20 6d 65 6e 75 20 77 68 ...//.Hide.the.auto-hide.menu.wh
39c0 65 6e 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 69 73 20 66 6f 63 75 73 65 64 2e 0a 20 20 74 68 69 en.webContents.is.focused....thi
39e0 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 61 63 74 69 76 61 74 65 27 2c 20 28 29 20 s.webContents.on('activate',.().
3a00 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 21 3d =>.{.....if.(process.platform.!=
3a20 3d 20 27 64 61 72 77 69 6e 27 20 26 26 20 74 68 69 73 2e 69 73 4d 65 6e 75 42 61 72 41 75 74 6f =.'darwin'.&&.this.isMenuBarAuto
3a40 48 69 64 65 28 29 20 26 26 20 74 68 69 73 2e 69 73 4d 65 6e 75 42 61 72 56 69 73 69 62 6c 65 28 Hide().&&.this.isMenuBarVisible(
3a60 29 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 73 65 74 4d 65 6e 75 42 61 72 56 69 73 69 62 69 )).{.......this.setMenuBarVisibi
3a80 6c 69 74 79 28 66 61 6c 73 65 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 43 68 61 lity(false).....}...})....//.Cha
3aa0 6e 67 65 20 77 69 6e 64 6f 77 20 74 69 74 6c 65 20 74 6f 20 70 61 67 65 20 74 69 74 6c 65 2e 0a nge.window.title.to.page.title..
3ac0 20 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 70 61 67 65 2d 74 69 74 6c ..this.webContents.on('page-titl
3ae0 65 2d 75 70 64 61 74 65 64 27 2c 20 28 65 76 65 6e 74 2c 20 74 69 74 6c 65 29 20 3d 3e 20 7b 0a e-updated',.(event,.title).=>.{.
3b00 20 20 20 20 2f 2f 20 52 6f 75 74 65 20 74 68 65 20 65 76 65 6e 74 20 74 6f 20 42 72 6f 77 73 65 ....//.Route.the.event.to.Browse
3b20 72 57 69 6e 64 6f 77 2e 0a 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 27 70 61 67 65 2d 74 69 74 rWindow......this.emit('page-tit
3b40 6c 65 2d 75 70 64 61 74 65 64 27 2c 20 65 76 65 6e 74 2c 20 74 69 74 6c 65 29 0a 20 20 20 20 69 le-updated',.event,.title).....i
3b60 66 20 28 21 74 68 69 73 2e 69 73 44 65 73 74 72 6f 79 65 64 28 29 20 26 26 20 21 65 76 65 6e 74 f.(!this.isDestroyed().&&.!event
3b80 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 29 20 74 68 69 73 2e 73 65 74 54 69 74 6c 65 .defaultPrevented).this.setTitle
3ba0 28 74 69 74 6c 65 29 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 53 6f 6d 65 74 69 6d 65 73 20 74 68 65 (title)...})....//.Sometimes.the
3bc0 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 64 6f 65 73 6e 27 74 20 67 65 74 20 66 6f 63 75 73 20 77 .webContents.doesn't.get.focus.w
3be0 68 65 6e 20 77 69 6e 64 6f 77 20 69 73 20 73 68 6f 77 6e 2c 20 73 6f 20 77 65 0a 20 20 2f 2f 20 hen.window.is.shown,.so.we...//.
3c00 68 61 76 65 20 74 6f 20 66 6f 72 63 65 20 66 6f 63 75 73 69 6e 67 20 6f 6e 20 77 65 62 43 6f 6e have.to.force.focusing.on.webCon
3c20 74 65 6e 74 73 20 69 6e 20 74 68 69 73 20 63 61 73 65 2e 20 54 68 65 20 73 61 66 65 73 74 20 77 tents.in.this.case..The.safest.w
3c40 61 79 20 69 73 20 74 6f 0a 20 20 2f 2f 20 66 6f 63 75 73 20 69 74 20 77 68 65 6e 20 77 65 20 66 ay.is.to...//.focus.it.when.we.f
3c60 69 72 73 74 20 73 74 61 72 74 20 74 6f 20 6c 6f 61 64 20 55 52 4c 2c 20 69 66 20 77 65 20 64 6f irst.start.to.load.URL,.if.we.do
3c80 20 69 74 20 65 61 72 6c 69 65 72 20 69 74 20 77 6f 6e 27 74 0a 20 20 2f 2f 20 68 61 76 65 20 65 .it.earlier.it.won't...//.have.e
3ca0 66 66 65 63 74 2c 20 69 66 20 77 65 20 64 6f 20 69 74 20 6c 61 74 65 72 20 77 65 20 6d 69 67 68 ffect,.if.we.do.it.later.we.migh
3cc0 74 20 6d 6f 76 65 20 66 6f 63 75 73 20 69 6e 20 74 68 65 20 70 61 67 65 2e 0a 20 20 2f 2f 0a 20 t.move.focus.in.the.page....//..
3ce0 20 2f 2f 20 54 68 6f 75 67 68 20 74 68 69 73 20 68 61 63 6b 20 69 73 20 6f 6e 6c 79 20 6e 65 65 .//.Though.this.hack.is.only.nee
3d00 64 65 64 20 6f 6e 20 6d 61 63 4f 53 20 77 68 65 6e 20 74 68 65 20 61 70 70 20 69 73 20 6c 61 75 ded.on.macOS.when.the.app.is.lau
3d20 6e 63 68 65 64 20 66 72 6f 6d 0a 20 20 2f 2f 20 46 69 6e 64 65 72 2c 20 77 65 20 73 74 69 6c 6c nched.from...//.Finder,.we.still
3d40 20 64 6f 20 69 74 20 6f 6e 20 61 6c 6c 20 70 6c 61 74 66 6f 72 6d 73 20 69 6e 20 63 61 73 65 20 .do.it.on.all.platforms.in.case.
3d60 6f 66 20 6f 74 68 65 72 20 62 75 67 73 20 77 65 20 64 6f 6e 27 74 0a 20 20 2f 2f 20 6b 6e 6f 77 of.other.bugs.we.don't...//.know
3d80 2e 0a 20 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 63 65 28 27 6c 6f 61 64 2d ....this.webContents.once('load-
3da0 75 72 6c 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 66 6f 63 url',.function.().{.....this.foc
3dc0 75 73 28 29 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 52 65 64 69 72 65 63 74 20 66 6f 63 75 73 2f 62 us()...})....//.Redirect.focus/b
3de0 6c 75 72 20 65 76 65 6e 74 20 74 6f 20 61 70 70 20 69 6e 73 74 61 6e 63 65 20 74 6f 6f 2e 0a 20 lur.event.to.app.instance.too...
3e00 20 74 68 69 73 2e 6f 6e 28 27 62 6c 75 72 27 2c 20 28 65 76 65 6e 74 29 20 3d 3e 20 7b 0a 20 20 .this.on('blur',.(event).=>.{...
3e20 20 20 61 70 70 2e 65 6d 69 74 28 27 62 72 6f 77 73 65 72 2d 77 69 6e 64 6f 77 2d 62 6c 75 72 27 ..app.emit('browser-window-blur'
3e40 2c 20 65 76 65 6e 74 2c 20 74 68 69 73 29 0a 20 20 7d 29 0a 20 20 74 68 69 73 2e 6f 6e 28 27 66 ,.event,.this)...})...this.on('f
3e60 6f 63 75 73 27 2c 20 28 65 76 65 6e 74 29 20 3d 3e 20 7b 0a 20 20 20 20 61 70 70 2e 65 6d 69 74 ocus',.(event).=>.{.....app.emit
3e80 28 27 62 72 6f 77 73 65 72 2d 77 69 6e 64 6f 77 2d 66 6f 63 75 73 27 2c 20 65 76 65 6e 74 2c 20 ('browser-window-focus',.event,.
3ea0 74 68 69 73 29 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 53 75 62 73 63 72 69 62 65 20 74 6f 20 76 69 this)...})....//.Subscribe.to.vi
3ec0 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 63 68 61 6e 67 65 73 20 61 6e 64 20 70 61 73 73 20 74 sibilityState.changes.and.pass.t
3ee0 6f 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 2e 0a 20 20 6c 65 74 20 69 73 56 69 73 69 o.renderer.process....let.isVisi
3f00 62 6c 65 20 3d 20 74 68 69 73 2e 69 73 56 69 73 69 62 6c 65 28 29 20 26 26 20 21 74 68 69 73 2e ble.=.this.isVisible().&&.!this.
3f20 69 73 4d 69 6e 69 6d 69 7a 65 64 28 29 0a 20 20 63 6f 6e 73 74 20 76 69 73 69 62 69 6c 69 74 79 isMinimized()...const.visibility
3f40 43 68 61 6e 67 65 64 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6e 65 77 53 Changed.=.().=>.{.....const.newS
3f60 74 61 74 65 20 3d 20 74 68 69 73 2e 69 73 56 69 73 69 62 6c 65 28 29 20 26 26 20 21 74 68 69 73 tate.=.this.isVisible().&&.!this
3f80 2e 69 73 4d 69 6e 69 6d 69 7a 65 64 28 29 0a 20 20 20 20 69 66 20 28 69 73 56 69 73 69 62 6c 65 .isMinimized().....if.(isVisible
3fa0 20 21 3d 3d 20 6e 65 77 53 74 61 74 65 29 20 7b 0a 20 20 20 20 20 20 69 73 56 69 73 69 62 6c 65 .!==.newState).{.......isVisible
3fc0 20 3d 20 6e 65 77 53 74 61 74 65 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 76 69 73 69 62 69 6c 69 .=.newState.......const.visibili
3fe0 74 79 53 74 61 74 65 20 3d 20 69 73 56 69 73 69 62 6c 65 20 3f 20 27 76 69 73 69 62 6c 65 27 20 tyState.=.isVisible.?.'visible'.
4000 3a 20 27 68 69 64 64 65 6e 27 0a 20 20 20 20 20 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 :.'hidden'.......this.webContent
4020 73 2e 65 6d 69 74 28 27 2d 77 69 6e 64 6f 77 2d 76 69 73 69 62 69 6c 69 74 79 2d 63 68 61 6e 67 s.emit('-window-visibility-chang
4040 65 27 2c 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a e',.visibilityState).....}...}..
4060 20 20 63 6f 6e 73 74 20 76 69 73 69 62 69 6c 69 74 79 45 76 65 6e 74 73 20 3d 20 5b 27 73 68 6f ..const.visibilityEvents.=.['sho
4080 77 27 2c 20 27 68 69 64 65 27 2c 20 27 6d 69 6e 69 6d 69 7a 65 27 2c 20 27 6d 61 78 69 6d 69 7a w',.'hide',.'minimize',.'maximiz
40a0 65 27 2c 20 27 72 65 73 74 6f 72 65 27 5d 0a 20 20 66 6f 72 20 28 6c 65 74 20 65 76 65 6e 74 20 e',.'restore']...for.(let.event.
40c0 6f 66 20 76 69 73 69 62 69 6c 69 74 79 45 76 65 6e 74 73 29 20 7b 0a 20 20 20 20 74 68 69 73 2e of.visibilityEvents).{.....this.
40e0 6f 6e 28 65 76 65 6e 74 2c 20 76 69 73 69 62 69 6c 69 74 79 43 68 61 6e 67 65 64 29 0a 20 20 7d on(event,.visibilityChanged)...}
4100 0a 0a 20 20 2f 2f 20 4e 6f 74 69 66 79 20 74 68 65 20 63 72 65 61 74 69 6f 6e 20 6f 66 20 74 68 ....//.Notify.the.creation.of.th
4120 65 20 77 69 6e 64 6f 77 2e 0a 20 20 61 70 70 2e 65 6d 69 74 28 27 62 72 6f 77 73 65 72 2d 77 69 e.window....app.emit('browser-wi
4140 6e 64 6f 77 2d 63 72 65 61 74 65 64 27 2c 20 7b 7d 2c 20 74 68 69 73 29 0a 0a 20 20 4f 62 6a 65 ndow-created',.{},.this)....Obje
4160 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 73 2c 20 27 64 65 76 54 6f 6f 6c ct.defineProperty(this,.'devTool
4180 73 57 65 62 43 6f 6e 74 65 6e 74 73 27 2c 20 7b 0a 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a sWebContents',.{.....enumerable:
41a0 20 74 72 75 65 2c 0a 20 20 20 20 63 6f 6e 66 69 67 75 72 61 62 6c 65 3a 20 66 61 6c 73 65 2c 0a .true,.....configurable:.false,.
41c0 20 20 20 20 67 65 74 20 28 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 ....get.().{.......return.this.w
41e0 65 62 43 6f 6e 74 65 6e 74 73 2e 64 65 76 54 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e 74 73 0a 20 ebContents.devToolsWebContents..
4200 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 46 6f ...}...}).}..BrowserWindow.getFo
4220 63 75 73 65 64 57 69 6e 64 6f 77 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 66 6f 72 20 28 6c 65 74 cusedWindow.=.().=>.{...for.(let
4240 20 77 69 6e 64 6f 77 20 6f 66 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c 57 .window.of.BrowserWindow.getAllW
4260 69 6e 64 6f 77 73 28 29 29 20 7b 0a 20 20 20 20 69 66 20 28 77 69 6e 64 6f 77 2e 69 73 46 6f 63 indows()).{.....if.(window.isFoc
4280 75 73 65 64 28 29 29 20 72 65 74 75 72 6e 20 77 69 6e 64 6f 77 0a 20 20 7d 0a 20 20 72 65 74 75 used()).return.window...}...retu
42a0 72 6e 20 6e 75 6c 6c 0a 7d 0a 0a 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 57 65 62 rn.null.}..BrowserWindow.fromWeb
42c0 43 6f 6e 74 65 6e 74 73 20 3d 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 Contents.=.(webContents).=>.{...
42e0 66 6f 72 20 28 63 6f 6e 73 74 20 77 69 6e 64 6f 77 20 6f 66 20 42 72 6f 77 73 65 72 57 69 6e 64 for.(const.window.of.BrowserWind
4300 6f 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 28 29 29 20 7b 0a 20 20 20 20 69 66 20 28 77 69 ow.getAllWindows()).{.....if.(wi
4320 6e 64 6f 77 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 65 71 75 61 6c 28 77 65 62 43 6f 6e 74 65 6e ndow.webContents.equal(webConten
4340 74 73 29 29 20 72 65 74 75 72 6e 20 77 69 6e 64 6f 77 0a 20 20 7d 0a 7d 0a 0a 42 72 6f 77 73 65 ts)).return.window...}.}..Browse
4360 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 42 72 6f 77 73 65 72 56 69 65 77 20 3d 20 28 62 72 6f 77 73 rWindow.fromBrowserView.=.(brows
4380 65 72 56 69 65 77 29 20 3d 3e 20 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 77 69 6e 64 6f 77 erView).=>.{...for.(const.window
43a0 20 6f 66 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 28 .of.BrowserWindow.getAllWindows(
43c0 29 29 20 7b 0a 20 20 20 20 69 66 20 28 77 69 6e 64 6f 77 2e 67 65 74 42 72 6f 77 73 65 72 56 69 )).{.....if.(window.getBrowserVi
43e0 65 77 28 29 20 3d 3d 3d 20 62 72 6f 77 73 65 72 56 69 65 77 29 20 72 65 74 75 72 6e 20 77 69 6e ew().===.browserView).return.win
4400 64 6f 77 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 0a 7d 0a 0a 42 72 6f 77 73 65 dow...}....return.null.}..Browse
4420 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 44 65 76 54 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e 74 73 20 rWindow.fromDevToolsWebContents.
4440 3d 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 =.(webContents).=>.{...for.(cons
4460 74 20 77 69 6e 64 6f 77 20 6f 66 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c t.window.of.BrowserWindow.getAll
4480 57 69 6e 64 6f 77 73 28 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 7b 64 65 76 54 6f 6f 6c 73 Windows()).{.....const.{devTools
44a0 57 65 62 43 6f 6e 74 65 6e 74 73 7d 20 3d 20 77 69 6e 64 6f 77 0a 20 20 20 20 69 66 20 28 64 65 WebContents}.=.window.....if.(de
44c0 76 54 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e 74 73 20 21 3d 20 6e 75 6c 6c 20 26 26 20 64 65 76 vToolsWebContents.!=.null.&&.dev
44e0 54 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e 74 73 2e 65 71 75 61 6c 28 77 65 62 43 6f 6e 74 65 6e ToolsWebContents.equal(webConten
4500 74 73 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 77 69 6e 64 6f 77 0a 20 20 20 20 7d ts)).{.......return.window.....}
4520 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 48 65 6c 70 65 72 73 2e 0a 4f 62 6a 65 63 74 2e 61 73 73 69 67 ...}.}..//.Helpers..Object.assig
4540 6e 28 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 70 72 6f 74 6f 74 79 70 65 2c 20 7b 0a 20 20 6c n(BrowserWindow.prototype,.{...l
4560 6f 61 64 55 52 4c 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 oadURL.(...args).{.....return.th
4580 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6c 6f 61 64 55 52 4c 28 2e 2e 2e 61 72 67 73 29 0a is.webContents.loadURL(...args).
45a0 20 20 7d 2c 0a 20 20 67 65 74 55 52 4c 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 ..},...getURL.(...args).{.....re
45c0 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 67 65 74 55 52 4c 28 29 0a 20 turn.this.webContents.getURL()..
45e0 20 7d 2c 0a 20 20 72 65 6c 6f 61 64 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 .},...reload.(...args).{.....ret
4600 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 72 65 6c 6f 61 64 28 2e 2e 2e 61 urn.this.webContents.reload(...a
4620 72 67 73 29 0a 20 20 7d 2c 0a 20 20 73 65 6e 64 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 rgs)...},...send.(...args).{....
4640 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 73 65 6e 64 28 2e 2e .return.this.webContents.send(..
4660 2e 61 72 67 73 29 0a 20 20 7d 2c 0a 20 20 6f 70 65 6e 44 65 76 54 6f 6f 6c 73 20 28 2e 2e 2e 61 .args)...},...openDevTools.(...a
4680 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e rgs).{.....return.this.webConten
46a0 74 73 2e 6f 70 65 6e 44 65 76 54 6f 6f 6c 73 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 2c 0a 20 20 ts.openDevTools(...args)...},...
46c0 63 6c 6f 73 65 44 65 76 54 6f 6f 6c 73 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 closeDevTools.().{.....return.th
46e0 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 63 6c 6f 73 65 44 65 76 54 6f 6f 6c 73 28 29 0a 20 is.webContents.closeDevTools()..
4700 20 7d 2c 0a 20 20 69 73 44 65 76 54 6f 6f 6c 73 4f 70 65 6e 65 64 20 28 29 20 7b 0a 20 20 20 20 .},...isDevToolsOpened.().{.....
4720 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 73 44 65 76 54 6f 6f return.this.webContents.isDevToo
4740 6c 73 4f 70 65 6e 65 64 28 29 0a 20 20 7d 2c 0a 20 20 69 73 44 65 76 54 6f 6f 6c 73 46 6f 63 75 lsOpened()...},...isDevToolsFocu
4760 73 65 64 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 sed.().{.....return.this.webCont
4780 65 6e 74 73 2e 69 73 44 65 76 54 6f 6f 6c 73 46 6f 63 75 73 65 64 28 29 0a 20 20 7d 2c 0a 20 20 ents.isDevToolsFocused()...},...
47a0 74 6f 67 67 6c 65 44 65 76 54 6f 6f 6c 73 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 toggleDevTools.().{.....return.t
47c0 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 74 6f 67 67 6c 65 44 65 76 54 6f 6f 6c 73 28 29 his.webContents.toggleDevTools()
47e0 0a 20 20 7d 2c 0a 20 20 69 6e 73 70 65 63 74 45 6c 65 6d 65 6e 74 20 28 2e 2e 2e 61 72 67 73 29 ...},...inspectElement.(...args)
4800 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 .{.....return.this.webContents.i
4820 6e 73 70 65 63 74 45 6c 65 6d 65 6e 74 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 2c 0a 20 20 69 6e nspectElement(...args)...},...in
4840 73 70 65 63 74 53 65 72 76 69 63 65 57 6f 72 6b 65 72 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 spectServiceWorker.().{.....retu
4860 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 6e 73 70 65 63 74 53 65 72 76 69 rn.this.webContents.inspectServi
4880 63 65 57 6f 72 6b 65 72 28 29 0a 20 20 7d 2c 0a 20 20 73 68 6f 77 44 65 66 69 6e 69 74 69 6f 6e ceWorker()...},...showDefinition
48a0 46 6f 72 53 65 6c 65 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 ForSelection.().{.....return.thi
48c0 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 73 68 6f 77 44 65 66 69 6e 69 74 69 6f 6e 46 6f 72 53 s.webContents.showDefinitionForS
48e0 65 6c 65 63 74 69 6f 6e 28 29 0a 20 20 7d 2c 0a 20 20 63 61 70 74 75 72 65 50 61 67 65 20 28 2e election()...},...capturePage.(.
4900 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e ..args).{.....return.this.webCon
4920 74 65 6e 74 73 2e 63 61 70 74 75 72 65 50 61 67 65 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 2c 0a tents.capturePage(...args)...},.
4940 20 20 73 65 74 54 6f 75 63 68 42 61 72 20 28 74 6f 75 63 68 42 61 72 29 20 7b 0a 20 20 20 20 65 ..setTouchBar.(touchBar).{.....e
4960 6c 65 63 74 72 6f 6e 2e 54 6f 75 63 68 42 61 72 2e 5f 73 65 74 4f 6e 57 69 6e 64 6f 77 28 74 6f lectron.TouchBar._setOnWindow(to
4980 75 63 68 42 61 72 2c 20 74 68 69 73 29 0a 20 20 7d 0a 7d 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 uchBar,.this)...}.})..module.exp
49a0 6f 72 74 73 20 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f orts.=.BrowserWindow.module.expo
49c0 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 63 6f 6e 74 65 rts.=.process.atomBinding('conte
49e0 6e 74 5f 74 72 61 63 69 6e 67 27 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 nt_tracing').'use.strict'..const
4a00 20 7b 61 70 70 2c 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 7d 20 3d 20 72 65 71 75 69 72 65 28 .{app,.BrowserWindow}.=.require(
4a20 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 62 69 6e 64 69 6e 67 20 3d 20 70 72 6f 63 'electron').const.binding.=.proc
4a40 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 64 69 61 6c 6f 67 27 29 0a 63 6f 6e 73 74 20 ess.atomBinding('dialog').const.
4a60 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 v8Util.=.process.atomBinding('v8
4a80 5f 75 74 69 6c 27 29 0a 0a 63 6f 6e 73 74 20 66 69 6c 65 44 69 61 6c 6f 67 50 72 6f 70 65 72 74 _util')..const.fileDialogPropert
4aa0 69 65 73 20 3d 20 7b 0a 20 20 6f 70 65 6e 46 69 6c 65 3a 20 31 20 3c 3c 20 30 2c 0a 20 20 6f 70 ies.=.{...openFile:.1.<<.0,...op
4ac0 65 6e 44 69 72 65 63 74 6f 72 79 3a 20 31 20 3c 3c 20 31 2c 0a 20 20 6d 75 6c 74 69 53 65 6c 65 enDirectory:.1.<<.1,...multiSele
4ae0 63 74 69 6f 6e 73 3a 20 31 20 3c 3c 20 32 2c 0a 20 20 63 72 65 61 74 65 44 69 72 65 63 74 6f 72 ctions:.1.<<.2,...createDirector
4b00 79 3a 20 31 20 3c 3c 20 33 2c 0a 20 20 73 68 6f 77 48 69 64 64 65 6e 46 69 6c 65 73 3a 20 31 20 y:.1.<<.3,...showHiddenFiles:.1.
4b20 3c 3c 20 34 2c 0a 20 20 70 72 6f 6d 70 74 54 6f 43 72 65 61 74 65 3a 20 31 20 3c 3c 20 35 2c 0a <<.4,...promptToCreate:.1.<<.5,.
4b40 20 20 6e 6f 52 65 73 6f 6c 76 65 41 6c 69 61 73 65 73 3a 20 31 20 3c 3c 20 36 2c 0a 20 20 74 72 ..noResolveAliases:.1.<<.6,...tr
4b60 65 61 74 50 61 63 6b 61 67 65 41 73 44 69 72 65 63 74 6f 72 79 3a 20 31 20 3c 3c 20 37 0a 7d 0a eatPackageAsDirectory:.1.<<.7.}.
4b80 0a 63 6f 6e 73 74 20 6d 65 73 73 61 67 65 42 6f 78 54 79 70 65 73 20 3d 20 5b 27 6e 6f 6e 65 27 .const.messageBoxTypes.=.['none'
4ba0 2c 20 27 69 6e 66 6f 27 2c 20 27 77 61 72 6e 69 6e 67 27 2c 20 27 65 72 72 6f 72 27 2c 20 27 71 ,.'info',.'warning',.'error',.'q
4bc0 75 65 73 74 69 6f 6e 27 5d 0a 0a 63 6f 6e 73 74 20 6d 65 73 73 61 67 65 42 6f 78 4f 70 74 69 6f uestion']..const.messageBoxOptio
4be0 6e 73 20 3d 20 7b 0a 20 20 6e 6f 4c 69 6e 6b 3a 20 31 20 3c 3c 20 30 0a 7d 0a 0a 63 6f 6e 73 74 ns.=.{...noLink:.1.<<.0.}..const
4c00 20 70 61 72 73 65 41 72 67 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 69 6e 64 6f 77 2c 20 6f .parseArgs.=.function.(window,.o
4c20 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 ptions,.callback,....args).{...i
4c40 66 20 28 77 69 6e 64 6f 77 20 21 3d 20 6e 75 6c 6c 20 26 26 20 77 69 6e 64 6f 77 2e 63 6f 6e 73 f.(window.!=.null.&&.window.cons
4c60 74 72 75 63 74 6f 72 20 21 3d 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 29 20 7b 0a 20 20 20 tructor.!==.BrowserWindow).{....
4c80 20 2f 2f 20 53 68 69 66 74 2e 0a 20 20 20 20 5b 63 61 6c 6c 62 61 63 6b 2c 20 6f 70 74 69 6f 6e .//.Shift......[callback,.option
4ca0 73 2c 20 77 69 6e 64 6f 77 5d 20 3d 20 5b 6f 70 74 69 6f 6e 73 2c 20 77 69 6e 64 6f 77 2c 20 6e s,.window].=.[options,.window,.n
4cc0 75 6c 6c 5d 0a 20 20 7d 0a 0a 20 20 69 66 20 28 28 63 61 6c 6c 62 61 63 6b 20 3d 3d 20 6e 75 6c ull]...}....if.((callback.==.nul
4ce0 6c 29 20 26 26 20 74 79 70 65 6f 66 20 6f 70 74 69 6f 6e 73 20 3d 3d 3d 20 27 66 75 6e 63 74 69 l).&&.typeof.options.===.'functi
4d00 6f 6e 27 29 20 7b 0a 20 20 20 20 2f 2f 20 53 68 69 66 74 2e 0a 20 20 20 20 5b 63 61 6c 6c 62 61 on').{.....//.Shift......[callba
4d20 63 6b 2c 20 6f 70 74 69 6f 6e 73 5d 20 3d 20 5b 6f 70 74 69 6f 6e 73 2c 20 6e 75 6c 6c 5d 0a 20 ck,.options].=.[options,.null]..
4d40 20 7d 0a 0a 20 20 2f 2f 20 46 61 6c 6c 62 61 63 6b 20 74 6f 20 75 73 69 6e 67 20 76 65 72 79 20 .}....//.Fallback.to.using.very.
4d60 6c 61 73 74 20 61 72 67 75 6d 65 6e 74 20 61 73 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 66 75 last.argument.as.the.callback.fu
4d80 6e 63 74 69 6f 6e 0a 20 20 63 6f 6e 73 74 20 6c 61 73 74 41 72 67 75 6d 65 6e 74 20 3d 20 61 72 nction...const.lastArgument.=.ar
4da0 67 73 5b 61 72 67 73 2e 6c 65 6e 67 74 68 20 2d 20 31 5d 0a 20 20 69 66 20 28 28 63 61 6c 6c 62 gs[args.length.-.1]...if.((callb
4dc0 61 63 6b 20 3d 3d 20 6e 75 6c 6c 29 20 26 26 20 74 79 70 65 6f 66 20 6c 61 73 74 41 72 67 75 6d ack.==.null).&&.typeof.lastArgum
4de0 65 6e 74 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 63 61 6c 6c 62 61 ent.===.'function').{.....callba
4e00 63 6b 20 3d 20 6c 61 73 74 41 72 67 75 6d 65 6e 74 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 ck.=.lastArgument...}....return.
4e20 5b 77 69 6e 64 6f 77 2c 20 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 5d 0a 7d 0a 0a 63 [window,.options,.callback].}..c
4e40 6f 6e 73 74 20 6e 6f 72 6d 61 6c 69 7a 65 41 63 63 65 73 73 4b 65 79 20 3d 20 28 74 65 78 74 29 onst.normalizeAccessKey.=.(text)
4e60 20 3d 3e 20 7b 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 74 65 78 74 20 21 3d 3d 20 27 73 74 72 .=>.{...if.(typeof.text.!==.'str
4e80 69 6e 67 27 29 20 72 65 74 75 72 6e 20 74 65 78 74 0a 0a 20 20 2f 2f 20 6d 61 63 4f 53 20 64 6f ing').return.text....//.macOS.do
4ea0 65 73 20 6e 6f 74 20 68 61 76 65 20 61 63 63 65 73 73 20 6b 65 79 73 20 73 6f 20 72 65 6d 6f 76 es.not.have.access.keys.so.remov
4ec0 65 20 73 69 6e 67 6c 65 20 61 6d 70 65 72 73 61 6e 64 73 0a 20 20 2f 2f 20 61 6e 64 20 72 65 70 e.single.ampersands...//.and.rep
4ee0 6c 61 63 65 20 64 6f 75 62 6c 65 20 61 6d 70 65 72 73 61 6e 64 73 20 77 69 74 68 20 61 20 73 69 lace.double.ampersands.with.a.si
4f00 6e 67 6c 65 20 61 6d 70 65 72 73 61 6e 64 0a 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 ngle.ampersand...if.(process.pla
4f20 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e tform.===.'darwin').{.....return
4f40 20 74 65 78 74 2e 72 65 70 6c 61 63 65 28 2f 26 28 26 3f 29 2f 67 2c 20 27 24 31 27 29 0a 20 20 .text.replace(/&(&?)/g,.'$1')...
4f60 7d 0a 0a 20 20 2f 2f 20 4c 69 6e 75 78 20 75 73 65 73 20 61 20 73 69 6e 67 6c 65 20 75 6e 64 65 }....//.Linux.uses.a.single.unde
4f80 72 73 63 6f 72 65 20 61 73 20 61 6e 20 61 63 63 65 73 73 20 6b 65 79 20 70 72 65 66 69 78 20 73 rscore.as.an.access.key.prefix.s
4fa0 6f 20 65 73 63 61 70 65 0a 20 20 2f 2f 20 65 78 69 73 74 69 6e 67 20 73 69 6e 67 6c 65 20 75 6e o.escape...//.existing.single.un
4fc0 64 65 72 73 63 6f 72 65 73 20 77 69 74 68 20 61 20 73 65 63 6f 6e 64 20 75 6e 64 65 72 73 63 6f derscores.with.a.second.undersco
4fe0 72 65 2c 20 72 65 70 6c 61 63 65 20 64 6f 75 62 6c 65 0a 20 20 2f 2f 20 61 6d 70 65 72 73 61 6e re,.replace.double...//.ampersan
5000 64 73 20 77 69 74 68 20 61 20 73 69 6e 67 6c 65 20 61 6d 70 65 72 73 61 6e 64 2c 20 61 6e 64 20 ds.with.a.single.ampersand,.and.
5020 72 65 70 6c 61 63 65 20 61 20 73 69 6e 67 6c 65 20 61 6d 70 65 72 73 61 6e 64 20 77 69 74 68 0a replace.a.single.ampersand.with.
5040 20 20 2f 2f 20 61 20 73 69 6e 67 6c 65 20 75 6e 64 65 72 73 63 6f 72 65 0a 20 20 69 66 20 28 70 ..//.a.single.underscore...if.(p
5060 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 6c 69 6e 75 78 27 29 20 7b 0a 20 rocess.platform.===.'linux').{..
5080 20 20 20 72 65 74 75 72 6e 20 74 65 78 74 2e 72 65 70 6c 61 63 65 28 2f 5f 2f 67 2c 20 27 5f 5f ...return.text.replace(/_/g,.'__
50a0 27 29 2e 72 65 70 6c 61 63 65 28 2f 26 28 2e 3f 29 2f 67 2c 20 28 6d 61 74 63 68 2c 20 61 66 74 ').replace(/&(.?)/g,.(match,.aft
50c0 65 72 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 66 20 28 61 66 74 65 72 20 3d 3d 3d 20 27 26 27 er).=>.{.......if.(after.===.'&'
50e0 29 20 72 65 74 75 72 6e 20 61 66 74 65 72 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 60 5f 24 7b ).return.after.......return.`_${
5100 61 66 74 65 72 7d 60 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 74 65 78 after}`.....})...}....return.tex
5120 74 0a 7d 0a 0a 63 6f 6e 73 74 20 63 68 65 63 6b 41 70 70 49 6e 69 74 69 61 6c 69 7a 65 64 20 3d t.}..const.checkAppInitialized.=
5140 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 69 66 20 28 21 61 70 70 2e 69 73 52 65 61 64 .function.().{...if.(!app.isRead
5160 79 28 29 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 64 69 61 6c y()).{.....throw.new.Error('dial
5180 6f 67 20 6d 6f 64 75 6c 65 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 75 73 65 64 20 61 66 74 65 72 og.module.can.only.be.used.after
51a0 20 61 70 70 20 69 73 20 72 65 61 64 79 27 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 .app.is.ready')...}.}..module.ex
51c0 70 6f 72 74 73 20 3d 20 7b 0a 20 20 73 68 6f 77 4f 70 65 6e 44 69 61 6c 6f 67 3a 20 66 75 6e 63 ports.=.{...showOpenDialog:.func
51e0 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 63 68 65 63 6b 41 70 70 49 6e 69 tion.(...args).{.....checkAppIni
5200 74 69 61 6c 69 7a 65 64 28 29 0a 0a 20 20 20 20 6c 65 74 20 5b 77 69 6e 64 6f 77 2c 20 6f 70 74 tialized()......let.[window,.opt
5220 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 5d 20 3d 20 70 61 72 73 65 41 72 67 73 28 2e 2e 2e 61 ions,.callback].=.parseArgs(...a
5240 72 67 73 29 0a 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b rgs)......if.(options.==.null).{
5260 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 74 69 74 6c 65 .......options.=.{.........title
5280 3a 20 27 4f 70 65 6e 27 2c 0a 20 20 20 20 20 20 20 20 70 72 6f 70 65 72 74 69 65 73 3a 20 5b 27 :.'Open',.........properties:.['
52a0 6f 70 65 6e 46 69 6c 65 27 5d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 openFile'].......}.....}......le
52c0 74 20 7b 62 75 74 74 6f 6e 4c 61 62 65 6c 2c 20 64 65 66 61 75 6c 74 50 61 74 68 2c 20 66 69 6c t.{buttonLabel,.defaultPath,.fil
52e0 74 65 72 73 2c 20 70 72 6f 70 65 72 74 69 65 73 2c 20 74 69 74 6c 65 2c 20 6d 65 73 73 61 67 65 ters,.properties,.title,.message
5300 7d 20 3d 20 6f 70 74 69 6f 6e 73 0a 0a 20 20 20 20 69 66 20 28 70 72 6f 70 65 72 74 69 65 73 20 }.=.options......if.(properties.
5320 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 70 72 6f 70 65 72 74 69 65 73 20 3d 20 5b 27 ==.null).{.......properties.=.['
5340 6f 70 65 6e 46 69 6c 65 27 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 21 41 72 72 61 79 openFile'].....}.else.if.(!Array
5360 2e 69 73 41 72 72 61 79 28 70 72 6f 70 65 72 74 69 65 73 29 29 20 7b 0a 20 20 20 20 20 20 74 68 .isArray(properties)).{.......th
5380 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 50 72 6f 70 65 72 74 69 65 73 20 6d 75 row.new.TypeError('Properties.mu
53a0 73 74 20 62 65 20 61 6e 20 61 72 72 61 79 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 st.be.an.array').....}......let.
53c0 64 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 20 3d 20 30 0a 20 20 20 20 66 6f 72 20 28 63 6f dialogProperties.=.0.....for.(co
53e0 6e 73 74 20 70 72 6f 70 20 69 6e 20 66 69 6c 65 44 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 nst.prop.in.fileDialogProperties
5400 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 70 72 6f 70 65 72 74 69 65 73 2e 69 6e 63 6c 75 64 65 ).{.......if.(properties.include
5420 73 28 70 72 6f 70 29 29 20 7b 0a 20 20 20 20 20 20 20 20 64 69 61 6c 6f 67 50 72 6f 70 65 72 74 s(prop)).{.........dialogPropert
5440 69 65 73 20 7c 3d 20 66 69 6c 65 44 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 5b 70 72 6f 70 ies.|=.fileDialogProperties[prop
5460 5d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 74 69 74 6c 65 20 3d ].......}.....}......if.(title.=
5480 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 69 74 6c 65 20 3d 20 27 27 0a 20 20 20 20 7d =.null).{.......title.=.''.....}
54a0 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 74 69 74 6c 65 20 21 3d 3d 20 27 73 74 72 69 .else.if.(typeof.title.!==.'stri
54c0 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 ng').{.......throw.new.TypeError
54e0 28 27 54 69 74 6c 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d ('Title.must.be.a.string').....}
5500 0a 0a 20 20 20 20 69 66 20 28 62 75 74 74 6f 6e 4c 61 62 65 6c 20 3d 3d 20 6e 75 6c 6c 29 20 7b ......if.(buttonLabel.==.null).{
5520 0a 20 20 20 20 20 20 62 75 74 74 6f 6e 4c 61 62 65 6c 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c .......buttonLabel.=.''.....}.el
5540 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 62 75 74 74 6f 6e 4c 61 62 65 6c 20 21 3d 3d 20 27 73 se.if.(typeof.buttonLabel.!==.'s
5560 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 tring').{.......throw.new.TypeEr
5580 72 6f 72 28 27 42 75 74 74 6f 6e 20 6c 61 62 65 6c 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 ror('Button.label.must.be.a.stri
55a0 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 64 65 66 61 75 6c 74 50 61 74 68 20 ng').....}......if.(defaultPath.
55c0 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 64 65 66 61 75 6c 74 50 61 74 68 20 3d 20 27 ==.null).{.......defaultPath.=.'
55e0 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 64 65 66 61 75 6c 74 50 '.....}.else.if.(typeof.defaultP
5600 61 74 68 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 ath.!==.'string').{.......throw.
5620 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 44 65 66 61 75 6c 74 20 70 61 74 68 20 6d 75 73 74 new.TypeError('Default.path.must
5640 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 66 69 .be.a.string').....}......if.(fi
5660 6c 74 65 72 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 66 69 6c 74 65 72 73 20 3d lters.==.null).{.......filters.=
5680 20 5b 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 6d 65 73 73 61 67 65 20 3d 3d 20 6e 75 .[].....}......if.(message.==.nu
56a0 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 ll).{.......message.=.''.....}.e
56c0 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 6d 65 73 73 61 67 65 20 21 3d 3d 20 27 73 74 72 69 lse.if.(typeof.message.!==.'stri
56e0 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 ng').{.......throw.new.TypeError
5700 28 27 4d 65 73 73 61 67 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 ('Message.must.be.a.string')....
5720 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 77 72 61 70 70 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 .}......const.wrappedCallback.=.
5740 74 79 70 65 6f 66 20 63 61 6c 6c 62 61 63 6b 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 3f typeof.callback.===.'function'.?
5760 20 66 75 6e 63 74 69 6f 6e 20 28 73 75 63 63 65 73 73 2c 20 72 65 73 75 6c 74 29 20 7b 0a 20 20 .function.(success,.result).{...
5780 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 73 75 63 63 65 73 73 20 3f 20 72 65 ....return.callback(success.?.re
57a0 73 75 6c 74 20 3a 20 76 6f 69 64 20 30 29 0a 20 20 20 20 7d 20 3a 20 6e 75 6c 6c 0a 20 20 20 20 sult.:.void.0).....}.:.null.....
57c0 63 6f 6e 73 74 20 73 65 74 74 69 6e 67 73 20 3d 20 7b 74 69 74 6c 65 2c 20 62 75 74 74 6f 6e 4c const.settings.=.{title,.buttonL
57e0 61 62 65 6c 2c 20 64 65 66 61 75 6c 74 50 61 74 68 2c 20 66 69 6c 74 65 72 73 2c 20 6d 65 73 73 abel,.defaultPath,.filters,.mess
5800 61 67 65 2c 20 77 69 6e 64 6f 77 7d 0a 20 20 20 20 73 65 74 74 69 6e 67 73 2e 70 72 6f 70 65 72 age,.window}.....settings.proper
5820 74 69 65 73 20 3d 20 64 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 0a 20 20 20 20 72 65 74 75 ties.=.dialogProperties.....retu
5840 72 6e 20 62 69 6e 64 69 6e 67 2e 73 68 6f 77 4f 70 65 6e 44 69 61 6c 6f 67 28 73 65 74 74 69 6e rn.binding.showOpenDialog(settin
5860 67 73 2c 20 77 72 61 70 70 65 64 43 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 2c 0a 0a 20 20 73 68 6f gs,.wrappedCallback)...},....sho
5880 77 53 61 76 65 44 69 61 6c 6f 67 3a 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 wSaveDialog:.function.(...args).
58a0 7b 0a 20 20 20 20 63 68 65 63 6b 41 70 70 49 6e 69 74 69 61 6c 69 7a 65 64 28 29 0a 0a 20 20 20 {.....checkAppInitialized().....
58c0 20 6c 65 74 20 5b 77 69 6e 64 6f 77 2c 20 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 5d .let.[window,.options,.callback]
58e0 20 3d 20 70 61 72 73 65 41 72 67 73 28 2e 2e 2e 61 72 67 73 29 0a 0a 20 20 20 20 69 66 20 28 6f .=.parseArgs(...args)......if.(o
5900 70 74 69 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 ptions.==.null).{.......options.
5920 3d 20 7b 0a 20 20 20 20 20 20 20 20 74 69 74 6c 65 3a 20 27 53 61 76 65 27 0a 20 20 20 20 20 20 =.{.........title:.'Save'.......
5940 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 7b 62 75 74 74 6f 6e 4c 61 62 65 6c 2c 20 64 }.....}......let.{buttonLabel,.d
5960 65 66 61 75 6c 74 50 61 74 68 2c 20 66 69 6c 74 65 72 73 2c 20 74 69 74 6c 65 2c 20 6d 65 73 73 efaultPath,.filters,.title,.mess
5980 61 67 65 2c 20 6e 61 6d 65 46 69 65 6c 64 4c 61 62 65 6c 2c 20 73 68 6f 77 73 54 61 67 46 69 65 age,.nameFieldLabel,.showsTagFie
59a0 6c 64 7d 20 3d 20 6f 70 74 69 6f 6e 73 0a 0a 20 20 20 20 69 66 20 28 74 69 74 6c 65 20 3d 3d 20 ld}.=.options......if.(title.==.
59c0 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 69 74 6c 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 null).{.......title.=.''.....}.e
59e0 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 74 69 74 6c 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 lse.if.(typeof.title.!==.'string
5a00 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 ').{.......throw.new.TypeError('
5a20 54 69 74 6c 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a Title.must.be.a.string').....}..
5a40 20 20 20 20 69 66 20 28 62 75 74 74 6f 6e 4c 61 62 65 6c 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 ....if.(buttonLabel.==.null).{..
5a60 20 20 20 20 20 62 75 74 74 6f 6e 4c 61 62 65 6c 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 .....buttonLabel.=.''.....}.else
5a80 20 69 66 20 28 74 79 70 65 6f 66 20 62 75 74 74 6f 6e 4c 61 62 65 6c 20 21 3d 3d 20 27 73 74 72 .if.(typeof.buttonLabel.!==.'str
5aa0 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f ing').{.......throw.new.TypeErro
5ac0 72 28 27 42 75 74 74 6f 6e 20 6c 61 62 65 6c 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 r('Button.label.must.be.a.string
5ae0 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 64 65 66 61 75 6c 74 50 61 74 68 20 3d 3d ').....}......if.(defaultPath.==
5b00 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 64 65 66 61 75 6c 74 50 61 74 68 20 3d 20 27 27 0a .null).{.......defaultPath.=.''.
5b20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 64 65 66 61 75 6c 74 50 61 74 ....}.else.if.(typeof.defaultPat
5b40 68 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 h.!==.'string').{.......throw.ne
5b60 77 20 54 79 70 65 45 72 72 6f 72 28 27 44 65 66 61 75 6c 74 20 70 61 74 68 20 6d 75 73 74 20 62 w.TypeError('Default.path.must.b
5b80 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 66 69 6c 74 e.a.string').....}......if.(filt
5ba0 65 72 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 66 69 6c 74 65 72 73 20 3d 20 5b ers.==.null).{.......filters.=.[
5bc0 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 6d 65 73 73 61 67 65 20 3d 3d 20 6e 75 6c 6c ].....}......if.(message.==.null
5be0 29 20 7b 0a 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 ).{.......message.=.''.....}.els
5c00 65 20 69 66 20 28 74 79 70 65 6f 66 20 6d 65 73 73 61 67 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 e.if.(typeof.message.!==.'string
5c20 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 ').{.......throw.new.TypeError('
5c40 4d 65 73 73 61 67 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d Message.must.be.a.string').....}
5c60 0a 0a 20 20 20 20 69 66 20 28 6e 61 6d 65 46 69 65 6c 64 4c 61 62 65 6c 20 3d 3d 20 6e 75 6c 6c ......if.(nameFieldLabel.==.null
5c80 29 20 7b 0a 20 20 20 20 20 20 6e 61 6d 65 46 69 65 6c 64 4c 61 62 65 6c 20 3d 20 27 27 0a 20 20 ).{.......nameFieldLabel.=.''...
5ca0 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 6e 61 6d 65 46 69 65 6c 64 4c 61 62 ..}.else.if.(typeof.nameFieldLab
5cc0 65 6c 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e el.!==.'string').{.......throw.n
5ce0 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 4e 61 6d 65 20 66 69 65 6c 64 20 6c 61 62 65 6c 20 6d ew.TypeError('Name.field.label.m
5d00 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 ust.be.a.string').....}......if.
5d20 28 73 68 6f 77 73 54 61 67 46 69 65 6c 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 (showsTagField.==.null).{.......
5d40 73 68 6f 77 73 54 61 67 46 69 65 6c 64 20 3d 20 74 72 75 65 0a 20 20 20 20 7d 0a 0a 20 20 20 20 showsTagField.=.true.....}......
5d60 63 6f 6e 73 74 20 77 72 61 70 70 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 74 79 70 65 6f 66 20 63 const.wrappedCallback.=.typeof.c
5d80 61 6c 6c 62 61 63 6b 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 3f 20 66 75 6e 63 74 69 6f allback.===.'function'.?.functio
5da0 6e 20 28 73 75 63 63 65 73 73 2c 20 72 65 73 75 6c 74 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 n.(success,.result).{.......retu
5dc0 72 6e 20 63 61 6c 6c 62 61 63 6b 28 73 75 63 63 65 73 73 20 3f 20 72 65 73 75 6c 74 20 3a 20 76 rn.callback(success.?.result.:.v
5de0 6f 69 64 20 30 29 0a 20 20 20 20 7d 20 3a 20 6e 75 6c 6c 0a 20 20 20 20 63 6f 6e 73 74 20 73 65 oid.0).....}.:.null.....const.se
5e00 74 74 69 6e 67 73 20 3d 20 7b 74 69 74 6c 65 2c 20 62 75 74 74 6f 6e 4c 61 62 65 6c 2c 20 64 65 ttings.=.{title,.buttonLabel,.de
5e20 66 61 75 6c 74 50 61 74 68 2c 20 66 69 6c 74 65 72 73 2c 20 6d 65 73 73 61 67 65 2c 20 6e 61 6d faultPath,.filters,.message,.nam
5e40 65 46 69 65 6c 64 4c 61 62 65 6c 2c 20 73 68 6f 77 73 54 61 67 46 69 65 6c 64 2c 20 77 69 6e 64 eFieldLabel,.showsTagField,.wind
5e60 6f 77 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 68 6f 77 53 61 76 65 44 ow}.....return.binding.showSaveD
5e80 69 61 6c 6f 67 28 73 65 74 74 69 6e 67 73 2c 20 77 72 61 70 70 65 64 43 61 6c 6c 62 61 63 6b 29 ialog(settings,.wrappedCallback)
5ea0 0a 20 20 7d 2c 0a 0a 20 20 73 68 6f 77 4d 65 73 73 61 67 65 42 6f 78 3a 20 66 75 6e 63 74 69 6f ...},....showMessageBox:.functio
5ec0 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 63 68 65 63 6b 41 70 70 49 6e 69 74 69 61 n.(...args).{.....checkAppInitia
5ee0 6c 69 7a 65 64 28 29 0a 0a 20 20 20 20 6c 65 74 20 5b 77 69 6e 64 6f 77 2c 20 6f 70 74 69 6f 6e lized()......let.[window,.option
5f00 73 2c 20 63 61 6c 6c 62 61 63 6b 5d 20 3d 20 70 61 72 73 65 41 72 67 73 28 2e 2e 2e 61 72 67 73 s,.callback].=.parseArgs(...args
5f20 29 0a 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 )......if.(options.==.null).{...
5f40 20 20 20 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 6e ....options.=.{.........type:.'n
5f60 6f 6e 65 27 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 7b 0a 20 20 one'.......}.....}......let.{...
5f80 20 20 20 20 62 75 74 74 6f 6e 73 2c 20 63 61 6e 63 65 6c 49 64 2c 20 63 68 65 63 6b 62 6f 78 4c ....buttons,.cancelId,.checkboxL
5fa0 61 62 65 6c 2c 20 63 68 65 63 6b 62 6f 78 43 68 65 63 6b 65 64 2c 20 64 65 66 61 75 6c 74 49 64 abel,.checkboxChecked,.defaultId
5fc0 2c 20 64 65 74 61 69 6c 2c 0a 20 20 20 20 20 20 69 63 6f 6e 2c 20 6d 65 73 73 61 67 65 2c 20 74 ,.detail,.......icon,.message,.t
5fe0 69 74 6c 65 2c 20 74 79 70 65 0a 20 20 20 20 7d 20 3d 20 6f 70 74 69 6f 6e 73 0a 0a 20 20 20 20 itle,.type.....}.=.options......
6000 69 66 20 28 74 79 70 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 79 70 65 20 3d if.(type.==.null).{.......type.=
6020 20 27 6e 6f 6e 65 27 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 73 73 61 67 65 .'none'.....}......const.message
6040 42 6f 78 54 79 70 65 20 3d 20 6d 65 73 73 61 67 65 42 6f 78 54 79 70 65 73 2e 69 6e 64 65 78 4f BoxType.=.messageBoxTypes.indexO
6060 66 28 74 79 70 65 29 0a 20 20 20 20 69 66 20 28 6d 65 73 73 61 67 65 42 6f 78 54 79 70 65 20 3d f(type).....if.(messageBoxType.=
6080 3d 3d 20 2d 31 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 ==.-1).{.......throw.new.TypeErr
60a0 6f 72 28 27 49 6e 76 61 6c 69 64 20 6d 65 73 73 61 67 65 20 62 6f 78 20 74 79 70 65 27 29 0a 20 or('Invalid.message.box.type')..
60c0 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 62 75 74 74 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b ...}......if.(buttons.==.null).{
60e0 0a 20 20 20 20 20 20 62 75 74 74 6f 6e 73 20 3d 20 5b 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 .......buttons.=.[].....}.else.i
6100 66 20 28 21 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 62 75 74 74 6f 6e 73 29 29 20 7b 0a 20 20 f.(!Array.isArray(buttons)).{...
6120 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 42 75 74 74 6f 6e 73 ....throw.new.TypeError('Buttons
6140 20 6d 75 73 74 20 62 65 20 61 6e 20 61 72 72 61 79 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 .must.be.an.array').....}......i
6160 66 20 28 6f 70 74 69 6f 6e 73 2e 6e 6f 72 6d 61 6c 69 7a 65 41 63 63 65 73 73 4b 65 79 73 29 20 f.(options.normalizeAccessKeys).
6180 7b 0a 20 20 20 20 20 20 62 75 74 74 6f 6e 73 20 3d 20 62 75 74 74 6f 6e 73 2e 6d 61 70 28 6e 6f {.......buttons.=.buttons.map(no
61a0 72 6d 61 6c 69 7a 65 41 63 63 65 73 73 4b 65 79 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 rmalizeAccessKey).....}......if.
61c0 28 74 69 74 6c 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 69 74 6c 65 20 3d 20 (title.==.null).{.......title.=.
61e0 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 74 69 74 6c 65 20 21 ''.....}.else.if.(typeof.title.!
6200 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 ==.'string').{.......throw.new.T
6220 79 70 65 45 72 72 6f 72 28 27 54 69 74 6c 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 ypeError('Title.must.be.a.string
6240 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 6d 65 73 73 61 67 65 20 3d 3d 20 6e 75 6c ').....}......if.(message.==.nul
6260 6c 29 20 7b 0a 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c l).{.......message.=.''.....}.el
6280 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 6d 65 73 73 61 67 65 20 21 3d 3d 20 27 73 74 72 69 6e se.if.(typeof.message.!==.'strin
62a0 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 g').{.......throw.new.TypeError(
62c0 27 4d 65 73 73 61 67 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 'Message.must.be.a.string').....
62e0 7d 0a 0a 20 20 20 20 69 66 20 28 64 65 74 61 69 6c 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 }......if.(detail.==.null).{....
6300 20 20 20 64 65 74 61 69 6c 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 ...detail.=.''.....}.else.if.(ty
6320 70 65 6f 66 20 64 65 74 61 69 6c 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 peof.detail.!==.'string').{.....
6340 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 44 65 74 61 69 6c 20 6d 75 ..throw.new.TypeError('Detail.mu
6360 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 68 65 63 st.be.a.string').....}......chec
6380 6b 62 6f 78 43 68 65 63 6b 65 64 20 3d 20 21 21 63 68 65 63 6b 62 6f 78 43 68 65 63 6b 65 64 0a kboxChecked.=.!!checkboxChecked.
63a0 0a 20 20 20 20 69 66 20 28 63 68 65 63 6b 62 6f 78 4c 61 62 65 6c 20 3d 3d 20 6e 75 6c 6c 29 20 .....if.(checkboxLabel.==.null).
63c0 7b 0a 20 20 20 20 20 20 63 68 65 63 6b 62 6f 78 4c 61 62 65 6c 20 3d 20 27 27 0a 20 20 20 20 7d {.......checkboxLabel.=.''.....}
63e0 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 63 68 65 63 6b 62 6f 78 4c 61 62 65 6c 20 21 .else.if.(typeof.checkboxLabel.!
6400 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 ==.'string').{.......throw.new.T
6420 79 70 65 45 72 72 6f 72 28 27 63 68 65 63 6b 62 6f 78 4c 61 62 65 6c 20 6d 75 73 74 20 62 65 20 ypeError('checkboxLabel.must.be.
6440 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 69 63 6f 6e 20 3d a.string').....}......if.(icon.=
6460 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 69 63 6f 6e 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 =.null).{.......icon.=.null.....
6480 7d 0a 0a 20 20 20 20 69 66 20 28 64 65 66 61 75 6c 74 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a }......if.(defaultId.==.null).{.
64a0 20 20 20 20 20 20 64 65 66 61 75 6c 74 49 64 20 3d 20 2d 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20 ......defaultId.=.-1.....}......
64c0 2f 2f 20 43 68 6f 6f 73 65 20 61 20 64 65 66 61 75 6c 74 20 62 75 74 74 6f 6e 20 74 6f 20 67 65 //.Choose.a.default.button.to.ge
64e0 74 20 73 65 6c 65 63 74 65 64 20 77 68 65 6e 20 64 69 61 6c 6f 67 20 69 73 20 63 61 6e 63 65 6c t.selected.when.dialog.is.cancel
6500 6c 65 64 2e 0a 20 20 20 20 69 66 20 28 63 61 6e 63 65 6c 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b led......if.(cancelId.==.null).{
6520 0a 20 20 20 20 20 20 63 61 6e 63 65 6c 49 64 20 3d 20 30 0a 20 20 20 20 20 20 66 6f 72 20 28 6c .......cancelId.=.0.......for.(l
6540 65 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 62 75 74 74 6f 6e 73 2e 6c 65 6e 67 74 68 3b 20 69 2b et.i.=.0;.i.<.buttons.length;.i+
6560 2b 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 74 65 78 74 20 3d 20 62 75 74 74 6f 6e +).{.........const.text.=.button
6580 73 5b 69 5d 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 s[i].toLowerCase().........if.(t
65a0 65 78 74 20 3d 3d 3d 20 27 63 61 6e 63 65 6c 27 20 7c 7c 20 74 65 78 74 20 3d 3d 3d 20 27 6e 6f ext.===.'cancel'.||.text.===.'no
65c0 27 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 63 61 6e 63 65 6c 49 64 20 3d 20 69 0a 20 20 20 20 ').{...........cancelId.=.i.....
65e0 20 20 20 20 20 20 62 72 65 61 6b 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 ......break.........}.......}...
6600 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 66 6c 61 67 73 20 3d 20 6f 70 74 69 6f 6e 73 2e 6e ..}......const.flags.=.options.n
6620 6f 4c 69 6e 6b 20 3f 20 6d 65 73 73 61 67 65 42 6f 78 4f 70 74 69 6f 6e 73 2e 6e 6f 4c 69 6e 6b oLink.?.messageBoxOptions.noLink
6640 20 3a 20 30 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 68 6f 77 4d 65 73 73 .:.0.....return.binding.showMess
6660 61 67 65 42 6f 78 28 6d 65 73 73 61 67 65 42 6f 78 54 79 70 65 2c 20 62 75 74 74 6f 6e 73 2c 20 ageBox(messageBoxType,.buttons,.
6680 64 65 66 61 75 6c 74 49 64 2c 20 63 61 6e 63 65 6c 49 64 2c 0a 20 20 20 20 20 20 20 20 20 20 20 defaultId,.cancelId,............
66a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6c 61 67 73 2c 20 74 69 .......................flags,.ti
66c0 74 6c 65 2c 20 6d 65 73 73 61 67 65 2c 20 64 65 74 61 69 6c 2c 20 63 68 65 63 6b 62 6f 78 4c 61 tle,.message,.detail,.checkboxLa
66e0 62 65 6c 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 bel,............................
6700 20 20 20 20 20 20 20 63 68 65 63 6b 62 6f 78 43 68 65 63 6b 65 64 2c 20 69 63 6f 6e 2c 20 77 69 .......checkboxChecked,.icon,.wi
6720 6e 64 6f 77 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 2c 0a 0a 20 20 73 68 6f 77 45 72 72 6f ndow,.callback)...},....showErro
6740 72 42 6f 78 3a 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 rBox:.function.(...args).{.....r
6760 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 68 6f 77 45 72 72 6f 72 42 6f 78 28 2e 2e 2e 61 72 eturn.binding.showErrorBox(...ar
6780 67 73 29 0a 20 20 7d 2c 0a 0a 20 20 73 68 6f 77 43 65 72 74 69 66 69 63 61 74 65 54 72 75 73 74 gs)...},....showCertificateTrust
67a0 44 69 61 6c 6f 67 3a 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 Dialog:.function.(...args).{....
67c0 20 6c 65 74 20 5b 77 69 6e 64 6f 77 2c 20 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 5d .let.[window,.options,.callback]
67e0 20 3d 20 70 61 72 73 65 41 72 67 73 28 2e 2e 2e 61 72 67 73 29 0a 0a 20 20 20 20 69 66 20 28 6f .=.parseArgs(...args)......if.(o
6800 70 74 69 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 74 79 70 65 6f 66 20 6f 70 74 69 6f 6e 73 ptions.==.null.||.typeof.options
6820 20 21 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 .!==.'object').{.......throw.new
6840 20 54 79 70 65 45 72 72 6f 72 28 27 6f 70 74 69 6f 6e 73 20 6d 75 73 74 20 62 65 20 61 6e 20 6f .TypeError('options.must.be.an.o
6860 62 6a 65 63 74 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 7b 63 65 72 74 69 66 69 63 bject').....}......let.{certific
6880 61 74 65 2c 20 6d 65 73 73 61 67 65 7d 20 3d 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 69 66 20 28 ate,.message}.=.options.....if.(
68a0 63 65 72 74 69 66 69 63 61 74 65 20 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 74 79 70 65 6f 66 20 63 65 certificate.==.null.||.typeof.ce
68c0 72 74 69 66 69 63 61 74 65 20 21 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 20 20 rtificate.!==.'object').{.......
68e0 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 63 65 72 74 69 66 69 63 61 74 65 throw.new.TypeError('certificate
6900 20 6d 75 73 74 20 62 65 20 61 6e 20 6f 62 6a 65 63 74 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 .must.be.an.object').....}......
6920 69 66 20 28 6d 65 73 73 61 67 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6d 65 73 if.(message.==.null).{.......mes
6940 73 61 67 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 sage.=.''.....}.else.if.(typeof.
6960 6d 65 73 73 61 67 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 message.!==.'string').{.......th
6980 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 6d 65 73 73 61 67 65 20 6d 75 73 74 20 row.new.TypeError('message.must.
69a0 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 be.a.string').....}......return.
69c0 62 69 6e 64 69 6e 67 2e 73 68 6f 77 43 65 72 74 69 66 69 63 61 74 65 54 72 75 73 74 44 69 61 6c binding.showCertificateTrustDial
69e0 6f 67 28 77 69 6e 64 6f 77 2c 20 63 65 72 74 69 66 69 63 61 74 65 2c 20 6d 65 73 73 61 67 65 2c og(window,.certificate,.message,
6a00 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4d 61 72 6b 20 73 74 61 6e 64 61 .callback)...}.}..//.Mark.standa
6a20 72 64 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 20 66 75 6e 63 74 69 6f 6e 73 2e 0a 76 38 55 74 69 rd.asynchronous.functions..v8Uti
6a40 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 2e l.setHiddenValue(module.exports.
6a60 73 68 6f 77 4d 65 73 73 61 67 65 42 6f 78 2c 20 27 61 73 79 6e 63 68 72 6f 6e 6f 75 73 27 2c 20 showMessageBox,.'asynchronous',.
6a80 74 72 75 65 29 0a 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 6d 6f 64 75 true).v8Util.setHiddenValue(modu
6aa0 6c 65 2e 65 78 70 6f 72 74 73 2e 73 68 6f 77 4f 70 65 6e 44 69 61 6c 6f 67 2c 20 27 61 73 79 6e le.exports.showOpenDialog,.'asyn
6ac0 63 68 72 6f 6e 6f 75 73 27 2c 20 74 72 75 65 29 0a 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 chronous',.true).v8Util.setHidde
6ae0 6e 56 61 6c 75 65 28 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 2e 73 68 6f 77 53 61 76 65 44 69 nValue(module.exports.showSaveDi
6b00 61 6c 6f 67 2c 20 27 61 73 79 6e 63 68 72 6f 6e 6f 75 73 27 2c 20 74 72 75 65 29 0a 63 6f 6e 73 alog,.'asynchronous',.true).cons
6b20 74 20 63 6f 6d 6d 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2e 2f 2e 2e 2f 2e 2e 2f 63 6f 6d t.common.=.require('../../../com
6b40 6d 6f 6e 2f 61 70 69 2f 65 78 70 6f 72 74 73 2f 65 6c 65 63 74 72 6f 6e 27 29 0a 2f 2f 20 73 69 mon/api/exports/electron').//.si
6b60 6e 63 65 20 62 72 6f 77 73 65 72 20 6d 6f 64 75 6c 65 20 6c 69 73 74 20 69 73 20 61 6c 73 6f 20 nce.browser.module.list.is.also.
6b80 75 73 65 64 20 69 6e 20 72 65 6e 64 65 72 65 72 2c 20 6b 65 65 70 20 69 74 20 73 65 70 61 72 61 used.in.renderer,.keep.it.separa
6ba0 74 65 2e 0a 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 4c 69 73 74 20 3d 20 72 65 71 75 69 72 65 28 27 te..const.moduleList.=.require('
6bc0 2e 2e 2f 6d 6f 64 75 6c 65 2d 6c 69 73 74 27 29 0a 0a 2f 2f 20 49 6d 70 6f 72 74 20 63 6f 6d 6d ../module-list')..//.Import.comm
6be0 6f 6e 20 6d 6f 64 75 6c 65 73 2e 0a 63 6f 6d 6d 6f 6e 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 on.modules..common.definePropert
6c00 69 65 73 28 65 78 70 6f 72 74 73 29 0a 0a 66 6f 72 20 28 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 20 ies(exports)..for.(const.module.
6c20 6f 66 20 6d 6f 64 75 6c 65 4c 69 73 74 29 20 7b 0a 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 of.moduleList).{...Object.define
6c40 50 72 6f 70 65 72 74 79 28 65 78 70 6f 72 74 73 2c 20 6d 6f 64 75 6c 65 2e 6e 61 6d 65 2c 20 7b Property(exports,.module.name,.{
6c60 0a 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 21 6d 6f 64 75 6c 65 2e 70 72 69 76 61 74 65 .....enumerable:.!module.private
6c80 2c 0a 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 72 65 71 75 69 72 65 28 60 2e 2e 2f 24 7b 6d ,.....get:.().=>.require(`../${m
6ca0 6f 64 75 6c 65 2e 66 69 6c 65 7d 60 29 0a 20 20 7d 29 0a 7d 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f odule.file}`)...}).}.module.expo
6cc0 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 67 6c 6f 62 61 rts.=.process.atomBinding('globa
6ce0 6c 5f 73 68 6f 72 74 63 75 74 27 29 2e 67 6c 6f 62 61 6c 53 68 6f 72 74 63 75 74 0a 63 6f 6e 73 l_shortcut').globalShortcut.cons
6d00 74 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 t.EventEmitter.=.require('events
6d20 27 29 2e 45 76 65 6e 74 45 6d 69 74 74 65 72 0a 0a 63 6f 6e 73 74 20 65 6d 69 74 74 65 72 20 3d ').EventEmitter..const.emitter.=
6d40 20 6e 65 77 20 45 76 65 6e 74 45 6d 69 74 74 65 72 28 29 0a 0a 63 6f 6e 73 74 20 72 65 6d 6f 76 .new.EventEmitter()..const.remov
6d60 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 20 3d 20 65 6d 69 74 74 65 72 2e 72 65 6d 6f 76 65 41 6c eAllListeners.=.emitter.removeAl
6d80 6c 4c 69 73 74 65 6e 65 72 73 2e 62 69 6e 64 28 65 6d 69 74 74 65 72 29 0a 65 6d 69 74 74 65 72 lListeners.bind(emitter).emitter
6da0 2e 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 .removeAllListeners.=.function.(
6dc0 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d ...args).{...if.(args.length.===
6de0 20 30 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 52 65 6d 6f 76 .0).{.....throw.new.Error('Remov
6e00 69 6e 67 20 61 6c 6c 20 6c 69 73 74 65 6e 65 72 73 20 66 72 6f 6d 20 69 70 63 4d 61 69 6e 20 77 ing.all.listeners.from.ipcMain.w
6e20 69 6c 6c 20 6d 61 6b 65 20 45 6c 65 63 74 72 6f 6e 20 69 6e 74 65 72 6e 61 6c 73 20 73 74 6f 70 ill.make.Electron.internals.stop
6e40 20 77 6f 72 6b 69 6e 67 2e 20 20 50 6c 65 61 73 65 20 73 70 65 63 69 66 79 20 61 20 65 76 65 6e .working...Please.specify.a.even
6e60 74 20 6e 61 6d 65 27 29 0a 20 20 7d 0a 20 20 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 65 6e 65 72 t.name')...}...removeAllListener
6e80 73 28 2e 2e 2e 61 72 67 73 29 0a 7d 0a 0a 2f 2f 20 44 6f 20 6e 6f 74 20 74 68 72 6f 77 20 65 78 s(...args).}..//.Do.not.throw.ex
6ea0 63 65 70 74 69 6f 6e 20 77 68 65 6e 20 63 68 61 6e 6e 65 6c 20 6e 61 6d 65 20 69 73 20 22 65 72 ception.when.channel.name.is."er
6ec0 72 6f 72 22 2e 0a 65 6d 69 74 74 65 72 2e 6f 6e 28 27 65 72 72 6f 72 27 2c 20 28 29 20 3d 3e 20 ror"..emitter.on('error',.().=>.
6ee0 7b 7d 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 65 6d 69 74 74 65 72 0a 63 6f {})..module.exports.=.emitter.co
6f00 6e 73 74 20 7b 61 70 70 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a nst.{app}.=.require('electron').
6f20 0a 63 6f 6e 73 74 20 72 6f 6c 65 73 20 3d 20 7b 0a 20 20 61 62 6f 75 74 3a 20 7b 0a 20 20 20 20 .const.roles.=.{...about:.{.....
6f40 67 65 74 20 6c 61 62 65 6c 20 28 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 70 72 6f 63 get.label.().{.......return.proc
6f60 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 6c 69 6e 75 78 27 20 3f 20 27 41 62 6f 75 ess.platform.===.'linux'.?.'Abou
6f80 74 27 20 3a 20 60 41 62 6f 75 74 20 24 7b 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 7d 60 0a 20 20 t'.:.`About.${app.getName()}`...
6fa0 20 20 7d 0a 20 20 7d 2c 0a 20 20 63 6c 6f 73 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 70 ..}...},...close:.{.....label:.p
6fc0 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 27 rocess.platform.===.'darwin'.?.'
6fe0 43 6c 6f 73 65 20 57 69 6e 64 6f 77 27 20 3a 20 27 43 6c 6f 73 65 27 2c 0a 20 20 20 20 61 63 63 Close.Window'.:.'Close',.....acc
7000 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 57 27 2c 0a elerator:.'CommandOrControl+W',.
7020 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 6f 64 3a 20 27 63 6c 6f 73 65 27 0a 20 20 7d 2c 0a 20 ....windowMethod:.'close'...},..
7040 20 63 6f 70 79 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 43 6f 70 79 27 2c 0a 20 20 20 20 .copy:.{.....label:.'Copy',.....
7060 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 43 accelerator:.'CommandOrControl+C
7080 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 63 6f 70 79 27 ',.....webContentsMethod:.'copy'
70a0 0a 20 20 7d 2c 0a 20 20 63 75 74 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 43 75 74 27 2c ...},...cut:.{.....label:.'Cut',
70c0 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 .....accelerator:.'CommandOrCont
70e0 72 6f 6c 2b 58 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 rol+X',.....webContentsMethod:.'
7100 63 75 74 27 0a 20 20 7d 2c 0a 20 20 64 65 6c 65 74 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a cut'...},...delete:.{.....label:
7120 20 27 44 65 6c 65 74 65 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 .'Delete',.....webContentsMethod
7140 3a 20 27 64 65 6c 65 74 65 27 0a 20 20 7d 2c 0a 20 20 66 6f 72 63 65 72 65 6c 6f 61 64 3a 20 7b :.'delete'...},...forcereload:.{
7160 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 46 6f 72 63 65 20 52 65 6c 6f 61 64 27 2c 0a 20 20 20 20 .....label:.'Force.Reload',.....
7180 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 53 68 69 66 74 2b 43 6d 64 4f 72 43 74 72 6c 2b 52 27 accelerator:.'Shift+CmdOrCtrl+R'
71a0 2c 0a 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 4d 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a ,.....nonNativeMacOSRole:.true,.
71c0 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 6f 64 3a 20 28 77 69 6e 64 6f 77 29 20 3d 3e 20 7b 0a ....windowMethod:.(window).=>.{.
71e0 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 72 65 6c 6f 61 64 49 ......window.webContents.reloadI
7200 67 6e 6f 72 69 6e 67 43 61 63 68 65 28 29 0a 20 20 20 20 7d 0a 20 20 7d 2c 0a 20 20 66 72 6f 6e gnoringCache().....}...},...fron
7220 74 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 42 72 69 6e 67 20 41 6c 6c 20 74 6f 20 46 72 t:.{.....label:.'Bring.All.to.Fr
7240 6f 6e 74 27 0a 20 20 7d 2c 0a 20 20 68 65 6c 70 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 ont'...},...help:.{.....label:.'
7260 48 65 6c 70 27 0a 20 20 7d 2c 0a 20 20 68 69 64 65 3a 20 7b 0a 20 20 20 20 67 65 74 20 6c 61 62 Help'...},...hide:.{.....get.lab
7280 65 6c 20 28 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 60 48 69 64 65 20 24 7b 61 70 70 el.().{.......return.`Hide.${app
72a0 2e 67 65 74 4e 61 6d 65 28 29 7d 60 0a 20 20 20 20 7d 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 .getName()}`.....},.....accelera
72c0 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 2b 48 27 0a 20 20 7d 2c 0a 20 20 68 69 64 65 6f 74 68 65 tor:.'Command+H'...},...hideothe
72e0 72 73 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 48 69 64 65 20 4f 74 68 65 72 73 27 2c 0a rs:.{.....label:.'Hide.Others',.
7300 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 2b 41 6c 74 2b 48 27 ....accelerator:.'Command+Alt+H'
7320 0a 20 20 7d 2c 0a 20 20 6d 69 6e 69 6d 69 7a 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 ...},...minimize:.{.....label:.'
7340 4d 69 6e 69 6d 69 7a 65 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d Minimize',.....accelerator:.'Com
7360 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 4d 27 2c 0a 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 mandOrControl+M',.....windowMeth
7380 6f 64 3a 20 27 6d 69 6e 69 6d 69 7a 65 27 0a 20 20 7d 2c 0a 20 20 70 61 73 74 65 3a 20 7b 0a 20 od:.'minimize'...},...paste:.{..
73a0 20 20 20 6c 61 62 65 6c 3a 20 27 50 61 73 74 65 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 ...label:.'Paste',.....accelerat
73c0 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 56 27 2c 0a 20 20 20 20 77 65 or:.'CommandOrControl+V',.....we
73e0 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 70 61 73 74 65 27 0a 20 20 7d 2c 0a 20 20 bContentsMethod:.'paste'...},...
7400 70 61 73 74 65 61 6e 64 6d 61 74 63 68 73 74 79 6c 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a pasteandmatchstyle:.{.....label:
7420 20 27 50 61 73 74 65 20 61 6e 64 20 4d 61 74 63 68 20 53 74 79 6c 65 27 2c 0a 20 20 20 20 61 63 .'Paste.and.Match.Style',.....ac
7440 63 65 6c 65 72 61 74 6f 72 3a 20 27 53 68 69 66 74 2b 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 celerator:.'Shift+CommandOrContr
7460 6f 6c 2b 56 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 70 ol+V',.....webContentsMethod:.'p
7480 61 73 74 65 41 6e 64 4d 61 74 63 68 53 74 79 6c 65 27 0a 20 20 7d 2c 0a 20 20 71 75 69 74 3a 20 asteAndMatchStyle'...},...quit:.
74a0 7b 0a 20 20 20 20 67 65 74 20 6c 61 62 65 6c 20 28 29 20 7b 0a 20 20 20 20 20 20 73 77 69 74 63 {.....get.label.().{.......switc
74c0 68 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 29 20 7b 0a 20 20 20 20 20 20 20 20 63 h.(process.platform).{.........c
74e0 61 73 65 20 27 64 61 72 77 69 6e 27 3a 20 72 65 74 75 72 6e 20 60 51 75 69 74 20 24 7b 61 70 70 ase.'darwin':.return.`Quit.${app
7500 2e 67 65 74 4e 61 6d 65 28 29 7d 60 0a 20 20 20 20 20 20 20 20 63 61 73 65 20 27 77 69 6e 33 32 .getName()}`.........case.'win32
7520 27 3a 20 72 65 74 75 72 6e 20 27 45 78 69 74 27 0a 20 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 ':.return.'Exit'.........default
7540 3a 20 72 65 74 75 72 6e 20 27 51 75 69 74 27 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 2c 0a 20 :.return.'Quit'.......}.....},..
7560 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d ...accelerator:.process.platform
7580 20 3d 3d 3d 20 27 77 69 6e 33 32 27 20 3f 20 6e 75 6c 6c 20 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 .===.'win32'.?.null.:.'CommandOr
75a0 43 6f 6e 74 72 6f 6c 2b 51 27 2c 0a 20 20 20 20 61 70 70 4d 65 74 68 6f 64 3a 20 27 71 75 69 74 Control+Q',.....appMethod:.'quit
75c0 27 0a 20 20 7d 2c 0a 20 20 72 65 64 6f 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 52 65 64 '...},...redo:.{.....label:.'Red
75e0 6f 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 70 72 6f 63 65 73 73 2e 70 6c 61 o',.....accelerator:.process.pla
7600 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 20 3f 20 27 43 6f 6e 74 72 6f 6c 2b 59 27 20 tform.===.'win32'.?.'Control+Y'.
7620 3a 20 27 53 68 69 66 74 2b 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 5a 27 2c 0a 20 20 :.'Shift+CommandOrControl+Z',...
7640 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 72 65 64 6f 27 0a 20 20 7d 2c ..webContentsMethod:.'redo'...},
7660 0a 20 20 72 65 6c 6f 61 64 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 52 65 6c 6f 61 64 27 ...reload:.{.....label:.'Reload'
7680 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6d 64 4f 72 43 74 72 6c 2b 52 27 ,.....accelerator:.'CmdOrCtrl+R'
76a0 2c 0a 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 4d 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a ,.....nonNativeMacOSRole:.true,.
76c0 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 6f 64 3a 20 27 72 65 6c 6f 61 64 27 0a 20 20 7d 2c 0a ....windowMethod:.'reload'...},.
76e0 20 20 72 65 73 65 74 7a 6f 6f 6d 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 41 63 74 75 61 ..resetzoom:.{.....label:.'Actua
7700 6c 20 53 69 7a 65 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 l.Size',.....accelerator:.'Comma
7720 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 30 27 2c 0a 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 4d 61 63 ndOrControl+0',.....nonNativeMac
7740 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 OSRole:.true,.....webContentsMet
7760 68 6f 64 3a 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 65 hod:.(webContents).=>.{.......we
7780 62 43 6f 6e 74 65 6e 74 73 2e 73 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 30 29 0a 20 20 20 20 7d 0a bContents.setZoomLevel(0).....}.
77a0 20 20 7d 2c 0a 20 20 73 65 6c 65 63 74 61 6c 6c 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 ..},...selectall:.{.....label:.'
77c0 53 65 6c 65 63 74 20 41 6c 6c 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 Select.All',.....accelerator:.'C
77e0 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 41 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 ommandOrControl+A',.....webConte
7800 6e 74 73 4d 65 74 68 6f 64 3a 20 27 73 65 6c 65 63 74 41 6c 6c 27 0a 20 20 7d 2c 0a 20 20 73 65 ntsMethod:.'selectAll'...},...se
7820 72 76 69 63 65 73 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 53 65 72 76 69 63 65 73 27 0a rvices:.{.....label:.'Services'.
7840 20 20 7d 2c 0a 20 20 73 74 61 72 74 73 70 65 61 6b 69 6e 67 3a 20 7b 0a 20 20 20 20 6c 61 62 65 ..},...startspeaking:.{.....labe
7860 6c 3a 20 27 53 74 61 72 74 20 53 70 65 61 6b 69 6e 67 27 0a 20 20 7d 2c 0a 20 20 73 74 6f 70 73 l:.'Start.Speaking'...},...stops
7880 70 65 61 6b 69 6e 67 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 53 74 6f 70 20 53 70 65 61 peaking:.{.....label:.'Stop.Spea
78a0 6b 69 6e 67 27 0a 20 20 7d 2c 0a 20 20 74 6f 67 67 6c 65 64 65 76 74 6f 6f 6c 73 3a 20 7b 0a 20 king'...},...toggledevtools:.{..
78c0 20 20 20 6c 61 62 65 6c 3a 20 27 54 6f 67 67 6c 65 20 44 65 76 65 6c 6f 70 65 72 20 54 6f 6f 6c ...label:.'Toggle.Developer.Tool
78e0 73 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 70 72 6f 63 65 73 73 2e 70 6c 61 s',.....accelerator:.process.pla
7900 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 27 41 6c 74 2b 43 6f 6d 6d 61 6e tform.===.'darwin'.?.'Alt+Comman
7920 64 2b 49 27 20 3a 20 27 43 74 72 6c 2b 53 68 69 66 74 2b 49 27 2c 0a 20 20 20 20 6e 6f 6e 4e 61 d+I'.:.'Ctrl+Shift+I',.....nonNa
7940 74 69 76 65 4d 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 77 69 6e 64 6f 77 4d tiveMacOSRole:.true,.....windowM
7960 65 74 68 6f 64 3a 20 27 74 6f 67 67 6c 65 44 65 76 54 6f 6f 6c 73 27 0a 20 20 7d 2c 0a 20 20 74 ethod:.'toggleDevTools'...},...t
7980 6f 67 67 6c 65 66 75 6c 6c 73 63 72 65 65 6e 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 54 ogglefullscreen:.{.....label:.'T
79a0 6f 67 67 6c 65 20 46 75 6c 6c 20 53 63 72 65 65 6e 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 oggle.Full.Screen',.....accelera
79c0 74 6f 72 3a 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 tor:.process.platform.===.'darwi
79e0 6e 27 20 3f 20 27 43 6f 6e 74 72 6f 6c 2b 43 6f 6d 6d 61 6e 64 2b 46 27 20 3a 20 27 46 31 31 27 n'.?.'Control+Command+F'.:.'F11'
7a00 2c 0a 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 6f 64 3a 20 28 77 69 6e 64 6f 77 29 20 3d 3e 20 ,.....windowMethod:.(window).=>.
7a20 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 73 65 74 46 75 6c 6c 53 63 72 65 65 6e 28 21 77 69 {.......window.setFullScreen(!wi
7a40 6e 64 6f 77 2e 69 73 46 75 6c 6c 53 63 72 65 65 6e 28 29 29 0a 20 20 20 20 7d 0a 20 20 7d 2c 0a ndow.isFullScreen()).....}...},.
7a60 20 20 75 6e 64 6f 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 55 6e 64 6f 27 2c 0a 20 20 20 ..undo:.{.....label:.'Undo',....
7a80 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b .accelerator:.'CommandOrControl+
7aa0 5a 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 75 6e 64 6f Z',.....webContentsMethod:.'undo
7ac0 27 0a 20 20 7d 2c 0a 20 20 75 6e 68 69 64 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 53 '...},...unhide:.{.....label:.'S
7ae0 68 6f 77 20 41 6c 6c 27 0a 20 20 7d 2c 0a 20 20 77 69 6e 64 6f 77 3a 20 7b 0a 20 20 20 20 6c 61 how.All'...},...window:.{.....la
7b00 62 65 6c 3a 20 27 57 69 6e 64 6f 77 27 0a 20 20 7d 2c 0a 20 20 7a 6f 6f 6d 3a 20 7b 0a 20 20 20 bel:.'Window'...},...zoom:.{....
7b20 20 6c 61 62 65 6c 3a 20 27 5a 6f 6f 6d 27 0a 20 20 7d 2c 0a 20 20 7a 6f 6f 6d 69 6e 3a 20 7b 0a .label:.'Zoom'...},...zoomin:.{.
7b40 20 20 20 20 6c 61 62 65 6c 3a 20 27 5a 6f 6f 6d 20 49 6e 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 ....label:.'Zoom.In',.....accele
7b60 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 50 6c 75 73 27 2c 0a rator:.'CommandOrControl+Plus',.
7b80 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 4d 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a 20 20 ....nonNativeMacOSRole:.true,...
7ba0 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 28 77 65 62 43 6f 6e 74 65 6e 74 ..webContentsMethod:.(webContent
7bc0 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 67 65 74 5a 6f 6f s).=>.{.......webContents.getZoo
7be0 6d 4c 65 76 65 6c 28 28 7a 6f 6f 6d 4c 65 76 65 6c 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 mLevel((zoomLevel).=>.{.........
7c00 77 65 62 43 6f 6e 74 65 6e 74 73 2e 73 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 7a 6f 6f 6d 4c 65 76 webContents.setZoomLevel(zoomLev
7c20 65 6c 20 2b 20 30 2e 35 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 2c 0a 20 20 el.+.0.5).......}).....}...},...
7c40 7a 6f 6f 6d 6f 75 74 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 5a 6f 6f 6d 20 4f 75 74 27 zoomout:.{.....label:.'Zoom.Out'
7c60 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e ,.....accelerator:.'CommandOrCon
7c80 74 72 6f 6c 2b 2d 27 2c 0a 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 4d 61 63 4f 53 52 6f 6c 65 3a trol+-',.....nonNativeMacOSRole:
7ca0 20 74 72 75 65 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 28 77 .true,.....webContentsMethod:.(w
7cc0 65 62 43 6f 6e 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 65 62 43 6f 6e 74 65 6e ebContents).=>.{.......webConten
7ce0 74 73 2e 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 28 7a 6f 6f 6d 4c 65 76 65 6c 29 20 3d 3e 20 7b ts.getZoomLevel((zoomLevel).=>.{
7d00 0a 20 20 20 20 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 73 65 74 5a 6f 6f 6d 4c 65 76 65 .........webContents.setZoomLeve
7d20 6c 28 7a 6f 6f 6d 4c 65 76 65 6c 20 2d 20 30 2e 35 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 l(zoomLevel.-.0.5).......}).....
7d40 7d 0a 20 20 7d 2c 0a 20 20 2f 2f 20 45 64 69 74 20 73 75 62 6d 65 6e 75 20 28 73 68 6f 75 6c 64 }...},...//.Edit.submenu.(should
7d60 20 66 69 74 20 62 6f 74 68 20 4d 61 63 20 26 20 57 69 6e 64 6f 77 73 29 0a 20 20 65 64 69 74 4d .fit.both.Mac.&.Windows)...editM
7d80 65 6e 75 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 45 64 69 74 27 2c 0a 20 20 20 20 73 75 enu:.{.....label:.'Edit',.....su
7da0 62 6d 65 6e 75 3a 20 5b 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 bmenu:.[.......{.........role:.'
7dc0 75 6e 64 6f 27 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 undo'.......},.......{.........r
7de0 6f 6c 65 3a 20 27 72 65 64 6f 27 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 7b 0a 20 20 20 ole:.'redo'.......},.......{....
7e00 20 20 20 20 20 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 20 20 20 20 7d 2c 0a .....type:.'separator'.......},.
7e20 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 63 75 74 27 0a 20 20 20 20 ......{.........role:.'cut'.....
7e40 20 20 7d 2c 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 63 6f 70 79 ..},.......{.........role:.'copy
7e60 27 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a '.......},.......{.........role:
7e80 20 27 70 61 73 74 65 27 0a 20 20 20 20 20 20 7d 2c 0a 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 .'paste'.......},........process
7ea0 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 7b 0a 20 20 20 20 20 .platform.===.'darwin'.?.{......
7ec0 20 20 20 72 6f 6c 65 3a 20 27 70 61 73 74 65 61 6e 64 6d 61 74 63 68 73 74 79 6c 65 27 0a 20 20 ...role:.'pasteandmatchstyle'...
7ee0 20 20 20 20 7d 20 3a 20 6e 75 6c 6c 2c 0a 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 ....}.:.null,........{.........r
7f00 6f 6c 65 3a 20 27 64 65 6c 65 74 65 27 0a 20 20 20 20 20 20 7d 2c 0a 0a 20 20 20 20 20 20 70 72 ole:.'delete'.......},........pr
7f20 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 20 3f 20 7b 0a 20 ocess.platform.===.'win32'.?.{..
7f40 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 20 20 20 20 7d .......type:.'separator'.......}
7f60 20 3a 20 6e 75 6c 6c 2c 0a 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 .:.null,........{.........role:.
7f80 27 73 65 6c 65 63 74 61 6c 6c 27 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 5d 0a 20 20 7d 2c 0a 0a 'selectall'.......}.....]...},..
7fa0 20 20 2f 2f 20 57 69 6e 64 6f 77 20 73 75 62 6d 65 6e 75 20 73 68 6f 75 6c 64 20 62 65 20 75 73 ..//.Window.submenu.should.be.us
7fc0 65 64 20 66 6f 72 20 4d 61 63 20 6f 6e 6c 79 0a 20 20 77 69 6e 64 6f 77 4d 65 6e 75 3a 20 7b 0a ed.for.Mac.only...windowMenu:.{.
7fe0 20 20 20 20 6c 61 62 65 6c 3a 20 27 57 69 6e 64 6f 77 27 2c 0a 20 20 20 20 73 75 62 6d 65 6e 75 ....label:.'Window',.....submenu
8000 3a 20 5b 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 6d 69 6e 69 6d :.[.......{.........role:.'minim
8020 69 7a 65 27 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f ize'.......},.......{.........ro
8040 6c 65 3a 20 27 63 6c 6f 73 65 27 0a 20 20 20 20 20 20 7d 2c 0a 0a 20 20 20 20 20 20 70 72 6f 63 le:.'close'.......},........proc
8060 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 7b 0a 20 20 ess.platform.===.'darwin'.?.{...
8080 20 20 20 20 20 20 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 20 20 20 20 7d 20 ......type:.'separator'.......}.
80a0 3a 20 6e 75 6c 6c 2c 0a 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 :.null,........process.platform.
80c0 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 ===.'darwin'.?.{.........role:.'
80e0 66 72 6f 6e 74 27 0a 20 20 20 20 20 20 7d 20 3a 20 6e 75 6c 6c 0a 0a 20 20 20 20 5d 0a 20 20 7d front'.......}.:.null......]...}
8100 0a 7d 0a 0a 63 6f 6e 73 74 20 63 61 6e 45 78 65 63 75 74 65 52 6f 6c 65 20 3d 20 28 72 6f 6c 65 .}..const.canExecuteRole.=.(role
8120 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 21 72 6f 6c 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 ).=>.{...if.(!roles.hasOwnProper
8140 74 79 28 72 6f 6c 65 29 29 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0a 20 20 69 66 20 28 70 72 6f ty(role)).return.false...if.(pro
8160 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 21 3d 3d 20 27 64 61 72 77 69 6e 27 29 20 72 65 74 75 cess.platform.!==.'darwin').retu
8180 72 6e 20 74 72 75 65 0a 20 20 2f 2f 20 6d 61 63 4f 53 20 68 61 6e 64 6c 65 73 20 61 6c 6c 20 72 rn.true...//.macOS.handles.all.r
81a0 6f 6c 65 73 20 6e 61 74 69 76 65 6c 79 20 65 78 63 65 70 74 20 66 6f 72 20 61 20 66 65 77 0a 20 oles.natively.except.for.a.few..
81c0 20 72 65 74 75 72 6e 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 2e 6e 6f 6e 4e 61 74 69 76 65 4d 61 63 .return.roles[role].nonNativeMac
81e0 4f 53 52 6f 6c 65 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 67 65 74 44 65 66 61 75 6c 74 4c 61 62 65 OSRole.}..exports.getDefaultLabe
8200 6c 20 3d 20 28 72 6f 6c 65 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 72 6f 6c 65 73 2e 68 61 73 4f l.=.(role).=>.{...if.(roles.hasO
8220 77 6e 50 72 6f 70 65 72 74 79 28 72 6f 6c 65 29 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 72 wnProperty(role)).{.....return.r
8240 6f 6c 65 73 5b 72 6f 6c 65 5d 2e 6c 61 62 65 6c 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 oles[role].label...}.else.{.....
8260 72 65 74 75 72 6e 20 27 27 0a 20 20 7d 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 67 65 74 44 65 66 61 return.''...}.}..exports.getDefa
8280 75 6c 74 41 63 63 65 6c 65 72 61 74 6f 72 20 3d 20 28 72 6f 6c 65 29 20 3d 3e 20 7b 0a 20 20 69 ultAccelerator.=.(role).=>.{...i
82a0 66 20 28 72 6f 6c 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 72 6f 6c 65 29 29 20 72 f.(roles.hasOwnProperty(role)).r
82c0 65 74 75 72 6e 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 2e 61 63 63 65 6c 65 72 61 74 6f 72 0a 7d 0a eturn.roles[role].accelerator.}.
82e0 0a 65 78 70 6f 72 74 73 2e 67 65 74 44 65 66 61 75 6c 74 53 75 62 6d 65 6e 75 20 3d 20 28 72 6f .exports.getDefaultSubmenu.=.(ro
8300 6c 65 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 21 72 6f 6c 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 le).=>.{...if.(!roles.hasOwnProp
8320 65 72 74 79 28 72 6f 6c 65 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 6c 65 74 20 7b 73 75 62 6d 65 erty(role)).return....let.{subme
8340 6e 75 7d 20 3d 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 0a 0a 20 20 2f 2f 20 72 65 6d 6f 76 65 20 6e nu}.=.roles[role]....//.remove.n
8360 75 6c 6c 20 69 74 65 6d 73 20 66 72 6f 6d 20 77 69 74 68 69 6e 20 74 68 65 20 73 75 62 6d 65 6e ull.items.from.within.the.submen
8380 75 0a 20 20 69 66 20 28 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 73 75 62 6d 65 6e 75 29 29 20 u...if.(Array.isArray(submenu)).
83a0 7b 0a 20 20 20 20 73 75 62 6d 65 6e 75 20 3d 20 73 75 62 6d 65 6e 75 2e 66 69 6c 74 65 72 28 28 {.....submenu.=.submenu.filter((
83c0 69 74 65 6d 29 20 3d 3e 20 69 74 65 6d 20 21 3d 20 6e 75 6c 6c 29 0a 20 20 7d 0a 0a 20 20 72 65 item).=>.item.!=.null)...}....re
83e0 74 75 72 6e 20 73 75 62 6d 65 6e 75 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 65 78 65 63 75 74 65 20 turn.submenu.}..exports.execute.
8400 3d 20 28 72 6f 6c 65 2c 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 2c 20 66 6f 63 75 73 65 64 57 =.(role,.focusedWindow,.focusedW
8420 65 62 43 6f 6e 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 21 63 61 6e 45 78 65 63 75 ebContents).=>.{...if.(!canExecu
8440 74 65 52 6f 6c 65 28 72 6f 6c 65 29 29 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0a 0a 20 20 63 6f teRole(role)).return.false....co
8460 6e 73 74 20 7b 61 70 70 4d 65 74 68 6f 64 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f nst.{appMethod,.webContentsMetho
8480 64 2c 20 77 69 6e 64 6f 77 4d 65 74 68 6f 64 7d 20 3d 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 0a 0a d,.windowMethod}.=.roles[role]..
84a0 20 20 69 66 20 28 61 70 70 4d 65 74 68 6f 64 29 20 7b 0a 20 20 20 20 61 70 70 5b 61 70 70 4d 65 ..if.(appMethod).{.....app[appMe
84c0 74 68 6f 64 5d 28 29 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 7d 0a 0a 20 20 69 thod]().....return.true...}....i
84e0 66 20 28 77 69 6e 64 6f 77 4d 65 74 68 6f 64 20 26 26 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 f.(windowMethod.&&.focusedWindow
8500 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 77 69 6e 64 6f .!=.null).{.....if.(typeof.windo
8520 77 4d 65 74 68 6f 64 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 wMethod.===.'function').{.......
8540 77 69 6e 64 6f 77 4d 65 74 68 6f 64 28 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 29 0a 20 20 20 20 windowMethod(focusedWindow).....
8560 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 5b 77 69 6e }.else.{.......focusedWindow[win
8580 64 6f 77 4d 65 74 68 6f 64 5d 28 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 dowMethod]().....}.....return.tr
85a0 75 65 0a 20 20 7d 0a 0a 20 20 69 66 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 20 ue...}....if.(webContentsMethod.
85c0 26 26 20 66 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 20 21 3d 20 6e 75 6c 6c 29 20 7b &&.focusedWebContents.!=.null).{
85e0 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f .....if.(typeof.webContentsMetho
8600 64 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 77 65 62 43 6f 6e d.===.'function').{.......webCon
8620 74 65 6e 74 73 4d 65 74 68 6f 64 28 66 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 29 0a tentsMethod(focusedWebContents).
8640 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 66 6f 63 75 73 65 64 57 65 62 43 6f 6e ....}.else.{.......focusedWebCon
8660 74 65 6e 74 73 5b 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 5d 28 29 0a 20 20 20 20 7d tents[webContentsMethod]().....}
8680 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 66 .....return.true...}....return.f
86a0 61 6c 73 65 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 72 6f 6c 65 73 alse.}.'use.strict'..const.roles
86c0 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2f 6d 65 6e 75 2d 69 74 65 6d 2d 72 6f 6c 65 73 27 29 0a .=.require('./menu-item-roles').
86e0 0a 6c 65 74 20 6e 65 78 74 43 6f 6d 6d 61 6e 64 49 64 20 3d 20 30 0a 0a 63 6f 6e 73 74 20 4d 65 .let.nextCommandId.=.0..const.Me
8700 6e 75 49 74 65 6d 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 nuItem.=.function.(options).{...
8720 63 6f 6e 73 74 20 7b 4d 65 6e 75 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e const.{Menu}.=.require('electron
8740 27 29 0a 0a 20 20 2f 2f 20 50 72 65 73 65 72 76 65 20 65 78 74 72 61 20 66 69 65 6c 64 73 20 73 ')....//.Preserve.extra.fields.s
8760 70 65 63 69 66 69 65 64 20 62 79 20 75 73 65 72 0a 20 20 66 6f 72 20 28 6c 65 74 20 6b 65 79 20 pecified.by.user...for.(let.key.
8780 69 6e 20 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 69 66 20 28 21 28 6b 65 79 20 69 6e 20 74 in.options).{.....if.(!(key.in.t
87a0 68 69 73 29 29 20 74 68 69 73 5b 6b 65 79 5d 20 3d 20 6f 70 74 69 6f 6e 73 5b 6b 65 79 5d 0a 20 his)).this[key].=.options[key]..
87c0 20 7d 0a 20 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 20 3d 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 .}...this.submenu.=.this.submenu
87e0 20 7c 7c 20 72 6f 6c 65 73 2e 67 65 74 44 65 66 61 75 6c 74 53 75 62 6d 65 6e 75 28 74 68 69 73 .||.roles.getDefaultSubmenu(this
8800 2e 72 6f 6c 65 29 0a 20 20 69 66 20 28 74 68 69 73 2e 73 75 62 6d 65 6e 75 20 21 3d 20 6e 75 6c .role)...if.(this.submenu.!=.nul
8820 6c 20 26 26 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 21 3d l.&&.this.submenu.constructor.!=
8840 3d 20 4d 65 6e 75 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 20 3d 20 4d 65 6e =.Menu).{.....this.submenu.=.Men
8860 75 2e 62 75 69 6c 64 46 72 6f 6d 54 65 6d 70 6c 61 74 65 28 74 68 69 73 2e 73 75 62 6d 65 6e 75 u.buildFromTemplate(this.submenu
8880 29 0a 20 20 7d 0a 20 20 69 66 20 28 74 68 69 73 2e 74 79 70 65 20 3d 3d 20 6e 75 6c 6c 20 26 26 )...}...if.(this.type.==.null.&&
88a0 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 68 69 .this.submenu.!=.null).{.....thi
88c0 73 2e 74 79 70 65 20 3d 20 27 73 75 62 6d 65 6e 75 27 0a 20 20 7d 0a 20 20 69 66 20 28 74 68 69 s.type.=.'submenu'...}...if.(thi
88e0 73 2e 74 79 70 65 20 3d 3d 3d 20 27 73 75 62 6d 65 6e 75 27 20 26 26 20 28 74 68 69 73 2e 73 75 s.type.===.'submenu'.&&.(this.su
8900 62 6d 65 6e 75 20 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 2e 63 6f bmenu.==.null.||.this.submenu.co
8920 6e 73 74 72 75 63 74 6f 72 20 21 3d 3d 20 4d 65 6e 75 29 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 nstructor.!==.Menu)).{.....throw
8940 20 6e 65 77 20 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 20 73 75 62 6d 65 6e 75 27 29 0a 20 20 .new.Error('Invalid.submenu')...
8960 7d 0a 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 }....this.overrideReadOnlyProper
8980 74 79 28 27 74 79 70 65 27 2c 20 27 6e 6f 72 6d 61 6c 27 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 ty('type',.'normal')...this.over
89a0 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 79 28 27 72 6f 6c 65 27 29 0a 20 20 74 rideReadOnlyProperty('role')...t
89c0 68 69 73 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 79 28 27 61 63 his.overrideReadOnlyProperty('ac
89e0 63 65 6c 65 72 61 74 6f 72 27 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f celerator')...this.overrideReadO
8a00 6e 6c 79 50 72 6f 70 65 72 74 79 28 27 69 63 6f 6e 27 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 nlyProperty('icon')...this.overr
8a20 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 79 28 27 73 75 62 6d 65 6e 75 27 29 0a 0a ideReadOnlyProperty('submenu')..
8a40 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 65 72 74 79 28 27 6c 61 62 65 6c 27 2c ..this.overrideProperty('label',
8a60 20 72 6f 6c 65 73 2e 67 65 74 44 65 66 61 75 6c 74 4c 61 62 65 6c 28 74 68 69 73 2e 72 6f 6c 65 .roles.getDefaultLabel(this.role
8a80 29 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 65 72 74 79 28 27 73 75 62 6c ))...this.overrideProperty('subl
8aa0 61 62 65 6c 27 2c 20 27 27 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 65 72 abel',.'')...this.overrideProper
8ac0 74 79 28 27 65 6e 61 62 6c 65 64 27 2c 20 74 72 75 65 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 ty('enabled',.true)...this.overr
8ae0 69 64 65 50 72 6f 70 65 72 74 79 28 27 76 69 73 69 62 6c 65 27 2c 20 74 72 75 65 29 0a 20 20 74 ideProperty('visible',.true)...t
8b00 68 69 73 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 65 72 74 79 28 27 63 68 65 63 6b 65 64 27 2c 20 his.overrideProperty('checked',.
8b20 66 61 6c 73 65 29 0a 0a 20 20 69 66 20 28 21 4d 65 6e 75 49 74 65 6d 2e 74 79 70 65 73 2e 69 6e false)....if.(!MenuItem.types.in
8b40 63 6c 75 64 65 73 28 74 68 69 73 2e 74 79 70 65 29 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e cludes(this.type)).{.....throw.n
8b60 65 77 20 45 72 72 6f 72 28 60 55 6e 6b 6e 6f 77 6e 20 6d 65 6e 75 20 69 74 65 6d 20 74 79 70 65 ew.Error(`Unknown.menu.item.type
8b80 3a 20 24 7b 74 68 69 73 2e 74 79 70 65 7d 60 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 6f 76 65 :.${this.type}`)...}....this.ove
8ba0 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 79 28 27 63 6f 6d 6d 61 6e 64 49 64 rrideReadOnlyProperty('commandId
8bc0 27 2c 20 2b 2b 6e 65 78 74 43 6f 6d 6d 61 6e 64 49 64 29 0a 0a 20 20 63 6f 6e 73 74 20 63 6c 69 ',.++nextCommandId)....const.cli
8be0 63 6b 20 3d 20 6f 70 74 69 6f 6e 73 2e 63 6c 69 63 6b 0a 20 20 74 68 69 73 2e 63 6c 69 63 6b 20 ck.=.options.click...this.click.
8c00 3d 20 28 65 76 65 6e 74 2c 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 2c 20 66 6f 63 75 73 65 64 =.(event,.focusedWindow,.focused
8c20 57 65 62 43 6f 6e 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 20 20 2f 2f 20 4d 61 6e 75 61 6c 6c WebContents).=>.{.....//.Manuall
8c40 79 20 66 6c 69 70 20 74 68 65 20 63 68 65 63 6b 65 64 20 66 6c 61 67 73 20 77 68 65 6e 20 63 6c y.flip.the.checked.flags.when.cl
8c60 69 63 6b 65 64 2e 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 74 79 70 65 20 3d 3d 3d 20 27 63 68 icked......if.(this.type.===.'ch
8c80 65 63 6b 62 6f 78 27 20 7c 7c 20 74 68 69 73 2e 74 79 70 65 20 3d 3d 3d 20 27 72 61 64 69 6f 27 eckbox'.||.this.type.===.'radio'
8ca0 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 63 68 65 63 6b 65 64 20 3d 20 21 74 68 69 73 2e 63 ).{.......this.checked.=.!this.c
8cc0 68 65 63 6b 65 64 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 21 72 6f 6c 65 73 2e 65 78 65 hecked.....}......if.(!roles.exe
8ce0 63 75 74 65 28 74 68 69 73 2e 72 6f 6c 65 2c 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 2c 20 66 cute(this.role,.focusedWindow,.f
8d00 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 ocusedWebContents)).{.......if.(
8d20 74 79 70 65 6f 66 20 63 6c 69 63 6b 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 typeof.click.===.'function').{..
8d40 20 20 20 20 20 20 20 63 6c 69 63 6b 28 74 68 69 73 2c 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 .......click(this,.focusedWindow
8d60 2c 20 65 76 65 6e 74 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 ,.event).......}.else.if.(typeof
8d80 20 74 68 69 73 2e 73 65 6c 65 63 74 6f 72 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 20 26 26 20 70 .this.selector.===.'string'.&&.p
8da0 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 29 20 7b 0a rocess.platform.===.'darwin').{.
8dc0 20 20 20 20 20 20 20 20 4d 65 6e 75 2e 73 65 6e 64 41 63 74 69 6f 6e 54 6f 46 69 72 73 74 52 65 ........Menu.sendActionToFirstRe
8de0 73 70 6f 6e 64 65 72 28 74 68 69 73 2e 73 65 6c 65 63 74 6f 72 29 0a 20 20 20 20 20 20 7d 0a 20 sponder(this.selector).......}..
8e00 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 4d 65 6e 75 49 74 65 6d 2e 74 79 70 65 73 20 3d 20 5b 27 6e ...}...}.}..MenuItem.types.=.['n
8e20 6f 72 6d 61 6c 27 2c 20 27 73 65 70 61 72 61 74 6f 72 27 2c 20 27 73 75 62 6d 65 6e 75 27 2c 20 ormal',.'separator',.'submenu',.
8e40 27 63 68 65 63 6b 62 6f 78 27 2c 20 27 72 61 64 69 6f 27 5d 0a 0a 4d 65 6e 75 49 74 65 6d 2e 70 'checkbox',.'radio']..MenuItem.p
8e60 72 6f 74 6f 74 79 70 65 2e 67 65 74 44 65 66 61 75 6c 74 52 6f 6c 65 41 63 63 65 6c 65 72 61 74 rototype.getDefaultRoleAccelerat
8e80 6f 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 72 6f 6c 65 or.=.function.().{...return.role
8ea0 73 2e 67 65 74 44 65 66 61 75 6c 74 41 63 63 65 6c 65 72 61 74 6f 72 28 74 68 69 73 2e 72 6f 6c s.getDefaultAccelerator(this.rol
8ec0 65 29 0a 7d 0a 0a 4d 65 6e 75 49 74 65 6d 2e 70 72 6f 74 6f 74 79 70 65 2e 6f 76 65 72 72 69 64 e).}..MenuItem.prototype.overrid
8ee0 65 50 72 6f 70 65 72 74 79 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 2c 20 64 65 66 61 eProperty.=.function.(name,.defa
8f00 75 6c 74 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 69 66 20 28 74 68 69 73 5b 6e 61 ultValue.=.null).{...if.(this[na
8f20 6d 65 5d 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 68 69 73 5b 6e 61 6d 65 5d 20 3d 20 me].==.null).{.....this[name].=.
8f40 64 65 66 61 75 6c 74 56 61 6c 75 65 0a 20 20 7d 0a 7d 0a 0a 4d 65 6e 75 49 74 65 6d 2e 70 72 6f defaultValue...}.}..MenuItem.pro
8f60 74 6f 74 79 70 65 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 79 20 totype.overrideReadOnlyProperty.
8f80 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 2c 20 64 65 66 61 75 6c 74 56 61 6c 75 65 29 20 =.function.(name,.defaultValue).
8fa0 7b 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 65 72 74 79 28 6e 61 6d 65 2c 20 {...this.overrideProperty(name,.
8fc0 64 65 66 61 75 6c 74 56 61 6c 75 65 29 0a 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f defaultValue)...Object.definePro
8fe0 70 65 72 74 79 28 74 68 69 73 2c 20 6e 61 6d 65 2c 20 7b 0a 20 20 20 20 65 6e 75 6d 65 72 61 62 perty(this,.name,.{.....enumerab
9000 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 77 72 69 74 61 62 6c 65 3a 20 66 61 6c 73 65 2c 0a 20 le:.true,.....writable:.false,..
9020 20 20 20 76 61 6c 75 65 3a 20 74 68 69 73 5b 6e 61 6d 65 5d 0a 20 20 7d 29 0a 7d 0a 0a 6d 6f 64 ...value:.this[name]...}).}..mod
9040 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 4d 65 6e 75 49 74 65 6d 0a 27 75 73 65 20 73 74 72 69 ule.exports.=.MenuItem.'use.stri
9060 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2c 20 4d 65 6e 75 49 ct'..const.{BrowserWindow,.MenuI
9080 74 65 6d 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 tem,.webContents}.=.require('ele
90a0 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 3d 20 72 65 71 ctron').const.EventEmitter.=.req
90c0 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 2e 45 76 65 6e 74 45 6d 69 74 74 65 72 0a 63 6f 6e 73 uire('events').EventEmitter.cons
90e0 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 t.v8Util.=.process.atomBinding('
9100 76 38 5f 75 74 69 6c 27 29 0a 63 6f 6e 73 74 20 62 69 6e 64 69 6e 67 73 20 3d 20 70 72 6f 63 65 v8_util').const.bindings.=.proce
9120 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 6d 65 6e 75 27 29 0a 0a 63 6f 6e 73 74 20 7b 4d ss.atomBinding('menu')..const.{M
9140 65 6e 75 7d 20 3d 20 62 69 6e 64 69 6e 67 73 0a 6c 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 4d enu}.=.bindings.let.applicationM
9160 65 6e 75 20 3d 20 6e 75 6c 6c 0a 6c 65 74 20 67 72 6f 75 70 49 64 49 6e 64 65 78 20 3d 20 30 0a enu.=.null.let.groupIdIndex.=.0.
9180 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 4d 65 6e 75 2e 70 72 6f 74 .Object.setPrototypeOf(Menu.prot
91a0 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a otype,.EventEmitter.prototype)..
91c0 2f 2a 20 49 6e 73 74 61 6e 63 65 20 4d 65 74 68 6f 64 73 20 2a 2f 0a 0a 4d 65 6e 75 2e 70 72 6f /*.Instance.Methods.*/..Menu.pro
91e0 74 6f 74 79 70 65 2e 5f 69 6e 69 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 74 totype._init.=.function.().{...t
9200 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 20 3d 20 7b 7d 0a 20 20 74 68 69 73 2e 67 72 6f 75 his.commandsMap.=.{}...this.grou
9220 70 73 4d 61 70 20 3d 20 7b 7d 0a 20 20 74 68 69 73 2e 69 74 65 6d 73 20 3d 20 5b 5d 0a 20 20 74 psMap.=.{}...this.items.=.[]...t
9240 68 69 73 2e 64 65 6c 65 67 61 74 65 20 3d 20 7b 0a 20 20 20 20 69 73 43 6f 6d 6d 61 6e 64 49 64 his.delegate.=.{.....isCommandId
9260 43 68 65 63 6b 65 64 3a 20 69 64 20 3d 3e 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b Checked:.id.=>.this.commandsMap[
9280 69 64 5d 20 3f 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 2e 63 68 65 63 6b id].?.this.commandsMap[id].check
92a0 65 64 20 3a 20 75 6e 64 65 66 69 6e 65 64 2c 0a 20 20 20 20 69 73 43 6f 6d 6d 61 6e 64 49 64 45 ed.:.undefined,.....isCommandIdE
92c0 6e 61 62 6c 65 64 3a 20 69 64 20 3d 3e 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 nabled:.id.=>.this.commandsMap[i
92e0 64 5d 20 3f 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 2e 65 6e 61 62 6c 65 d].?.this.commandsMap[id].enable
9300 64 20 3a 20 75 6e 64 65 66 69 6e 65 64 2c 0a 20 20 20 20 69 73 43 6f 6d 6d 61 6e 64 49 64 56 69 d.:.undefined,.....isCommandIdVi
9320 73 69 62 6c 65 3a 20 69 64 20 3d 3e 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 sible:.id.=>.this.commandsMap[id
9340 5d 20 3f 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 2e 76 69 73 69 62 6c 65 ].?.this.commandsMap[id].visible
9360 20 3a 20 75 6e 64 65 66 69 6e 65 64 2c 0a 20 20 20 20 67 65 74 41 63 63 65 6c 65 72 61 74 6f 72 .:.undefined,.....getAccelerator
9380 46 6f 72 43 6f 6d 6d 61 6e 64 49 64 3a 20 28 69 64 2c 20 75 73 65 44 65 66 61 75 6c 74 41 63 63 ForCommandId:.(id,.useDefaultAcc
93a0 65 6c 65 72 61 74 6f 72 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 elerator).=>.{.......const.comma
93c0 6e 64 20 3d 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 0a 20 20 20 20 20 20 nd.=.this.commandsMap[id].......
93e0 69 66 20 28 21 63 6f 6d 6d 61 6e 64 29 20 72 65 74 75 72 6e 0a 20 20 20 20 20 20 69 66 20 28 63 if.(!command).return.......if.(c
9400 6f 6d 6d 61 6e 64 2e 61 63 63 65 6c 65 72 61 74 6f 72 29 20 72 65 74 75 72 6e 20 63 6f 6d 6d 61 ommand.accelerator).return.comma
9420 6e 64 2e 61 63 63 65 6c 65 72 61 74 6f 72 0a 20 20 20 20 20 20 69 66 20 28 75 73 65 44 65 66 61 nd.accelerator.......if.(useDefa
9440 75 6c 74 41 63 63 65 6c 65 72 61 74 6f 72 29 20 72 65 74 75 72 6e 20 63 6f 6d 6d 61 6e 64 2e 67 ultAccelerator).return.command.g
9460 65 74 44 65 66 61 75 6c 74 52 6f 6c 65 41 63 63 65 6c 65 72 61 74 6f 72 28 29 0a 20 20 20 20 7d etDefaultRoleAccelerator().....}
9480 2c 0a 20 20 20 20 67 65 74 49 63 6f 6e 46 6f 72 43 6f 6d 6d 61 6e 64 49 64 3a 20 69 64 20 3d 3e ,.....getIconForCommandId:.id.=>
94a0 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 20 3f 20 74 68 69 73 2e 63 6f 6d .this.commandsMap[id].?.this.com
94c0 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 2e 69 63 6f 6e 20 3a 20 75 6e 64 65 66 69 6e 65 64 2c 0a 20 mandsMap[id].icon.:.undefined,..
94e0 20 20 20 65 78 65 63 75 74 65 43 6f 6d 6d 61 6e 64 3a 20 28 65 76 65 6e 74 2c 20 69 64 29 20 3d ...executeCommand:.(event,.id).=
9500 3e 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 74 68 69 73 2e 63 >.{.......const.command.=.this.c
9520 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 0a 20 20 20 20 20 20 69 66 20 28 21 63 6f 6d 6d 61 6e ommandsMap[id].......if.(!comman
9540 64 29 20 72 65 74 75 72 6e 0a 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 2e 63 6c 69 63 6b 28 65 76 d).return.......command.click(ev
9560 65 6e 74 2c 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 46 6f 63 75 73 65 64 57 69 6e ent,.BrowserWindow.getFocusedWin
9580 64 6f 77 28 29 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 67 65 74 46 6f 63 75 73 65 64 57 65 62 dow(),.webContents.getFocusedWeb
95a0 43 6f 6e 74 65 6e 74 73 28 29 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 6d 65 6e 75 57 69 6c 6c 53 Contents()).....},.....menuWillS
95c0 68 6f 77 3a 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 2f 2f 20 45 6e 73 75 72 65 20 72 61 64 how:.().=>.{.......//.Ensure.rad
95e0 69 6f 20 67 72 6f 75 70 73 20 68 61 76 65 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 6d 65 6e 75 io.groups.have.at.least.one.menu
9600 20 69 74 65 6d 20 73 65 6c 65 74 65 64 0a 20 20 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 69 .item.seleted.......for.(const.i
9620 64 20 69 6e 20 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 29 20 7b 0a 20 20 20 20 20 20 20 20 63 d.in.this.groupsMap).{.........c
9640 6f 6e 73 74 20 66 6f 75 6e 64 20 3d 20 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 64 5d 2e onst.found.=.this.groupsMap[id].
9660 66 69 6e 64 28 69 74 65 6d 20 3d 3e 20 69 74 65 6d 2e 63 68 65 63 6b 65 64 29 20 7c 7c 20 6e 75 find(item.=>.item.checked).||.nu
9680 6c 6c 0a 20 20 20 20 20 20 20 20 69 66 20 28 21 66 6f 75 6e 64 29 20 76 38 55 74 69 6c 2e 73 65 ll.........if.(!found).v8Util.se
96a0 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 64 5d 5b tHiddenValue(this.groupsMap[id][
96c0 30 5d 2c 20 27 63 68 65 63 6b 65 64 27 2c 20 74 72 75 65 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 0],.'checked',.true).......}....
96e0 20 7d 0a 20 20 7d 0a 7d 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e 70 6f 70 75 70 20 3d .}...}.}..Menu.prototype.popup.=
9700 20 66 75 6e 63 74 69 6f 6e 20 28 77 69 6e 64 6f 77 2c 20 78 2c 20 79 2c 20 70 6f 73 69 74 69 6f .function.(window,.x,.y,.positio
9720 6e 69 6e 67 49 74 65 6d 29 20 7b 0a 20 20 6c 65 74 20 61 73 79 6e 63 50 6f 70 75 70 2c 20 6f 70 ningItem).{...let.asyncPopup,.op
9740 74 73 0a 20 20 6c 65 74 20 5b 6e 65 77 58 2c 20 6e 65 77 59 2c 20 6e 65 77 50 6f 73 69 74 69 6f ts...let.[newX,.newY,.newPositio
9760 6e 2c 20 6e 65 77 57 69 6e 64 6f 77 5d 20 3d 20 5b 78 2c 20 79 2c 20 70 6f 73 69 74 69 6f 6e 69 n,.newWindow].=.[x,.y,.positioni
9780 6e 67 49 74 65 6d 2c 20 77 69 6e 64 6f 77 5d 0a 0a 20 20 2f 2f 20 6d 65 6e 75 2e 70 6f 70 75 70 ngItem,.window]....//.menu.popup
97a0 28 78 2c 20 79 2c 20 70 6f 73 69 74 69 6f 6e 69 6e 67 49 74 65 6d 29 0a 20 20 69 66 20 28 77 69 (x,.y,.positioningItem)...if.(wi
97c0 6e 64 6f 77 20 21 3d 20 6e 75 6c 6c 20 26 26 20 21 28 77 69 6e 64 6f 77 20 69 6e 73 74 61 6e 63 ndow.!=.null.&&.!(window.instanc
97e0 65 6f 66 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 29 29 20 7b 0a 20 20 20 20 5b 6e 65 77 50 6f eof.BrowserWindow)).{.....[newPo
9800 73 69 74 69 6f 6e 2c 20 6e 65 77 59 2c 20 6e 65 77 58 2c 20 6e 65 77 57 69 6e 64 6f 77 5d 20 3d sition,.newY,.newX,.newWindow].=
9820 20 5b 79 2c 20 78 2c 20 77 69 6e 64 6f 77 2c 20 6e 75 6c 6c 5d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 .[y,.x,.window,.null]...}....//.
9840 6d 65 6e 75 2e 70 6f 70 75 70 28 7b 7d 29 0a 20 20 69 66 20 28 77 69 6e 64 6f 77 20 21 3d 20 6e menu.popup({})...if.(window.!=.n
9860 75 6c 6c 20 26 26 20 77 69 6e 64 6f 77 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 3d 3d 3d 20 4f 62 ull.&&.window.constructor.===.Ob
9880 6a 65 63 74 29 20 7b 0a 20 20 20 20 6f 70 74 73 20 3d 20 77 69 6e 64 6f 77 0a 20 20 2f 2f 20 6d ject).{.....opts.=.window...//.m
98a0 65 6e 75 2e 70 6f 70 75 70 28 77 69 6e 64 6f 77 2c 20 7b 7d 29 0a 20 20 7d 20 65 6c 73 65 20 69 enu.popup(window,.{})...}.else.i
98c0 66 20 28 78 20 26 26 20 74 79 70 65 6f 66 20 78 20 3d 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b f.(x.&&.typeof.x.===.'object').{
98e0 0a 20 20 20 20 6f 70 74 73 20 3d 20 78 0a 20 20 7d 0a 0a 20 20 69 66 20 28 6f 70 74 73 29 20 7b .....opts.=.x...}....if.(opts).{
9900 0a 20 20 20 20 6e 65 77 58 20 3d 20 6f 70 74 73 2e 78 0a 20 20 20 20 6e 65 77 59 20 3d 20 6f 70 .....newX.=.opts.x.....newY.=.op
9920 74 73 2e 79 0a 20 20 20 20 6e 65 77 50 6f 73 69 74 69 6f 6e 20 3d 20 6f 70 74 73 2e 70 6f 73 69 ts.y.....newPosition.=.opts.posi
9940 74 69 6f 6e 69 6e 67 49 74 65 6d 0a 20 20 20 20 61 73 79 6e 63 50 6f 70 75 70 20 3d 20 6f 70 74 tioningItem.....asyncPopup.=.opt
9960 73 2e 61 73 79 6e 63 0a 20 20 7d 0a 0a 20 20 2f 2f 20 73 65 74 20 64 65 66 61 75 6c 74 73 0a 20 s.async...}....//.set.defaults..
9980 20 69 66 20 28 74 79 70 65 6f 66 20 6e 65 77 58 20 21 3d 3d 20 27 6e 75 6d 62 65 72 27 29 20 6e .if.(typeof.newX.!==.'number').n
99a0 65 77 58 20 3d 20 2d 31 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 6e 65 77 59 20 21 3d 3d 20 27 ewX.=.-1...if.(typeof.newY.!==.'
99c0 6e 75 6d 62 65 72 27 29 20 6e 65 77 59 20 3d 20 2d 31 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 number').newY.=.-1...if.(typeof.
99e0 6e 65 77 50 6f 73 69 74 69 6f 6e 20 21 3d 3d 20 27 6e 75 6d 62 65 72 27 29 20 6e 65 77 50 6f 73 newPosition.!==.'number').newPos
9a00 69 74 69 6f 6e 20 3d 20 2d 31 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 61 73 79 6e 63 50 6f 70 ition.=.-1...if.(typeof.asyncPop
9a20 75 70 20 21 3d 3d 20 27 62 6f 6f 6c 65 61 6e 27 29 20 61 73 79 6e 63 50 6f 70 75 70 20 3d 20 66 up.!==.'boolean').asyncPopup.=.f
9a40 61 6c 73 65 0a 20 20 69 66 20 28 21 6e 65 77 57 69 6e 64 6f 77 20 7c 7c 20 28 6e 65 77 57 69 6e alse...if.(!newWindow.||.(newWin
9a60 64 6f 77 20 26 26 20 6e 65 77 57 69 6e 64 6f 77 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 21 3d 3d dow.&&.newWindow.constructor.!==
9a80 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 29 29 20 7b 0a 20 20 20 20 6e 65 77 57 69 6e 64 6f 77 .BrowserWindow)).{.....newWindow
9aa0 20 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 46 6f 63 75 73 65 64 57 69 6e 64 6f .=.BrowserWindow.getFocusedWindo
9ac0 77 28 29 0a 0a 20 20 20 20 2f 2f 20 4e 6f 20 77 69 6e 64 6f 77 20 66 6f 63 75 73 65 64 3f 0a 20 w()......//.No.window.focused?..
9ae0 20 20 20 69 66 20 28 21 6e 65 77 57 69 6e 64 6f 77 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 ...if.(!newWindow).{.......const
9b00 20 62 72 6f 77 73 65 72 57 69 6e 64 6f 77 73 20 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e .browserWindows.=.BrowserWindow.
9b20 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 28 29 0a 0a 20 20 20 20 20 20 69 66 20 28 62 72 6f 77 73 getAllWindows()........if.(brows
9b40 65 72 57 69 6e 64 6f 77 73 20 26 26 20 62 72 6f 77 73 65 72 57 69 6e 64 6f 77 73 2e 6c 65 6e 67 erWindows.&&.browserWindows.leng
9b60 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 20 20 20 20 6e 65 77 57 69 6e 64 6f 77 20 3d 20 62 72 th.>.0).{.........newWindow.=.br
9b80 6f 77 73 65 72 57 69 6e 64 6f 77 73 5b 30 5d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 owserWindows[0].......}.else.{..
9ba0 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 6f .......throw.new.Error(`Cannot.o
9bc0 70 65 6e 20 4d 65 6e 75 20 77 69 74 68 6f 75 74 20 61 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 pen.Menu.without.a.BrowserWindow
9be0 20 70 72 65 73 65 6e 74 60 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 .present`).......}.....}...}....
9c00 74 68 69 73 2e 70 6f 70 75 70 41 74 28 6e 65 77 57 69 6e 64 6f 77 2c 20 6e 65 77 58 2c 20 6e 65 this.popupAt(newWindow,.newX,.ne
9c20 77 59 2c 20 6e 65 77 50 6f 73 69 74 69 6f 6e 2c 20 61 73 79 6e 63 50 6f 70 75 70 29 0a 0a 20 20 wY,.newPosition,.asyncPopup)....
9c40 72 65 74 75 72 6e 20 7b 20 62 72 6f 77 73 65 72 57 69 6e 64 6f 77 3a 20 6e 65 77 57 69 6e 64 6f return.{.browserWindow:.newWindo
9c60 77 2c 20 78 3a 20 6e 65 77 58 2c 20 79 3a 20 6e 65 77 59 2c 20 70 6f 73 69 74 69 6f 6e 3a 20 6e w,.x:.newX,.y:.newY,.position:.n
9c80 65 77 50 6f 73 69 74 69 6f 6e 2c 20 61 73 79 6e 63 3a 20 61 73 79 6e 63 50 6f 70 75 70 20 7d 0a ewPosition,.async:.asyncPopup.}.
9ca0 7d 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e 63 6c 6f 73 65 50 6f 70 75 70 20 3d 20 66 }..Menu.prototype.closePopup.=.f
9cc0 75 6e 63 74 69 6f 6e 20 28 77 69 6e 64 6f 77 29 20 7b 0a 20 20 69 66 20 28 21 77 69 6e 64 6f 77 unction.(window).{...if.(!window
9ce0 20 7c 7c 20 77 69 6e 64 6f 77 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 21 3d 3d 20 42 72 6f 77 73 .||.window.constructor.!==.Brows
9d00 65 72 57 69 6e 64 6f 77 29 20 7b 0a 20 20 20 20 77 69 6e 64 6f 77 20 3d 20 42 72 6f 77 73 65 72 erWindow).{.....window.=.Browser
9d20 57 69 6e 64 6f 77 2e 67 65 74 46 6f 63 75 73 65 64 57 69 6e 64 6f 77 28 29 0a 20 20 7d 0a 20 20 Window.getFocusedWindow()...}...
9d40 69 66 20 28 77 69 6e 64 6f 77 29 20 74 68 69 73 2e 63 6c 6f 73 65 50 6f 70 75 70 41 74 28 77 69 if.(window).this.closePopupAt(wi
9d60 6e 64 6f 77 2e 69 64 29 0a 7d 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 4d 65 ndow.id).}..Menu.prototype.getMe
9d80 6e 75 49 74 65 6d 42 79 49 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 64 29 20 7b 0a 20 20 63 nuItemById.=.function.(id).{...c
9da0 6f 6e 73 74 20 69 74 65 6d 73 20 3d 20 74 68 69 73 2e 69 74 65 6d 73 0a 0a 20 20 6c 65 74 20 66 onst.items.=.this.items....let.f
9dc0 6f 75 6e 64 20 3d 20 69 74 65 6d 73 2e 66 69 6e 64 28 69 74 65 6d 20 3d 3e 20 69 74 65 6d 2e 69 ound.=.items.find(item.=>.item.i
9de0 64 20 3d 3d 3d 20 69 64 29 20 7c 7c 20 6e 75 6c 6c 0a 20 20 66 6f 72 20 28 6c 65 74 20 69 20 3d d.===.id).||.null...for.(let.i.=
9e00 20 30 3b 20 21 66 6f 75 6e 64 20 26 26 20 69 20 3c 20 69 74 65 6d 73 2e 6c 65 6e 67 74 68 3b 20 .0;.!found.&&.i.<.items.length;.
9e20 69 2b 2b 29 20 7b 0a 20 20 20 20 69 66 20 28 69 74 65 6d 73 5b 69 5d 2e 73 75 62 6d 65 6e 75 29 i++).{.....if.(items[i].submenu)
9e40 20 7b 0a 20 20 20 20 20 20 66 6f 75 6e 64 20 3d 20 69 74 65 6d 73 5b 69 5d 2e 73 75 62 6d 65 6e .{.......found.=.items[i].submen
9e60 75 2e 67 65 74 4d 65 6e 75 49 74 65 6d 42 79 49 64 28 69 64 29 0a 20 20 20 20 7d 0a 20 20 7d 0a u.getMenuItemById(id).....}...}.
9e80 20 20 72 65 74 75 72 6e 20 66 6f 75 6e 64 0a 7d 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 ..return.found.}..Menu.prototype
9ea0 2e 61 70 70 65 6e 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 74 65 6d 29 20 7b 0a 20 20 72 65 .append.=.function.(item).{...re
9ec0 74 75 72 6e 20 74 68 69 73 2e 69 6e 73 65 72 74 28 74 68 69 73 2e 67 65 74 49 74 65 6d 43 6f 75 turn.this.insert(this.getItemCou
9ee0 6e 74 28 29 2c 20 69 74 65 6d 29 0a 7d 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e 69 6e nt(),.item).}..Menu.prototype.in
9f00 73 65 72 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 70 6f 73 2c 20 69 74 65 6d 29 20 7b 0a 20 20 sert.=.function.(pos,.item).{...
9f20 69 66 20 28 28 69 74 65 6d 20 3f 20 69 74 65 6d 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 3a 20 76 if.((item.?.item.constructor.:.v
9f40 6f 69 64 20 30 29 20 21 3d 3d 20 4d 65 6e 75 49 74 65 6d 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 oid.0).!==.MenuItem).{.....throw
9f60 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 20 69 74 65 6d 27 29 0a 20 .new.TypeError('Invalid.item')..
9f80 20 7d 0a 0a 20 20 2f 2f 20 69 6e 73 65 72 74 20 69 74 65 6d 20 64 65 70 65 6e 64 69 6e 67 20 6f .}....//.insert.item.depending.o
9fa0 6e 20 69 74 73 20 74 79 70 65 0a 20 20 69 6e 73 65 72 74 49 74 65 6d 42 79 54 79 70 65 2e 63 61 n.its.type...insertItemByType.ca
9fc0 6c 6c 28 74 68 69 73 2c 20 69 74 65 6d 2c 20 70 6f 73 29 0a 0a 20 20 2f 2f 20 73 65 74 20 69 74 ll(this,.item,.pos)....//.set.it
9fe0 65 6d 20 70 72 6f 70 65 72 74 69 65 73 0a 20 20 69 66 20 28 69 74 65 6d 2e 73 75 62 6c 61 62 65 em.properties...if.(item.sublabe
a000 6c 29 20 74 68 69 73 2e 73 65 74 53 75 62 6c 61 62 65 6c 28 70 6f 73 2c 20 69 74 65 6d 2e 73 75 l).this.setSublabel(pos,.item.su
a020 62 6c 61 62 65 6c 29 0a 20 20 69 66 20 28 69 74 65 6d 2e 69 63 6f 6e 29 20 74 68 69 73 2e 73 65 blabel)...if.(item.icon).this.se
a040 74 49 63 6f 6e 28 70 6f 73 2c 20 69 74 65 6d 2e 69 63 6f 6e 29 0a 20 20 69 66 20 28 69 74 65 6d tIcon(pos,.item.icon)...if.(item
a060 2e 72 6f 6c 65 29 20 74 68 69 73 2e 73 65 74 52 6f 6c 65 28 70 6f 73 2c 20 69 74 65 6d 2e 72 6f .role).this.setRole(pos,.item.ro
a080 6c 65 29 0a 0a 20 20 2f 2f 20 4d 61 6b 65 20 6d 65 6e 75 20 61 63 63 65 73 73 61 62 6c 65 20 74 le)....//.Make.menu.accessable.t
a0a0 6f 20 69 74 65 6d 73 2e 0a 20 20 69 74 65 6d 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 o.items....item.overrideReadOnly
a0c0 50 72 6f 70 65 72 74 79 28 27 6d 65 6e 75 27 2c 20 74 68 69 73 29 0a 0a 20 20 2f 2f 20 52 65 6d Property('menu',.this)....//.Rem
a0e0 65 6d 62 65 72 20 74 68 65 20 69 74 65 6d 73 2e 0a 20 20 74 68 69 73 2e 69 74 65 6d 73 2e 73 70 ember.the.items....this.items.sp
a100 6c 69 63 65 28 70 6f 73 2c 20 30 2c 20 69 74 65 6d 29 0a 20 20 74 68 69 73 2e 63 6f 6d 6d 61 6e lice(pos,.0,.item)...this.comman
a120 64 73 4d 61 70 5b 69 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 5d 20 3d 20 69 74 65 6d 0a 7d 0a 0a dsMap[item.commandId].=.item.}..
a140 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 63 61 6c 6c 4d 65 6e 75 57 69 6c 6c 53 68 6f 77 Menu.prototype._callMenuWillShow
a160 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 69 66 20 28 74 68 69 73 2e 64 65 6c 65 .=.function.().{...if.(this.dele
a180 67 61 74 65 29 20 74 68 69 73 2e 64 65 6c 65 67 61 74 65 2e 6d 65 6e 75 57 69 6c 6c 53 68 6f 77 gate).this.delegate.menuWillShow
a1a0 28 29 0a 20 20 74 68 69 73 2e 69 74 65 6d 73 2e 66 6f 72 45 61 63 68 28 69 74 65 6d 20 3d 3e 20 ()...this.items.forEach(item.=>.
a1c0 7b 0a 20 20 20 20 69 66 20 28 69 74 65 6d 2e 73 75 62 6d 65 6e 75 29 20 69 74 65 6d 2e 73 75 62 {.....if.(item.submenu).item.sub
a1e0 6d 65 6e 75 2e 5f 63 61 6c 6c 4d 65 6e 75 57 69 6c 6c 53 68 6f 77 28 29 0a 20 20 7d 29 0a 7d 0a menu._callMenuWillShow()...}).}.
a200 0a 2f 2a 20 53 74 61 74 69 63 20 4d 65 74 68 6f 64 73 20 2a 2f 0a 0a 4d 65 6e 75 2e 67 65 74 41 ./*.Static.Methods.*/..Menu.getA
a220 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 20 3d 20 28 29 20 3d 3e 20 61 70 70 6c 69 63 61 74 69 pplicationMenu.=.().=>.applicati
a240 6f 6e 4d 65 6e 75 0a 0a 4d 65 6e 75 2e 73 65 6e 64 41 63 74 69 6f 6e 54 6f 46 69 72 73 74 52 65 onMenu..Menu.sendActionToFirstRe
a260 73 70 6f 6e 64 65 72 20 3d 20 62 69 6e 64 69 6e 67 73 2e 73 65 6e 64 41 63 74 69 6f 6e 54 6f 46 sponder.=.bindings.sendActionToF
a280 69 72 73 74 52 65 73 70 6f 6e 64 65 72 0a 0a 2f 2f 20 73 65 74 20 61 70 70 6c 69 63 61 74 69 6f irstResponder..//.set.applicatio
a2a0 6e 20 6d 65 6e 75 20 77 69 74 68 20 61 20 70 72 65 65 78 69 73 74 69 6e 67 20 6d 65 6e 75 0a 4d n.menu.with.a.preexisting.menu.M
a2c0 65 6e 75 2e 73 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 20 3d 20 66 75 6e 63 74 69 6f enu.setApplicationMenu.=.functio
a2e0 6e 20 28 6d 65 6e 75 29 20 7b 0a 20 20 69 66 20 28 6d 65 6e 75 20 26 26 20 6d 65 6e 75 2e 63 6f n.(menu).{...if.(menu.&&.menu.co
a300 6e 73 74 72 75 63 74 6f 72 20 21 3d 3d 20 4d 65 6e 75 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 nstructor.!==.Menu).{.....throw.
a320 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 20 6d 65 6e 75 27 29 0a 20 20 new.TypeError('Invalid.menu')...
a340 7d 0a 0a 20 20 61 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 20 3d 20 6d 65 6e 75 0a 20 20 69 66 }....applicationMenu.=.menu...if
a360 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 29 .(process.platform.===.'darwin')
a380 20 7b 0a 20 20 20 20 69 66 20 28 21 6d 65 6e 75 29 20 72 65 74 75 72 6e 0a 20 20 20 20 6d 65 6e .{.....if.(!menu).return.....men
a3a0 75 2e 5f 63 61 6c 6c 4d 65 6e 75 57 69 6c 6c 53 68 6f 77 28 29 0a 20 20 20 20 62 69 6e 64 69 6e u._callMenuWillShow().....bindin
a3c0 67 73 2e 73 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 28 6d 65 6e 75 29 0a 20 20 7d 20 gs.setApplicationMenu(menu)...}.
a3e0 65 6c 73 65 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 77 69 6e 64 6f 77 73 20 3d 20 42 72 6f 77 73 else.{.....const.windows.=.Brows
a400 65 72 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 28 29 0a 20 20 20 20 72 65 74 erWindow.getAllWindows().....ret
a420 75 72 6e 20 77 69 6e 64 6f 77 73 2e 6d 61 70 28 77 20 3d 3e 20 77 2e 73 65 74 4d 65 6e 75 28 6d urn.windows.map(w.=>.w.setMenu(m
a440 65 6e 75 29 29 0a 20 20 7d 0a 7d 0a 0a 4d 65 6e 75 2e 62 75 69 6c 64 46 72 6f 6d 54 65 6d 70 6c enu))...}.}..Menu.buildFromTempl
a460 61 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 74 65 6d 70 6c 61 74 65 29 20 7b 0a 20 20 69 66 ate.=.function.(template).{...if
a480 20 28 21 28 74 65 6d 70 6c 61 74 65 20 69 6e 73 74 61 6e 63 65 6f 66 20 41 72 72 61 79 29 29 20 .(!(template.instanceof.Array)).
a4a0 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 49 6e 76 61 6c {.....throw.new.TypeError('Inval
a4c0 69 64 20 74 65 6d 70 6c 61 74 65 20 66 6f 72 20 4d 65 6e 75 27 29 0a 20 20 7d 0a 0a 20 20 63 6f id.template.for.Menu')...}....co
a4e0 6e 73 74 20 6d 65 6e 75 20 3d 20 6e 65 77 20 4d 65 6e 75 28 29 0a 20 20 63 6f 6e 73 74 20 70 6f nst.menu.=.new.Menu()...const.po
a500 73 69 74 69 6f 6e 65 64 20 3d 20 5b 5d 0a 20 20 6c 65 74 20 69 64 78 20 3d 20 30 0a 0a 20 20 2f sitioned.=.[]...let.idx.=.0..../
a520 2f 20 73 6f 72 74 20 74 65 6d 70 6c 61 74 65 20 62 79 20 70 6f 73 69 74 69 6f 6e 0a 20 20 74 65 /.sort.template.by.position...te
a540 6d 70 6c 61 74 65 2e 66 6f 72 45 61 63 68 28 69 74 65 6d 20 3d 3e 20 7b 0a 20 20 20 20 69 64 78 mplate.forEach(item.=>.{.....idx
a560 20 3d 20 28 69 74 65 6d 2e 70 6f 73 69 74 69 6f 6e 29 20 3f 20 69 6e 64 65 78 54 6f 49 6e 73 65 .=.(item.position).?.indexToInse
a580 72 74 42 79 50 6f 73 69 74 69 6f 6e 28 70 6f 73 69 74 69 6f 6e 65 64 2c 20 69 74 65 6d 2e 70 6f rtByPosition(positioned,.item.po
a5a0 73 69 74 69 6f 6e 29 20 3a 20 69 64 78 20 2b 3d 20 31 0a 20 20 20 20 70 6f 73 69 74 69 6f 6e 65 sition).:.idx.+=.1.....positione
a5c0 64 2e 73 70 6c 69 63 65 28 69 64 78 2c 20 30 2c 20 69 74 65 6d 29 0a 20 20 7d 29 0a 0a 20 20 2f d.splice(idx,.0,.item)...})..../
a5e0 2f 20 61 64 64 20 65 61 63 68 20 69 74 65 6d 20 66 72 6f 6d 20 70 6f 73 69 74 69 6f 6e 65 64 20 /.add.each.item.from.positioned.
a600 6d 65 6e 75 20 74 6f 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6d 65 6e 75 0a 20 20 70 6f 73 69 74 menu.to.application.menu...posit
a620 69 6f 6e 65 64 2e 66 6f 72 45 61 63 68 28 28 69 74 65 6d 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 ioned.forEach((item).=>.{.....if
a640 20 28 74 79 70 65 6f 66 20 69 74 65 6d 20 21 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 .(typeof.item.!==.'object').{...
a660 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 ....throw.new.TypeError('Invalid
a680 20 74 65 6d 70 6c 61 74 65 20 66 6f 72 20 4d 65 6e 75 49 74 65 6d 27 29 0a 20 20 20 20 7d 0a 20 .template.for.MenuItem').....}..
a6a0 20 20 20 6d 65 6e 75 2e 61 70 70 65 6e 64 28 6e 65 77 20 4d 65 6e 75 49 74 65 6d 28 69 74 65 6d ...menu.append(new.MenuItem(item
a6c0 29 29 0a 20 20 7d 29 0a 0a 20 20 72 65 74 75 72 6e 20 6d 65 6e 75 0a 7d 0a 0a 2f 2a 20 48 65 6c ))...})....return.menu.}../*.Hel
a6e0 70 65 72 20 46 75 6e 63 74 69 6f 6e 73 20 2a 2f 0a 0a 2f 2f 20 53 65 61 72 63 68 20 62 65 74 77 per.Functions.*/..//.Search.betw
a700 65 65 6e 20 73 65 70 61 72 61 74 6f 72 73 20 74 6f 20 66 69 6e 64 20 61 20 72 61 64 69 6f 20 6d een.separators.to.find.a.radio.m
a720 65 6e 75 20 69 74 65 6d 20 61 6e 64 20 72 65 74 75 72 6e 20 69 74 73 20 67 72 6f 75 70 20 69 64 enu.item.and.return.its.group.id
a740 0a 66 75 6e 63 74 69 6f 6e 20 67 65 6e 65 72 61 74 65 47 72 6f 75 70 49 64 20 28 69 74 65 6d 73 .function.generateGroupId.(items
a760 2c 20 70 6f 73 29 20 7b 0a 20 20 69 66 20 28 70 6f 73 20 3e 20 30 29 20 7b 0a 20 20 20 20 66 6f ,.pos).{...if.(pos.>.0).{.....fo
a780 72 20 28 6c 65 74 20 69 64 78 20 3d 20 70 6f 73 20 2d 20 31 3b 20 69 64 78 20 3e 3d 20 30 3b 20 r.(let.idx.=.pos.-.1;.idx.>=.0;.
a7a0 69 64 78 2d 2d 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 69 74 65 6d 73 5b 69 64 78 5d 2e 74 79 idx--).{.......if.(items[idx].ty
a7c0 70 65 20 3d 3d 3d 20 27 72 61 64 69 6f 27 29 20 72 65 74 75 72 6e 20 69 74 65 6d 73 5b 69 64 78 pe.===.'radio').return.items[idx
a7e0 5d 2e 67 72 6f 75 70 49 64 0a 20 20 20 20 20 20 69 66 20 28 69 74 65 6d 73 5b 69 64 78 5d 2e 74 ].groupId.......if.(items[idx].t
a800 79 70 65 20 3d 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 29 20 62 72 65 61 6b 0a 20 20 20 20 7d ype.===.'separator').break.....}
a820 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 70 6f 73 20 3c 20 69 74 65 6d 73 2e 6c 65 6e 67 74 68 ...}.else.if.(pos.<.items.length
a840 29 20 7b 0a 20 20 20 20 66 6f 72 20 28 6c 65 74 20 69 64 78 20 3d 20 70 6f 73 3b 20 69 64 78 20 ).{.....for.(let.idx.=.pos;.idx.
a860 3c 3d 20 69 74 65 6d 73 2e 6c 65 6e 67 74 68 20 2d 20 31 3b 20 69 64 78 2b 2b 29 20 7b 0a 20 20 <=.items.length.-.1;.idx++).{...
a880 20 20 20 20 69 66 20 28 69 74 65 6d 73 5b 69 64 78 5d 2e 74 79 70 65 20 3d 3d 3d 20 27 72 61 64 ....if.(items[idx].type.===.'rad
a8a0 69 6f 27 29 20 72 65 74 75 72 6e 20 69 74 65 6d 73 5b 69 64 78 5d 2e 67 72 6f 75 70 49 64 0a 20 io').return.items[idx].groupId..
a8c0 20 20 20 20 20 69 66 20 28 69 74 65 6d 73 5b 69 64 78 5d 2e 74 79 70 65 20 3d 3d 3d 20 27 73 65 .....if.(items[idx].type.===.'se
a8e0 70 61 72 61 74 6f 72 27 29 20 62 72 65 61 6b 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 67 72 6f 75 parator').break.....}...}...grou
a900 70 49 64 49 6e 64 65 78 20 2b 3d 20 31 0a 20 20 72 65 74 75 72 6e 20 67 72 6f 75 70 49 64 49 6e pIdIndex.+=.1...return.groupIdIn
a920 64 65 78 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 69 6e 64 65 78 4f 66 49 74 65 6d 42 79 49 64 20 dex.}..function.indexOfItemById.
a940 28 69 74 65 6d 73 2c 20 69 64 29 20 7b 0a 20 20 63 6f 6e 73 74 20 66 6f 75 6e 64 49 74 65 6d 20 (items,.id).{...const.foundItem.
a960 3d 20 69 74 65 6d 73 2e 66 69 6e 64 28 69 74 65 6d 20 3d 3e 20 69 74 65 6d 2e 69 64 20 3d 3d 3d =.items.find(item.=>.item.id.===
a980 20 69 64 29 20 7c 7c 20 2d 31 0a 20 20 72 65 74 75 72 6e 20 69 74 65 6d 73 2e 69 6e 64 65 78 4f .id).||.-1...return.items.indexO
a9a0 66 28 66 6f 75 6e 64 49 74 65 6d 29 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 69 6e 64 65 78 54 6f f(foundItem).}..function.indexTo
a9c0 49 6e 73 65 72 74 42 79 50 6f 73 69 74 69 6f 6e 20 28 69 74 65 6d 73 2c 20 70 6f 73 69 74 69 6f InsertByPosition.(items,.positio
a9e0 6e 29 20 7b 0a 20 20 69 66 20 28 21 70 6f 73 69 74 69 6f 6e 29 20 72 65 74 75 72 6e 20 69 74 65 n).{...if.(!position).return.ite
aa00 6d 73 2e 6c 65 6e 67 74 68 0a 0a 20 20 63 6f 6e 73 74 20 5b 71 75 65 72 79 2c 20 69 64 5d 20 3d ms.length....const.[query,.id].=
aa20 20 70 6f 73 69 74 69 6f 6e 2e 73 70 6c 69 74 28 27 3d 27 29 20 2f 2f 20 70 61 72 73 65 20 71 75 .position.split('=').//.parse.qu
aa40 65 72 79 20 61 6e 64 20 69 64 20 66 72 6f 6d 20 70 6f 73 69 74 69 6f 6e 0a 20 20 63 6f 6e 73 74 ery.and.id.from.position...const
aa60 20 69 64 78 20 3d 20 69 6e 64 65 78 4f 66 49 74 65 6d 42 79 49 64 28 69 74 65 6d 73 2c 20 69 64 .idx.=.indexOfItemById(items,.id
aa80 29 20 2f 2f 20 63 61 6c 63 75 6c 61 74 65 20 69 6e 69 74 69 61 6c 20 69 6e 64 65 78 20 6f 66 20 ).//.calculate.initial.index.of.
aaa0 69 74 65 6d 0a 0a 20 20 2f 2f 20 77 61 72 6e 20 69 66 20 71 75 65 72 79 20 64 6f 65 73 6e 27 74 item....//.warn.if.query.doesn't
aac0 20 65 78 69 73 74 0a 20 20 69 66 20 28 69 64 78 20 3d 3d 3d 20 2d 31 20 26 26 20 71 75 65 72 79 .exist...if.(idx.===.-1.&&.query
aae0 20 21 3d 3d 20 27 65 6e 64 6f 66 27 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e .!==.'endof').{.....console.warn
ab00 28 60 49 74 65 6d 20 77 69 74 68 20 69 64 20 24 7b 69 64 7d 20 69 73 20 6e 6f 74 20 66 6f 75 6e (`Item.with.id.${id}.is.not.foun
ab20 64 60 29 0a 20 20 20 20 72 65 74 75 72 6e 20 69 74 65 6d 73 2e 6c 65 6e 67 74 68 0a 20 20 7d 0a d`).....return.items.length...}.
ab40 0a 20 20 2f 2f 20 63 6f 6d 70 75 74 65 20 6e 65 77 20 69 6e 64 65 78 20 62 61 73 65 64 20 6f 6e ...//.compute.new.index.based.on
ab60 20 71 75 65 72 79 0a 20 20 63 6f 6e 73 74 20 71 75 65 72 69 65 73 20 3d 20 7b 0a 20 20 20 20 61 .query...const.queries.=.{.....a
ab80 66 74 65 72 3a 20 28 69 6e 64 65 78 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 6e 64 65 78 20 2b fter:.(index).=>.{.......index.+
aba0 3d 20 31 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 69 6e 64 65 78 0a 20 20 20 20 7d 2c 0a 20 20 =.1.......return.index.....},...
abc0 20 20 65 6e 64 6f 66 3a 20 28 69 6e 64 65 78 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 66 20 28 ..endof:.(index).=>.{.......if.(
abe0 69 6e 64 65 78 20 3d 3d 3d 20 2d 31 29 20 7b 0a 20 20 20 20 20 20 20 20 69 74 65 6d 73 2e 70 75 index.===.-1).{.........items.pu
ac00 73 68 28 7b 69 64 2c 20 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 7d 29 0a 20 20 20 20 sh({id,.type:.'separator'}).....
ac20 20 20 20 20 69 6e 64 65 78 20 3d 20 69 74 65 6d 73 2e 6c 65 6e 67 74 68 20 2d 20 31 0a 20 20 20 ....index.=.items.length.-.1....
ac40 20 20 20 7d 0a 0a 20 20 20 20 20 20 69 6e 64 65 78 20 2b 3d 20 31 0a 20 20 20 20 20 20 77 68 69 ...}........index.+=.1.......whi
ac60 6c 65 20 28 69 6e 64 65 78 20 3c 20 69 74 65 6d 73 2e 6c 65 6e 67 74 68 20 26 26 20 69 74 65 6d le.(index.<.items.length.&&.item
ac80 73 5b 69 6e 64 65 78 5d 2e 74 79 70 65 20 21 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 29 20 69 s[index].type.!==.'separator').i
aca0 6e 64 65 78 20 2b 3d 20 31 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 69 6e 64 65 78 0a 20 20 20 ndex.+=.1.......return.index....
acc0 20 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 72 65 74 75 72 6e 20 6e 65 77 20 69 6e 64 65 78 20 69 66 .}...}....//.return.new.index.if
ace0 20 6e 65 65 64 65 64 2c 20 6f 72 20 6f 72 69 67 69 6e 61 6c 20 69 6e 64 65 78 4f 66 49 74 65 6d .needed,.or.original.indexOfItem
ad00 42 79 49 64 0a 20 20 72 65 74 75 72 6e 20 28 71 75 65 72 79 20 69 6e 20 71 75 65 72 69 65 73 29 ById...return.(query.in.queries)
ad20 20 3f 20 71 75 65 72 69 65 73 5b 71 75 65 72 79 5d 28 69 64 78 29 20 3a 20 69 64 78 0a 7d 0a 0a .?.queries[query](idx).:.idx.}..
ad40 66 75 6e 63 74 69 6f 6e 20 69 6e 73 65 72 74 49 74 65 6d 42 79 54 79 70 65 20 28 69 74 65 6d 2c function.insertItemByType.(item,
ad60 20 70 6f 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 74 79 70 65 73 20 3d 20 7b 0a 20 20 20 20 6e 6f .pos).{...const.types.=.{.....no
ad80 72 6d 61 6c 3a 20 28 29 20 3d 3e 20 74 68 69 73 2e 69 6e 73 65 72 74 49 74 65 6d 28 70 6f 73 2c rmal:.().=>.this.insertItem(pos,
ada0 20 69 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 2c 20 69 74 65 6d 2e 6c 61 62 65 6c 29 2c 0a 20 20 .item.commandId,.item.label),...
adc0 20 20 63 68 65 63 6b 62 6f 78 3a 20 28 29 20 3d 3e 20 74 68 69 73 2e 69 6e 73 65 72 74 43 68 65 ..checkbox:.().=>.this.insertChe
ade0 63 6b 49 74 65 6d 28 70 6f 73 2c 20 69 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 2c 20 69 74 65 6d ckItem(pos,.item.commandId,.item
ae00 2e 6c 61 62 65 6c 29 2c 0a 20 20 20 20 73 65 70 61 72 61 74 6f 72 3a 20 28 29 20 3d 3e 20 74 68 .label),.....separator:.().=>.th
ae20 69 73 2e 69 6e 73 65 72 74 53 65 70 61 72 61 74 6f 72 28 70 6f 73 29 2c 0a 20 20 20 20 73 75 62 is.insertSeparator(pos),.....sub
ae40 6d 65 6e 75 3a 20 28 29 20 3d 3e 20 74 68 69 73 2e 69 6e 73 65 72 74 53 75 62 4d 65 6e 75 28 70 menu:.().=>.this.insertSubMenu(p
ae60 6f 73 2c 20 69 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 2c 20 69 74 65 6d 2e 6c 61 62 65 6c 2c 20 os,.item.commandId,.item.label,.
ae80 69 74 65 6d 2e 73 75 62 6d 65 6e 75 29 2c 0a 20 20 20 20 72 61 64 69 6f 3a 20 28 29 20 3d 3e 20 item.submenu),.....radio:.().=>.
aea0 7b 0a 20 20 20 20 20 20 2f 2f 20 47 72 6f 75 70 69 6e 67 20 72 61 64 69 6f 20 6d 65 6e 75 20 69 {.......//.Grouping.radio.menu.i
aec0 74 65 6d 73 0a 20 20 20 20 20 20 69 74 65 6d 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 tems.......item.overrideReadOnly
aee0 50 72 6f 70 65 72 74 79 28 27 67 72 6f 75 70 49 64 27 2c 20 67 65 6e 65 72 61 74 65 47 72 6f 75 Property('groupId',.generateGrou
af00 70 49 64 28 74 68 69 73 2e 69 74 65 6d 73 2c 20 70 6f 73 29 29 0a 20 20 20 20 20 20 69 66 20 28 pId(this.items,.pos)).......if.(
af20 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 74 65 6d 2e 67 72 6f 75 70 49 64 5d 20 3d 3d 20 this.groupsMap[item.groupId].==.
af40 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 null).{.........this.groupsMap[i
af60 74 65 6d 2e 67 72 6f 75 70 49 64 5d 20 3d 20 5b 5d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 tem.groupId].=.[].......}.......
af80 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 74 65 6d 2e 67 72 6f 75 70 49 64 5d 2e 70 75 73 this.groupsMap[item.groupId].pus
afa0 68 28 69 74 65 6d 29 0a 0a 20 20 20 20 20 20 2f 2f 20 53 65 74 74 69 6e 67 20 61 20 72 61 64 69 h(item)........//.Setting.a.radi
afc0 6f 20 6d 65 6e 75 20 69 74 65 6d 20 73 68 6f 75 6c 64 20 66 6c 69 70 20 6f 74 68 65 72 20 69 74 o.menu.item.should.flip.other.it
afe0 65 6d 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 2e 0a 20 20 20 20 20 20 76 38 55 74 69 6c 2e 73 ems.in.the.group........v8Util.s
b000 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 69 74 65 6d 2c 20 27 63 68 65 63 6b 65 64 27 2c 20 69 etHiddenValue(item,.'checked',.i
b020 74 65 6d 2e 63 68 65 63 6b 65 64 29 0a 20 20 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 tem.checked).......Object.define
b040 50 72 6f 70 65 72 74 79 28 69 74 65 6d 2c 20 27 63 68 65 63 6b 65 64 27 2c 20 7b 0a 20 20 20 20 Property(item,.'checked',.{.....
b060 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 20 20 67 65 ....enumerable:.true,.........ge
b080 74 3a 20 28 29 20 3d 3e 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 69 t:.().=>.v8Util.getHiddenValue(i
b0a0 74 65 6d 2c 20 27 63 68 65 63 6b 65 64 27 29 2c 0a 20 20 20 20 20 20 20 20 73 65 74 3a 20 28 29 tem,.'checked'),.........set:.()
b0c0 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 .=>.{...........this.groupsMap[i
b0e0 74 65 6d 2e 67 72 6f 75 70 49 64 5d 2e 66 6f 72 45 61 63 68 28 6f 74 68 65 72 20 3d 3e 20 7b 0a tem.groupId].forEach(other.=>.{.
b100 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6f 74 68 65 72 20 21 3d 3d 20 69 74 65 6d 29 20 ............if.(other.!==.item).
b120 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 6f 74 68 65 72 2c 20 27 63 68 v8Util.setHiddenValue(other,.'ch
b140 65 63 6b 65 64 27 2c 20 66 61 6c 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 20 ecked',.false)...........}).....
b160 20 20 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 69 74 65 6d ......v8Util.setHiddenValue(item
b180 2c 20 27 63 68 65 63 6b 65 64 27 2c 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 ,.'checked',.true).........}....
b1a0 20 20 20 7d 29 0a 20 20 20 20 20 20 74 68 69 73 2e 69 6e 73 65 72 74 52 61 64 69 6f 49 74 65 6d ...}).......this.insertRadioItem
b1c0 28 70 6f 73 2c 20 69 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 2c 20 69 74 65 6d 2e 6c 61 62 65 6c (pos,.item.commandId,.item.label
b1e0 2c 20 69 74 65 6d 2e 67 72 6f 75 70 49 64 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 74 79 70 65 ,.item.groupId).....}...}...type
b200 73 5b 69 74 65 6d 2e 74 79 70 65 5d 28 29 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 s[item.type]().}..module.exports
b220 20 3d 20 4d 65 6e 75 0a 2f 2f 20 42 72 6f 77 73 65 72 20 73 69 64 65 20 6d 6f 64 75 6c 65 73 2c .=.Menu.//.Browser.side.modules,
b240 20 70 6c 65 61 73 65 20 73 6f 72 74 20 61 6c 70 68 61 62 65 74 69 63 61 6c 6c 79 2e 0a 6d 6f 64 .please.sort.alphabetically..mod
b260 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 5b 0a 20 20 7b 6e 61 6d 65 3a 20 27 61 70 70 27 2c 20 ule.exports.=.[...{name:.'app',.
b280 66 69 6c 65 3a 20 27 61 70 70 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 61 75 74 6f 55 70 64 61 file:.'app'},...{name:.'autoUpda
b2a0 74 65 72 27 2c 20 66 69 6c 65 3a 20 27 61 75 74 6f 2d 75 70 64 61 74 65 72 27 7d 2c 0a 20 20 7b ter',.file:.'auto-updater'},...{
b2c0 6e 61 6d 65 3a 20 27 42 72 6f 77 73 65 72 56 69 65 77 27 2c 20 66 69 6c 65 3a 20 27 62 72 6f 77 name:.'BrowserView',.file:.'brow
b2e0 73 65 72 2d 76 69 65 77 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 42 72 6f 77 73 65 72 57 69 6e ser-view'},...{name:.'BrowserWin
b300 64 6f 77 27 2c 20 66 69 6c 65 3a 20 27 62 72 6f 77 73 65 72 2d 77 69 6e 64 6f 77 27 7d 2c 0a 20 dow',.file:.'browser-window'},..
b320 20 7b 6e 61 6d 65 3a 20 27 63 6f 6e 74 65 6e 74 54 72 61 63 69 6e 67 27 2c 20 66 69 6c 65 3a 20 .{name:.'contentTracing',.file:.
b340 27 63 6f 6e 74 65 6e 74 2d 74 72 61 63 69 6e 67 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 64 69 'content-tracing'},...{name:.'di
b360 61 6c 6f 67 27 2c 20 66 69 6c 65 3a 20 27 64 69 61 6c 6f 67 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a alog',.file:.'dialog'},...{name:
b380 20 27 67 6c 6f 62 61 6c 53 68 6f 72 74 63 75 74 27 2c 20 66 69 6c 65 3a 20 27 67 6c 6f 62 61 6c .'globalShortcut',.file:.'global
b3a0 2d 73 68 6f 72 74 63 75 74 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 69 70 63 4d 61 69 6e 27 2c -shortcut'},...{name:.'ipcMain',
b3c0 20 66 69 6c 65 3a 20 27 69 70 63 2d 6d 61 69 6e 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 4d 65 .file:.'ipc-main'},...{name:.'Me
b3e0 6e 75 27 2c 20 66 69 6c 65 3a 20 27 6d 65 6e 75 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 4d 65 nu',.file:.'menu'},...{name:.'Me
b400 6e 75 49 74 65 6d 27 2c 20 66 69 6c 65 3a 20 27 6d 65 6e 75 2d 69 74 65 6d 27 7d 2c 0a 20 20 7b nuItem',.file:.'menu-item'},...{
b420 6e 61 6d 65 3a 20 27 6e 65 74 27 2c 20 66 69 6c 65 3a 20 27 6e 65 74 27 7d 2c 0a 20 20 7b 6e 61 name:.'net',.file:.'net'},...{na
b440 6d 65 3a 20 27 4e 6f 74 69 66 69 63 61 74 69 6f 6e 27 2c 20 66 69 6c 65 3a 20 27 6e 6f 74 69 66 me:.'Notification',.file:.'notif
b460 69 63 61 74 69 6f 6e 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 70 6f 77 65 72 4d 6f 6e 69 74 6f ication'},...{name:.'powerMonito
b480 72 27 2c 20 66 69 6c 65 3a 20 27 70 6f 77 65 72 2d 6d 6f 6e 69 74 6f 72 27 7d 2c 0a 20 20 7b 6e r',.file:.'power-monitor'},...{n
b4a0 61 6d 65 3a 20 27 70 6f 77 65 72 53 61 76 65 42 6c 6f 63 6b 65 72 27 2c 20 66 69 6c 65 3a 20 27 ame:.'powerSaveBlocker',.file:.'
b4c0 70 6f 77 65 72 2d 73 61 76 65 2d 62 6c 6f 63 6b 65 72 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 power-save-blocker'},...{name:.'
b4e0 70 72 6f 74 6f 63 6f 6c 27 2c 20 66 69 6c 65 3a 20 27 70 72 6f 74 6f 63 6f 6c 27 7d 2c 0a 20 20 protocol',.file:.'protocol'},...
b500 7b 6e 61 6d 65 3a 20 27 73 63 72 65 65 6e 27 2c 20 66 69 6c 65 3a 20 27 73 63 72 65 65 6e 27 7d {name:.'screen',.file:.'screen'}
b520 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 73 65 73 73 69 6f 6e 27 2c 20 66 69 6c 65 3a 20 27 73 65 73 ,...{name:.'session',.file:.'ses
b540 73 69 6f 6e 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 73 79 73 74 65 6d 50 72 65 66 65 72 65 6e sion'},...{name:.'systemPreferen
b560 63 65 73 27 2c 20 66 69 6c 65 3a 20 27 73 79 73 74 65 6d 2d 70 72 65 66 65 72 65 6e 63 65 73 27 ces',.file:.'system-preferences'
b580 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 54 6f 75 63 68 42 61 72 27 2c 20 66 69 6c 65 3a 20 27 74 },...{name:.'TouchBar',.file:.'t
b5a0 6f 75 63 68 2d 62 61 72 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 54 72 61 79 27 2c 20 66 69 6c ouch-bar'},...{name:.'Tray',.fil
b5c0 65 3a 20 27 74 72 61 79 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 77 65 62 43 6f 6e 74 65 6e 74 e:.'tray'},...{name:.'webContent
b5e0 73 27 2c 20 66 69 6c 65 3a 20 27 77 65 62 2d 63 6f 6e 74 65 6e 74 73 27 7d 2c 0a 20 20 2f 2f 20 s',.file:.'web-contents'},...//.
b600 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 6d 6f 64 75 6c 65 73 2c 20 69 6e 76 69 73 69 62 6c 65 20 The.internal.modules,.invisible.
b620 75 6e 6c 65 73 73 20 79 6f 75 20 6b 6e 6f 77 20 74 68 65 69 72 20 6e 61 6d 65 73 2e 0a 20 20 7b unless.you.know.their.names....{
b640 6e 61 6d 65 3a 20 27 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 27 2c 20 66 69 name:.'NavigationController',.fi
b660 6c 65 3a 20 27 6e 61 76 69 67 61 74 69 6f 6e 2d 63 6f 6e 74 72 6f 6c 6c 65 72 27 2c 20 70 72 69 le:.'navigation-controller',.pri
b680 76 61 74 65 3a 20 74 72 75 65 7d 0a 5d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 vate:.true}.].'use.strict'..cons
b6a0 74 20 7b 69 70 63 4d 61 69 6e 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 t.{ipcMain}.=.require('electron'
b6c0 29 0a 0a 2f 2f 20 54 68 65 20 68 69 73 74 6f 72 79 20 6f 70 65 72 61 74 69 6f 6e 20 69 6e 20 72 )..//.The.history.operation.in.r
b6e0 65 6e 64 65 72 65 72 20 69 73 20 72 65 64 69 72 65 63 74 65 64 20 74 6f 20 62 72 6f 77 73 65 72 enderer.is.redirected.to.browser
b700 2e 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 4e 41 56 49 47 41 54 49 4f ..ipcMain.on('ELECTRON_NAVIGATIO
b720 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 N_CONTROLLER',.function.(event,.
b740 6d 65 74 68 6f 64 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 method,....args).{...event.sende
b760 72 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f r[method](...args).})..ipcMain.o
b780 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 53 59 4e 43 5f 4e 41 56 49 47 41 54 49 4f 4e 5f 43 4f 4e 54 n('ELECTRON_SYNC_NAVIGATION_CONT
b7a0 52 4f 4c 4c 45 52 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 6d 65 74 68 6f 64 ROLLER',.function.(event,.method
b7c0 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 ,....args).{...event.returnValue
b7e0 20 3d 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 29 .=.event.sender[method](...args)
b800 0a 7d 29 0a 0a 2f 2f 20 4a 61 76 61 53 63 72 69 70 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f .})..//.JavaScript.implementatio
b820 6e 20 6f 66 20 43 68 72 6f 6d 69 75 6d 27 73 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f n.of.Chromium's.NavigationContro
b840 6c 6c 65 72 2e 0a 2f 2f 20 49 6e 73 74 65 61 64 20 6f 66 20 72 65 6c 79 69 6e 67 20 6f 6e 20 43 ller..//.Instead.of.relying.on.C
b860 68 72 6f 6d 69 75 6d 20 66 6f 72 20 68 69 73 74 6f 72 79 20 63 6f 6e 74 72 6f 6c 2c 20 77 65 20 hromium.for.history.control,.we.
b880 63 6f 6d 70 65 6c 65 74 65 6c 79 20 64 6f 20 68 69 73 74 6f 72 79 0a 2f 2f 20 63 6f 6e 74 72 6f compeletely.do.history.//.contro
b8a0 6c 20 6f 6e 20 75 73 65 72 20 6c 61 6e 64 2c 20 61 6e 64 20 6f 6e 6c 79 20 72 65 6c 79 20 6f 6e l.on.user.land,.and.only.rely.on
b8c0 20 57 65 62 43 6f 6e 74 65 6e 74 73 2e 6c 6f 61 64 55 52 4c 20 66 6f 72 20 6e 61 76 69 67 61 74 .WebContents.loadURL.for.navigat
b8e0 69 6f 6e 2e 0a 2f 2f 20 54 68 69 73 20 68 65 6c 70 73 20 75 73 20 61 76 6f 69 64 20 43 68 72 6f ion..//.This.helps.us.avoid.Chro
b900 6d 69 75 6d 27 73 20 76 61 72 69 6f 75 73 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 73 20 73 6f 20 mium's.various.optimizations.so.
b920 77 65 20 63 61 6e 20 65 6e 73 75 72 65 20 72 65 6e 64 65 72 65 72 0a 2f 2f 20 70 72 6f 63 65 73 we.can.ensure.renderer.//.proces
b940 73 20 69 73 20 72 65 73 74 61 72 74 65 64 20 65 76 65 72 79 74 69 6d 65 2e 0a 76 61 72 20 4e 61 s.is.restarted.everytime..var.Na
b960 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 20 3d 20 28 66 75 6e 63 74 69 6f 6e 20 28 vigationController.=.(function.(
b980 29 20 7b 0a 20 20 66 75 6e 63 74 69 6f 6e 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c ).{...function.NavigationControl
b9a0 6c 65 72 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 77 65 62 ler.(webContents).{.....this.web
b9c0 43 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 0a 20 20 20 20 74 68 69 73 2e Contents.=.webContents.....this.
b9e0 63 6c 65 61 72 48 69 73 74 6f 72 79 28 29 0a 0a 20 20 20 20 2f 2f 20 77 65 62 43 6f 6e 74 65 6e clearHistory()......//.webConten
ba00 74 73 20 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 6e 61 76 69 67 61 74 65 64 20 74 6f ts.may.have.already.navigated.to
ba20 20 61 20 70 61 67 65 2e 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 .a.page......if.(this.webContent
ba40 73 2e 5f 67 65 74 55 52 4c 28 29 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 63 75 72 72 65 6e s._getURL()).{.......this.curren
ba60 74 49 6e 64 65 78 2b 2b 0a 20 20 20 20 20 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 70 75 73 68 tIndex++.......this.history.push
ba80 28 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 67 65 74 55 52 4c 28 29 29 0a 20 20 20 (this.webContents._getURL())....
baa0 20 7d 0a 20 20 20 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 6e 61 76 69 .}.....this.webContents.on('navi
bac0 67 61 74 69 6f 6e 2d 65 6e 74 72 79 2d 63 6f 6d 6d 69 74 65 64 27 2c 20 28 65 76 65 6e 74 2c 20 gation-entry-commited',.(event,.
bae0 75 72 6c 2c 20 69 6e 50 61 67 65 2c 20 72 65 70 6c 61 63 65 45 6e 74 72 79 29 20 3d 3e 20 7b 0a url,.inPage,.replaceEntry).=>.{.
bb00 20 20 20 20 20 20 69 66 20 28 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 20 3e 20 2d 31 20 ......if.(this.inPageIndex.>.-1.
bb20 26 26 20 21 69 6e 50 61 67 65 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 4e 61 76 69 67 61 74 &&.!inPage).{.........//.Navigat
bb40 65 64 20 74 6f 20 61 20 6e 65 77 20 70 61 67 65 2c 20 63 6c 65 61 72 20 69 6e 2d 70 61 67 65 20 ed.to.a.new.page,.clear.in-page.
bb60 6d 61 72 6b 2e 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 20 3d mark..........this.inPageIndex.=
bb80 20 2d 31 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 68 69 73 2e 69 6e 50 61 67 65 .-1.......}.else.if.(this.inPage
bba0 49 6e 64 65 78 20 3d 3d 3d 20 2d 31 20 26 26 20 69 6e 50 61 67 65 20 26 26 20 21 72 65 70 6c 61 Index.===.-1.&&.inPage.&&.!repla
bbc0 63 65 45 6e 74 72 79 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 53 74 61 72 74 65 64 20 69 6e ceEntry).{.........//.Started.in
bbe0 2d 70 61 67 65 20 6e 61 76 69 67 61 74 69 6f 6e 73 2e 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e -page.navigations..........this.
bc00 69 6e 50 61 67 65 49 6e 64 65 78 20 3d 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 0a inPageIndex.=.this.currentIndex.
bc20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 69 66 20 28 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e ......}.......if.(this.pendingIn
bc40 64 65 78 20 3e 3d 20 30 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 47 6f 20 74 6f 20 69 6e 64 dex.>=.0).{.........//.Go.to.ind
bc60 65 78 2e 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 3d 20 ex..........this.currentIndex.=.
bc80 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 70 this.pendingIndex.........this.p
bca0 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 68 69 endingIndex.=.-1.........this.hi
bcc0 73 74 6f 72 79 5b 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 5d 20 3d 20 75 72 6c 0a 20 story[this.currentIndex].=.url..
bce0 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 72 65 70 6c 61 63 65 45 6e 74 72 79 29 20 7b 0a .....}.else.if.(replaceEntry).{.
bd00 20 20 20 20 20 20 20 20 2f 2f 20 4e 6f 6e 2d 75 73 65 72 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 ........//.Non-user.initialized.
bd20 6e 61 76 69 67 61 74 69 6f 6e 2e 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 68 69 73 74 6f 72 79 navigation..........this.history
bd40 5b 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 5d 20 3d 20 75 72 6c 0a 20 20 20 20 20 20 [this.currentIndex].=.url.......
bd60 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 4e 6f 72 6d 61 6c 20 6e 61 76 69 67 }.else.{.........//.Normal.navig
bd80 61 74 69 6f 6e 2e 20 43 6c 65 61 72 20 68 69 73 74 6f 72 79 2e 0a 20 20 20 20 20 20 20 20 74 68 ation..Clear.history..........th
bda0 69 73 2e 68 69 73 74 6f 72 79 20 3d 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 73 6c 69 63 65 28 is.history.=.this.history.slice(
bdc0 30 2c 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 2b 20 31 29 0a 20 20 20 20 20 20 0,.this.currentIndex.+.1).......
bde0 20 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 2b 2b 0a 20 20 20 20 20 20 20 20 74 68 ..this.currentIndex++.........th
be00 69 73 2e 68 69 73 74 6f 72 79 2e 70 75 73 68 28 75 72 6c 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 is.history.push(url).......}....
be20 20 7d 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e .})...}....NavigationController.
be40 70 72 6f 74 6f 74 79 70 65 2e 6c 6f 61 64 55 52 4c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 72 prototype.loadURL.=.function.(ur
be60 6c 2c 20 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 20 3d 3d l,.options).{.....if.(options.==
be80 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 7d 0a 20 20 20 20 .null).{.......options.=.{}.....
bea0 7d 0a 20 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 20 }.....this.pendingIndex.=.-1....
bec0 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 75 72 6c 2c 20 .this.webContents._loadURL(url,.
bee0 6f 70 74 69 6f 6e 73 29 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 options).....return.this.webCont
bf00 65 6e 74 73 2e 65 6d 69 74 28 27 6c 6f 61 64 2d 75 72 6c 27 2c 20 75 72 6c 2c 20 6f 70 74 69 6f ents.emit('load-url',.url,.optio
bf20 6e 73 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e ns)...}....NavigationController.
bf40 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 55 52 4c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b prototype.getURL.=.function.().{
bf60 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 3d 3d 3d 20 2d .....if.(this.currentIndex.===.-
bf80 31 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 1).{.......return.''.....}.else.
bfa0 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 68 69 73 74 6f 72 79 5b 74 68 69 73 {.......return.this.history[this
bfc0 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 5d 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 .currentIndex].....}...}....Navi
bfe0 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 73 74 6f 70 20 gationController.prototype.stop.
c000 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 =.function.().{.....this.pending
c020 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f Index.=.-1.....return.this.webCo
c040 6e 74 65 6e 74 73 2e 5f 73 74 6f 70 28 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e ntents._stop()...}....Navigation
c060 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 72 65 6c 6f 61 64 20 3d 20 66 75 Controller.prototype.reload.=.fu
c080 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 nction.().{.....this.pendingInde
c0a0 78 20 3d 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 0a 20 20 20 20 72 65 74 75 72 6e x.=.this.currentIndex.....return
c0c0 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 74 68 69 73 2e .this.webContents._loadURL(this.
c0e0 67 65 74 55 52 4c 28 29 2c 20 7b 7d 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 getURL(),.{})...}....NavigationC
c100 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 72 65 6c 6f 61 64 49 67 6e 6f 72 69 ontroller.prototype.reloadIgnori
c120 6e 67 43 61 63 68 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 ngCache.=.function.().{.....this
c140 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 .pendingIndex.=.this.currentInde
c160 78 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c x.....return.this.webContents._l
c180 6f 61 64 55 52 4c 28 74 68 69 73 2e 67 65 74 55 52 4c 28 29 2c 20 7b 0a 20 20 20 20 20 20 65 78 oadURL(this.getURL(),.{.......ex
c1a0 74 72 61 48 65 61 64 65 72 73 3a 20 27 70 72 61 67 6d 61 3a 20 6e 6f 2d 63 61 63 68 65 5c 6e 27 traHeaders:.'pragma:.no-cache\n'
c1c0 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c .....})...}....NavigationControl
c1e0 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 61 6e 47 6f 42 61 63 6b 20 3d 20 66 75 6e 63 74 69 ler.prototype.canGoBack.=.functi
c200 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 41 63 74 69 76 on.().{.....return.this.getActiv
c220 65 49 6e 64 65 78 28 29 20 3e 20 30 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f eIndex().>.0...}....NavigationCo
c240 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 61 6e 47 6f 46 6f 72 77 61 72 64 20 ntroller.prototype.canGoForward.
c260 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e =.function.().{.....return.this.
c280 67 65 74 41 63 74 69 76 65 49 6e 64 65 78 28 29 20 3c 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e getActiveIndex().<.this.history.
c2a0 6c 65 6e 67 74 68 20 2d 20 31 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 length.-.1...}....NavigationCont
c2c0 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 61 6e 47 6f 54 6f 49 6e 64 65 78 20 3d 20 roller.prototype.canGoToIndex.=.
c2e0 66 75 6e 63 74 69 6f 6e 20 28 69 6e 64 65 78 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 69 6e function.(index).{.....return.in
c300 64 65 78 20 3e 3d 20 30 20 26 26 20 69 6e 64 65 78 20 3c 20 74 68 69 73 2e 68 69 73 74 6f 72 79 dex.>=.0.&&.index.<.this.history
c320 2e 6c 65 6e 67 74 68 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c .length...}....NavigationControl
c340 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 61 6e 47 6f 54 6f 4f 66 66 73 65 74 20 3d 20 66 75 ler.prototype.canGoToOffset.=.fu
c360 6e 63 74 69 6f 6e 20 28 6f 66 66 73 65 74 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 nction.(offset).{.....return.thi
c380 73 2e 63 61 6e 47 6f 54 6f 49 6e 64 65 78 28 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 s.canGoToIndex(this.currentIndex
c3a0 20 2b 20 6f 66 66 73 65 74 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 .+.offset)...}....NavigationCont
c3c0 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 6c 65 61 72 48 69 73 74 6f 72 79 20 3d 20 roller.prototype.clearHistory.=.
c3e0 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 68 69 73 74 6f 72 79 20 3d function.().{.....this.history.=
c400 20 5b 5d 0a 20 20 20 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 3d 20 2d 31 0a 20 .[].....this.currentIndex.=.-1..
c420 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 20 20 74 68 ...this.pendingIndex.=.-1.....th
c440 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 is.inPageIndex.=.-1...}....Navig
c460 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 67 6f 42 61 63 6b ationController.prototype.goBack
c480 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 63 .=.function.().{.....if.(!this.c
c4a0 61 6e 47 6f 42 61 63 6b 28 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d anGoBack()).{.......return.....}
c4c0 0a 20 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 74 68 69 73 2e 67 65 .....this.pendingIndex.=.this.ge
c4e0 74 41 63 74 69 76 65 49 6e 64 65 78 28 29 20 2d 20 31 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e tActiveIndex().-.1.....if.(this.
c500 69 6e 50 61 67 65 49 6e 64 65 78 20 3e 20 2d 31 20 26 26 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 inPageIndex.>.-1.&&.this.pending
c520 49 6e 64 65 78 20 3e 3d 20 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 29 20 7b 0a 20 20 20 Index.>=.this.inPageIndex).{....
c540 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 67 6f 42 61 ...return.this.webContents._goBa
c560 63 6b 28 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 ck().....}.else.{.......return.t
c580 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 74 68 69 73 2e 68 69 his.webContents._loadURL(this.hi
c5a0 73 74 6f 72 79 5b 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 5d 2c 20 7b 7d 29 0a 20 20 story[this.pendingIndex],.{})...
c5c0 20 20 7d 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e ..}...}....NavigationController.
c5e0 70 72 6f 74 6f 74 79 70 65 2e 67 6f 46 6f 72 77 61 72 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 prototype.goForward.=.function.(
c600 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 63 61 6e 47 6f 46 6f 72 77 61 72 64 28 29 ).{.....if.(!this.canGoForward()
c620 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e ).{.......return.....}.....this.
c640 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 74 68 69 73 2e 67 65 74 41 63 74 69 76 65 49 6e 64 pendingIndex.=.this.getActiveInd
c660 65 78 28 29 20 2b 20 31 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 ex().+.1.....if.(this.inPageInde
c680 78 20 3e 20 2d 31 20 26 26 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3e 3d 20 74 x.>.-1.&&.this.pendingIndex.>=.t
c6a0 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 his.inPageIndex).{.......return.
c6c0 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 67 6f 46 6f 72 77 61 72 64 28 29 0a 20 20 this.webContents._goForward()...
c6e0 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 ..}.else.{.......return.this.web
c700 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 74 68 69 73 2e 68 69 73 74 6f 72 79 5b 74 Contents._loadURL(this.history[t
c720 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 5d 2c 20 7b 7d 29 0a 20 20 20 20 7d 0a 20 20 7d his.pendingIndex],.{}).....}...}
c740 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 ....NavigationController.prototy
c760 70 65 2e 67 6f 54 6f 49 6e 64 65 78 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 6e 64 65 78 29 20 pe.goToIndex.=.function.(index).
c780 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 63 61 6e 47 6f 54 6f 49 6e 64 65 78 28 69 6e 64 {.....if.(!this.canGoToIndex(ind
c7a0 65 78 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 ex)).{.......return.....}.....th
c7c0 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 69 6e 64 65 78 0a 20 20 20 20 72 65 74 75 is.pendingIndex.=.index.....retu
c7e0 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 74 68 69 rn.this.webContents._loadURL(thi
c800 73 2e 68 69 73 74 6f 72 79 5b 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 5d 2c 20 7b 7d s.history[this.pendingIndex],.{}
c820 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 )...}....NavigationController.pr
c840 6f 74 6f 74 79 70 65 2e 67 6f 54 6f 4f 66 66 73 65 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f ototype.goToOffset.=.function.(o
c860 66 66 73 65 74 29 20 7b 0a 20 20 20 20 76 61 72 20 70 65 6e 64 69 6e 67 49 6e 64 65 78 0a 20 20 ffset).{.....var.pendingIndex...
c880 20 20 69 66 20 28 21 74 68 69 73 2e 63 61 6e 47 6f 54 6f 4f 66 66 73 65 74 28 6f 66 66 73 65 74 ..if.(!this.canGoToOffset(offset
c8a0 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 70 65 6e 64 )).{.......return.....}.....pend
c8c0 69 6e 67 49 6e 64 65 78 20 3d 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 2b 20 6f ingIndex.=.this.currentIndex.+.o
c8e0 66 66 73 65 74 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 20 3e ffset.....if.(this.inPageIndex.>
c900 20 2d 31 20 26 26 20 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3e 3d 20 74 68 69 73 2e 69 6e 50 61 .-1.&&.pendingIndex.>=.this.inPa
c920 67 65 49 6e 64 65 78 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 geIndex).{.......this.pendingInd
c940 65 78 20 3d 20 70 65 6e 64 69 6e 67 49 6e 64 65 78 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 ex.=.pendingIndex.......return.t
c960 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 67 6f 54 6f 4f 66 66 73 65 74 28 6f 66 66 73 his.webContents._goToOffset(offs
c980 65 74 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 et).....}.else.{.......return.th
c9a0 69 73 2e 67 6f 54 6f 49 6e 64 65 78 28 70 65 6e 64 69 6e 67 49 6e 64 65 78 29 0a 20 20 20 20 7d is.goToIndex(pendingIndex).....}
c9c0 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f ...}....NavigationController.pro
c9e0 74 6f 74 79 70 65 2e 67 65 74 41 63 74 69 76 65 49 6e 64 65 78 20 3d 20 66 75 6e 63 74 69 6f 6e totype.getActiveIndex.=.function
ca00 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 .().{.....if.(this.pendingIndex.
ca20 3d 3d 3d 20 2d 31 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 63 75 72 72 ===.-1).{.......return.this.curr
ca40 65 6e 74 49 6e 64 65 78 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 entIndex.....}.else.{.......retu
ca60 72 6e 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a rn.this.pendingIndex.....}...}..
ca80 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 ..NavigationController.prototype
caa0 2e 6c 65 6e 67 74 68 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 .length.=.function.().{.....retu
cac0 72 6e 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 6c 65 6e 67 74 68 0a 20 20 7d 0a 0a 20 20 72 65 rn.this.history.length...}....re
cae0 74 75 72 6e 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 0a 7d 29 28 29 0a 0a turn.NavigationController.})()..
cb00 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 module.exports.=.NavigationContr
cb20 6f 6c 6c 65 72 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 75 72 6c 20 3d 20 oller.'use.strict'..const.url.=.
cb40 72 65 71 75 69 72 65 28 27 75 72 6c 27 29 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d 69 74 74 require('url').const.{EventEmitt
cb60 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 52 er}.=.require('events').const.{R
cb80 65 61 64 61 62 6c 65 7d 20 3d 20 72 65 71 75 69 72 65 28 27 73 74 72 65 61 6d 27 29 0a 63 6f 6e eadable}.=.require('stream').con
cba0 73 74 20 7b 61 70 70 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 st.{app}.=.require('electron').c
cbc0 6f 6e 73 74 20 7b 53 65 73 73 69 6f 6e 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e onst.{Session}.=.process.atomBin
cbe0 64 69 6e 67 28 27 73 65 73 73 69 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b 6e 65 74 2c 20 4e 65 74 7d ding('session').const.{net,.Net}
cc00 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 6e 65 74 27 29 0a 63 6f .=.process.atomBinding('net').co
cc20 6e 73 74 20 7b 55 52 4c 52 65 71 75 65 73 74 7d 20 3d 20 6e 65 74 0a 0a 2f 2f 20 4e 65 74 20 69 nst.{URLRequest}.=.net..//.Net.i
cc40 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f s.an.EventEmitter..Object.setPro
cc60 74 6f 74 79 70 65 4f 66 28 4e 65 74 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 totypeOf(Net.prototype,.EventEmi
cc80 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c tter.prototype).EventEmitter.cal
cca0 6c 28 6e 65 74 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 55 52 l(net)..Object.setPrototypeOf(UR
ccc0 4c 52 65 71 75 65 73 74 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 LRequest.prototype,.EventEmitter
cce0 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 63 6f 6e 73 74 20 6b 53 75 70 70 6f 72 74 65 64 50 72 6f .prototype)..const.kSupportedPro
cd00 74 6f 63 6f 6c 73 20 3d 20 6e 65 77 20 53 65 74 28 5b 27 68 74 74 70 3a 27 2c 20 27 68 74 74 70 tocols.=.new.Set(['http:',.'http
cd20 73 3a 27 5d 29 0a 0a 63 6c 61 73 73 20 49 6e 63 6f 6d 69 6e 67 4d 65 73 73 61 67 65 20 65 78 74 s:'])..class.IncomingMessage.ext
cd40 65 6e 64 73 20 52 65 61 64 61 62 6c 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 75 ends.Readable.{...constructor.(u
cd60 72 6c 52 65 71 75 65 73 74 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 74 68 69 rlRequest).{.....super().....thi
cd80 73 2e 75 72 6c 52 65 71 75 65 73 74 20 3d 20 75 72 6c 52 65 71 75 65 73 74 0a 20 20 20 20 74 68 s.urlRequest.=.urlRequest.....th
cda0 69 73 2e 73 68 6f 75 6c 64 50 75 73 68 20 3d 20 66 61 6c 73 65 0a 20 20 20 20 74 68 69 73 2e 64 is.shouldPush.=.false.....this.d
cdc0 61 74 61 20 3d 20 5b 5d 0a 20 20 20 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 6f 6e 28 ata.=.[].....this.urlRequest.on(
cde0 27 64 61 74 61 27 2c 20 28 65 76 65 6e 74 2c 20 63 68 75 6e 6b 29 20 3d 3e 20 7b 0a 20 20 20 20 'data',.(event,.chunk).=>.{.....
ce00 20 20 74 68 69 73 2e 5f 73 74 6f 72 65 49 6e 74 65 72 6e 61 6c 44 61 74 61 28 63 68 75 6e 6b 29 ..this._storeInternalData(chunk)
ce20 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 70 75 73 68 49 6e 74 65 72 6e 61 6c 44 61 74 61 28 29 0a .......this._pushInternalData().
ce40 20 20 20 20 7d 29 0a 20 20 20 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 6f 6e 28 27 65 ....}).....this.urlRequest.on('e
ce60 6e 64 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 73 74 6f 72 65 49 6e nd',.().=>.{.......this._storeIn
ce80 74 65 72 6e 61 6c 44 61 74 61 28 6e 75 6c 6c 29 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 70 75 73 ternalData(null).......this._pus
cea0 68 49 6e 74 65 72 6e 61 6c 44 61 74 61 28 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 67 65 hInternalData().....})...}....ge
cec0 74 20 73 74 61 74 75 73 43 6f 64 65 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 t.statusCode.().{.....return.thi
cee0 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 73 74 61 74 75 73 43 6f 64 65 0a 20 20 7d 0a 0a 20 20 67 s.urlRequest.statusCode...}....g
cf00 65 74 20 73 74 61 74 75 73 4d 65 73 73 61 67 65 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e et.statusMessage.().{.....return
cf20 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 73 74 61 74 75 73 4d 65 73 73 61 67 65 0a 20 .this.urlRequest.statusMessage..
cf40 20 7d 0a 0a 20 20 67 65 74 20 68 65 61 64 65 72 73 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 .}....get.headers.().{.....retur
cf60 6e 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 72 61 77 52 65 73 70 6f 6e 73 65 48 65 61 n.this.urlRequest.rawResponseHea
cf80 64 65 72 73 0a 20 20 7d 0a 0a 20 20 67 65 74 20 68 74 74 70 56 65 72 73 69 6f 6e 20 28 29 20 7b ders...}....get.httpVersion.().{
cfa0 0a 20 20 20 20 72 65 74 75 72 6e 20 60 24 7b 74 68 69 73 2e 68 74 74 70 56 65 72 73 69 6f 6e 4d .....return.`${this.httpVersionM
cfc0 61 6a 6f 72 7d 2e 24 7b 74 68 69 73 2e 68 74 74 70 56 65 72 73 69 6f 6e 4d 69 6e 6f 72 7d 60 0a ajor}.${this.httpVersionMinor}`.
cfe0 20 20 7d 0a 0a 20 20 67 65 74 20 68 74 74 70 56 65 72 73 69 6f 6e 4d 61 6a 6f 72 20 28 29 20 7b ..}....get.httpVersionMajor.().{
d000 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 68 74 74 70 .....return.this.urlRequest.http
d020 56 65 72 73 69 6f 6e 4d 61 6a 6f 72 0a 20 20 7d 0a 0a 20 20 67 65 74 20 68 74 74 70 56 65 72 73 VersionMajor...}....get.httpVers
d040 69 6f 6e 4d 69 6e 6f 72 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 75 72 ionMinor.().{.....return.this.ur
d060 6c 52 65 71 75 65 73 74 2e 68 74 74 70 56 65 72 73 69 6f 6e 4d 69 6e 6f 72 0a 20 20 7d 0a 0a 20 lRequest.httpVersionMinor...}...
d080 20 67 65 74 20 72 61 77 54 72 61 69 6c 65 72 73 20 28 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 .get.rawTrailers.().{.....throw.
d0a0 6e 65 77 20 45 72 72 6f 72 28 27 48 54 54 50 20 74 72 61 69 6c 65 72 73 20 61 72 65 20 6e 6f 74 new.Error('HTTP.trailers.are.not
d0c0 20 73 75 70 70 6f 72 74 65 64 2e 27 29 0a 20 20 7d 0a 0a 20 20 67 65 74 20 74 72 61 69 6c 65 72 .supported.')...}....get.trailer
d0e0 73 20 28 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 48 54 54 50 s.().{.....throw.new.Error('HTTP
d100 20 74 72 61 69 6c 65 72 73 20 61 72 65 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 2e 27 29 0a 20 .trailers.are.not.supported.')..
d120 20 7d 0a 0a 20 20 5f 73 74 6f 72 65 49 6e 74 65 72 6e 61 6c 44 61 74 61 20 28 63 68 75 6e 6b 29 .}...._storeInternalData.(chunk)
d140 20 7b 0a 20 20 20 20 74 68 69 73 2e 64 61 74 61 2e 70 75 73 68 28 63 68 75 6e 6b 29 0a 20 20 7d .{.....this.data.push(chunk)...}
d160 0a 0a 20 20 5f 70 75 73 68 49 6e 74 65 72 6e 61 6c 44 61 74 61 20 28 29 20 7b 0a 20 20 20 20 77 ...._pushInternalData.().{.....w
d180 68 69 6c 65 20 28 74 68 69 73 2e 73 68 6f 75 6c 64 50 75 73 68 20 26 26 20 74 68 69 73 2e 64 61 hile.(this.shouldPush.&&.this.da
d1a0 74 61 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 63 68 75 ta.length.>.0).{.......const.chu
d1c0 6e 6b 20 3d 20 74 68 69 73 2e 64 61 74 61 2e 73 68 69 66 74 28 29 0a 20 20 20 20 20 20 74 68 69 nk.=.this.data.shift().......thi
d1e0 73 2e 73 68 6f 75 6c 64 50 75 73 68 20 3d 20 74 68 69 73 2e 70 75 73 68 28 63 68 75 6e 6b 29 0a s.shouldPush.=.this.push(chunk).
d200 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 5f 72 65 61 64 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 ....}...}...._read.().{.....this
d220 2e 73 68 6f 75 6c 64 50 75 73 68 20 3d 20 74 72 75 65 0a 20 20 20 20 74 68 69 73 2e 5f 70 75 73 .shouldPush.=.true.....this._pus
d240 68 49 6e 74 65 72 6e 61 6c 44 61 74 61 28 29 0a 20 20 7d 0a 0a 7d 0a 0a 55 52 4c 52 65 71 75 65 hInternalData()...}..}..URLReque
d260 73 74 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 65 6d 69 74 52 65 71 75 65 73 74 45 76 65 6e 74 20 3d st.prototype._emitRequestEvent.=
d280 20 66 75 6e 63 74 69 6f 6e 20 28 69 73 41 73 79 6e 63 2c 20 2e 2e 2e 72 65 73 74 29 20 7b 0a 20 .function.(isAsync,....rest).{..
d2a0 20 69 66 20 28 69 73 41 73 79 6e 63 29 20 7b 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 .if.(isAsync).{.....process.next
d2c0 54 69 63 6b 28 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 63 6c 69 65 6e 74 52 65 Tick(().=>.{.......this.clientRe
d2e0 71 75 65 73 74 2e 65 6d 69 74 28 2e 2e 2e 72 65 73 74 29 0a 20 20 20 20 7d 29 0a 20 20 7d 20 65 quest.emit(...rest).....})...}.e
d300 6c 73 65 20 7b 0a 20 20 20 20 74 68 69 73 2e 63 6c 69 65 6e 74 52 65 71 75 65 73 74 2e 65 6d 69 lse.{.....this.clientRequest.emi
d320 74 28 2e 2e 2e 72 65 73 74 29 0a 20 20 7d 0a 7d 0a 0a 55 52 4c 52 65 71 75 65 73 74 2e 70 72 6f t(...rest)...}.}..URLRequest.pro
d340 74 6f 74 79 70 65 2e 5f 65 6d 69 74 52 65 73 70 6f 6e 73 65 45 76 65 6e 74 20 3d 20 66 75 6e 63 totype._emitResponseEvent.=.func
d360 74 69 6f 6e 20 28 69 73 41 73 79 6e 63 2c 20 2e 2e 2e 72 65 73 74 29 20 7b 0a 20 20 69 66 20 28 tion.(isAsync,....rest).{...if.(
d380 69 73 41 73 79 6e 63 29 20 7b 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 isAsync).{.....process.nextTick(
d3a0 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 72 65 73 70 6f 6e 73 65 2e 65 6d 69 ().=>.{.......this._response.emi
d3c0 74 28 2e 2e 2e 72 65 73 74 29 0a 20 20 20 20 7d 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 t(...rest).....})...}.else.{....
d3e0 20 74 68 69 73 2e 5f 72 65 73 70 6f 6e 73 65 2e 65 6d 69 74 28 2e 2e 2e 72 65 73 74 29 0a 20 20 .this._response.emit(...rest)...
d400 7d 0a 7d 0a 0a 63 6c 61 73 73 20 43 6c 69 65 6e 74 52 65 71 75 65 73 74 20 65 78 74 65 6e 64 73 }.}..class.ClientRequest.extends
d420 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7b 0a 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 .EventEmitter.{....constructor.(
d440 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 options,.callback).{.....super()
d460 0a 0a 20 20 20 20 69 66 20 28 21 61 70 70 2e 69 73 52 65 61 64 79 28 29 29 20 7b 0a 20 20 20 20 ......if.(!app.isReady()).{.....
d480 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 6e 65 74 20 6d 6f 64 75 6c 65 20 63 61 ..throw.new.Error('net.module.ca
d4a0 6e 20 6f 6e 6c 79 20 62 65 20 75 73 65 64 20 61 66 74 65 72 20 61 70 70 20 69 73 20 72 65 61 64 n.only.be.used.after.app.is.read
d4c0 79 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 6f 70 74 69 6f 6e y').....}......if.(typeof.option
d4e0 73 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 s.===.'string').{.......options.
d500 3d 20 75 72 6c 2e 70 61 72 73 65 28 6f 70 74 69 6f 6e 73 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 =.url.parse(options).....}.else.
d520 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 3d 20 4f 62 6a 65 63 74 2e 61 73 73 69 67 6e 28 {.......options.=.Object.assign(
d540 7b 7d 2c 20 6f 70 74 69 6f 6e 73 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 {},.options).....}......const.me
d560 74 68 6f 64 20 3d 20 28 6f 70 74 69 6f 6e 73 2e 6d 65 74 68 6f 64 20 7c 7c 20 27 47 45 54 27 29 thod.=.(options.method.||.'GET')
d580 2e 74 6f 55 70 70 65 72 43 61 73 65 28 29 0a 20 20 20 20 6c 65 74 20 75 72 6c 53 74 72 20 3d 20 .toUpperCase().....let.urlStr.=.
d5a0 6f 70 74 69 6f 6e 73 2e 75 72 6c 0a 0a 20 20 20 20 69 66 20 28 21 75 72 6c 53 74 72 29 20 7b 0a options.url......if.(!urlStr).{.
d5c0 20 20 20 20 20 20 6c 65 74 20 75 72 6c 4f 62 6a 20 3d 20 7b 7d 0a 20 20 20 20 20 20 63 6f 6e 73 ......let.urlObj.=.{}.......cons
d5e0 74 20 70 72 6f 74 6f 63 6f 6c 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 72 6f 74 6f 63 6f 6c 20 7c 7c t.protocol.=.options.protocol.||
d600 20 27 68 74 74 70 3a 27 0a 20 20 20 20 20 20 69 66 20 28 21 6b 53 75 70 70 6f 72 74 65 64 50 72 .'http:'.......if.(!kSupportedPr
d620 6f 74 6f 63 6f 6c 73 2e 68 61 73 28 70 72 6f 74 6f 63 6f 6c 29 29 20 7b 0a 20 20 20 20 20 20 20 otocols.has(protocol)).{........
d640 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 50 72 6f 74 6f 63 6f 6c 20 22 27 20 2b 20 .throw.new.Error('Protocol."'.+.
d660 70 72 6f 74 6f 63 6f 6c 20 2b 20 27 22 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 2e 20 27 29 0a protocol.+.'".not.supported..').
d680 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 75 72 6c 4f 62 6a 2e 70 72 6f 74 6f 63 6f 6c 20 3d 20 ......}.......urlObj.protocol.=.
d6a0 70 72 6f 74 6f 63 6f 6c 0a 0a 20 20 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 68 6f 73 74 protocol........if.(options.host
d6c0 29 20 7b 0a 20 20 20 20 20 20 20 20 75 72 6c 4f 62 6a 2e 68 6f 73 74 20 3d 20 6f 70 74 69 6f 6e ).{.........urlObj.host.=.option
d6e0 73 2e 68 6f 73 74 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 69 66 s.host.......}.else.{.........if
d700 20 28 6f 70 74 69 6f 6e 73 2e 68 6f 73 74 6e 61 6d 65 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 .(options.hostname).{...........
d720 75 72 6c 4f 62 6a 2e 68 6f 73 74 6e 61 6d 65 20 3d 20 6f 70 74 69 6f 6e 73 2e 68 6f 73 74 6e 61 urlObj.hostname.=.options.hostna
d740 6d 65 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 75 72 me.........}.else.{...........ur
d760 6c 4f 62 6a 2e 68 6f 73 74 6e 61 6d 65 20 3d 20 27 6c 6f 63 61 6c 68 6f 73 74 27 0a 20 20 20 20 lObj.hostname.=.'localhost'.....
d780 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 70 6f 72 74 29 ....}..........if.(options.port)
d7a0 20 7b 0a 20 20 20 20 20 20 20 20 20 20 75 72 6c 4f 62 6a 2e 70 6f 72 74 20 3d 20 6f 70 74 69 6f .{...........urlObj.port.=.optio
d7c0 6e 73 2e 70 6f 72 74 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 ns.port.........}.......}.......
d7e0 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 70 61 74 68 20 26 26 20 2f 20 2f 2e 74 65 73 74 28 6f 70 .if.(options.path.&&././.test(op
d800 74 69 6f 6e 73 2e 70 61 74 68 29 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 54 68 65 20 61 63 tions.path)).{.........//.The.ac
d820 74 75 61 6c 20 72 65 67 65 78 20 69 73 20 6d 6f 72 65 20 6c 69 6b 65 20 2f 5b 5e 41 2d 5a 61 2d tual.regex.is.more.like./[^A-Za-
d840 7a 30 2d 39 5c 2d 2e 5f 7e 21 24 26 27 28 29 2a 2b 2c 3b 3d 2f 3a 40 5d 2f 0a 20 20 20 20 20 20 z0-9\-._~!$&'()*+,;=/:@]/.......
d860 20 20 2f 2f 20 77 69 74 68 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 6c 20 72 75 6c 65 20 66 6f 72 ..//.with.an.additional.rule.for
d880 20 69 67 6e 6f 72 69 6e 67 20 70 65 72 63 65 6e 74 61 67 65 2d 65 73 63 61 70 65 64 20 63 68 61 .ignoring.percentage-escaped.cha
d8a0 72 61 63 74 65 72 73 0a 20 20 20 20 20 20 20 20 2f 2f 20 62 75 74 20 74 68 61 74 27 73 20 61 29 racters.........//.but.that's.a)
d8c0 20 68 61 72 64 20 74 6f 20 63 61 70 74 75 72 65 20 69 6e 20 61 20 72 65 67 75 6c 61 72 20 65 78 .hard.to.capture.in.a.regular.ex
d8e0 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 70 65 72 66 6f 72 6d 73 0a 20 20 20 20 20 20 20 20 2f pression.that.performs........./
d900 2f 20 77 65 6c 6c 2c 20 61 6e 64 20 62 29 20 70 6f 73 73 69 62 6c 79 20 74 6f 6f 20 72 65 73 74 /.well,.and.b).possibly.too.rest
d920 72 69 63 74 69 76 65 20 66 6f 72 20 72 65 61 6c 2d 77 6f 72 6c 64 20 75 73 61 67 65 2e 20 54 68 rictive.for.real-world.usage..Th
d940 61 74 27 73 0a 20 20 20 20 20 20 20 20 2f 2f 20 77 68 79 20 69 74 20 6f 6e 6c 79 20 73 63 61 6e at's.........//.why.it.only.scan
d960 73 20 66 6f 72 20 73 70 61 63 65 73 20 62 65 63 61 75 73 65 20 74 68 6f 73 65 20 61 72 65 20 67 s.for.spaces.because.those.are.g
d980 75 61 72 61 6e 74 65 65 64 20 74 6f 20 63 72 65 61 74 65 0a 20 20 20 20 20 20 20 20 2f 2f 20 61 uaranteed.to.create.........//.a
d9a0 6e 20 69 6e 76 61 6c 69 64 20 72 65 71 75 65 73 74 2e 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 n.invalid.request..........throw
d9c0 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 52 65 71 75 65 73 74 20 70 61 74 68 20 63 6f 6e .new.TypeError('Request.path.con
d9e0 74 61 69 6e 73 20 75 6e 65 73 63 61 70 65 64 20 63 68 61 72 61 63 74 65 72 73 2e 27 29 0a 20 20 tains.unescaped.characters.')...
da00 20 20 20 20 7d 0a 20 20 20 20 20 20 6c 65 74 20 70 61 74 68 4f 62 6a 20 3d 20 75 72 6c 2e 70 61 ....}.......let.pathObj.=.url.pa
da20 72 73 65 28 6f 70 74 69 6f 6e 73 2e 70 61 74 68 20 7c 7c 20 27 2f 27 29 0a 20 20 20 20 20 20 75 rse(options.path.||.'/').......u
da40 72 6c 4f 62 6a 2e 70 61 74 68 6e 61 6d 65 20 3d 20 70 61 74 68 4f 62 6a 2e 70 61 74 68 6e 61 6d rlObj.pathname.=.pathObj.pathnam
da60 65 0a 20 20 20 20 20 20 75 72 6c 4f 62 6a 2e 73 65 61 72 63 68 20 3d 20 70 61 74 68 4f 62 6a 2e e.......urlObj.search.=.pathObj.
da80 73 65 61 72 63 68 0a 20 20 20 20 20 20 75 72 6c 4f 62 6a 2e 68 61 73 68 20 3d 20 70 61 74 68 4f search.......urlObj.hash.=.pathO
daa0 62 6a 2e 68 61 73 68 0a 20 20 20 20 20 20 75 72 6c 53 74 72 20 3d 20 75 72 6c 2e 66 6f 72 6d 61 bj.hash.......urlStr.=.url.forma
dac0 74 28 75 72 6c 4f 62 6a 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 64 69 72 t(urlObj).....}......const.redir
dae0 65 63 74 50 6f 6c 69 63 79 20 3d 20 6f 70 74 69 6f 6e 73 2e 72 65 64 69 72 65 63 74 20 7c 7c 20 ectPolicy.=.options.redirect.||.
db00 27 66 6f 6c 6c 6f 77 27 0a 20 20 20 20 69 66 20 28 21 5b 27 66 6f 6c 6c 6f 77 27 2c 20 27 65 72 'follow'.....if.(!['follow',.'er
db20 72 6f 72 27 2c 20 27 6d 61 6e 75 61 6c 27 5d 2e 69 6e 63 6c 75 64 65 73 28 72 65 64 69 72 65 63 ror',.'manual'].includes(redirec
db40 74 50 6f 6c 69 63 79 29 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f tPolicy)).{.......throw.new.Erro
db60 72 28 27 72 65 64 69 72 65 63 74 20 6d 6f 64 65 20 73 68 6f 75 6c 64 20 62 65 20 6f 6e 65 20 6f r('redirect.mode.should.be.one.o
db80 66 20 66 6f 6c 6c 6f 77 2c 20 65 72 72 6f 72 20 6f 72 20 6d 61 6e 75 61 6c 27 29 0a 20 20 20 20 f.follow,.error.or.manual').....
dba0 7d 0a 0a 20 20 20 20 6c 65 74 20 75 72 6c 52 65 71 75 65 73 74 4f 70 74 69 6f 6e 73 20 3d 20 7b }......let.urlRequestOptions.=.{
dbc0 0a 20 20 20 20 20 20 6d 65 74 68 6f 64 3a 20 6d 65 74 68 6f 64 2c 0a 20 20 20 20 20 20 75 72 6c .......method:.method,.......url
dbe0 3a 20 75 72 6c 53 74 72 2c 0a 20 20 20 20 20 20 72 65 64 69 72 65 63 74 3a 20 72 65 64 69 72 65 :.urlStr,.......redirect:.redire
dc00 63 74 50 6f 6c 69 63 79 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 73 ctPolicy.....}.....if.(options.s
dc20 65 73 73 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 73 65 73 73 ession).{.......if.(options.sess
dc40 69 6f 6e 20 69 6e 73 74 61 6e 63 65 6f 66 20 53 65 73 73 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 ion.instanceof.Session).{.......
dc60 20 20 75 72 6c 52 65 71 75 65 73 74 4f 70 74 69 6f 6e 73 2e 73 65 73 73 69 6f 6e 20 3d 20 6f 70 ..urlRequestOptions.session.=.op
dc80 74 69 6f 6e 73 2e 73 65 73 73 69 6f 6e 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 tions.session.......}.else.{....
dca0 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 60 73 65 73 73 69 .....throw.new.TypeError('`sessi
dcc0 6f 6e 60 20 73 68 6f 75 6c 64 20 62 65 20 61 6e 20 69 6e 73 74 61 6e 63 65 20 6f 66 20 74 68 65 on`.should.be.an.instance.of.the
dce0 20 53 65 73 73 69 6f 6e 20 63 6c 61 73 73 2e 27 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 .Session.class.').......}.....}.
dd00 65 6c 73 65 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 70 61 72 74 69 74 69 6f 6e 29 20 7b 0a 20 20 else.if.(options.partition).{...
dd20 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 6f 70 74 69 6f 6e 73 2e 70 61 72 74 69 74 69 6f 6e ....if.(typeof.options.partition
dd40 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 20 20 75 72 6c 52 65 71 75 .===.'string').{.........urlRequ
dd60 65 73 74 4f 70 74 69 6f 6e 73 2e 70 61 72 74 69 74 69 6f 6e 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 estOptions.partition.=.options.p
dd80 61 72 74 69 74 69 6f 6e 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 artition.......}.else.{.........
dda0 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 60 70 61 72 74 69 74 69 6f 6e 60 throw.new.TypeError('`partition`
ddc0 20 73 68 6f 75 6c 64 20 62 65 20 61 6e 20 61 20 73 74 72 69 6e 67 2e 27 29 0a 20 20 20 20 20 20 .should.be.an.a.string.').......
dde0 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 75 72 6c 52 65 71 75 65 73 74 20 3d 20 6e 65 }.....}......let.urlRequest.=.ne
de00 77 20 55 52 4c 52 65 71 75 65 73 74 28 75 72 6c 52 65 71 75 65 73 74 4f 70 74 69 6f 6e 73 29 0a w.URLRequest(urlRequestOptions).
de20 0a 20 20 20 20 2f 2f 20 53 65 74 20 62 61 63 6b 20 61 6e 64 20 66 6f 72 77 61 72 64 20 6c 69 6e .....//.Set.back.and.forward.lin
de40 6b 73 2e 0a 20 20 20 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 20 3d 20 75 72 6c 52 65 71 ks......this.urlRequest.=.urlReq
de60 75 65 73 74 0a 20 20 20 20 75 72 6c 52 65 71 75 65 73 74 2e 63 6c 69 65 6e 74 52 65 71 75 65 73 uest.....urlRequest.clientReques
de80 74 20 3d 20 74 68 69 73 0a 0a 20 20 20 20 2f 2f 20 54 68 69 73 20 69 73 20 61 20 63 6f 70 79 20 t.=.this......//.This.is.a.copy.
dea0 6f 66 20 74 68 65 20 65 78 74 72 61 20 68 65 61 64 65 72 73 20 73 74 72 75 63 74 75 72 65 20 68 of.the.extra.headers.structure.h
dec0 65 6c 64 20 62 79 20 74 68 65 20 6e 61 74 69 76 65 0a 20 20 20 20 2f 2f 20 6e 65 74 3a 3a 55 52 eld.by.the.native.....//.net::UR
dee0 4c 52 65 71 75 65 73 74 2e 20 54 68 65 20 6d 61 69 6e 20 72 65 61 73 6f 6e 20 69 73 20 74 6f 20 LRequest..The.main.reason.is.to.
df00 6b 65 65 70 20 74 68 65 20 67 65 74 48 65 61 64 65 72 20 41 50 49 20 73 79 6e 63 68 72 6f 6e 6f keep.the.getHeader.API.synchrono
df20 75 73 0a 20 20 20 20 2f 2f 20 61 66 74 65 72 20 74 68 65 20 72 65 71 75 65 73 74 20 73 74 61 72 us.....//.after.the.request.star
df40 74 73 2e 0a 20 20 20 20 74 68 69 73 2e 65 78 74 72 61 48 65 61 64 65 72 73 20 3d 20 7b 7d 0a 0a ts......this.extraHeaders.=.{}..
df60 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 68 65 61 64 65 72 73 29 20 7b 0a 20 20 20 20 20 ....if.(options.headers).{......
df80 20 66 6f 72 20 28 6c 65 74 20 6b 65 79 20 69 6e 20 6f 70 74 69 6f 6e 73 2e 68 65 61 64 65 72 73 .for.(let.key.in.options.headers
dfa0 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 73 65 74 48 65 61 64 65 72 28 6b 65 79 2c 20 ).{.........this.setHeader(key,.
dfc0 6f 70 74 69 6f 6e 73 2e 68 65 61 64 65 72 73 5b 6b 65 79 5d 29 0a 20 20 20 20 20 20 7d 0a 20 20 options.headers[key]).......}...
dfe0 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 53 65 74 20 77 68 65 6e 20 74 68 65 20 72 65 71 75 65 73 74 ..}......//.Set.when.the.request
e000 20 75 73 65 73 20 63 68 75 6e 6b 65 64 20 65 6e 63 6f 64 69 6e 67 2e 20 43 61 6e 20 62 65 20 73 .uses.chunked.encoding..Can.be.s
e020 77 69 74 63 68 65 64 0a 20 20 20 20 2f 2f 20 74 6f 20 74 72 75 65 20 6f 6e 6c 79 20 6f 6e 63 65 witched.....//.to.true.only.once
e040 20 61 6e 64 20 6e 65 76 65 72 20 73 65 74 20 62 61 63 6b 20 74 6f 20 66 61 6c 73 65 2e 0a 20 20 .and.never.set.back.to.false....
e060 20 20 74 68 69 73 2e 63 68 75 6e 6b 65 64 45 6e 63 6f 64 69 6e 67 45 6e 61 62 6c 65 64 20 3d 20 ..this.chunkedEncodingEnabled.=.
e080 66 61 6c 73 65 0a 0a 20 20 20 20 75 72 6c 52 65 71 75 65 73 74 2e 6f 6e 28 27 72 65 73 70 6f 6e false......urlRequest.on('respon
e0a0 73 65 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 73 70 6f 6e 73 se',.().=>.{.......const.respons
e0c0 65 20 3d 20 6e 65 77 20 49 6e 63 6f 6d 69 6e 67 4d 65 73 73 61 67 65 28 75 72 6c 52 65 71 75 65 e.=.new.IncomingMessage(urlReque
e0e0 73 74 29 0a 20 20 20 20 20 20 75 72 6c 52 65 71 75 65 73 74 2e 5f 72 65 73 70 6f 6e 73 65 20 3d st).......urlRequest._response.=
e100 20 72 65 73 70 6f 6e 73 65 0a 20 20 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 27 72 65 73 70 6f .response.......this.emit('respo
e120 6e 73 65 27 2c 20 72 65 73 70 6f 6e 73 65 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 75 72 6c 52 nse',.response).....})......urlR
e140 65 71 75 65 73 74 2e 6f 6e 28 27 6c 6f 67 69 6e 27 2c 20 28 65 76 65 6e 74 2c 20 61 75 74 68 49 equest.on('login',.(event,.authI
e160 6e 66 6f 2c 20 63 61 6c 6c 62 61 63 6b 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 65 nfo,.callback).=>.{.......this.e
e180 6d 69 74 28 27 6c 6f 67 69 6e 27 2c 20 61 75 74 68 49 6e 66 6f 2c 20 28 75 73 65 72 6e 61 6d 65 mit('login',.authInfo,.(username
e1a0 2c 20 70 61 73 73 77 6f 72 64 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 49 66 20 6e ,.password).=>.{.........//.If.n
e1c0 75 6c 6c 20 6f 72 20 75 6e 64 65 66 69 6e 65 64 20 75 73 65 72 6e 61 6d 65 2f 70 61 73 73 77 6f ull.or.undefined.username/passwo
e1e0 72 64 2c 20 66 6f 72 63 65 20 74 6f 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e 0a 20 20 20 20 20 rd,.force.to.empty.string.......
e200 20 20 20 69 66 20 28 75 73 65 72 6e 61 6d 65 20 3d 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 75 73 65 72 ...if.(username.===.null.||.user
e220 6e 61 6d 65 20 3d 3d 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 name.===.undefined).{...........
e240 75 73 65 72 6e 61 6d 65 20 3d 20 27 27 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 username.=.''.........}.........
e260 69 66 20 28 74 79 70 65 6f 66 20 75 73 65 72 6e 61 6d 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 if.(typeof.username.!==.'string'
e280 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 75 ).{...........throw.new.Error('u
e2a0 73 65 72 6e 61 6d 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 20 sername.must.be.a.string')......
e2c0 20 20 20 7d 0a 20 20 20 20 20 20 20 20 69 66 20 28 70 61 73 73 77 6f 72 64 20 3d 3d 3d 20 6e 75 ...}.........if.(password.===.nu
e2e0 6c 6c 20 7c 7c 20 70 61 73 73 77 6f 72 64 20 3d 3d 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a ll.||.password.===.undefined).{.
e300 20 20 20 20 20 20 20 20 20 20 70 61 73 73 77 6f 72 64 20 3d 20 27 27 0a 20 20 20 20 20 20 20 20 ..........password.=.''.........
e320 7d 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 70 61 73 73 77 6f 72 64 20 21 3d }.........if.(typeof.password.!=
e340 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 =.'string').{...........throw.ne
e360 77 20 45 72 72 6f 72 28 27 70 61 73 73 77 6f 72 64 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 w.Error('password.must.be.a.stri
e380 6e 67 27 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 ng').........}.........callback(
e3a0 75 73 65 72 6e 61 6d 65 2c 20 70 61 73 73 77 6f 72 64 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 username,.password).......})....
e3c0 20 7d 29 0a 0a 20 20 20 20 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 74 .})......if.(callback).{.......t
e3e0 68 69 73 2e 6f 6e 63 65 28 27 72 65 73 70 6f 6e 73 65 27 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 his.once('response',.callback)..
e400 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 67 65 74 20 63 68 75 6e 6b 65 64 45 6e 63 6f 64 69 6e 67 20 ...}...}....get.chunkedEncoding.
e420 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 63 68 75 6e 6b 65 64 45 6e 63 6f ().{.....return.this.chunkedEnco
e440 64 69 6e 67 45 6e 61 62 6c 65 64 0a 20 20 7d 0a 0a 20 20 73 65 74 20 63 68 75 6e 6b 65 64 45 6e dingEnabled...}....set.chunkedEn
e460 63 6f 64 69 6e 67 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 75 coding.(value).{.....if.(!this.u
e480 72 6c 52 65 71 75 65 73 74 2e 6e 6f 74 53 74 61 72 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 rlRequest.notStarted).{.......th
e4a0 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 43 61 6e 5c 27 74 20 73 65 74 20 74 68 65 20 74 72 row.new.Error('Can\'t.set.the.tr
e4c0 61 6e 73 66 65 72 20 65 6e 63 6f 64 69 6e 67 2c 20 68 65 61 64 65 72 73 20 68 61 76 65 20 62 65 ansfer.encoding,.headers.have.be
e4e0 65 6e 20 73 65 6e 74 2e 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 63 68 75 6e 6b 65 en.sent.').....}.....this.chunke
e500 64 45 6e 63 6f 64 69 6e 67 45 6e 61 62 6c 65 64 20 3d 20 76 61 6c 75 65 0a 20 20 7d 0a 0a 20 20 dEncodingEnabled.=.value...}....
e520 73 65 74 48 65 61 64 65 72 20 28 6e 61 6d 65 2c 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 69 66 setHeader.(name,.value).{.....if
e540 20 28 74 79 70 65 6f 66 20 6e 61 6d 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 .(typeof.name.!==.'string').{...
e560 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 60 6e 61 6d 65 60 20 ....throw.new.TypeError('`name`.
e580 73 68 6f 75 6c 64 20 62 65 20 61 20 73 74 72 69 6e 67 20 69 6e 20 73 65 74 48 65 61 64 65 72 28 should.be.a.string.in.setHeader(
e5a0 6e 61 6d 65 2c 20 76 61 6c 75 65 29 2e 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 76 61 name,.value).').....}.....if.(va
e5c0 6c 75 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 lue.==.null).{.......throw.new.E
e5e0 72 72 6f 72 28 27 60 76 61 6c 75 65 60 20 72 65 71 75 69 72 65 64 20 69 6e 20 73 65 74 48 65 61 rror('`value`.required.in.setHea
e600 64 65 72 28 22 27 20 2b 20 6e 61 6d 65 20 2b 20 27 22 2c 20 76 61 6c 75 65 29 2e 27 29 0a 20 20 der("'.+.name.+.'",.value).')...
e620 20 20 7d 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 6e 6f 74 ..}.....if.(!this.urlRequest.not
e640 53 74 61 72 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 Started).{.......throw.new.Error
e660 28 27 43 61 6e 5c 27 74 20 73 65 74 20 68 65 61 64 65 72 73 20 61 66 74 65 72 20 74 68 65 79 20 ('Can\'t.set.headers.after.they.
e680 61 72 65 20 73 65 6e 74 2e 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 6b 65 79 are.sent.').....}......const.key
e6a0 20 3d 20 6e 61 6d 65 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 20 20 20 20 74 68 69 73 2e 65 .=.name.toLowerCase().....this.e
e6c0 78 74 72 61 48 65 61 64 65 72 73 5b 6b 65 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 74 68 69 xtraHeaders[key].=.value.....thi
e6e0 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 73 65 74 45 78 74 72 61 48 65 61 64 65 72 28 6e 61 6d 65 s.urlRequest.setExtraHeader(name
e700 2c 20 76 61 6c 75 65 2e 74 6f 53 74 72 69 6e 67 28 29 29 0a 20 20 7d 0a 0a 20 20 67 65 74 48 65 ,.value.toString())...}....getHe
e720 61 64 65 72 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 69 66 20 28 6e 61 6d 65 20 3d 3d 20 6e 75 ader.(name).{.....if.(name.==.nu
e740 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 60 6e 61 ll).{.......throw.new.Error('`na
e760 6d 65 60 20 69 73 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 67 65 74 48 65 61 64 65 72 28 6e 61 me`.is.required.for.getHeader(na
e780 6d 65 29 2e 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 65 78 74 72 me).').....}......if.(!this.extr
e7a0 61 48 65 61 64 65 72 73 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a aHeaders).{.......return.....}..
e7c0 20 20 20 20 63 6f 6e 73 74 20 6b 65 79 20 3d 20 6e 61 6d 65 2e 74 6f 4c 6f 77 65 72 43 61 73 65 ....const.key.=.name.toLowerCase
e7e0 28 29 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 78 74 72 61 48 65 61 64 65 72 73 5b ().....return.this.extraHeaders[
e800 6b 65 79 5d 0a 20 20 7d 0a 0a 20 20 72 65 6d 6f 76 65 48 65 61 64 65 72 20 28 6e 61 6d 65 29 20 key]...}....removeHeader.(name).
e820 7b 0a 20 20 20 20 69 66 20 28 6e 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 {.....if.(name.==.null).{.......
e840 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 60 6e 61 6d 65 60 20 69 73 20 72 65 71 75 69 throw.new.Error('`name`.is.requi
e860 72 65 64 20 66 6f 72 20 72 65 6d 6f 76 65 48 65 61 64 65 72 28 6e 61 6d 65 29 2e 27 29 0a 20 20 red.for.removeHeader(name).')...
e880 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 6e 6f ..}......if.(!this.urlRequest.no
e8a0 74 53 74 61 72 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f tStarted).{.......throw.new.Erro
e8c0 72 28 27 43 61 6e 5c 27 74 20 72 65 6d 6f 76 65 20 68 65 61 64 65 72 73 20 61 66 74 65 72 20 74 r('Can\'t.remove.headers.after.t
e8e0 68 65 79 20 61 72 65 20 73 65 6e 74 2e 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 hey.are.sent.').....}......const
e900 20 6b 65 79 20 3d 20 6e 61 6d 65 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 20 20 20 20 64 65 .key.=.name.toLowerCase().....de
e920 6c 65 74 65 20 74 68 69 73 2e 65 78 74 72 61 48 65 61 64 65 72 73 5b 6b 65 79 5d 0a 20 20 20 20 lete.this.extraHeaders[key].....
e940 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 72 65 6d 6f 76 65 45 78 74 72 61 48 65 61 64 65 this.urlRequest.removeExtraHeade
e960 72 28 6e 61 6d 65 29 0a 20 20 7d 0a 0a 20 20 5f 77 72 69 74 65 20 28 63 68 75 6e 6b 2c 20 65 6e r(name)...}...._write.(chunk,.en
e980 63 6f 64 69 6e 67 2c 20 63 61 6c 6c 62 61 63 6b 2c 20 69 73 4c 61 73 74 29 20 7b 0a 20 20 20 20 coding,.callback,.isLast).{.....
e9a0 6c 65 74 20 63 68 75 6e 6b 49 73 53 74 72 69 6e 67 20 3d 20 74 79 70 65 6f 66 20 63 68 75 6e 6b let.chunkIsString.=.typeof.chunk
e9c0 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 0a 20 20 20 20 6c 65 74 20 63 68 75 6e 6b 49 73 42 75 66 .===.'string'.....let.chunkIsBuf
e9e0 66 65 72 20 3d 20 63 68 75 6e 6b 20 69 6e 73 74 61 6e 63 65 6f 66 20 42 75 66 66 65 72 0a 20 20 fer.=.chunk.instanceof.Buffer...
ea00 20 20 69 66 20 28 21 63 68 75 6e 6b 49 73 53 74 72 69 6e 67 20 26 26 20 21 63 68 75 6e 6b 49 73 ..if.(!chunkIsString.&&.!chunkIs
ea20 42 75 66 66 65 72 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 Buffer).{.......throw.new.TypeEr
ea40 72 6f 72 28 27 46 69 72 73 74 20 61 72 67 75 6d 65 6e 74 20 6d 75 73 74 20 62 65 20 61 20 73 74 ror('First.argument.must.be.a.st
ea60 72 69 6e 67 20 6f 72 20 42 75 66 66 65 72 2e 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 ring.or.Buffer.').....}......if.
ea80 28 63 68 75 6e 6b 49 73 53 74 72 69 6e 67 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 57 65 20 63 6f (chunkIsString).{.......//.We.co
eaa0 6e 76 65 72 74 20 61 6c 6c 20 73 74 72 69 6e 67 73 20 69 6e 74 6f 20 62 69 6e 61 72 79 20 62 75 nvert.all.strings.into.binary.bu
eac0 66 66 65 72 73 2e 0a 20 20 20 20 20 20 63 68 75 6e 6b 20 3d 20 42 75 66 66 65 72 2e 66 72 6f 6d ffers........chunk.=.Buffer.from
eae0 28 63 68 75 6e 6b 2c 20 65 6e 63 6f 64 69 6e 67 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 (chunk,.encoding).....}......//.
eb00 53 69 6e 63 65 20 77 72 69 74 69 6e 67 20 74 6f 20 74 68 65 20 6e 65 74 77 6f 72 6b 20 69 73 20 Since.writing.to.the.network.is.
eb20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 2c 20 77 65 20 63 6f 6e 73 65 72 76 61 74 69 76 65 6c 79 0a asynchronous,.we.conservatively.
eb40 20 20 20 20 2f 2f 20 61 73 73 75 6d 65 20 74 68 61 74 20 72 65 71 75 65 73 74 20 68 65 61 64 65 ....//.assume.that.request.heade
eb60 72 73 20 61 72 65 20 77 72 69 74 74 65 6e 20 61 66 74 65 72 20 64 65 6c 69 76 65 72 69 6e 67 20 rs.are.written.after.delivering.
eb80 74 68 65 20 66 69 72 73 74 0a 20 20 20 20 2f 2f 20 62 75 66 66 65 72 20 74 6f 20 74 68 65 20 6e the.first.....//.buffer.to.the.n
eba0 65 74 77 6f 72 6b 20 49 4f 20 74 68 72 65 61 64 2e 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 75 etwork.IO.thread......if.(this.u
ebc0 72 6c 52 65 71 75 65 73 74 2e 6e 6f 74 53 74 61 72 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 rlRequest.notStarted).{.......th
ebe0 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 73 65 74 43 68 75 6e 6b 65 64 55 70 6c 6f 61 64 28 74 is.urlRequest.setChunkedUpload(t
ec00 68 69 73 2e 63 68 75 6e 6b 65 64 45 6e 63 6f 64 69 6e 67 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 his.chunkedEncoding).....}......
ec20 2f 2f 20 48 65 61 64 65 72 73 20 61 72 65 20 61 73 73 75 6d 65 64 20 74 6f 20 62 65 20 73 65 6e //.Headers.are.assumed.to.be.sen
ec40 74 20 6f 6e 20 66 69 72 73 74 20 63 61 6c 6c 20 74 6f 20 5f 77 72 69 74 65 42 75 66 66 65 72 2c t.on.first.call.to._writeBuffer,
ec60 0a 20 20 20 20 2f 2f 20 69 2e 65 2e 20 61 66 74 65 72 20 74 68 65 20 66 69 72 73 74 20 63 61 6c .....//.i.e..after.the.first.cal
ec80 6c 20 74 6f 20 77 72 69 74 65 20 6f 72 20 65 6e 64 2e 0a 20 20 20 20 6c 65 74 20 72 65 73 75 6c l.to.write.or.end......let.resul
eca0 74 20 3d 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 77 72 69 74 65 28 63 68 75 6e 6b 2c t.=.this.urlRequest.write(chunk,
ecc0 20 69 73 4c 61 73 74 29 0a 0a 20 20 20 20 2f 2f 20 54 68 65 20 77 72 69 74 65 20 63 61 6c 6c 62 .isLast)......//.The.write.callb
ece0 61 63 6b 20 69 73 20 66 69 72 65 64 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 20 74 6f 20 6d ack.is.fired.asynchronously.to.m
ed00 69 6d 69 63 20 4e 6f 64 65 2e 6a 73 2e 0a 20 20 20 20 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 20 imic.Node.js......if.(callback).
ed20 7b 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 63 61 6c 6c 62 61 63 {.......process.nextTick(callbac
ed40 6b 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 72 65 73 75 6c 74 0a 20 20 7d 0a k).....}......return.result...}.
ed60 0a 20 20 77 72 69 74 65 20 28 64 61 74 61 2c 20 65 6e 63 6f 64 69 6e 67 2c 20 63 61 6c 6c 62 61 ...write.(data,.encoding,.callba
ed80 63 6b 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 66 69 ck).{.....if.(this.urlRequest.fi
eda0 6e 69 73 68 65 64 29 20 7b 0a 20 20 20 20 20 20 6c 65 74 20 65 72 72 6f 72 20 3d 20 6e 65 77 20 nished).{.......let.error.=.new.
edc0 45 72 72 6f 72 28 27 57 72 69 74 65 20 61 66 74 65 72 20 65 6e 64 2e 27 29 0a 20 20 20 20 20 20 Error('Write.after.end.').......
ede0 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 77 72 69 74 65 41 66 74 65 72 45 6e 64 4e 54 process.nextTick(writeAfterEndNT
ee00 2c 20 74 68 69 73 2c 20 65 72 72 6f 72 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 20 20 72 ,.this,.error,.callback).......r
ee20 65 74 75 72 6e 20 74 72 75 65 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 eturn.true.....}......return.thi
ee40 73 2e 5f 77 72 69 74 65 28 64 61 74 61 2c 20 65 6e 63 6f 64 69 6e 67 2c 20 63 61 6c 6c 62 61 63 s._write(data,.encoding,.callbac
ee60 6b 2c 20 66 61 6c 73 65 29 0a 20 20 7d 0a 0a 20 20 65 6e 64 20 28 64 61 74 61 2c 20 65 6e 63 6f k,.false)...}....end.(data,.enco
ee80 64 69 6e 67 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 75 ding,.callback).{.....if.(this.u
eea0 72 6c 52 65 71 75 65 73 74 2e 66 69 6e 69 73 68 65 64 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 rlRequest.finished).{.......retu
eec0 72 6e 20 66 61 6c 73 65 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 64 rn.false.....}......if.(typeof.d
eee0 61 74 61 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 63 61 6c 6c ata.===.'function').{.......call
ef00 62 61 63 6b 20 3d 20 64 61 74 61 0a 20 20 20 20 20 20 65 6e 63 6f 64 69 6e 67 20 3d 20 6e 75 6c back.=.data.......encoding.=.nul
ef20 6c 0a 20 20 20 20 20 20 64 61 74 61 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 l.......data.=.null.....}.else.i
ef40 66 20 28 74 79 70 65 6f 66 20 65 6e 63 6f 64 69 6e 67 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e f.(typeof.encoding.===.'function
ef60 27 29 20 7b 0a 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b 20 3d 20 65 6e 63 6f 64 69 6e 67 0a 20 ').{.......callback.=.encoding..
ef80 20 20 20 20 20 65 6e 63 6f 64 69 6e 67 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 7d 0a 0a 20 20 20 20 .....encoding.=.null.....}......
efa0 64 61 74 61 20 3d 20 64 61 74 61 20 7c 7c 20 27 27 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 data.=.data.||.''......return.th
efc0 69 73 2e 5f 77 72 69 74 65 28 64 61 74 61 2c 20 65 6e 63 6f 64 69 6e 67 2c 20 63 61 6c 6c 62 61 is._write(data,.encoding,.callba
efe0 63 6b 2c 20 74 72 75 65 29 0a 20 20 7d 0a 0a 20 20 66 6f 6c 6c 6f 77 52 65 64 69 72 65 63 74 20 ck,.true)...}....followRedirect.
f000 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 66 6f 6c 6c 6f 77 52 ().{.....this.urlRequest.followR
f020 65 64 69 72 65 63 74 28 29 0a 20 20 7d 0a 0a 20 20 61 62 6f 72 74 20 28 29 20 7b 0a 20 20 20 20 edirect()...}....abort.().{.....
f040 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 63 61 6e 63 65 6c 28 29 0a 20 20 7d 0a 0a 7d 0a this.urlRequest.cancel()...}..}.
f060 0a 66 75 6e 63 74 69 6f 6e 20 77 72 69 74 65 41 66 74 65 72 45 6e 64 4e 54 20 28 73 65 6c 66 2c .function.writeAfterEndNT.(self,
f080 20 65 72 72 6f 72 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 73 65 6c 66 2e 65 6d 69 74 28 .error,.callback).{...self.emit(
f0a0 27 65 72 72 6f 72 27 2c 20 65 72 72 6f 72 29 0a 20 20 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 20 'error',.error)...if.(callback).
f0c0 63 61 6c 6c 62 61 63 6b 28 65 72 72 6f 72 29 0a 7d 0a 0a 4e 65 74 2e 70 72 6f 74 6f 74 79 70 65 callback(error).}..Net.prototype
f0e0 2e 72 65 71 75 65 73 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 70 74 69 6f 6e 73 2c 20 63 61 .request.=.function.(options,.ca
f100 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 6e 65 77 20 43 6c 69 65 6e 74 52 65 71 llback).{...return.new.ClientReq
f120 75 65 73 74 28 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 7d 0a 0a 6e 65 74 2e 43 uest(options,.callback).}..net.C
f140 6c 69 65 6e 74 52 65 71 75 65 73 74 20 3d 20 43 6c 69 65 6e 74 52 65 71 75 65 73 74 0a 0a 6d 6f lientRequest.=.ClientRequest..mo
f160 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 6e 65 74 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 dule.exports.=.net.const.{EventE
f180 6d 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 mitter}.=.require('events').cons
f1a0 74 20 7b 4e 6f 74 69 66 69 63 61 74 69 6f 6e 2c 20 69 73 53 75 70 70 6f 72 74 65 64 7d 20 3d 20 t.{Notification,.isSupported}.=.
f1c0 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 6e 6f 74 69 66 69 63 61 74 69 6f process.atomBinding('notificatio
f1e0 6e 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 4e 6f 74 69 66 n')..Object.setPrototypeOf(Notif
f200 69 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e ication.prototype,.EventEmitter.
f220 70 72 6f 74 6f 74 79 70 65 29 0a 0a 4e 6f 74 69 66 69 63 61 74 69 6f 6e 2e 69 73 53 75 70 70 6f prototype)..Notification.isSuppo
f240 72 74 65 64 20 3d 20 69 73 53 75 70 70 6f 72 74 65 64 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 rted.=.isSupported..module.expor
f260 74 73 20 3d 20 4e 6f 74 69 66 69 63 61 74 69 6f 6e 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d ts.=.Notification.const.{EventEm
f280 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 itter}.=.require('events').const
f2a0 20 7b 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 2c 20 50 6f 77 65 72 4d 6f 6e 69 74 6f 72 7d 20 3d 20 .{powerMonitor,.PowerMonitor}.=.
f2c0 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 70 6f 77 65 72 5f 6d 6f 6e 69 74 process.atomBinding('power_monit
f2e0 6f 72 27 29 0a 0a 2f 2f 20 50 6f 77 65 72 4d 6f 6e 69 74 6f 72 20 69 73 20 61 6e 20 45 76 65 6e or')..//.PowerMonitor.is.an.Even
f300 74 45 6d 69 74 74 65 72 2e 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 tEmitter..Object.setPrototypeOf(
f320 50 6f 77 65 72 4d 6f 6e 69 74 6f 72 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 PowerMonitor.prototype,.EventEmi
f340 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c tter.prototype).EventEmitter.cal
f360 6c 28 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 l(powerMonitor)..module.exports.
f380 3d 20 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 =.powerMonitor.module.exports.=.
f3a0 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 70 6f 77 65 72 5f 73 61 76 65 5f process.atomBinding('power_save_
f3c0 62 6c 6f 63 6b 65 72 27 29 2e 70 6f 77 65 72 53 61 76 65 42 6c 6f 63 6b 65 72 0a 63 6f 6e 73 74 blocker').powerSaveBlocker.const
f3e0 20 7b 61 70 70 2c 20 73 65 73 73 69 6f 6e 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 .{app,.session}.=.require('elect
f400 72 6f 6e 27 29 0a 0a 2f 2f 20 47 6c 6f 62 61 6c 20 70 72 6f 74 6f 63 6f 6c 20 41 50 49 73 2e 0a ron')..//.Global.protocol.APIs..
f420 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e module.exports.=.process.atomBin
f440 64 69 6e 67 28 27 70 72 6f 74 6f 63 6f 6c 27 29 0a 0a 2f 2f 20 46 61 6c 6c 62 61 63 6b 20 70 72 ding('protocol')..//.Fallback.pr
f460 6f 74 6f 63 6f 6c 20 41 50 49 73 20 6f 66 20 64 65 66 61 75 6c 74 20 73 65 73 73 69 6f 6e 2e 0a otocol.APIs.of.default.session..
f480 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 6d 6f 64 75 6c 65 2e 65 78 70 Object.setPrototypeOf(module.exp
f4a0 6f 72 74 73 2c 20 6e 65 77 20 50 72 6f 78 79 28 7b 7d 2c 20 7b 0a 20 20 67 65 74 20 28 74 61 72 orts,.new.Proxy({},.{...get.(tar
f4c0 67 65 74 2c 20 70 72 6f 70 65 72 74 79 29 20 7b 0a 20 20 20 20 69 66 20 28 21 61 70 70 2e 69 73 get,.property).{.....if.(!app.is
f4e0 52 65 61 64 79 28 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 63 6f 6e 73 74 20 70 72 6f 74 6f Ready()).return......const.proto
f500 63 6f 6c 20 3d 20 73 65 73 73 69 6f 6e 2e 64 65 66 61 75 6c 74 53 65 73 73 69 6f 6e 2e 70 72 6f col.=.session.defaultSession.pro
f520 74 6f 63 6f 6c 0a 20 20 20 20 69 66 20 28 21 4f 62 6a 65 63 74 2e 67 65 74 50 72 6f 74 6f 74 79 tocol.....if.(!Object.getPrototy
f540 70 65 4f 66 28 70 72 6f 74 6f 63 6f 6c 29 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 70 72 peOf(protocol).hasOwnProperty(pr
f560 6f 70 65 72 74 79 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 2f 2f 20 52 65 74 75 72 6e 69 6e operty)).return......//.Returnin
f580 67 20 61 20 6e 61 74 69 76 65 20 66 75 6e 63 74 69 6f 6e 20 64 69 72 65 63 74 6c 79 20 77 6f 75 g.a.native.function.directly.wou
f5a0 6c 64 20 74 68 72 6f 77 20 65 72 72 6f 72 2e 0a 20 20 20 20 72 65 74 75 72 6e 20 28 2e 2e 2e 61 ld.throw.error......return.(...a
f5c0 72 67 73 29 20 3d 3e 20 70 72 6f 74 6f 63 6f 6c 5b 70 72 6f 70 65 72 74 79 5d 28 2e 2e 2e 61 72 rgs).=>.protocol[property](...ar
f5e0 67 73 29 0a 20 20 7d 2c 0a 0a 20 20 6f 77 6e 4b 65 79 73 20 28 29 20 7b 0a 20 20 20 20 69 66 20 gs)...},....ownKeys.().{.....if.
f600 28 21 61 70 70 2e 69 73 52 65 61 64 79 28 29 29 20 72 65 74 75 72 6e 20 5b 5d 0a 0a 20 20 20 20 (!app.isReady()).return.[]......
f620 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 4e 61 6d 65 return.Object.getOwnPropertyName
f640 73 28 4f 62 6a 65 63 74 2e 67 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 73 65 73 73 69 6f 6e 2e s(Object.getPrototypeOf(session.
f660 64 65 66 61 75 6c 74 53 65 73 73 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 29 29 0a 20 20 7d 2c 0a 0a defaultSession.protocol))...},..
f680 20 20 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 72 69 70 74 6f 72 20 28 74 61 72 67 ..getOwnPropertyDescriptor.(targ
f6a0 65 74 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 7b 20 63 6f 6e 66 69 67 75 72 61 62 6c 65 3a et).{.....return.{.configurable:
f6c0 20 74 72 75 65 2c 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 20 7d 0a 20 20 7d 0a 7d 29 .true,.enumerable:.true.}...}.})
f6e0 29 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 65 ).const.{EventEmitter}.=.require
f700 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 73 63 72 65 65 6e 2c 20 53 63 72 65 65 6e ('events').const.{screen,.Screen
f720 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 73 63 72 65 65 6e 27 }.=.process.atomBinding('screen'
f740 29 0a 0a 2f 2f 20 53 63 72 65 65 6e 20 69 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e )..//.Screen.is.an.EventEmitter.
f760 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 53 63 72 65 65 6e 2e 70 72 .Object.setPrototypeOf(Screen.pr
f780 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 ototype,.EventEmitter.prototype)
f7a0 0a 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 73 63 72 65 65 6e 29 0a 0a 6d 6f 64 75 .EventEmitter.call(screen)..modu
f7c0 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 73 63 72 65 65 6e 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 le.exports.=.screen.const.{Event
f7e0 45 6d 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e Emitter}.=.require('events').con
f800 73 74 20 7b 61 70 70 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 st.{app}.=.require('electron').c
f820 6f 6e 73 74 20 7b 66 72 6f 6d 50 61 72 74 69 74 69 6f 6e 2c 20 53 65 73 73 69 6f 6e 2c 20 43 6f onst.{fromPartition,.Session,.Co
f840 6f 6b 69 65 73 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 73 65 okies}.=.process.atomBinding('se
f860 73 73 69 6f 6e 27 29 0a 0a 2f 2f 20 50 75 62 6c 69 63 20 41 50 49 2e 0a 4f 62 6a 65 63 74 2e 64 ssion')..//.Public.API..Object.d
f880 65 66 69 6e 65 50 72 6f 70 65 72 74 69 65 73 28 65 78 70 6f 72 74 73 2c 20 7b 0a 20 20 64 65 66 efineProperties(exports,.{...def
f8a0 61 75 6c 74 53 65 73 73 69 6f 6e 3a 20 7b 0a 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 aultSession:.{.....enumerable:.t
f8c0 72 75 65 2c 0a 20 20 20 20 67 65 74 20 28 29 20 7b 20 72 65 74 75 72 6e 20 66 72 6f 6d 50 61 72 rue,.....get.().{.return.fromPar
f8e0 74 69 74 69 6f 6e 28 27 27 29 20 7d 0a 20 20 7d 2c 0a 20 20 66 72 6f 6d 50 61 72 74 69 74 69 6f tition('').}...},...fromPartitio
f900 6e 3a 20 7b 0a 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 76 n:.{.....enumerable:.true,.....v
f920 61 6c 75 65 3a 20 66 72 6f 6d 50 61 72 74 69 74 69 6f 6e 0a 20 20 7d 0a 7d 29 0a 0a 4f 62 6a 65 alue:.fromPartition...}.})..Obje
f940 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 53 65 73 73 69 6f 6e 2e 70 72 6f 74 6f 74 ct.setPrototypeOf(Session.protot
f960 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 4f 62 6a ype,.EventEmitter.prototype).Obj
f980 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 43 6f 6f 6b 69 65 73 2e 70 72 6f 74 6f ect.setPrototypeOf(Cookies.proto
f9a0 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 53 type,.EventEmitter.prototype)..S
f9c0 65 73 73 69 6f 6e 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 20 3d 20 66 75 6e 63 74 69 6f ession.prototype._init.=.functio
f9e0 6e 20 28 29 20 7b 0a 20 20 61 70 70 2e 65 6d 69 74 28 27 73 65 73 73 69 6f 6e 2d 63 72 65 61 74 n.().{...app.emit('session-creat
fa00 65 64 27 2c 20 74 68 69 73 29 0a 7d 0a 0a 53 65 73 73 69 6f 6e 2e 70 72 6f 74 6f 74 79 70 65 2e ed',.this).}..Session.prototype.
fa20 73 65 74 43 65 72 74 69 66 69 63 61 74 65 56 65 72 69 66 79 50 72 6f 63 20 3d 20 66 75 6e 63 74 setCertificateVerifyProc.=.funct
fa40 69 6f 6e 20 28 76 65 72 69 66 79 50 72 6f 63 29 20 7b 0a 20 20 69 66 20 28 76 65 72 69 66 79 50 ion.(verifyProc).{...if.(verifyP
fa60 72 6f 63 20 21 3d 20 6e 75 6c 6c 20 26 26 20 76 65 72 69 66 79 50 72 6f 63 2e 6c 65 6e 67 74 68 roc.!=.null.&&.verifyProc.length
fa80 20 3e 20 32 29 20 7b 0a 20 20 20 20 2f 2f 20 54 4f 44 4f 28 6b 65 76 69 6e 73 61 77 69 63 6b 69 .>.2).{.....//.TODO(kevinsawicki
faa0 29 3a 20 52 65 6d 6f 76 65 20 69 6e 20 32 2e 30 2c 20 64 65 70 72 65 63 61 74 65 20 62 65 66 6f ):.Remove.in.2.0,.deprecate.befo
fac0 72 65 20 74 68 65 6e 20 77 69 74 68 20 77 61 72 6e 69 6e 67 73 0a 20 20 20 20 74 68 69 73 2e 5f re.then.with.warnings.....this._
fae0 73 65 74 43 65 72 74 69 66 69 63 61 74 65 56 65 72 69 66 79 50 72 6f 63 28 28 7b 68 6f 73 74 6e setCertificateVerifyProc(({hostn
fb00 61 6d 65 2c 20 63 65 72 74 69 66 69 63 61 74 65 2c 20 76 65 72 69 66 69 63 61 74 69 6f 6e 52 65 ame,.certificate,.verificationRe
fb20 73 75 6c 74 7d 2c 20 63 62 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 76 65 72 69 66 79 50 72 6f 63 sult},.cb).=>.{.......verifyProc
fb40 28 68 6f 73 74 6e 61 6d 65 2c 20 63 65 72 74 69 66 69 63 61 74 65 2c 20 28 72 65 73 75 6c 74 29 (hostname,.certificate,.(result)
fb60 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 63 62 28 72 65 73 75 6c 74 20 3f 20 30 20 3a 20 2d 32 .=>.{.........cb(result.?.0.:.-2
fb80 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 ).......}).....})...}.else.{....
fba0 20 74 68 69 73 2e 5f 73 65 74 43 65 72 74 69 66 69 63 61 74 65 56 65 72 69 66 79 50 72 6f 63 28 .this._setCertificateVerifyProc(
fbc0 76 65 72 69 66 79 50 72 6f 63 29 0a 20 20 7d 0a 7d 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d verifyProc)...}.}.const.{EventEm
fbe0 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 itter}.=.require('events').const
fc00 20 7b 73 79 73 74 65 6d 50 72 65 66 65 72 65 6e 63 65 73 2c 20 53 79 73 74 65 6d 50 72 65 66 65 .{systemPreferences,.SystemPrefe
fc20 72 65 6e 63 65 73 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 73 rences}.=.process.atomBinding('s
fc40 79 73 74 65 6d 5f 70 72 65 66 65 72 65 6e 63 65 73 27 29 0a 0a 2f 2f 20 53 79 73 74 65 6d 50 72 ystem_preferences')..//.SystemPr
fc60 65 66 65 72 65 6e 63 65 73 20 69 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 0a 4f 62 eferences.is.an.EventEmitter..Ob
fc80 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 53 79 73 74 65 6d 50 72 65 66 65 72 ject.setPrototypeOf(SystemPrefer
fca0 65 6e 63 65 73 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 ences.prototype,.EventEmitter.pr
fcc0 6f 74 6f 74 79 70 65 29 0a 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 73 79 73 74 65 ototype).EventEmitter.call(syste
fce0 6d 50 72 65 66 65 72 65 6e 63 65 73 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 mPreferences)..module.exports.=.
fd00 73 79 73 74 65 6d 50 72 65 66 65 72 65 6e 63 65 73 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d systemPreferences.const.{EventEm
fd20 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 0a 6c 65 74 20 itter}.=.require('events')..let.
fd40 6e 65 78 74 49 74 65 6d 49 44 20 3d 20 31 0a 0a 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 20 65 nextItemID.=.1..class.TouchBar.e
fd60 78 74 65 6e 64 73 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7b 0a 20 20 2f 2f 20 42 69 6e 64 20 xtends.EventEmitter.{...//.Bind.
fd80 61 20 74 6f 75 63 68 20 62 61 72 20 74 6f 20 61 20 77 69 6e 64 6f 77 0a 20 20 73 74 61 74 69 63 a.touch.bar.to.a.window...static
fda0 20 5f 73 65 74 4f 6e 57 69 6e 64 6f 77 20 28 74 6f 75 63 68 42 61 72 2c 20 77 69 6e 64 6f 77 29 ._setOnWindow.(touchBar,.window)
fdc0 20 7b 0a 20 20 20 20 69 66 20 28 77 69 6e 64 6f 77 2e 5f 74 6f 75 63 68 42 61 72 20 21 3d 20 6e .{.....if.(window._touchBar.!=.n
fde0 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 5f 74 6f 75 63 68 42 61 72 2e 5f 72 ull).{.......window._touchBar._r
fe00 65 6d 6f 76 65 46 72 6f 6d 57 69 6e 64 6f 77 28 77 69 6e 64 6f 77 29 0a 20 20 20 20 7d 0a 0a 20 emoveFromWindow(window).....}...
fe20 20 20 20 69 66 20 28 74 6f 75 63 68 42 61 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 ...if.(touchBar.==.null).{......
fe40 20 77 69 6e 64 6f 77 2e 5f 73 65 74 54 6f 75 63 68 42 61 72 49 74 65 6d 73 28 5b 5d 29 0a 20 20 .window._setTouchBarItems([])...
fe60 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 41 72 72 61 79 2e ....return.....}......if.(Array.
fe80 69 73 41 72 72 61 79 28 74 6f 75 63 68 42 61 72 29 29 20 7b 0a 20 20 20 20 20 20 74 6f 75 63 68 isArray(touchBar)).{.......touch
fea0 42 61 72 20 3d 20 6e 65 77 20 54 6f 75 63 68 42 61 72 28 74 6f 75 63 68 42 61 72 29 0a 20 20 20 Bar.=.new.TouchBar(touchBar)....
fec0 20 7d 0a 20 20 20 20 74 6f 75 63 68 42 61 72 2e 5f 61 64 64 54 6f 57 69 6e 64 6f 77 28 77 69 6e .}.....touchBar._addToWindow(win
fee0 64 6f 77 29 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 6f 70 74 69 6f 6e 73 dow)...}....constructor.(options
ff00 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 ).{.....super()......if.(options
ff20 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f .==.null).{.......throw.new.Erro
ff40 72 28 27 4d 75 73 74 20 73 70 65 63 69 66 79 20 6f 70 74 69 6f 6e 73 20 6f 62 6a 65 63 74 20 61 r('Must.specify.options.object.a
ff60 73 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 s.first.argument').....}......le
ff80 74 20 7b 69 74 65 6d 73 2c 20 65 73 63 61 70 65 49 74 65 6d 7d 20 3d 20 6f 70 74 69 6f 6e 73 0a t.{items,.escapeItem}.=.options.
ffa0 0a 20 20 20 20 2f 2f 20 46 49 58 4d 45 20 53 75 70 70 6f 72 74 20 61 72 72 61 79 20 61 73 20 66 .....//.FIXME.Support.array.as.f
ffc0 69 72 73 74 20 61 72 67 75 6d 65 6e 74 2c 20 72 65 6d 6f 76 65 20 69 6e 20 32 2e 30 0a 20 20 20 irst.argument,.remove.in.2.0....
ffe0 20 69 66 20 28 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 6f 70 74 69 6f 6e 73 29 29 20 7b 0a 20 .if.(Array.isArray(options)).{..
10000 20 20 20 20 20 69 74 65 6d 73 20 3d 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 20 20 65 73 63 61 70 .....items.=.options.......escap
10020 65 49 74 65 6d 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 21 41 72 72 eItem.=.null.....}......if.(!Arr
10040 61 79 2e 69 73 41 72 72 61 79 28 69 74 65 6d 73 29 29 20 7b 0a 20 20 20 20 20 20 69 74 65 6d 73 ay.isArray(items)).{.......items
10060 20 3d 20 5b 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 68 69 73 2e 63 68 61 6e 67 65 4c 69 73 74 .=.[].....}......this.changeList
10080 65 6e 65 72 20 3d 20 28 69 74 65 6d 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 65 6d ener.=.(item).=>.{.......this.em
100a0 69 74 28 27 63 68 61 6e 67 65 27 2c 20 69 74 65 6d 2e 69 64 2c 20 69 74 65 6d 2e 74 79 70 65 29 it('change',.item.id,.item.type)
100c0 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 68 69 73 2e 77 69 6e 64 6f 77 4c 69 73 74 65 6e 65 72 73 .....}......this.windowListeners
100e0 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 69 74 65 6d 73 20 3d 20 7b 7d 0a 20 20 20 20 74 68 .=.{}.....this.items.=.{}.....th
10100 69 73 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 20 3d 20 5b 5d 0a 20 20 20 20 74 68 69 73 2e is.ordereredItems.=.[].....this.
10120 65 73 63 61 70 65 49 74 65 6d 20 3d 20 65 73 63 61 70 65 49 74 65 6d 0a 0a 20 20 20 20 63 6f 6e escapeItem.=.escapeItem......con
10140 73 74 20 72 65 67 69 73 74 65 72 49 74 65 6d 20 3d 20 28 69 74 65 6d 29 20 3d 3e 20 7b 0a 20 20 st.registerItem.=.(item).=>.{...
10160 20 20 20 20 74 68 69 73 2e 69 74 65 6d 73 5b 69 74 65 6d 2e 69 64 5d 20 3d 20 69 74 65 6d 0a 20 ....this.items[item.id].=.item..
10180 20 20 20 20 20 69 74 65 6d 2e 6f 6e 28 27 63 68 61 6e 67 65 27 2c 20 74 68 69 73 2e 63 68 61 6e .....item.on('change',.this.chan
101a0 67 65 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 20 20 69 66 20 28 69 74 65 6d 2e 63 68 69 6c 64 geListener).......if.(item.child
101c0 20 69 6e 73 74 61 6e 63 65 6f 66 20 54 6f 75 63 68 42 61 72 29 20 7b 0a 20 20 20 20 20 20 20 20 .instanceof.TouchBar).{.........
101e0 69 74 65 6d 2e 63 68 69 6c 64 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 2e 66 6f 72 45 61 63 item.child.ordereredItems.forEac
10200 68 28 72 65 67 69 73 74 65 72 49 74 65 6d 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 h(registerItem).......}.....}...
10220 20 20 69 74 65 6d 73 2e 66 6f 72 45 61 63 68 28 28 69 74 65 6d 29 20 3d 3e 20 7b 0a 20 20 20 20 ..items.forEach((item).=>.{.....
10240 20 20 69 66 20 28 21 28 69 74 65 6d 20 69 6e 73 74 61 6e 63 65 6f 66 20 54 6f 75 63 68 42 61 72 ..if.(!(item.instanceof.TouchBar
10260 49 74 65 6d 29 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 Item)).{.........throw.new.Error
10280 28 27 45 61 63 68 20 69 74 65 6d 20 6d 75 73 74 20 62 65 20 61 6e 20 69 6e 73 74 61 6e 63 65 20 ('Each.item.must.be.an.instance.
102a0 6f 66 20 54 6f 75 63 68 42 61 72 49 74 65 6d 27 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 of.TouchBarItem').......}.......
102c0 74 68 69 73 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 2e 70 75 73 68 28 69 74 65 6d 29 0a 20 this.ordereredItems.push(item)..
102e0 20 20 20 20 20 72 65 67 69 73 74 65 72 49 74 65 6d 28 69 74 65 6d 29 0a 20 20 20 20 7d 29 0a 20 .....registerItem(item).....})..
10300 20 7d 0a 0a 20 20 73 65 74 20 65 73 63 61 70 65 49 74 65 6d 20 28 69 74 65 6d 29 20 7b 0a 20 20 .}....set.escapeItem.(item).{...
10320 20 20 69 66 20 28 69 74 65 6d 20 21 3d 20 6e 75 6c 6c 20 26 26 20 21 28 69 74 65 6d 20 69 6e 73 ..if.(item.!=.null.&&.!(item.ins
10340 74 61 6e 63 65 6f 66 20 54 6f 75 63 68 42 61 72 49 74 65 6d 29 29 20 7b 0a 20 20 20 20 20 20 74 tanceof.TouchBarItem)).{.......t
10360 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 45 73 63 61 70 65 20 69 74 65 6d 20 6d 75 73 74 hrow.new.Error('Escape.item.must
10380 20 62 65 20 61 6e 20 69 6e 73 74 61 6e 63 65 20 6f 66 20 54 6f 75 63 68 42 61 72 49 74 65 6d 27 .be.an.instance.of.TouchBarItem'
103a0 29 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 20 ).....}.....if.(this.escapeItem.
103c0 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d !=.null).{.......this.escapeItem
103e0 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 63 68 61 6e 67 65 27 2c 20 74 68 69 73 2e 63 .removeListener('change',.this.c
10400 68 61 6e 67 65 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 5f 65 hangeListener).....}.....this._e
10420 73 63 61 70 65 49 74 65 6d 20 3d 20 69 74 65 6d 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 65 73 scapeItem.=.item.....if.(this.es
10440 63 61 70 65 49 74 65 6d 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 65 capeItem.!=.null).{.......this.e
10460 73 63 61 70 65 49 74 65 6d 2e 6f 6e 28 27 63 68 61 6e 67 65 27 2c 20 74 68 69 73 2e 63 68 61 6e scapeItem.on('change',.this.chan
10480 67 65 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 geListener).....}.....this.emit(
104a0 27 65 73 63 61 70 65 2d 69 74 65 6d 2d 63 68 61 6e 67 65 27 2c 20 69 74 65 6d 29 0a 20 20 7d 0a 'escape-item-change',.item)...}.
104c0 0a 20 20 67 65 74 20 65 73 63 61 70 65 49 74 65 6d 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 ...get.escapeItem.().{.....retur
104e0 6e 20 74 68 69 73 2e 5f 65 73 63 61 70 65 49 74 65 6d 0a 20 20 7d 0a 0a 20 20 5f 61 64 64 54 6f n.this._escapeItem...}...._addTo
10500 57 69 6e 64 6f 77 20 28 77 69 6e 64 6f 77 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 7b 69 64 7d Window.(window).{.....const.{id}
10520 20 3d 20 77 69 6e 64 6f 77 0a 0a 20 20 20 20 2f 2f 20 41 6c 72 65 61 64 79 20 61 64 64 65 64 20 .=.window......//.Already.added.
10540 74 6f 20 77 69 6e 64 6f 77 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 77 69 6e 64 6f 77 4c 69 73 to.window.....if.(this.windowLis
10560 74 65 6e 65 72 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 69 64 29 29 20 72 65 74 75 72 teners.hasOwnProperty(id)).retur
10580 6e 0a 0a 20 20 20 20 77 69 6e 64 6f 77 2e 5f 74 6f 75 63 68 42 61 72 20 3d 20 74 68 69 73 0a 0a n......window._touchBar.=.this..
105a0 20 20 20 20 63 6f 6e 73 74 20 63 68 61 6e 67 65 4c 69 73 74 65 6e 65 72 20 3d 20 28 69 74 65 6d ....const.changeListener.=.(item
105c0 49 44 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 5f 72 65 66 72 65 73 68 54 6f ID).=>.{.......window._refreshTo
105e0 75 63 68 42 61 72 49 74 65 6d 28 69 74 65 6d 49 44 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 uchBarItem(itemID).....}.....thi
10600 73 2e 6f 6e 28 27 63 68 61 6e 67 65 27 2c 20 63 68 61 6e 67 65 4c 69 73 74 65 6e 65 72 29 0a 0a s.on('change',.changeListener)..
10620 20 20 20 20 63 6f 6e 73 74 20 65 73 63 61 70 65 49 74 65 6d 4c 69 73 74 65 6e 65 72 20 3d 20 28 ....const.escapeItemListener.=.(
10640 69 74 65 6d 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 5f 73 65 74 45 73 63 61 item).=>.{.......window._setEsca
10660 70 65 54 6f 75 63 68 42 61 72 49 74 65 6d 28 69 74 65 6d 20 21 3d 20 6e 75 6c 6c 20 3f 20 69 74 peTouchBarItem(item.!=.null.?.it
10680 65 6d 20 3a 20 7b 7d 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 6f 6e 28 27 65 73 63 61 em.:.{}).....}.....this.on('esca
106a0 70 65 2d 69 74 65 6d 2d 63 68 61 6e 67 65 27 2c 20 65 73 63 61 70 65 49 74 65 6d 4c 69 73 74 65 pe-item-change',.escapeItemListe
106c0 6e 65 72 29 0a 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 61 63 74 69 6f 6e 4c 69 73 74 65 ner)......const.interactionListe
106e0 6e 65 72 20 3d 20 28 65 76 65 6e 74 2c 20 69 74 65 6d 49 44 2c 20 64 65 74 61 69 6c 73 29 20 3d ner.=.(event,.itemID,.details).=
10700 3e 20 7b 0a 20 20 20 20 20 20 6c 65 74 20 69 74 65 6d 20 3d 20 74 68 69 73 2e 69 74 65 6d 73 5b >.{.......let.item.=.this.items[
10720 69 74 65 6d 49 44 5d 0a 20 20 20 20 20 20 69 66 20 28 69 74 65 6d 20 3d 3d 20 6e 75 6c 6c 20 26 itemID].......if.(item.==.null.&
10740 26 20 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 20 21 3d 20 6e 75 6c 6c 20 26 26 20 74 68 69 &.this.escapeItem.!=.null.&&.thi
10760 73 2e 65 73 63 61 70 65 49 74 65 6d 2e 69 64 20 3d 3d 3d 20 69 74 65 6d 49 44 29 20 7b 0a 20 20 s.escapeItem.id.===.itemID).{...
10780 20 20 20 20 20 20 69 74 65 6d 20 3d 20 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 0a 20 20 20 ......item.=.this.escapeItem....
107a0 20 20 20 7d 0a 20 20 20 20 20 20 69 66 20 28 69 74 65 6d 20 21 3d 20 6e 75 6c 6c 20 26 26 20 69 ...}.......if.(item.!=.null.&&.i
107c0 74 65 6d 2e 6f 6e 49 6e 74 65 72 61 63 74 69 6f 6e 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 tem.onInteraction.!=.null).{....
107e0 20 20 20 20 20 69 74 65 6d 2e 6f 6e 49 6e 74 65 72 61 63 74 69 6f 6e 28 64 65 74 61 69 6c 73 29 .....item.onInteraction(details)
10800 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 77 69 6e 64 6f 77 2e 6f 6e 28 27 2d 74 .......}.....}.....window.on('-t
10820 6f 75 63 68 2d 62 61 72 2d 69 6e 74 65 72 61 63 74 69 6f 6e 27 2c 20 69 6e 74 65 72 61 63 74 69 ouch-bar-interaction',.interacti
10840 6f 6e 4c 69 73 74 65 6e 65 72 29 0a 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 6d 6f 76 65 4c 69 73 onListener)......const.removeLis
10860 74 65 6e 65 72 73 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 72 65 6d 6f teners.=.().=>.{.......this.remo
10880 76 65 4c 69 73 74 65 6e 65 72 28 27 63 68 61 6e 67 65 27 2c 20 63 68 61 6e 67 65 4c 69 73 74 65 veListener('change',.changeListe
108a0 6e 65 72 29 0a 20 20 20 20 20 20 74 68 69 73 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 ner).......this.removeListener('
108c0 65 73 63 61 70 65 2d 69 74 65 6d 2d 63 68 61 6e 67 65 27 2c 20 65 73 63 61 70 65 49 74 65 6d 4c escape-item-change',.escapeItemL
108e0 69 73 74 65 6e 65 72 29 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 72 65 6d 6f 76 65 4c 69 73 74 istener).......window.removeList
10900 65 6e 65 72 28 27 2d 74 6f 75 63 68 2d 62 61 72 2d 69 6e 74 65 72 61 63 74 69 6f 6e 27 2c 20 69 ener('-touch-bar-interaction',.i
10920 6e 74 65 72 61 63 74 69 6f 6e 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 nteractionListener).......window
10940 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 63 6c 6f 73 65 64 27 2c 20 72 65 6d 6f 76 65 .removeListener('closed',.remove
10960 4c 69 73 74 65 6e 65 72 73 29 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 5f 74 6f 75 63 68 42 61 Listeners).......window._touchBa
10980 72 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 20 20 64 65 6c 65 74 65 20 74 68 69 73 2e 77 69 6e 64 6f r.=.null.......delete.this.windo
109a0 77 4c 69 73 74 65 6e 65 72 73 5b 69 64 5d 0a 20 20 20 20 7d 0a 20 20 20 20 77 69 6e 64 6f 77 2e wListeners[id].....}.....window.
109c0 6f 6e 63 65 28 27 63 6c 6f 73 65 64 27 2c 20 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 73 29 0a once('closed',.removeListeners).
109e0 20 20 20 20 74 68 69 73 2e 77 69 6e 64 6f 77 4c 69 73 74 65 6e 65 72 73 5b 69 64 5d 20 3d 20 72 ....this.windowListeners[id].=.r
10a00 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 73 0a 0a 20 20 20 20 77 69 6e 64 6f 77 2e 5f 73 65 74 54 emoveListeners......window._setT
10a20 6f 75 63 68 42 61 72 49 74 65 6d 73 28 74 68 69 73 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 ouchBarItems(this.ordereredItems
10a40 29 0a 20 20 20 20 65 73 63 61 70 65 49 74 65 6d 4c 69 73 74 65 6e 65 72 28 74 68 69 73 2e 65 73 ).....escapeItemListener(this.es
10a60 63 61 70 65 49 74 65 6d 29 0a 20 20 7d 0a 0a 20 20 5f 72 65 6d 6f 76 65 46 72 6f 6d 57 69 6e 64 capeItem)...}...._removeFromWind
10a80 6f 77 20 28 77 69 6e 64 6f 77 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 6d 6f 76 65 4c 69 ow.(window).{.....const.removeLi
10aa0 73 74 65 6e 65 72 73 20 3d 20 74 68 69 73 2e 77 69 6e 64 6f 77 4c 69 73 74 65 6e 65 72 73 5b 77 steners.=.this.windowListeners[w
10ac0 69 6e 64 6f 77 2e 69 64 5d 0a 20 20 20 20 69 66 20 28 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 indow.id].....if.(removeListener
10ae0 73 20 21 3d 20 6e 75 6c 6c 29 20 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 73 28 29 0a 20 20 7d s.!=.null).removeListeners()...}
10b00 0a 7d 0a 0a 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 65 78 74 65 6e 64 73 20 45 .}..class.TouchBarItem.extends.E
10b20 76 65 6e 74 45 6d 69 74 74 65 72 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 29 20 7b ventEmitter.{...constructor.().{
10b40 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 74 68 69 73 2e 69 64 20 3d 20 60 24 7b 6e 65 .....super().....this.id.=.`${ne
10b60 78 74 49 74 65 6d 49 44 2b 2b 7d 60 0a 20 20 7d 0a 0a 20 20 5f 61 64 64 4c 69 76 65 50 72 6f 70 xtItemID++}`...}...._addLiveProp
10b80 65 72 74 79 20 28 6e 61 6d 65 2c 20 69 6e 69 74 69 61 6c 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 erty.(name,.initialValue).{.....
10ba0 63 6f 6e 73 74 20 70 72 69 76 61 74 65 4e 61 6d 65 20 3d 20 60 5f 24 7b 6e 61 6d 65 7d 60 0a 20 const.privateName.=.`_${name}`..
10bc0 20 20 20 74 68 69 73 5b 70 72 69 76 61 74 65 4e 61 6d 65 5d 20 3d 20 69 6e 69 74 69 61 6c 56 61 ...this[privateName].=.initialVa
10be0 6c 75 65 0a 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 lue.....Object.defineProperty(th
10c00 69 73 2c 20 6e 61 6d 65 2c 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 is,.name,.{.......get:.function.
10c20 28 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 5b 70 72 69 76 61 74 65 ().{.........return.this[private
10c40 4e 61 6d 65 5d 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 73 65 74 3a 20 66 75 6e 63 74 69 Name].......},.......set:.functi
10c60 6f 6e 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 5b 70 72 69 76 61 74 on.(value).{.........this[privat
10c80 65 4e 61 6d 65 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 65 6d 69 74 eName].=.value.........this.emit
10ca0 28 27 63 68 61 6e 67 65 27 2c 20 74 68 69 73 29 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 ('change',.this).......},.......
10cc0 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 7d 0a 0a 54 enumerable:.true.....})...}.}..T
10ce0 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 42 75 74 74 6f 6e 20 3d 20 63 6c 61 73 73 20 54 ouchBar.TouchBarButton.=.class.T
10d00 6f 75 63 68 42 61 72 42 75 74 74 6f 6e 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 ouchBarButton.extends.TouchBarIt
10d20 65 6d 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 em.{...constructor.(config).{...
10d40 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c ..super().....if.(config.==.null
10d60 29 20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 74 79 70 65 20 3d 20 27 62 ).config.=.{}.....this.type.=.'b
10d80 75 74 74 6f 6e 27 0a 20 20 20 20 63 6f 6e 73 74 20 7b 63 6c 69 63 6b 2c 20 69 63 6f 6e 2c 20 69 utton'.....const.{click,.icon,.i
10da0 63 6f 6e 50 6f 73 69 74 69 6f 6e 2c 20 6c 61 62 65 6c 2c 20 62 61 63 6b 67 72 6f 75 6e 64 43 6f conPosition,.label,.backgroundCo
10dc0 6c 6f 72 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 lor}.=.config.....this._addLiveP
10de0 72 6f 70 65 72 74 79 28 27 6c 61 62 65 6c 27 2c 20 6c 61 62 65 6c 29 0a 20 20 20 20 74 68 69 73 roperty('label',.label).....this
10e00 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 62 61 63 6b 67 72 6f 75 6e 64 43 6f 6c ._addLiveProperty('backgroundCol
10e20 6f 72 27 2c 20 62 61 63 6b 67 72 6f 75 6e 64 43 6f 6c 6f 72 29 0a 20 20 20 20 74 68 69 73 2e 5f or',.backgroundColor).....this._
10e40 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 69 63 6f 6e 27 2c 20 69 63 6f 6e 29 0a 20 20 addLiveProperty('icon',.icon)...
10e60 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 69 63 6f 6e 50 6f 73 ..this._addLiveProperty('iconPos
10e80 69 74 69 6f 6e 27 2c 20 69 63 6f 6e 50 6f 73 69 74 69 6f 6e 29 0a 20 20 20 20 69 66 20 28 74 79 ition',.iconPosition).....if.(ty
10ea0 70 65 6f 66 20 63 6c 69 63 6b 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 peof.click.===.'function').{....
10ec0 20 20 20 74 68 69 73 2e 6f 6e 49 6e 74 65 72 61 63 74 69 6f 6e 20 3d 20 28 29 20 3d 3e 20 7b 0a ...this.onInteraction.=.().=>.{.
10ee0 20 20 20 20 20 20 20 20 63 6f 6e 66 69 67 2e 63 6c 69 63 6b 28 29 0a 20 20 20 20 20 20 7d 0a 20 ........config.click().......}..
10f00 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 43 6f 6c ...}...}.}..TouchBar.TouchBarCol
10f20 6f 72 50 69 63 6b 65 72 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 43 6f 6c 6f 72 50 69 orPicker.=.class.TouchBarColorPi
10f40 63 6b 65 72 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 63 6f cker.extends.TouchBarItem.{...co
10f60 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 nstructor.(config).{.....super()
10f80 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 20 .....if.(config.==.null).config.
10fa0 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 74 79 70 65 20 3d 20 27 63 6f 6c 6f 72 70 69 63 6b 65 =.{}.....this.type.=.'colorpicke
10fc0 72 27 0a 20 20 20 20 63 6f 6e 73 74 20 7b 61 76 61 69 6c 61 62 6c 65 43 6f 6c 6f 72 73 2c 20 63 r'.....const.{availableColors,.c
10fe0 68 61 6e 67 65 2c 20 73 65 6c 65 63 74 65 64 43 6f 6c 6f 72 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 hange,.selectedColor}.=.config..
11000 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 61 76 61 69 6c 61 ...this._addLiveProperty('availa
11020 62 6c 65 43 6f 6c 6f 72 73 27 2c 20 61 76 61 69 6c 61 62 6c 65 43 6f 6c 6f 72 73 29 0a 20 20 20 bleColors',.availableColors)....
11040 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 73 65 6c 65 63 74 65 64 .this._addLiveProperty('selected
11060 43 6f 6c 6f 72 27 2c 20 73 65 6c 65 63 74 65 64 43 6f 6c 6f 72 29 0a 0a 20 20 20 20 69 66 20 28 Color',.selectedColor)......if.(
11080 74 79 70 65 6f 66 20 63 68 61 6e 67 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a typeof.change.===.'function').{.
110a0 20 20 20 20 20 20 74 68 69 73 2e 6f 6e 49 6e 74 65 72 61 63 74 69 6f 6e 20 3d 20 28 64 65 74 61 ......this.onInteraction.=.(deta
110c0 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 5f 73 65 6c 65 63 74 65 64 ils).=>.{.........this._selected
110e0 43 6f 6c 6f 72 20 3d 20 64 65 74 61 69 6c 73 2e 63 6f 6c 6f 72 0a 20 20 20 20 20 20 20 20 63 68 Color.=.details.color.........ch
11100 61 6e 67 65 28 64 65 74 61 69 6c 73 2e 63 6f 6c 6f 72 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 ange(details.color).......}.....
11120 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 47 72 6f 75 70 20 }...}.}..TouchBar.TouchBarGroup.
11140 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 47 72 6f 75 70 20 65 78 74 65 6e 64 73 20 54 6f =.class.TouchBarGroup.extends.To
11160 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 uchBarItem.{...constructor.(conf
11180 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 ig).{.....super().....if.(config
111a0 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 74 .==.null).config.=.{}.....this.t
111c0 79 70 65 20 3d 20 27 67 72 6f 75 70 27 0a 20 20 20 20 74 68 69 73 2e 63 68 69 6c 64 20 3d 20 63 ype.=.'group'.....this.child.=.c
111e0 6f 6e 66 69 67 2e 69 74 65 6d 73 0a 20 20 20 20 69 66 20 28 21 28 74 68 69 73 2e 63 68 69 6c 64 onfig.items.....if.(!(this.child
11200 20 69 6e 73 74 61 6e 63 65 6f 66 20 54 6f 75 63 68 42 61 72 29 29 20 7b 0a 20 20 20 20 20 20 74 .instanceof.TouchBar)).{.......t
11220 68 69 73 2e 63 68 69 6c 64 20 3d 20 6e 65 77 20 54 6f 75 63 68 42 61 72 28 74 68 69 73 2e 63 68 his.child.=.new.TouchBar(this.ch
11240 69 6c 64 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 ild).....}...}.}..TouchBar.Touch
11260 42 61 72 4c 61 62 65 6c 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 4c 61 62 65 6c 20 65 BarLabel.=.class.TouchBarLabel.e
11280 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 xtends.TouchBarItem.{...construc
112a0 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 69 tor.(config).{.....super().....i
112c0 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a 20 f.(config.==.null).config.=.{}..
112e0 20 20 20 74 68 69 73 2e 74 79 70 65 20 3d 20 27 6c 61 62 65 6c 27 0a 20 20 20 20 74 68 69 73 2e ...this.type.=.'label'.....this.
11300 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6c 61 62 65 6c 27 2c 20 63 6f 6e 66 69 67 _addLiveProperty('label',.config
11320 2e 6c 61 62 65 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 .label).....this._addLivePropert
11340 79 28 27 74 65 78 74 43 6f 6c 6f 72 27 2c 20 63 6f 6e 66 69 67 2e 74 65 78 74 43 6f 6c 6f 72 29 y('textColor',.config.textColor)
11360 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 50 6f 70 6f 76 65 72 ...}.}..TouchBar.TouchBarPopover
11380 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 50 6f 70 6f 76 65 72 20 65 78 74 65 6e 64 73 .=.class.TouchBarPopover.extends
113a0 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 .TouchBarItem.{...constructor.(c
113c0 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e onfig).{.....super().....if.(con
113e0 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 fig.==.null).config.=.{}.....thi
11400 73 2e 74 79 70 65 20 3d 20 27 70 6f 70 6f 76 65 72 27 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 s.type.=.'popover'.....this._add
11420 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6c 61 62 65 6c 27 2c 20 63 6f 6e 66 69 67 2e 6c 61 62 LiveProperty('label',.config.lab
11440 65 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 69 el).....this._addLiveProperty('i
11460 63 6f 6e 27 2c 20 63 6f 6e 66 69 67 2e 69 63 6f 6e 29 0a 20 20 20 20 74 68 69 73 2e 73 68 6f 77 con',.config.icon).....this.show
11480 43 6c 6f 73 65 42 75 74 74 6f 6e 20 3d 20 63 6f 6e 66 69 67 2e 73 68 6f 77 43 6c 6f 73 65 42 75 CloseButton.=.config.showCloseBu
114a0 74 74 6f 6e 0a 20 20 20 20 74 68 69 73 2e 63 68 69 6c 64 20 3d 20 63 6f 6e 66 69 67 2e 69 74 65 tton.....this.child.=.config.ite
114c0 6d 73 0a 20 20 20 20 69 66 20 28 21 28 74 68 69 73 2e 63 68 69 6c 64 20 69 6e 73 74 61 6e 63 65 ms.....if.(!(this.child.instance
114e0 6f 66 20 54 6f 75 63 68 42 61 72 29 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 63 68 69 6c 64 of.TouchBar)).{.......this.child
11500 20 3d 20 6e 65 77 20 54 6f 75 63 68 42 61 72 28 74 68 69 73 2e 63 68 69 6c 64 29 0a 20 20 20 20 .=.new.TouchBar(this.child).....
11520 7d 0a 20 20 20 20 74 68 69 73 2e 63 68 69 6c 64 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 2e }.....this.child.ordereredItems.
11540 66 6f 72 45 61 63 68 28 28 69 74 65 6d 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 74 65 6d 2e 5f forEach((item).=>.{.......item._
11560 70 6f 70 6f 76 65 72 20 3d 20 69 74 65 6d 2e 5f 70 6f 70 6f 76 65 72 20 7c 7c 20 5b 5d 0a 20 20 popover.=.item._popover.||.[]...
11580 20 20 20 20 69 66 20 28 21 69 74 65 6d 2e 5f 70 6f 70 6f 76 65 72 2e 69 6e 63 6c 75 64 65 73 28 ....if.(!item._popover.includes(
115a0 74 68 69 73 2e 69 64 29 29 20 69 74 65 6d 2e 5f 70 6f 70 6f 76 65 72 2e 70 75 73 68 28 74 68 69 this.id)).item._popover.push(thi
115c0 73 2e 69 64 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 s.id).....})...}.}..TouchBar.Tou
115e0 63 68 42 61 72 53 6c 69 64 65 72 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 53 6c 69 64 chBarSlider.=.class.TouchBarSlid
11600 65 72 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 63 6f 6e 73 er.extends.TouchBarItem.{...cons
11620 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 tructor.(config).{.....super()..
11640 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 20 3d 20 ...if.(config.==.null).config.=.
11660 7b 7d 0a 20 20 20 20 74 68 69 73 2e 74 79 70 65 20 3d 20 27 73 6c 69 64 65 72 27 0a 20 20 20 20 {}.....this.type.=.'slider'.....
11680 63 6f 6e 73 74 20 7b 63 68 61 6e 67 65 2c 20 6c 61 62 65 6c 2c 20 6d 69 6e 56 61 6c 75 65 2c 20 const.{change,.label,.minValue,.
116a0 6d 61 78 56 61 6c 75 65 2c 20 76 61 6c 75 65 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 20 20 20 74 68 maxValue,.value}.=.config.....th
116c0 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6c 61 62 65 6c 27 2c 20 6c 61 62 is._addLiveProperty('label',.lab
116e0 65 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6d el).....this._addLiveProperty('m
11700 69 6e 56 61 6c 75 65 27 2c 20 6d 69 6e 56 61 6c 75 65 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 inValue',.minValue).....this._ad
11720 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6d 61 78 56 61 6c 75 65 27 2c 20 6d 61 78 56 61 6c dLiveProperty('maxValue',.maxVal
11740 75 65 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 76 ue).....this._addLiveProperty('v
11760 61 6c 75 65 27 2c 20 76 61 6c 75 65 29 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 68 alue',.value)......if.(typeof.ch
11780 61 6e 67 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 74 68 69 ange.===.'function').{.......thi
117a0 73 2e 6f 6e 49 6e 74 65 72 61 63 74 69 6f 6e 20 3d 20 28 64 65 74 61 69 6c 73 29 20 3d 3e 20 7b s.onInteraction.=.(details).=>.{
117c0 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 5f 76 61 6c 75 65 20 3d 20 64 65 74 61 69 6c 73 2e 76 .........this._value.=.details.v
117e0 61 6c 75 65 0a 20 20 20 20 20 20 20 20 63 68 61 6e 67 65 28 64 65 74 61 69 6c 73 2e 76 61 6c 75 alue.........change(details.valu
11800 65 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 e).......}.....}...}.}..TouchBar
11820 2e 54 6f 75 63 68 42 61 72 53 70 61 63 65 72 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 .TouchBarSpacer.=.class.TouchBar
11840 53 70 61 63 65 72 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 Spacer.extends.TouchBarItem.{...
11860 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 constructor.(config).{.....super
11880 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 ().....if.(config.==.null).confi
118a0 67 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 74 79 70 65 20 3d 20 27 73 70 61 63 65 72 27 0a g.=.{}.....this.type.=.'spacer'.
118c0 20 20 20 20 74 68 69 73 2e 73 69 7a 65 20 3d 20 63 6f 6e 66 69 67 2e 73 69 7a 65 0a 20 20 7d 0a ....this.size.=.config.size...}.
118e0 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 53 65 67 6d 65 6e 74 65 64 43 6f 6e }..TouchBar.TouchBarSegmentedCon
11900 74 72 6f 6c 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 53 65 67 6d 65 6e 74 65 64 43 6f trol.=.class.TouchBarSegmentedCo
11920 6e 74 72 6f 6c 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 63 ntrol.extends.TouchBarItem.{...c
11940 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 onstructor.(config).{.....super(
11960 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 ).....if.(config.==.null).config
11980 20 3d 20 7b 7d 0a 20 20 20 20 63 6f 6e 73 74 20 7b 73 65 67 6d 65 6e 74 53 74 79 6c 65 2c 20 73 .=.{}.....const.{segmentStyle,.s
119a0 65 67 6d 65 6e 74 73 2c 20 73 65 6c 65 63 74 65 64 49 6e 64 65 78 2c 20 63 68 61 6e 67 65 2c 20 egments,.selectedIndex,.change,.
119c0 6d 6f 64 65 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 20 20 20 74 68 69 73 2e 74 79 70 65 20 3d 20 27 mode}.=.config.....this.type.=.'
119e0 73 65 67 6d 65 6e 74 65 64 5f 63 6f 6e 74 72 6f 6c 27 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 segmented_control'.....this._add
11a00 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 73 65 67 6d 65 6e 74 53 74 79 6c 65 27 2c 20 73 65 67 LiveProperty('segmentStyle',.seg
11a20 6d 65 6e 74 53 74 79 6c 65 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 mentStyle).....this._addLiveProp
11a40 65 72 74 79 28 27 73 65 67 6d 65 6e 74 73 27 2c 20 73 65 67 6d 65 6e 74 73 20 7c 7c 20 5b 5d 29 erty('segments',.segments.||.[])
11a60 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 73 65 6c 65 .....this._addLiveProperty('sele
11a80 63 74 65 64 49 6e 64 65 78 27 2c 20 73 65 6c 65 63 74 65 64 49 6e 64 65 78 29 0a 20 20 20 20 74 ctedIndex',.selectedIndex).....t
11aa0 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6d 6f 64 65 27 2c 20 6d 6f 64 his._addLiveProperty('mode',.mod
11ac0 65 29 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 68 61 6e 67 65 20 3d 3d 3d 20 27 66 e)......if.(typeof.change.===.'f
11ae0 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 6f 6e 49 6e 74 65 72 61 63 unction').{.......this.onInterac
11b00 74 69 6f 6e 20 3d 20 28 64 65 74 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 74 68 tion.=.(details).=>.{.........th
11b20 69 73 2e 5f 73 65 6c 65 63 74 65 64 49 6e 64 65 78 20 3d 20 64 65 74 61 69 6c 73 2e 73 65 6c 65 is._selectedIndex.=.details.sele
11b40 63 74 65 64 49 6e 64 65 78 0a 20 20 20 20 20 20 20 20 63 68 61 6e 67 65 28 64 65 74 61 69 6c 73 ctedIndex.........change(details
11b60 2e 73 65 6c 65 63 74 65 64 49 6e 64 65 78 2c 20 64 65 74 61 69 6c 73 2e 69 73 53 65 6c 65 63 74 .selectedIndex,.details.isSelect
11b80 65 64 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 ed).......}.....}...}.}..TouchBa
11ba0 72 2e 54 6f 75 63 68 42 61 72 53 63 72 75 62 62 65 72 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 r.TouchBarScrubber.=.class.Touch
11bc0 42 61 72 53 63 72 75 62 62 65 72 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d BarScrubber.extends.TouchBarItem
11be0 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 .{...constructor.(config).{.....
11c00 73 75 70 65 72 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 super().....if.(config.==.null).
11c20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 20 20 63 6f 6e 73 74 20 7b 69 74 65 6d 73 2c 20 73 65 config.=.{}.....const.{items,.se
11c40 6c 65 63 74 65 64 53 74 79 6c 65 2c 20 6f 76 65 72 6c 61 79 53 74 79 6c 65 2c 20 73 68 6f 77 41 lectedStyle,.overlayStyle,.showA
11c60 72 72 6f 77 42 75 74 74 6f 6e 73 2c 20 63 6f 6e 74 69 6e 75 6f 75 73 2c 20 6d 6f 64 65 7d 20 3d rrowButtons,.continuous,.mode}.=
11c80 20 63 6f 6e 66 69 67 0a 20 20 20 20 6c 65 74 20 7b 73 65 6c 65 63 74 2c 20 68 69 67 68 6c 69 67 .config.....let.{select,.highlig
11ca0 68 74 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 20 20 20 74 68 69 73 2e 74 79 70 65 20 3d 20 27 73 63 ht}.=.config.....this.type.=.'sc
11cc0 72 75 62 62 65 72 27 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 rubber'.....this._addLivePropert
11ce0 79 28 27 69 74 65 6d 73 27 2c 20 69 74 65 6d 73 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c y('items',.items).....this._addL
11d00 69 76 65 50 72 6f 70 65 72 74 79 28 27 73 65 6c 65 63 74 65 64 53 74 79 6c 65 27 2c 20 73 65 6c iveProperty('selectedStyle',.sel
11d20 65 63 74 65 64 53 74 79 6c 65 20 7c 7c 20 6e 75 6c 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 ectedStyle.||.null).....this._ad
11d40 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6f 76 65 72 6c 61 79 53 74 79 6c 65 27 2c 20 6f 76 dLiveProperty('overlayStyle',.ov
11d60 65 72 6c 61 79 53 74 79 6c 65 20 7c 7c 20 6e 75 6c 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 erlayStyle.||.null).....this._ad
11d80 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 73 68 6f 77 41 72 72 6f 77 42 75 74 74 6f 6e 73 27 dLiveProperty('showArrowButtons'
11da0 2c 20 73 68 6f 77 41 72 72 6f 77 42 75 74 74 6f 6e 73 20 7c 7c 20 66 61 6c 73 65 29 0a 20 20 20 ,.showArrowButtons.||.false)....
11dc0 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6d 6f 64 65 27 2c 20 6d .this._addLiveProperty('mode',.m
11de0 6f 64 65 20 7c 7c 20 27 66 72 65 65 27 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 ode.||.'free').....this._addLive
11e00 50 72 6f 70 65 72 74 79 28 27 63 6f 6e 74 69 6e 75 6f 75 73 27 2c 20 74 79 70 65 6f 66 20 63 6f Property('continuous',.typeof.co
11e20 6e 74 69 6e 75 6f 75 73 20 3d 3d 3d 20 27 75 6e 64 65 66 69 6e 65 64 27 20 3f 20 74 72 75 65 20 ntinuous.===.'undefined'.?.true.
11e40 3a 20 63 6f 6e 74 69 6e 75 6f 75 73 29 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 73 65 :.continuous)......if.(typeof.se
11e60 6c 65 63 74 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 7c 7c 20 74 79 70 65 6f 66 20 68 69 lect.===.'function'.||.typeof.hi
11e80 67 68 6c 69 67 68 74 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 ghlight.===.'function').{.......
11ea0 69 66 20 28 73 65 6c 65 63 74 20 3d 3d 20 6e 75 6c 6c 29 20 73 65 6c 65 63 74 20 3d 20 28 29 20 if.(select.==.null).select.=.().
11ec0 3d 3e 20 7b 7d 0a 20 20 20 20 20 20 69 66 20 28 68 69 67 68 6c 69 67 68 74 20 3d 3d 20 6e 75 6c =>.{}.......if.(highlight.==.nul
11ee0 6c 29 20 68 69 67 68 6c 69 67 68 74 20 3d 20 28 29 20 3d 3e 20 7b 7d 0a 20 20 20 20 20 20 74 68 l).highlight.=.().=>.{}.......th
11f00 69 73 2e 6f 6e 49 6e 74 65 72 61 63 74 69 6f 6e 20 3d 20 28 64 65 74 61 69 6c 73 29 20 3d 3e 20 is.onInteraction.=.(details).=>.
11f20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 64 65 74 61 69 6c 73 2e 74 79 70 65 20 3d 3d 3d 20 27 {.........if.(details.type.===.'
11f40 73 65 6c 65 63 74 27 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 73 65 6c 65 63 74 28 64 65 74 61 select').{...........select(deta
11f60 69 6c 73 2e 73 65 6c 65 63 74 65 64 49 6e 64 65 78 29 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 ils.selectedIndex).........}.els
11f80 65 20 69 66 20 28 64 65 74 61 69 6c 73 2e 74 79 70 65 20 3d 3d 3d 20 27 68 69 67 68 6c 69 67 68 e.if.(details.type.===.'highligh
11fa0 74 27 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 68 69 67 68 6c 69 67 68 74 28 64 65 74 61 69 6c t').{...........highlight(detail
11fc0 73 2e 68 69 67 68 6c 69 67 68 74 65 64 49 6e 64 65 78 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 s.highlightedIndex).........}...
11fe0 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 ....}.....}...}.}..module.export
12000 73 20 3d 20 54 6f 75 63 68 42 61 72 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d 69 74 74 65 72 s.=.TouchBar.const.{EventEmitter
12020 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 54 72 61 }.=.require('events').const.{Tra
12040 79 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 74 72 61 79 27 29 y}.=.process.atomBinding('tray')
12060 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 54 72 61 79 2e 70 72 6f ..Object.setPrototypeOf(Tray.pro
12080 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a totype,.EventEmitter.prototype).
120a0 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 54 72 61 79 0a 27 75 73 65 20 73 74 72 69 .module.exports.=.Tray.'use.stri
120c0 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 45 76 65 6e 74 45 6d 69 74 74 65 72 7d 20 3d 20 72 65 71 75 ct'..const.{EventEmitter}.=.requ
120e0 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 65 6c 65 63 74 72 6f 6e 20 3d 20 72 ire('events').const.electron.=.r
12100 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b 61 70 70 2c 20 69 equire('electron').const.{app,.i
12120 70 63 4d 61 69 6e 2c 20 73 65 73 73 69 6f 6e 2c 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 pcMain,.session,.NavigationContr
12140 6f 6c 6c 65 72 7d 20 3d 20 65 6c 65 63 74 72 6f 6e 0a 0a 2f 2f 20 73 65 73 73 69 6f 6e 20 69 73 oller}.=.electron..//.session.is
12160 20 6e 6f 74 20 75 73 65 64 20 68 65 72 65 2c 20 74 68 65 20 70 75 72 70 6f 73 65 20 69 73 20 74 .not.used.here,.the.purpose.is.t
12180 6f 20 6d 61 6b 65 20 73 75 72 65 20 73 65 73 73 69 6f 6e 20 69 73 20 69 6e 69 74 61 6c 69 7a 65 o.make.sure.session.is.initalize
121a0 64 0a 2f 2f 20 62 65 66 6f 72 65 20 74 68 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 6d 6f 64 75 d.//.before.the.webContents.modu
121c0 6c 65 2e 0a 73 65 73 73 69 6f 6e 0a 0a 6c 65 74 20 6e 65 78 74 49 64 20 3d 20 30 0a 63 6f 6e 73 le..session..let.nextId.=.0.cons
121e0 74 20 67 65 74 4e 65 78 74 49 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 t.getNextId.=.function.().{...re
12200 74 75 72 6e 20 2b 2b 6e 65 78 74 49 64 0a 7d 0a 0a 2f 2f 20 53 74 6f 63 6b 20 70 61 67 65 20 73 turn.++nextId.}..//.Stock.page.s
12220 69 7a 65 73 0a 63 6f 6e 73 74 20 50 44 46 50 61 67 65 53 69 7a 65 73 20 3d 20 7b 0a 20 20 41 35 izes.const.PDFPageSizes.=.{...A5
12240 3a 20 7b 0a 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c 61 79 5f 6e 61 6d 65 3a 20 27 41 35 :.{.....custom_display_name:.'A5
12260 27 2c 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 6f 6e 73 3a 20 32 31 30 30 30 30 2c 0a 20 ',.....height_microns:.210000,..
12280 20 20 20 6e 61 6d 65 3a 20 27 49 53 4f 5f 41 35 27 2c 0a 20 20 20 20 77 69 64 74 68 5f 6d 69 63 ...name:.'ISO_A5',.....width_mic
122a0 72 6f 6e 73 3a 20 31 34 38 30 30 30 0a 20 20 7d 2c 0a 20 20 41 34 3a 20 7b 0a 20 20 20 20 63 75 rons:.148000...},...A4:.{.....cu
122c0 73 74 6f 6d 5f 64 69 73 70 6c 61 79 5f 6e 61 6d 65 3a 20 27 41 34 27 2c 0a 20 20 20 20 68 65 69 stom_display_name:.'A4',.....hei
122e0 67 68 74 5f 6d 69 63 72 6f 6e 73 3a 20 32 39 37 30 30 30 2c 0a 20 20 20 20 6e 61 6d 65 3a 20 27 ght_microns:.297000,.....name:.'
12300 49 53 4f 5f 41 34 27 2c 0a 20 20 20 20 69 73 5f 64 65 66 61 75 6c 74 3a 20 27 74 72 75 65 27 2c ISO_A4',.....is_default:.'true',
12320 0a 20 20 20 20 77 69 64 74 68 5f 6d 69 63 72 6f 6e 73 3a 20 32 31 30 30 30 30 0a 20 20 7d 2c 0a .....width_microns:.210000...},.
12340 20 20 41 33 3a 20 7b 0a 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c 61 79 5f 6e 61 6d 65 3a ..A3:.{.....custom_display_name:
12360 20 27 41 33 27 2c 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 6f 6e 73 3a 20 34 32 30 30 30 .'A3',.....height_microns:.42000
12380 30 2c 0a 20 20 20 20 6e 61 6d 65 3a 20 27 49 53 4f 5f 41 33 27 2c 0a 20 20 20 20 77 69 64 74 68 0,.....name:.'ISO_A3',.....width
123a0 5f 6d 69 63 72 6f 6e 73 3a 20 32 39 37 30 30 30 0a 20 20 7d 2c 0a 20 20 4c 65 67 61 6c 3a 20 7b _microns:.297000...},...Legal:.{
123c0 0a 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c 61 79 5f 6e 61 6d 65 3a 20 27 4c 65 67 61 6c .....custom_display_name:.'Legal
123e0 27 2c 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 6f 6e 73 3a 20 33 35 35 36 30 30 2c 0a 20 ',.....height_microns:.355600,..
12400 20 20 20 6e 61 6d 65 3a 20 27 4e 41 5f 4c 45 47 41 4c 27 2c 0a 20 20 20 20 77 69 64 74 68 5f 6d ...name:.'NA_LEGAL',.....width_m
12420 69 63 72 6f 6e 73 3a 20 32 31 35 39 30 30 0a 20 20 7d 2c 0a 20 20 4c 65 74 74 65 72 3a 20 7b 0a icrons:.215900...},...Letter:.{.
12440 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c 61 79 5f 6e 61 6d 65 3a 20 27 4c 65 74 74 65 72 ....custom_display_name:.'Letter
12460 27 2c 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 6f 6e 73 3a 20 32 37 39 34 30 30 2c 0a 20 ',.....height_microns:.279400,..
12480 20 20 20 6e 61 6d 65 3a 20 27 4e 41 5f 4c 45 54 54 45 52 27 2c 0a 20 20 20 20 77 69 64 74 68 5f ...name:.'NA_LETTER',.....width_
124a0 6d 69 63 72 6f 6e 73 3a 20 32 31 35 39 30 30 0a 20 20 7d 2c 0a 20 20 54 61 62 6c 6f 69 64 3a 20 microns:.215900...},...Tabloid:.
124c0 7b 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 6f 6e 73 3a 20 34 33 31 38 30 30 2c 0a 20 20 {.....height_microns:.431800,...
124e0 20 20 6e 61 6d 65 3a 20 27 4e 41 5f 4c 45 44 47 45 52 27 2c 0a 20 20 20 20 77 69 64 74 68 5f 6d ..name:.'NA_LEDGER',.....width_m
12500 69 63 72 6f 6e 73 3a 20 32 37 39 34 30 30 2c 0a 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c icrons:.279400,.....custom_displ
12520 61 79 5f 6e 61 6d 65 3a 20 27 54 61 62 6c 6f 69 64 27 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 44 65 66 ay_name:.'Tabloid'...}.}..//.Def
12540 61 75 6c 74 20 70 72 69 6e 74 69 6e 67 20 73 65 74 74 69 6e 67 0a 63 6f 6e 73 74 20 64 65 66 61 ault.printing.setting.const.defa
12560 75 6c 74 50 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 20 3d 20 7b 0a 20 20 70 61 67 65 52 61 67 ultPrintingSetting.=.{...pageRag
12580 65 3a 20 5b 5d 2c 0a 20 20 6d 65 64 69 61 53 69 7a 65 3a 20 7b 7d 2c 0a 20 20 6c 61 6e 64 73 63 e:.[],...mediaSize:.{},...landsc
125a0 61 70 65 3a 20 66 61 6c 73 65 2c 0a 20 20 63 6f 6c 6f 72 3a 20 32 2c 0a 20 20 68 65 61 64 65 72 ape:.false,...color:.2,...header
125c0 46 6f 6f 74 65 72 45 6e 61 62 6c 65 64 3a 20 66 61 6c 73 65 2c 0a 20 20 6d 61 72 67 69 6e 73 54 FooterEnabled:.false,...marginsT
125e0 79 70 65 3a 20 30 2c 0a 20 20 69 73 46 69 72 73 74 52 65 71 75 65 73 74 3a 20 66 61 6c 73 65 2c ype:.0,...isFirstRequest:.false,
12600 0a 20 20 72 65 71 75 65 73 74 49 44 3a 20 67 65 74 4e 65 78 74 49 64 28 29 2c 0a 20 20 70 72 65 ...requestID:.getNextId(),...pre
12620 76 69 65 77 4d 6f 64 69 66 69 61 62 6c 65 3a 20 74 72 75 65 2c 0a 20 20 70 72 69 6e 74 54 6f 50 viewModifiable:.true,...printToP
12640 44 46 3a 20 74 72 75 65 2c 0a 20 20 70 72 69 6e 74 57 69 74 68 43 6c 6f 75 64 50 72 69 6e 74 3a DF:.true,...printWithCloudPrint:
12660 20 66 61 6c 73 65 2c 0a 20 20 70 72 69 6e 74 57 69 74 68 50 72 69 76 65 74 3a 20 66 61 6c 73 65 .false,...printWithPrivet:.false
12680 2c 0a 20 20 70 72 69 6e 74 57 69 74 68 45 78 74 65 6e 73 69 6f 6e 3a 20 66 61 6c 73 65 2c 0a 20 ,...printWithExtension:.false,..
126a0 20 64 65 76 69 63 65 4e 61 6d 65 3a 20 27 53 61 76 65 20 61 73 20 50 44 46 27 2c 0a 20 20 67 65 .deviceName:.'Save.as.PDF',...ge
126c0 6e 65 72 61 74 65 44 72 61 66 74 44 61 74 61 3a 20 74 72 75 65 2c 0a 20 20 66 69 74 54 6f 50 61 nerateDraftData:.true,...fitToPa
126e0 67 65 45 6e 61 62 6c 65 64 3a 20 66 61 6c 73 65 2c 0a 20 20 73 63 61 6c 65 46 61 63 74 6f 72 3a geEnabled:.false,...scaleFactor:
12700 20 31 2c 0a 20 20 64 70 69 48 6f 72 69 7a 6f 6e 74 61 6c 3a 20 37 32 2c 0a 20 20 64 70 69 56 65 .1,...dpiHorizontal:.72,...dpiVe
12720 72 74 69 63 61 6c 3a 20 37 32 2c 0a 20 20 72 61 73 74 65 72 69 7a 65 50 44 46 3a 20 66 61 6c 73 rtical:.72,...rasterizePDF:.fals
12740 65 2c 0a 20 20 64 75 70 6c 65 78 3a 20 30 2c 0a 20 20 63 6f 70 69 65 73 3a 20 31 2c 0a 20 20 63 e,...duplex:.0,...copies:.1,...c
12760 6f 6c 6c 61 74 65 3a 20 74 72 75 65 2c 0a 20 20 73 68 6f 75 6c 64 50 72 69 6e 74 42 61 63 6b 67 ollate:.true,...shouldPrintBackg
12780 72 6f 75 6e 64 73 3a 20 66 61 6c 73 65 2c 0a 20 20 73 68 6f 75 6c 64 50 72 69 6e 74 53 65 6c 65 rounds:.false,...shouldPrintSele
127a0 63 74 69 6f 6e 4f 6e 6c 79 3a 20 66 61 6c 73 65 0a 7d 0a 0a 2f 2f 20 4a 61 76 61 53 63 72 69 70 ctionOnly:.false.}..//.JavaScrip
127c0 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 57 65 62 43 6f 6e 74 65 6e 74 73 t.implementations.of.WebContents
127e0 2e 0a 63 6f 6e 73 74 20 62 69 6e 64 69 6e 67 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 ..const.binding.=.process.atomBi
12800 6e 64 69 6e 67 28 27 77 65 62 5f 63 6f 6e 74 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 57 65 62 nding('web_contents').const.{Web
12820 43 6f 6e 74 65 6e 74 73 7d 20 3d 20 62 69 6e 64 69 6e 67 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 Contents}.=.binding..Object.setP
12840 72 6f 74 6f 74 79 70 65 4f 66 28 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e rototypeOf(NavigationController.
12860 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 prototype,.EventEmitter.prototyp
12880 65 29 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 57 65 62 43 6f 6e 74 e).Object.setPrototypeOf(WebCont
128a0 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2c 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f ents.prototype,.NavigationContro
128c0 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 2f 2f 20 57 65 62 43 6f 6e 74 65 6e 74 73 3a ller.prototype)..//.WebContents:
128e0 3a 73 65 6e 64 28 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 2e 2e 29 0a 2f 2f 20 57 65 62 43 6f 6e :send(channel,.args..).//.WebCon
12900 74 65 6e 74 73 3a 3a 73 65 6e 64 54 6f 41 6c 6c 28 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 2e 2e tents::sendToAll(channel,.args..
12920 29 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 73 65 6e 64 20 3d 20 66 ).WebContents.prototype.send.=.f
12940 75 6e 63 74 69 6f 6e 20 28 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 unction.(channel,....args).{...i
12960 66 20 28 63 68 61 6e 6e 65 6c 20 3d 3d 20 6e 75 6c 6c 29 20 74 68 72 6f 77 20 6e 65 77 20 45 72 f.(channel.==.null).throw.new.Er
12980 72 6f 72 28 27 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 63 68 61 6e 6e 65 6c 20 61 72 ror('Missing.required.channel.ar
129a0 67 75 6d 65 6e 74 27 29 0a 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 73 65 6e 64 28 66 61 6c gument')...return.this._send(fal
129c0 73 65 2c 20 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 29 0a 7d 0a 57 65 62 43 6f 6e 74 65 6e 74 73 se,.channel,.args).}.WebContents
129e0 2e 70 72 6f 74 6f 74 79 70 65 2e 73 65 6e 64 54 6f 41 6c 6c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 .prototype.sendToAll.=.function.
12a00 28 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 66 20 28 63 68 61 6e 6e (channel,....args).{...if.(chann
12a20 65 6c 20 3d 3d 20 6e 75 6c 6c 29 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 4d 69 73 el.==.null).throw.new.Error('Mis
12a40 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 63 68 61 6e 6e 65 6c 20 61 72 67 75 6d 65 6e 74 27 29 sing.required.channel.argument')
12a60 0a 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 73 65 6e 64 28 74 72 75 65 2c 20 63 68 61 6e 6e ...return.this._send(true,.chann
12a80 65 6c 2c 20 61 72 67 73 29 0a 7d 0a 0a 2f 2f 20 46 6f 6c 6c 6f 77 69 6e 67 20 6d 65 74 68 6f 64 el,.args).}..//.Following.method
12aa0 73 20 61 72 65 20 6d 61 70 70 65 64 20 74 6f 20 77 65 62 46 72 61 6d 65 2e 0a 63 6f 6e 73 74 20 s.are.mapped.to.webFrame..const.
12ac0 77 65 62 46 72 61 6d 65 4d 65 74 68 6f 64 73 20 3d 20 5b 0a 20 20 27 69 6e 73 65 72 74 43 53 53 webFrameMethods.=.[...'insertCSS
12ae0 27 2c 0a 20 20 27 69 6e 73 65 72 74 54 65 78 74 27 2c 0a 20 20 27 73 65 74 4c 61 79 6f 75 74 5a ',...'insertText',...'setLayoutZ
12b00 6f 6f 6d 4c 65 76 65 6c 4c 69 6d 69 74 73 27 2c 0a 20 20 27 73 65 74 56 69 73 75 61 6c 5a 6f 6f oomLevelLimits',...'setVisualZoo
12b20 6d 4c 65 76 65 6c 4c 69 6d 69 74 73 27 2c 0a 20 20 2f 2f 20 54 4f 44 4f 28 6b 65 76 69 6e 73 61 mLevelLimits',...//.TODO(kevinsa
12b40 77 69 63 6b 69 29 3a 20 52 65 6d 6f 76 65 20 69 6e 20 32 2e 30 2c 20 64 65 70 72 65 63 61 74 65 wicki):.Remove.in.2.0,.deprecate
12b60 20 62 65 66 6f 72 65 20 74 68 65 6e 20 77 69 74 68 20 77 61 72 6e 69 6e 67 73 0a 20 20 27 73 65 .before.then.with.warnings...'se
12b80 74 5a 6f 6f 6d 4c 65 76 65 6c 4c 69 6d 69 74 73 27 0a 5d 0a 63 6f 6e 73 74 20 77 65 62 46 72 61 tZoomLevelLimits'.].const.webFra
12ba0 6d 65 4d 65 74 68 6f 64 73 57 69 74 68 52 65 73 75 6c 74 20 3d 20 5b 5d 0a 0a 63 6f 6e 73 74 20 meMethodsWithResult.=.[]..const.
12bc0 65 72 72 6f 72 43 6f 6e 73 74 72 75 63 74 6f 72 73 20 3d 20 7b 0a 20 20 45 72 72 6f 72 2c 0a 20 errorConstructors.=.{...Error,..
12be0 20 45 76 61 6c 45 72 72 6f 72 2c 0a 20 20 52 61 6e 67 65 45 72 72 6f 72 2c 0a 20 20 52 65 66 65 .EvalError,...RangeError,...Refe
12c00 72 65 6e 63 65 45 72 72 6f 72 2c 0a 20 20 53 79 6e 74 61 78 45 72 72 6f 72 2c 0a 20 20 54 79 70 renceError,...SyntaxError,...Typ
12c20 65 45 72 72 6f 72 2c 0a 20 20 55 52 49 45 72 72 6f 72 0a 7d 0a 0a 63 6f 6e 73 74 20 61 73 79 6e eError,...URIError.}..const.asyn
12c40 63 57 65 62 46 72 61 6d 65 4d 65 74 68 6f 64 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 72 65 71 cWebFrameMethods.=.function.(req
12c60 75 65 73 74 49 64 2c 20 6d 65 74 68 6f 64 2c 20 63 61 6c 6c 62 61 63 6b 2c 20 2e 2e 2e 61 72 67 uestId,.method,.callback,....arg
12c80 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 6e 65 77 20 50 72 6f 6d 69 73 65 28 28 72 65 73 6f 6c s).{...return.new.Promise((resol
12ca0 76 65 2c 20 72 65 6a 65 63 74 29 20 3d 3e 20 7b 0a 20 20 20 20 74 68 69 73 2e 73 65 6e 64 28 27 ve,.reject).=>.{.....this.send('
12cc0 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 52 45 4e 44 45 52 45 52 5f 41 53 59 4e 43 ELECTRON_INTERNAL_RENDERER_ASYNC
12ce0 5f 57 45 42 5f 46 52 41 4d 45 5f 4d 45 54 48 4f 44 27 2c 20 72 65 71 75 65 73 74 49 64 2c 20 6d _WEB_FRAME_METHOD',.requestId,.m
12d00 65 74 68 6f 64 2c 20 61 72 67 73 29 0a 20 20 20 20 69 70 63 4d 61 69 6e 2e 6f 6e 63 65 28 60 45 ethod,.args).....ipcMain.once(`E
12d20 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 42 52 4f 57 53 45 52 5f 41 53 59 4e 43 5f 57 LECTRON_INTERNAL_BROWSER_ASYNC_W
12d40 45 42 5f 46 52 41 4d 45 5f 52 45 53 50 4f 4e 53 45 5f 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c EB_FRAME_RESPONSE_${requestId}`,
12d60 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 72 72 6f 72 2c 20 72 65 73 75 6c 74 29 .function.(event,.error,.result)
12d80 20 7b 0a 20 20 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 .{.......if.(error.==.null).{...
12da0 20 20 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 61 6c 6c 62 61 63 6b 20 3d 3d 3d 20 27 66 ......if.(typeof.callback.===.'f
12dc0 75 6e 63 74 69 6f 6e 27 29 20 63 61 6c 6c 62 61 63 6b 28 72 65 73 75 6c 74 29 0a 20 20 20 20 20 unction').callback(result)......
12de0 20 20 20 72 65 73 6f 6c 76 65 28 72 65 73 75 6c 74 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 ...resolve(result).......}.else.
12e00 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 65 72 72 6f 72 2e 5f 5f 45 4c 45 43 54 52 4f 4e 5f 53 {.........if.(error.__ELECTRON_S
12e20 45 52 49 41 4c 49 5a 45 44 5f 45 52 52 4f 52 5f 5f 20 26 26 20 65 72 72 6f 72 43 6f 6e 73 74 72 ERIALIZED_ERROR__.&&.errorConstr
12e40 75 63 74 6f 72 73 5b 65 72 72 6f 72 2e 6e 61 6d 65 5d 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 uctors[error.name]).{...........
12e60 63 6f 6e 73 74 20 72 65 68 79 64 72 61 74 65 64 45 72 72 6f 72 20 3d 20 6e 65 77 20 65 72 72 6f const.rehydratedError.=.new.erro
12e80 72 43 6f 6e 73 74 72 75 63 74 6f 72 73 5b 65 72 72 6f 72 2e 6e 61 6d 65 5d 28 65 72 72 6f 72 2e rConstructors[error.name](error.
12ea0 6d 65 73 73 61 67 65 29 0a 20 20 20 20 20 20 20 20 20 20 72 65 68 79 64 72 61 74 65 64 45 72 72 message)...........rehydratedErr
12ec0 6f 72 2e 73 74 61 63 6b 20 3d 20 65 72 72 6f 72 2e 73 74 61 63 6b 0a 0a 20 20 20 20 20 20 20 20 or.stack.=.error.stack..........
12ee0 20 20 72 65 6a 65 63 74 28 72 65 68 79 64 72 61 74 65 64 45 72 72 6f 72 29 0a 20 20 20 20 20 20 ..reject(rehydratedError).......
12f00 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 72 65 6a 65 63 74 28 65 72 72 6f ..}.else.{...........reject(erro
12f20 72 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 20 20 7d 29 r).........}.......}.....})...})
12f40 0a 7d 0a 0a 63 6f 6e 73 74 20 73 79 6e 63 57 65 62 46 72 61 6d 65 4d 65 74 68 6f 64 73 20 3d 20 .}..const.syncWebFrameMethods.=.
12f60 66 75 6e 63 74 69 6f 6e 20 28 72 65 71 75 65 73 74 49 64 2c 20 6d 65 74 68 6f 64 2c 20 63 61 6c function.(requestId,.method,.cal
12f80 6c 62 61 63 6b 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 74 68 69 73 2e 73 65 6e 64 28 27 45 lback,....args).{...this.send('E
12fa0 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 52 45 4e 44 45 52 45 52 5f 53 59 4e 43 5f 57 LECTRON_INTERNAL_RENDERER_SYNC_W
12fc0 45 42 5f 46 52 41 4d 45 5f 4d 45 54 48 4f 44 27 2c 20 72 65 71 75 65 73 74 49 64 2c 20 6d 65 74 EB_FRAME_METHOD',.requestId,.met
12fe0 68 6f 64 2c 20 61 72 67 73 29 0a 20 20 69 70 63 4d 61 69 6e 2e 6f 6e 63 65 28 60 45 4c 45 43 54 hod,.args)...ipcMain.once(`ELECT
13000 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 42 52 4f 57 53 45 52 5f 53 59 4e 43 5f 57 45 42 5f 46 52 RON_INTERNAL_BROWSER_SYNC_WEB_FR
13020 41 4d 45 5f 52 45 53 50 4f 4e 53 45 5f 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 66 75 6e 63 AME_RESPONSE_${requestId}`,.func
13040 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 29 20 7b 0a 20 20 20 20 69 66 20 28 63 tion.(event,.result).{.....if.(c
13060 61 6c 6c 62 61 63 6b 29 20 63 61 6c 6c 62 61 63 6b 28 72 65 73 75 6c 74 29 0a 20 20 7d 29 0a 7d allback).callback(result)...}).}
13080 0a 0a 66 6f 72 20 28 63 6f 6e 73 74 20 6d 65 74 68 6f 64 20 6f 66 20 77 65 62 46 72 61 6d 65 4d ..for.(const.method.of.webFrameM
130a0 65 74 68 6f 64 73 29 20 7b 0a 20 20 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 ethods).{...WebContents.prototyp
130c0 65 5b 6d 65 74 68 6f 64 5d 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b e[method].=.function.(...args).{
130e0 0a 20 20 20 20 74 68 69 73 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 .....this.send('ELECTRON_INTERNA
13100 4c 5f 52 45 4e 44 45 52 45 52 5f 57 45 42 5f 46 52 41 4d 45 5f 4d 45 54 48 4f 44 27 2c 20 6d 65 L_RENDERER_WEB_FRAME_METHOD',.me
13120 74 68 6f 64 2c 20 61 72 67 73 29 0a 20 20 7d 0a 7d 0a 0a 66 6f 72 20 28 63 6f 6e 73 74 20 6d 65 thod,.args)...}.}..for.(const.me
13140 74 68 6f 64 20 6f 66 20 77 65 62 46 72 61 6d 65 4d 65 74 68 6f 64 73 57 69 74 68 52 65 73 75 6c thod.of.webFrameMethodsWithResul
13160 74 29 20 7b 0a 20 20 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 5b 6d 65 74 t).{...WebContents.prototype[met
13180 68 6f 64 5d 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 hod].=.function.(...args).{.....
131a0 63 6f 6e 73 74 20 63 61 6c 6c 62 61 63 6b 20 3d 20 61 72 67 73 5b 61 72 67 73 2e 6c 65 6e 67 74 const.callback.=.args[args.lengt
131c0 68 20 2d 20 31 5d 0a 20 20 20 20 63 6f 6e 73 74 20 61 63 74 75 61 6c 41 72 67 73 20 3d 20 61 72 h.-.1].....const.actualArgs.=.ar
131e0 67 73 2e 73 6c 69 63 65 28 30 2c 20 61 72 67 73 2e 6c 65 6e 67 74 68 20 2d 20 32 29 0a 20 20 20 gs.slice(0,.args.length.-.2)....
13200 20 73 79 6e 63 57 65 62 46 72 61 6d 65 4d 65 74 68 6f 64 73 2e 63 61 6c 6c 28 74 68 69 73 2c 20 .syncWebFrameMethods.call(this,.
13220 67 65 74 4e 65 78 74 49 64 28 29 2c 20 6d 65 74 68 6f 64 2c 20 63 61 6c 6c 62 61 63 6b 2c 20 2e getNextId(),.method,.callback,..
13240 2e 2e 61 63 74 75 61 6c 41 72 67 73 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4d 61 6b 65 20 73 75 72 ..actualArgs)...}.}..//.Make.sur
13260 65 20 57 65 62 43 6f 6e 74 65 6e 74 73 3a 3a 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 e.WebContents::executeJavaScript
13280 20 77 6f 75 6c 64 20 72 75 6e 20 74 68 65 20 63 6f 64 65 20 6f 6e 6c 79 20 77 68 65 6e 20 74 68 .would.run.the.code.only.when.th
132a0 65 0a 2f 2f 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 68 61 73 20 62 65 65 6e 20 6c 6f 61 64 65 64 e.//.WebContents.has.been.loaded
132c0 2e 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 65 78 65 63 75 74 65 4a ..WebContents.prototype.executeJ
132e0 61 76 61 53 63 72 69 70 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 6f 64 65 2c 20 68 61 73 55 avaScript.=.function.(code,.hasU
13300 73 65 72 47 65 73 74 75 72 65 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 63 6f 6e 73 74 20 serGesture,.callback).{...const.
13320 72 65 71 75 65 73 74 49 64 20 3d 20 67 65 74 4e 65 78 74 49 64 28 29 0a 0a 20 20 69 66 20 28 74 requestId.=.getNextId()....if.(t
13340 79 70 65 6f 66 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 ypeof.hasUserGesture.===.'functi
13360 6f 6e 27 29 20 7b 0a 20 20 20 20 2f 2f 20 53 68 69 66 74 2e 0a 20 20 20 20 63 61 6c 6c 62 61 63 on').{.....//.Shift......callbac
13380 6b 20 3d 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 0a 20 20 20 20 68 61 73 55 73 65 72 47 65 k.=.hasUserGesture.....hasUserGe
133a0 73 74 75 72 65 20 3d 20 6e 75 6c 6c 0a 20 20 7d 0a 0a 20 20 69 66 20 28 68 61 73 55 73 65 72 47 sture.=.null...}....if.(hasUserG
133c0 65 73 74 75 72 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 68 61 73 55 73 65 72 47 65 73 esture.==.null).{.....hasUserGes
133e0 74 75 72 65 20 3d 20 66 61 6c 73 65 0a 20 20 7d 0a 0a 20 20 69 66 20 28 74 68 69 73 2e 67 65 74 ture.=.false...}....if.(this.get
13400 55 52 4c 28 29 20 26 26 20 21 74 68 69 73 2e 69 73 4c 6f 61 64 69 6e 67 4d 61 69 6e 46 72 61 6d URL().&&.!this.isLoadingMainFram
13420 65 28 29 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 61 73 79 6e 63 57 65 62 46 72 61 6d 65 4d e()).{.....return.asyncWebFrameM
13440 65 74 68 6f 64 73 2e 63 61 6c 6c 28 74 68 69 73 2c 20 72 65 71 75 65 73 74 49 64 2c 20 27 65 78 ethods.call(this,.requestId,.'ex
13460 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 27 2c 20 63 61 6c 6c 62 61 63 6b 2c 20 63 6f 64 65 ecuteJavaScript',.callback,.code
13480 2c 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 ,.hasUserGesture)...}.else.{....
134a0 20 72 65 74 75 72 6e 20 6e 65 77 20 50 72 6f 6d 69 73 65 28 28 72 65 73 6f 6c 76 65 2c 20 72 65 .return.new.Promise((resolve,.re
134c0 6a 65 63 74 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 6f 6e 63 65 28 27 64 69 64 2d ject).=>.{.......this.once('did-
134e0 66 69 6e 69 73 68 2d 6c 6f 61 64 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 61 73 finish-load',.().=>.{.........as
13500 79 6e 63 57 65 62 46 72 61 6d 65 4d 65 74 68 6f 64 73 2e 63 61 6c 6c 28 74 68 69 73 2c 20 72 65 yncWebFrameMethods.call(this,.re
13520 71 75 65 73 74 49 64 2c 20 27 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 27 2c 20 63 61 questId,.'executeJavaScript',.ca
13540 6c 6c 62 61 63 6b 2c 20 63 6f 64 65 2c 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 29 2e 74 68 llback,.code,.hasUserGesture).th
13560 65 6e 28 72 65 73 6f 6c 76 65 29 2e 63 61 74 63 68 28 72 65 6a 65 63 74 29 0a 20 20 20 20 20 20 en(resolve).catch(reject).......
13580 7d 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 54 72 61 6e 73 6c 61 74 65 20 74 68 }).....})...}.}..//.Translate.th
135a0 65 20 6f 70 74 69 6f 6e 73 20 6f 66 20 70 72 69 6e 74 54 6f 50 44 46 2e 0a 57 65 62 43 6f 6e 74 e.options.of.printToPDF..WebCont
135c0 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 70 72 69 6e 74 54 6f 50 44 46 20 3d 20 66 75 6e 63 ents.prototype.printToPDF.=.func
135e0 74 69 6f 6e 20 28 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 63 6f 6e tion.(options,.callback).{...con
13600 73 74 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 20 3d 20 4f 62 6a 65 63 74 2e 61 73 73 69 st.printingSetting.=.Object.assi
13620 67 6e 28 7b 7d 2c 20 64 65 66 61 75 6c 74 50 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 29 0a 20 gn({},.defaultPrintingSetting)..
13640 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 6c 61 6e 64 73 63 61 70 65 29 20 7b 0a 20 20 20 20 70 72 .if.(options.landscape).{.....pr
13660 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 6c 61 6e 64 73 63 61 70 65 20 3d 20 6f 70 74 69 6f 6e intingSetting.landscape.=.option
13680 73 2e 6c 61 6e 64 73 63 61 70 65 0a 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 6d 61 s.landscape...}...if.(options.ma
136a0 72 67 69 6e 73 54 79 70 65 29 20 7b 0a 20 20 20 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 rginsType).{.....printingSetting
136c0 2e 6d 61 72 67 69 6e 73 54 79 70 65 20 3d 20 6f 70 74 69 6f 6e 73 2e 6d 61 72 67 69 6e 73 54 79 .marginsType.=.options.marginsTy
136e0 70 65 0a 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 70 72 69 6e 74 53 65 6c 65 63 74 pe...}...if.(options.printSelect
13700 69 6f 6e 4f 6e 6c 79 29 20 7b 0a 20 20 20 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 73 ionOnly).{.....printingSetting.s
13720 68 6f 75 6c 64 50 72 69 6e 74 53 65 6c 65 63 74 69 6f 6e 4f 6e 6c 79 20 3d 20 6f 70 74 69 6f 6e houldPrintSelectionOnly.=.option
13740 73 2e 70 72 69 6e 74 53 65 6c 65 63 74 69 6f 6e 4f 6e 6c 79 0a 20 20 7d 0a 20 20 69 66 20 28 6f s.printSelectionOnly...}...if.(o
13760 70 74 69 6f 6e 73 2e 70 72 69 6e 74 42 61 63 6b 67 72 6f 75 6e 64 29 20 7b 0a 20 20 20 20 70 72 ptions.printBackground).{.....pr
13780 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 73 68 6f 75 6c 64 50 72 69 6e 74 42 61 63 6b 67 72 6f intingSetting.shouldPrintBackgro
137a0 75 6e 64 73 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 72 69 6e 74 42 61 63 6b 67 72 6f 75 6e 64 0a 20 unds.=.options.printBackground..
137c0 20 7d 0a 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 70 61 67 65 53 69 7a 65 29 20 7b 0a 20 20 .}....if.(options.pageSize).{...
137e0 20 20 63 6f 6e 73 74 20 70 61 67 65 53 69 7a 65 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 61 67 65 53 ..const.pageSize.=.options.pageS
13800 69 7a 65 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 70 61 67 65 53 69 7a 65 20 3d 3d 3d 20 ize.....if.(typeof.pageSize.===.
13820 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 21 70 61 67 65 53 69 7a 65 2e 'object').{.......if.(!pageSize.
13840 68 65 69 67 68 74 20 7c 7c 20 21 70 61 67 65 53 69 7a 65 2e 77 69 64 74 68 29 20 7b 0a 20 20 20 height.||.!pageSize.width).{....
13860 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 6e 65 77 20 45 72 72 6f 72 28 27 .....return.callback(new.Error('
13880 4d 75 73 74 20 64 65 66 69 6e 65 20 68 65 69 67 68 74 20 61 6e 64 20 77 69 64 74 68 20 66 6f 72 Must.define.height.and.width.for
138a0 20 70 61 67 65 53 69 7a 65 27 29 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 2f 2f 20 44 69 .pageSize')).......}.......//.Di
138c0 6d 65 6e 73 69 6f 6e 73 20 69 6e 20 4d 69 63 72 6f 6e 73 0a 20 20 20 20 20 20 2f 2f 20 31 20 6d mensions.in.Microns.......//.1.m
138e0 65 74 65 72 20 3d 20 31 30 5e 36 20 6d 69 63 72 6f 6e 73 0a 20 20 20 20 20 20 70 72 69 6e 74 69 eter.=.10^6.microns.......printi
13900 6e 67 53 65 74 74 69 6e 67 2e 6d 65 64 69 61 53 69 7a 65 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 ngSetting.mediaSize.=.{.........
13920 6e 61 6d 65 3a 20 27 43 55 53 54 4f 4d 27 2c 0a 20 20 20 20 20 20 20 20 63 75 73 74 6f 6d 5f 64 name:.'CUSTOM',.........custom_d
13940 69 73 70 6c 61 79 5f 6e 61 6d 65 3a 20 27 43 75 73 74 6f 6d 27 2c 0a 20 20 20 20 20 20 20 20 68 isplay_name:.'Custom',.........h
13960 65 69 67 68 74 5f 6d 69 63 72 6f 6e 73 3a 20 4d 61 74 68 2e 63 65 69 6c 28 70 61 67 65 53 69 7a eight_microns:.Math.ceil(pageSiz
13980 65 2e 68 65 69 67 68 74 29 2c 0a 20 20 20 20 20 20 20 20 77 69 64 74 68 5f 6d 69 63 72 6f 6e 73 e.height),.........width_microns
139a0 3a 20 4d 61 74 68 2e 63 65 69 6c 28 70 61 67 65 53 69 7a 65 2e 77 69 64 74 68 29 0a 20 20 20 20 :.Math.ceil(pageSize.width).....
139c0 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 50 44 46 50 61 67 65 53 69 7a 65 73 5b ..}.....}.else.if.(PDFPageSizes[
139e0 70 61 67 65 53 69 7a 65 5d 29 20 7b 0a 20 20 20 20 20 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 pageSize]).{.......printingSetti
13a00 6e 67 2e 6d 65 64 69 61 53 69 7a 65 20 3d 20 50 44 46 50 61 67 65 53 69 7a 65 73 5b 70 61 67 65 ng.mediaSize.=.PDFPageSizes[page
13a20 53 69 7a 65 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 Size].....}.else.{.......return.
13a40 63 61 6c 6c 62 61 63 6b 28 6e 65 77 20 45 72 72 6f 72 28 60 44 6f 65 73 20 6e 6f 74 20 73 75 70 callback(new.Error(`Does.not.sup
13a60 70 6f 72 74 20 70 61 67 65 53 69 7a 65 20 77 69 74 68 20 24 7b 70 61 67 65 53 69 7a 65 7d 60 29 port.pageSize.with.${pageSize}`)
13a80 29 0a 20 20 20 20 7d 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 70 72 69 6e 74 69 6e 67 53 ).....}...}.else.{.....printingS
13aa0 65 74 74 69 6e 67 2e 6d 65 64 69 61 53 69 7a 65 20 3d 20 50 44 46 50 61 67 65 53 69 7a 65 73 5b etting.mediaSize.=.PDFPageSizes[
13ac0 27 41 34 27 5d 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 5f 70 72 69 6e 74 54 6f 50 44 46 28 70 72 'A4']...}....this._printToPDF(pr
13ae0 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 7d 0a 0a 57 65 62 43 intingSetting,.callback).}..WebC
13b00 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c 20 3d ontents.prototype.getZoomLevel.=
13b20 20 66 75 6e 63 74 69 6f 6e 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 69 66 20 28 74 79 70 .function.(callback).{...if.(typ
13b40 65 6f 66 20 63 61 6c 6c 62 61 63 6b 20 21 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 eof.callback.!==.'function').{..
13b60 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 4d 75 73 74 20 70 61 73 73 20 66 75 ...throw.new.Error('Must.pass.fu
13b80 6e 63 74 69 6f 6e 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 27 29 0a 20 20 7d 0a 20 20 70 72 nction.as.an.argument')...}...pr
13ba0 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 28 29 20 3d 3e 20 7b 0a 20 20 20 20 63 6f 6e 73 74 ocess.nextTick(().=>.{.....const
13bc0 20 7a 6f 6f 6d 4c 65 76 65 6c 20 3d 20 74 68 69 73 2e 5f 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 .zoomLevel.=.this._getZoomLevel(
13be0 29 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 7a 6f 6f 6d 4c 65 76 65 6c 29 0a 20 20 7d 29 0a 7d ).....callback(zoomLevel)...}).}
13c00 0a 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 5a 6f 6f 6d 46 ..WebContents.prototype.getZoomF
13c20 61 63 74 6f 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 actor.=.function.(callback).{...
13c40 69 66 20 28 74 79 70 65 6f 66 20 63 61 6c 6c 62 61 63 6b 20 21 3d 3d 20 27 66 75 6e 63 74 69 6f if.(typeof.callback.!==.'functio
13c60 6e 27 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 4d 75 73 74 20 n').{.....throw.new.Error('Must.
13c80 70 61 73 73 20 66 75 6e 63 74 69 6f 6e 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 27 29 0a 20 pass.function.as.an.argument')..
13ca0 20 7d 0a 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 28 29 20 3d 3e 20 7b 0a 20 20 .}...process.nextTick(().=>.{...
13cc0 20 20 63 6f 6e 73 74 20 7a 6f 6f 6d 46 61 63 74 6f 72 20 3d 20 74 68 69 73 2e 5f 67 65 74 5a 6f ..const.zoomFactor.=.this._getZo
13ce0 6f 6d 46 61 63 74 6f 72 28 29 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 7a 6f 6f 6d 46 61 63 74 omFactor().....callback(zoomFact
13d00 6f 72 29 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 41 64 64 20 4a 61 76 61 53 63 72 69 70 74 20 77 72 or)...}).}..//.Add.JavaScript.wr
13d20 61 70 70 65 72 73 20 66 6f 72 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 63 6c 61 73 73 2e 0a 57 65 appers.for.WebContents.class..We
13d40 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 20 3d 20 66 75 6e 63 bContents.prototype._init.=.func
13d60 74 69 6f 6e 20 28 29 20 7b 0a 20 20 2f 2f 20 54 68 65 20 6e 61 76 69 67 61 74 69 6f 6e 20 63 6f tion.().{...//.The.navigation.co
13d80 6e 74 72 6f 6c 6c 65 72 2e 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 ntroller....NavigationController
13da0 2e 63 61 6c 6c 28 74 68 69 73 2c 20 74 68 69 73 29 0a 0a 20 20 2f 2f 20 45 76 65 72 79 20 72 65 .call(this,.this)....//.Every.re
13dc0 6d 6f 74 65 20 63 61 6c 6c 62 61 63 6b 20 66 72 6f 6d 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 mote.callback.from.renderer.proc
13de0 65 73 73 20 77 6f 75 6c 64 20 61 64 64 20 61 20 6c 69 73 74 65 6e 74 65 72 20 74 6f 20 74 68 65 ess.would.add.a.listenter.to.the
13e00 0a 20 20 2f 2f 20 72 65 6e 64 65 72 2d 76 69 65 77 2d 64 65 6c 65 74 65 64 20 65 76 65 6e 74 2c ...//.render-view-deleted.event,
13e20 20 73 6f 20 69 67 6e 6f 72 65 20 74 68 65 20 6c 69 73 74 65 6e 74 65 72 73 20 77 61 72 6e 69 6e .so.ignore.the.listenters.warnin
13e40 67 2e 0a 20 20 74 68 69 73 2e 73 65 74 4d 61 78 4c 69 73 74 65 6e 65 72 73 28 30 29 0a 0a 20 20 g....this.setMaxListeners(0)....
13e60 2f 2f 20 44 69 73 70 61 74 63 68 20 49 50 43 20 6d 65 73 73 61 67 65 73 20 74 6f 20 74 68 65 20 //.Dispatch.IPC.messages.to.the.
13e80 69 70 63 20 6d 6f 64 75 6c 65 2e 0a 20 20 74 68 69 73 2e 6f 6e 28 27 69 70 63 2d 6d 65 73 73 61 ipc.module....this.on('ipc-messa
13ea0 67 65 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 5b 63 68 61 6e 6e 65 6c 2c 20 ge',.function.(event,.[channel,.
13ec0 2e 2e 2e 61 72 67 73 5d 29 20 7b 0a 20 20 20 20 69 70 63 4d 61 69 6e 2e 65 6d 69 74 28 63 68 61 ...args]).{.....ipcMain.emit(cha
13ee0 6e 6e 65 6c 2c 20 65 76 65 6e 74 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 29 0a 20 20 74 68 69 nnel,.event,....args)...})...thi
13f00 73 2e 6f 6e 28 27 69 70 63 2d 6d 65 73 73 61 67 65 2d 73 79 6e 63 27 2c 20 66 75 6e 63 74 69 6f s.on('ipc-message-sync',.functio
13f20 6e 20 28 65 76 65 6e 74 2c 20 5b 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 5d 29 20 7b 0a n.(event,.[channel,....args]).{.
13f40 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 65 76 65 6e 74 2c ....Object.defineProperty(event,
13f60 20 27 72 65 74 75 72 6e 56 61 6c 75 65 27 2c 20 7b 0a 20 20 20 20 20 20 73 65 74 3a 20 66 75 6e .'returnValue',.{.......set:.fun
13f80 63 74 69 6f 6e 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 65 ction.(value).{.........return.e
13fa0 76 65 6e 74 2e 73 65 6e 64 52 65 70 6c 79 28 4a 53 4f 4e 2e 73 74 72 69 6e 67 69 66 79 28 76 61 vent.sendReply(JSON.stringify(va
13fc0 6c 75 65 29 29 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 67 65 74 3a 20 66 75 6e 63 74 69 lue)).......},.......get:.functi
13fe0 6f 6e 20 28 29 20 7b 7d 0a 20 20 20 20 7d 29 0a 20 20 20 20 69 70 63 4d 61 69 6e 2e 65 6d 69 74 on.().{}.....}).....ipcMain.emit
14000 28 63 68 61 6e 6e 65 6c 2c 20 65 76 65 6e 74 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 29 0a 0a (channel,.event,....args)...})..
14020 20 20 2f 2f 20 48 61 6e 64 6c 65 20 63 6f 6e 74 65 78 74 20 6d 65 6e 75 20 61 63 74 69 6f 6e 20 ..//.Handle.context.menu.action.
14040 72 65 71 75 65 73 74 20 66 72 6f 6d 20 70 65 70 70 65 72 20 70 6c 75 67 69 6e 2e 0a 20 20 74 68 request.from.pepper.plugin....th
14060 69 73 2e 6f 6e 28 27 70 65 70 70 65 72 2d 63 6f 6e 74 65 78 74 2d 6d 65 6e 75 27 2c 20 66 75 6e is.on('pepper-context-menu',.fun
14080 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 70 61 72 61 6d 73 29 20 7b 0a 20 20 20 20 2f 2f 20 41 ction.(event,.params).{.....//.A
140a0 63 63 65 73 73 20 4d 65 6e 75 20 76 69 61 20 65 6c 65 63 74 72 6f 6e 2e 4d 65 6e 75 20 74 6f 20 ccess.Menu.via.electron.Menu.to.
140c0 70 72 65 76 65 6e 74 20 63 69 72 63 75 6c 61 72 20 72 65 71 75 69 72 65 0a 20 20 20 20 63 6f 6e prevent.circular.require.....con
140e0 73 74 20 6d 65 6e 75 20 3d 20 65 6c 65 63 74 72 6f 6e 2e 4d 65 6e 75 2e 62 75 69 6c 64 46 72 6f st.menu.=.electron.Menu.buildFro
14100 6d 54 65 6d 70 6c 61 74 65 28 70 61 72 61 6d 73 2e 6d 65 6e 75 29 0a 20 20 20 20 6d 65 6e 75 2e mTemplate(params.menu).....menu.
14120 70 6f 70 75 70 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 4f 77 6e 65 72 42 72 6f 77 73 popup(event.sender.getOwnerBrows
14140 65 72 57 69 6e 64 6f 77 28 29 2c 20 70 61 72 61 6d 73 2e 78 2c 20 70 61 72 61 6d 73 2e 79 29 0a erWindow(),.params.x,.params.y).
14160 20 20 7d 29 0a 0a 20 20 2f 2f 20 54 68 65 20 64 65 76 74 6f 6f 6c 73 20 72 65 71 75 65 73 74 73 ..})....//.The.devtools.requests
14180 20 74 68 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 74 6f 20 72 65 6c 6f 61 64 2e 0a 20 20 74 68 .the.webContents.to.reload....th
141a0 69 73 2e 6f 6e 28 27 64 65 76 74 6f 6f 6c 73 2d 72 65 6c 6f 61 64 2d 70 61 67 65 27 2c 20 66 75 is.on('devtools-reload-page',.fu
141c0 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 72 65 6c 6f 61 64 28 29 0a 20 20 nction.().{.....this.reload()...
141e0 7d 29 0a 0a 20 20 61 70 70 2e 65 6d 69 74 28 27 77 65 62 2d 63 6f 6e 74 65 6e 74 73 2d 63 72 65 })....app.emit('web-contents-cre
14200 61 74 65 64 27 2c 20 7b 7d 2c 20 74 68 69 73 29 0a 7d 0a 0a 2f 2f 20 4a 61 76 61 53 63 72 69 70 ated',.{},.this).}..//.JavaScrip
14220 74 20 77 72 61 70 70 65 72 20 6f 66 20 44 65 62 75 67 67 65 72 2e 0a 63 6f 6e 73 74 20 7b 44 65 t.wrapper.of.Debugger..const.{De
14240 62 75 67 67 65 72 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 64 bugger}.=.process.atomBinding('d
14260 65 62 75 67 67 65 72 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 ebugger')..Object.setPrototypeOf
14280 28 44 65 62 75 67 67 65 72 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 (Debugger.prototype,.EventEmitte
142a0 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 2f 2f 20 50 75 62 6c 69 63 20 41 50 49 73 2e 0a 6d 6f r.prototype)..//.Public.APIs..mo
142c0 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 7b 0a 20 20 63 72 65 61 74 65 20 28 6f 70 74 69 6f dule.exports.=.{...create.(optio
142e0 6e 73 20 3d 20 7b 7d 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 63 72 ns.=.{}).{.....return.binding.cr
14300 65 61 74 65 28 6f 70 74 69 6f 6e 73 29 0a 20 20 7d 2c 0a 0a 20 20 66 72 6f 6d 49 64 20 28 69 64 eate(options)...},....fromId.(id
14320 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 66 72 6f 6d 49 64 28 69 64 ).{.....return.binding.fromId(id
14340 29 0a 20 20 7d 2c 0a 0a 20 20 67 65 74 46 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 20 )...},....getFocusedWebContents.
14360 28 29 20 7b 0a 20 20 20 20 6c 65 74 20 66 6f 63 75 73 65 64 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 ().{.....let.focused.=.null.....
14380 66 6f 72 20 28 6c 65 74 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 62 69 6e 64 69 6e 67 2e 67 65 74 for.(let.contents.of.binding.get
143a0 41 6c 6c 57 65 62 43 6f 6e 74 65 6e 74 73 28 29 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 21 63 AllWebContents()).{.......if.(!c
143c0 6f 6e 74 65 6e 74 73 2e 69 73 46 6f 63 75 73 65 64 28 29 29 20 63 6f 6e 74 69 6e 75 65 0a 20 20 ontents.isFocused()).continue...
143e0 20 20 20 20 69 66 20 28 66 6f 63 75 73 65 64 20 3d 3d 20 6e 75 6c 6c 29 20 66 6f 63 75 73 65 64 ....if.(focused.==.null).focused
14400 20 3d 20 63 6f 6e 74 65 6e 74 73 0a 20 20 20 20 20 20 2f 2f 20 52 65 74 75 72 6e 20 77 65 62 76 .=.contents.......//.Return.webv
14420 69 65 77 20 77 65 62 20 63 6f 6e 74 65 6e 74 73 20 77 68 69 63 68 20 6d 61 79 20 62 65 20 65 6d iew.web.contents.which.may.be.em
14440 62 65 64 64 65 64 20 69 6e 73 69 64 65 20 61 6e 6f 74 68 65 72 0a 20 20 20 20 20 20 2f 2f 20 77 bedded.inside.another.......//.w
14460 65 62 20 63 6f 6e 74 65 6e 74 73 20 74 68 61 74 20 69 73 20 61 6c 73 6f 20 72 65 70 6f 72 74 69 eb.contents.that.is.also.reporti
14480 6e 67 20 61 73 20 66 6f 63 75 73 65 64 0a 20 20 20 20 20 20 69 66 20 28 63 6f 6e 74 65 6e 74 73 ng.as.focused.......if.(contents
144a0 2e 67 65 74 54 79 70 65 28 29 20 3d 3d 3d 20 27 77 65 62 76 69 65 77 27 29 20 72 65 74 75 72 6e .getType().===.'webview').return
144c0 20 63 6f 6e 74 65 6e 74 73 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 66 6f 63 75 73 .contents.....}.....return.focus
144e0 65 64 0a 20 20 7d 2c 0a 0a 20 20 67 65 74 41 6c 6c 57 65 62 43 6f 6e 74 65 6e 74 73 20 28 29 20 ed...},....getAllWebContents.().
14500 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 67 65 74 41 6c 6c 57 65 62 43 6f {.....return.binding.getAllWebCo
14520 6e 74 65 6e 74 73 28 29 0a 20 20 7d 0a 7d 0a 63 6f 6e 73 74 20 7b 61 70 70 2c 20 69 70 63 4d 61 ntents()...}.}.const.{app,.ipcMa
14540 69 6e 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 7d 20 in,.webContents,.BrowserWindow}.
14560 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b 67 65 74 =.require('electron').const.{get
14580 41 6c 6c 57 65 62 43 6f 6e 74 65 6e 74 73 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 AllWebContents}.=.process.atomBi
145a0 6e 64 69 6e 67 28 27 77 65 62 5f 63 6f 6e 74 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 72 65 6e 64 nding('web_contents').const.rend
145c0 65 72 50 72 6f 63 65 73 73 50 72 65 66 65 72 65 6e 63 65 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 erProcessPreferences.=.process.a
145e0 74 6f 6d 42 69 6e 64 69 6e 67 28 27 72 65 6e 64 65 72 5f 70 72 6f 63 65 73 73 5f 70 72 65 66 65 tomBinding('render_process_prefe
14600 72 65 6e 63 65 73 27 29 2e 66 6f 72 41 6c 6c 57 65 62 43 6f 6e 74 65 6e 74 73 28 29 0a 0a 63 6f rences').forAllWebContents()..co
14620 6e 73 74 20 7b 42 75 66 66 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 62 75 66 66 65 72 27 29 nst.{Buffer}.=.require('buffer')
14640 0a 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 0a 63 6f 6e 73 74 20 .const.fs.=.require('fs').const.
14660 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 75 72 6c path.=.require('path').const.url
14680 20 3d 20 72 65 71 75 69 72 65 28 27 75 72 6c 27 29 0a 0a 2f 2f 20 54 4f 44 4f 28 7a 63 62 65 6e .=.require('url')..//.TODO(zcben
146a0 7a 29 3a 20 52 65 6d 6f 76 65 20 74 68 69 73 20 77 68 65 6e 20 77 65 20 68 61 76 65 20 4f 62 6a z):.Remove.this.when.we.have.Obj
146c0 65 63 74 2e 76 61 6c 75 65 73 28 29 2e 0a 63 6f 6e 73 74 20 6f 62 6a 65 63 74 56 61 6c 75 65 73 ect.values()..const.objectValues
146e0 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 62 6a 65 63 74 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 .=.function.(object).{...return.
14700 4f 62 6a 65 63 74 2e 6b 65 79 73 28 6f 62 6a 65 63 74 29 2e 6d 61 70 28 66 75 6e 63 74 69 6f 6e Object.keys(object).map(function
14720 20 28 6b 65 79 29 20 7b 20 72 65 74 75 72 6e 20 6f 62 6a 65 63 74 5b 6b 65 79 5d 20 7d 29 0a 7d .(key).{.return.object[key].}).}
14740 0a 0a 2f 2f 20 4d 61 70 70 69 6e 67 20 62 65 74 77 65 65 6e 20 65 78 74 65 6e 73 69 6f 6e 49 64 ..//.Mapping.between.extensionId
14760 28 68 6f 73 74 6e 61 6d 65 29 20 61 6e 64 20 6d 61 6e 69 66 65 73 74 2e 0a 63 6f 6e 73 74 20 6d (hostname).and.manifest..const.m
14780 61 6e 69 66 65 73 74 4d 61 70 20 3d 20 7b 7d 20 20 2f 2f 20 65 78 74 65 6e 73 69 6f 6e 49 64 20 anifestMap.=.{}..//.extensionId.
147a0 3d 3e 20 6d 61 6e 69 66 65 73 74 0a 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 =>.manifest.const.manifestNameMa
147c0 70 20 3d 20 7b 7d 20 20 2f 2f 20 6e 61 6d 65 20 3d 3e 20 6d 61 6e 69 66 65 73 74 0a 63 6f 6e 73 p.=.{}..//.name.=>.manifest.cons
147e0 74 20 64 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 20 3d 20 6e 65 77 20 53 t.devToolsExtensionNames.=.new.S
14800 65 74 28 29 0a 0a 63 6f 6e 73 74 20 67 65 6e 65 72 61 74 65 45 78 74 65 6e 73 69 6f 6e 49 64 46 et()..const.generateExtensionIdF
14820 72 6f 6d 4e 61 6d 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 72 65 romName.=.function.(name).{...re
14840 74 75 72 6e 20 6e 61 6d 65 2e 72 65 70 6c 61 63 65 28 2f 5b 5c 57 5f 5d 2b 2f 67 2c 20 27 2d 27 turn.name.replace(/[\W_]+/g,.'-'
14860 29 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 7d 0a 0a 63 6f 6e 73 74 20 69 73 57 69 6e 64 6f ).toLowerCase().}..const.isWindo
14880 77 4f 72 57 65 62 56 69 65 77 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 43 6f 6e 74 65 6e wOrWebView.=.function.(webConten
148a0 74 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 74 79 70 65 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 ts).{...const.type.=.webContents
148c0 2e 67 65 74 54 79 70 65 28 29 0a 20 20 72 65 74 75 72 6e 20 74 79 70 65 20 3d 3d 3d 20 27 77 69 .getType()...return.type.===.'wi
148e0 6e 64 6f 77 27 20 7c 7c 20 74 79 70 65 20 3d 3d 3d 20 27 77 65 62 76 69 65 77 27 0a 7d 0a 0a 2f ndow'.||.type.===.'webview'.}../
14900 2f 20 43 72 65 61 74 65 20 6f 72 20 67 65 74 20 6d 61 6e 69 66 65 73 74 20 6f 62 6a 65 63 74 20 /.Create.or.get.manifest.object.
14920 66 72 6f 6d 20 7c 73 72 63 44 69 72 65 63 74 6f 72 79 7c 2e 0a 63 6f 6e 73 74 20 67 65 74 4d 61 from.|srcDirectory|..const.getMa
14940 6e 69 66 65 73 74 46 72 6f 6d 50 61 74 68 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 72 63 44 69 nifestFromPath.=.function.(srcDi
14960 72 65 63 74 6f 72 79 29 20 7b 0a 20 20 6c 65 74 20 6d 61 6e 69 66 65 73 74 0a 20 20 6c 65 74 20 rectory).{...let.manifest...let.
14980 6d 61 6e 69 66 65 73 74 43 6f 6e 74 65 6e 74 0a 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 6d 61 6e manifestContent....try.{.....man
149a0 69 66 65 73 74 43 6f 6e 74 65 6e 74 20 3d 20 66 73 2e 72 65 61 64 46 69 6c 65 53 79 6e 63 28 70 ifestContent.=.fs.readFileSync(p
149c0 61 74 68 2e 6a 6f 69 6e 28 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 27 6d 61 6e 69 66 65 73 74 ath.join(srcDirectory,.'manifest
149e0 2e 6a 73 6f 6e 27 29 29 0a 20 20 7d 20 63 61 74 63 68 20 28 72 65 61 64 45 72 72 6f 72 29 20 7b .json'))...}.catch.(readError).{
14a00 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 60 52 65 61 64 69 6e 67 20 24 7b 70 61 74 .....console.warn(`Reading.${pat
14a20 68 2e 6a 6f 69 6e 28 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 27 6d 61 6e 69 66 65 73 74 2e 6a h.join(srcDirectory,.'manifest.j
14a40 73 6f 6e 27 29 7d 20 66 61 69 6c 65 64 2e 60 29 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 son')}.failed.`).....console.war
14a60 6e 28 72 65 61 64 45 72 72 6f 72 2e 73 74 61 63 6b 20 7c 7c 20 72 65 61 64 45 72 72 6f 72 29 0a n(readError.stack.||.readError).
14a80 20 20 20 20 74 68 72 6f 77 20 72 65 61 64 45 72 72 6f 72 0a 20 20 7d 0a 0a 20 20 74 72 79 20 7b ....throw.readError...}....try.{
14aa0 0a 20 20 20 20 6d 61 6e 69 66 65 73 74 20 3d 20 4a 53 4f 4e 2e 70 61 72 73 65 28 6d 61 6e 69 66 .....manifest.=.JSON.parse(manif
14ac0 65 73 74 43 6f 6e 74 65 6e 74 29 0a 20 20 7d 20 63 61 74 63 68 20 28 70 61 72 73 65 45 72 72 6f estContent)...}.catch.(parseErro
14ae0 72 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 60 50 61 72 73 69 6e 67 20 24 r).{.....console.warn(`Parsing.$
14b00 7b 70 61 74 68 2e 6a 6f 69 6e 28 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 27 6d 61 6e 69 66 65 {path.join(srcDirectory,.'manife
14b20 73 74 2e 6a 73 6f 6e 27 29 7d 20 66 61 69 6c 65 64 2e 60 29 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 st.json')}.failed.`).....console
14b40 2e 77 61 72 6e 28 70 61 72 73 65 45 72 72 6f 72 2e 73 74 61 63 6b 20 7c 7c 20 70 61 72 73 65 45 .warn(parseError.stack.||.parseE
14b60 72 72 6f 72 29 0a 20 20 20 20 74 68 72 6f 77 20 70 61 72 73 65 45 72 72 6f 72 0a 20 20 7d 0a 0a rror).....throw.parseError...}..
14b80 20 20 69 66 20 28 21 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 5b 6d 61 6e 69 66 65 73 74 2e ..if.(!manifestNameMap[manifest.
14ba0 6e 61 6d 65 5d 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 65 78 74 65 6e 73 69 6f 6e 49 64 20 3d name]).{.....const.extensionId.=
14bc0 20 67 65 6e 65 72 61 74 65 45 78 74 65 6e 73 69 6f 6e 49 64 46 72 6f 6d 4e 61 6d 65 28 6d 61 6e .generateExtensionIdFromName(man
14be0 69 66 65 73 74 2e 6e 61 6d 65 29 0a 20 20 20 20 6d 61 6e 69 66 65 73 74 4d 61 70 5b 65 78 74 65 ifest.name).....manifestMap[exte
14c00 6e 73 69 6f 6e 49 64 5d 20 3d 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 5b 6d 61 6e 69 66 nsionId].=.manifestNameMap[manif
14c20 65 73 74 2e 6e 61 6d 65 5d 20 3d 20 6d 61 6e 69 66 65 73 74 0a 20 20 20 20 4f 62 6a 65 63 74 2e est.name].=.manifest.....Object.
14c40 61 73 73 69 67 6e 28 6d 61 6e 69 66 65 73 74 2c 20 7b 0a 20 20 20 20 20 20 73 72 63 44 69 72 65 assign(manifest,.{.......srcDire
14c60 63 74 6f 72 79 3a 20 73 72 63 44 69 72 65 63 74 6f 72 79 2c 0a 20 20 20 20 20 20 65 78 74 65 6e ctory:.srcDirectory,.......exten
14c80 73 69 6f 6e 49 64 3a 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 0a 20 20 20 20 20 20 2f 2f 20 57 65 sionId:.extensionId,.......//.We
14ca0 20 63 61 6e 20 6e 6f 74 20 75 73 65 20 27 66 69 6c 65 3a 2f 2f 27 20 64 69 72 65 63 74 6c 79 20 .can.not.use.'file://'.directly.
14cc0 62 65 63 61 75 73 65 20 61 6c 6c 20 72 65 73 6f 75 72 63 65 73 20 69 6e 20 74 68 65 20 65 78 74 because.all.resources.in.the.ext
14ce0 65 6e 73 69 6f 6e 0a 20 20 20 20 20 20 2f 2f 20 77 69 6c 6c 20 62 65 20 74 72 65 61 74 65 64 20 ension.......//.will.be.treated.
14d00 61 73 20 72 65 6c 61 74 69 76 65 20 74 6f 20 74 68 65 20 72 6f 6f 74 20 69 6e 20 43 68 72 6f 6d as.relative.to.the.root.in.Chrom
14d20 65 2e 0a 20 20 20 20 20 20 73 74 61 72 74 50 61 67 65 3a 20 75 72 6c 2e 66 6f 72 6d 61 74 28 7b e........startPage:.url.format({
14d40 0a 20 20 20 20 20 20 20 20 70 72 6f 74 6f 63 6f 6c 3a 20 27 63 68 72 6f 6d 65 2d 65 78 74 65 6e .........protocol:.'chrome-exten
14d60 73 69 6f 6e 27 2c 0a 20 20 20 20 20 20 20 20 73 6c 61 73 68 65 73 3a 20 74 72 75 65 2c 0a 20 20 sion',.........slashes:.true,...
14d80 20 20 20 20 20 20 68 6f 73 74 6e 61 6d 65 3a 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 0a 20 20 20 ......hostname:.extensionId,....
14da0 20 20 20 20 20 70 61 74 68 6e 61 6d 65 3a 20 6d 61 6e 69 66 65 73 74 2e 64 65 76 74 6f 6f 6c 73 .....pathname:.manifest.devtools
14dc0 5f 70 61 67 65 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 29 0a 20 20 20 20 72 65 74 75 72 6e _page.......}).....}).....return
14de0 20 6d 61 6e 69 66 65 73 74 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6d 61 6e 69 66 65 73 74 20 .manifest...}.else.if.(manifest.
14e00 26 26 20 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e &&.manifest.name).{.....console.
14e20 77 61 72 6e 28 60 41 74 74 65 6d 70 74 65 64 20 74 6f 20 6c 6f 61 64 20 65 78 74 65 6e 73 69 6f warn(`Attempted.to.load.extensio
14e40 6e 20 22 24 7b 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 7d 22 20 74 68 61 74 20 68 61 73 20 61 6c n."${manifest.name}".that.has.al
14e60 72 65 61 64 79 20 62 65 65 6e 20 6c 6f 61 64 65 64 2e 60 29 0a 20 20 20 20 72 65 74 75 72 6e 20 ready.been.loaded.`).....return.
14e80 6d 61 6e 69 66 65 73 74 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4d 61 6e 61 67 65 20 74 68 65 20 62 61 manifest...}.}..//.Manage.the.ba
14ea0 63 6b 67 72 6f 75 6e 64 20 70 61 67 65 73 2e 0a 63 6f 6e 73 74 20 62 61 63 6b 67 72 6f 75 6e 64 ckground.pages..const.background
14ec0 50 61 67 65 73 20 3d 20 7b 7d 0a 0a 63 6f 6e 73 74 20 73 74 61 72 74 42 61 63 6b 67 72 6f 75 6e Pages.=.{}..const.startBackgroun
14ee0 64 50 61 67 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e 69 66 65 73 74 29 20 7b 0a 20 dPages.=.function.(manifest).{..
14f00 20 69 66 20 28 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 6d 61 6e 69 66 65 73 74 2e 65 78 .if.(backgroundPages[manifest.ex
14f20 74 65 6e 73 69 6f 6e 49 64 5d 20 7c 7c 20 21 6d 61 6e 69 66 65 73 74 2e 62 61 63 6b 67 72 6f 75 tensionId].||.!manifest.backgrou
14f40 6e 64 29 20 72 65 74 75 72 6e 0a 0a 20 20 6c 65 74 20 68 74 6d 6c 0a 20 20 6c 65 74 20 6e 61 6d nd).return....let.html...let.nam
14f60 65 0a 20 20 69 66 20 28 6d 61 6e 69 66 65 73 74 2e 62 61 63 6b 67 72 6f 75 6e 64 2e 70 61 67 65 e...if.(manifest.background.page
14f80 29 20 7b 0a 20 20 20 20 6e 61 6d 65 20 3d 20 6d 61 6e 69 66 65 73 74 2e 62 61 63 6b 67 72 6f 75 ).{.....name.=.manifest.backgrou
14fa0 6e 64 2e 70 61 67 65 0a 20 20 20 20 68 74 6d 6c 20 3d 20 66 73 2e 72 65 61 64 46 69 6c 65 53 79 nd.page.....html.=.fs.readFileSy
14fc0 6e 63 28 70 61 74 68 2e 6a 6f 69 6e 28 6d 61 6e 69 66 65 73 74 2e 73 72 63 44 69 72 65 63 74 6f nc(path.join(manifest.srcDirecto
14fe0 72 79 2c 20 6d 61 6e 69 66 65 73 74 2e 62 61 63 6b 67 72 6f 75 6e 64 2e 70 61 67 65 29 29 0a 20 ry,.manifest.background.page))..
15000 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 6e 61 6d 65 20 3d 20 27 5f 67 65 6e 65 72 61 74 65 64 .}.else.{.....name.=.'_generated
15020 5f 62 61 63 6b 67 72 6f 75 6e 64 5f 70 61 67 65 2e 68 74 6d 6c 27 0a 20 20 20 20 63 6f 6e 73 74 _background_page.html'.....const
15040 20 73 63 72 69 70 74 73 20 3d 20 6d 61 6e 69 66 65 73 74 2e 62 61 63 6b 67 72 6f 75 6e 64 2e 73 .scripts.=.manifest.background.s
15060 63 72 69 70 74 73 2e 6d 61 70 28 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 72 65 74 cripts.map((name).=>.{.......ret
15080 75 72 6e 20 60 3c 73 63 72 69 70 74 20 73 72 63 3d 22 24 7b 6e 61 6d 65 7d 22 3e 3c 2f 73 63 72 urn.`<script.src="${name}"></scr
150a0 69 70 74 3e 60 0a 20 20 20 20 7d 29 2e 6a 6f 69 6e 28 27 27 29 0a 20 20 20 20 68 74 6d 6c 20 3d ipt>`.....}).join('').....html.=
150c0 20 42 75 66 66 65 72 2e 66 72 6f 6d 28 60 3c 68 74 6d 6c 3e 3c 62 6f 64 79 3e 24 7b 73 63 72 69 .Buffer.from(`<html><body>${scri
150e0 70 74 73 7d 3c 2f 62 6f 64 79 3e 3c 2f 68 74 6d 6c 3e 60 29 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 pts}</body></html>`)...}....cons
15100 74 20 63 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 63 72 65 61 74 65 28 t.contents.=.webContents.create(
15120 7b 0a 20 20 20 20 70 61 72 74 69 74 69 6f 6e 3a 20 27 70 65 72 73 69 73 74 3a 5f 5f 63 68 72 6f {.....partition:.'persist:__chro
15140 6d 65 5f 65 78 74 65 6e 73 69 6f 6e 27 2c 0a 20 20 20 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 me_extension',.....isBackgroundP
15160 61 67 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 63 6f 6d 6d 61 6e 64 4c 69 6e 65 53 77 69 74 63 68 age:.true,.....commandLineSwitch
15180 65 73 3a 20 5b 27 2d 2d 62 61 63 6b 67 72 6f 75 6e 64 2d 70 61 67 65 27 5d 0a 20 20 7d 29 0a 20 es:.['--background-page']...})..
151a0 20 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 .backgroundPages[manifest.extens
151c0 69 6f 6e 49 64 5d 20 3d 20 7b 20 68 74 6d 6c 3a 20 68 74 6d 6c 2c 20 77 65 62 43 6f 6e 74 65 6e ionId].=.{.html:.html,.webConten
151e0 74 73 3a 20 63 6f 6e 74 65 6e 74 73 2c 20 6e 61 6d 65 3a 20 6e 61 6d 65 20 7d 0a 20 20 63 6f 6e ts:.contents,.name:.name.}...con
15200 74 65 6e 74 73 2e 6c 6f 61 64 55 52 4c 28 75 72 6c 2e 66 6f 72 6d 61 74 28 7b 0a 20 20 20 20 70 tents.loadURL(url.format({.....p
15220 72 6f 74 6f 63 6f 6c 3a 20 27 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 27 2c 0a 20 20 20 rotocol:.'chrome-extension',....
15240 20 73 6c 61 73 68 65 73 3a 20 74 72 75 65 2c 0a 20 20 20 20 68 6f 73 74 6e 61 6d 65 3a 20 6d 61 .slashes:.true,.....hostname:.ma
15260 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 69 6f 6e 49 64 2c 0a 20 20 20 20 70 61 74 68 6e 61 6d 65 nifest.extensionId,.....pathname
15280 3a 20 6e 61 6d 65 0a 20 20 7d 29 29 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 6d 6f 76 65 42 61 63 6b :.name...})).}..const.removeBack
152a0 67 72 6f 75 6e 64 50 61 67 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e 69 66 65 73 74 groundPages.=.function.(manifest
152c0 29 20 7b 0a 20 20 69 66 20 28 21 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 6d 61 6e 69 66 ).{...if.(!backgroundPages[manif
152e0 65 73 74 2e 65 78 74 65 6e 73 69 6f 6e 49 64 5d 29 20 72 65 74 75 72 6e 0a 0a 20 20 62 61 63 6b est.extensionId]).return....back
15300 67 72 6f 75 6e 64 50 61 67 65 73 5b 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 69 6f 6e 49 64 groundPages[manifest.extensionId
15320 5d 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 64 65 73 74 72 6f 79 28 29 0a 20 20 64 65 6c 65 74 65 ].webContents.destroy()...delete
15340 20 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 .backgroundPages[manifest.extens
15360 69 6f 6e 49 64 5d 0a 7d 0a 0a 63 6f 6e 73 74 20 73 65 6e 64 54 6f 42 61 63 6b 67 72 6f 75 6e 64 ionId].}..const.sendToBackground
15380 50 61 67 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 66 Pages.=.function.(...args).{...f
153a0 6f 72 20 28 63 6f 6e 73 74 20 70 61 67 65 20 6f 66 20 6f 62 6a 65 63 74 56 61 6c 75 65 73 28 62 or.(const.page.of.objectValues(b
153c0 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 29 29 20 7b 0a 20 20 20 20 70 61 67 65 2e 77 65 62 43 ackgroundPages)).{.....page.webC
153e0 6f 6e 74 65 6e 74 73 2e 73 65 6e 64 54 6f 41 6c 6c 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 0a 7d ontents.sendToAll(...args)...}.}
15400 0a 0a 2f 2f 20 44 69 73 70 61 74 63 68 20 77 65 62 20 63 6f 6e 74 65 6e 74 73 20 65 76 65 6e 74 ..//.Dispatch.web.contents.event
15420 73 20 74 6f 20 43 68 72 6f 6d 65 20 41 50 49 73 0a 63 6f 6e 73 74 20 68 6f 6f 6b 57 65 62 43 6f s.to.Chrome.APIs.const.hookWebCo
15440 6e 74 65 6e 74 73 45 76 65 6e 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 43 6f 6e 74 ntentsEvents.=.function.(webCont
15460 65 6e 74 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 74 61 62 49 64 20 3d 20 77 65 62 43 6f 6e 74 65 ents).{...const.tabId.=.webConte
15480 6e 74 73 2e 69 64 0a 0a 20 20 73 65 6e 64 54 6f 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 28 nts.id....sendToBackgroundPages(
154a0 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 4f 4e 43 52 45 41 54 45 44 27 29 0a 0a 20 20 77 65 62 43 'CHROME_TABS_ONCREATED')....webC
154c0 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 77 69 6c 6c 2d 6e 61 76 69 67 61 74 65 27 2c 20 28 65 76 65 ontents.on('will-navigate',.(eve
154e0 6e 74 2c 20 75 72 6c 29 20 3d 3e 20 7b 0a 20 20 20 20 73 65 6e 64 54 6f 42 61 63 6b 67 72 6f 75 nt,.url).=>.{.....sendToBackgrou
15500 6e 64 50 61 67 65 73 28 27 43 48 52 4f 4d 45 5f 57 45 42 4e 41 56 49 47 41 54 49 4f 4e 5f 4f 4e ndPages('CHROME_WEBNAVIGATION_ON
15520 42 45 46 4f 52 45 4e 41 56 49 47 41 54 45 27 2c 20 7b 0a 20 20 20 20 20 20 66 72 61 6d 65 49 64 BEFORENAVIGATE',.{.......frameId
15540 3a 20 30 2c 0a 20 20 20 20 20 20 70 61 72 65 6e 74 46 72 61 6d 65 49 64 3a 20 2d 31 2c 0a 20 20 :.0,.......parentFrameId:.-1,...
15560 20 20 20 20 70 72 6f 63 65 73 73 49 64 3a 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 67 65 74 50 72 ....processId:.webContents.getPr
15580 6f 63 65 73 73 49 64 28 29 2c 0a 20 20 20 20 20 20 74 61 62 49 64 3a 20 74 61 62 49 64 2c 0a 20 ocessId(),.......tabId:.tabId,..
155a0 20 20 20 20 20 74 69 6d 65 53 74 61 6d 70 3a 20 44 61 74 65 2e 6e 6f 77 28 29 2c 0a 20 20 20 20 .....timeStamp:.Date.now(),.....
155c0 20 20 75 72 6c 3a 20 75 72 6c 0a 20 20 20 20 7d 29 0a 20 20 7d 29 0a 0a 20 20 77 65 62 43 6f 6e ..url:.url.....})...})....webCon
155e0 74 65 6e 74 73 2e 6f 6e 28 27 64 69 64 2d 6e 61 76 69 67 61 74 65 27 2c 20 28 65 76 65 6e 74 2c tents.on('did-navigate',.(event,
15600 20 75 72 6c 29 20 3d 3e 20 7b 0a 20 20 20 20 73 65 6e 64 54 6f 42 61 63 6b 67 72 6f 75 6e 64 50 .url).=>.{.....sendToBackgroundP
15620 61 67 65 73 28 27 43 48 52 4f 4d 45 5f 57 45 42 4e 41 56 49 47 41 54 49 4f 4e 5f 4f 4e 43 4f 4d ages('CHROME_WEBNAVIGATION_ONCOM
15640 50 4c 45 54 45 44 27 2c 20 7b 0a 20 20 20 20 20 20 66 72 61 6d 65 49 64 3a 20 30 2c 0a 20 20 20 PLETED',.{.......frameId:.0,....
15660 20 20 20 70 61 72 65 6e 74 46 72 61 6d 65 49 64 3a 20 2d 31 2c 0a 20 20 20 20 20 20 70 72 6f 63 ...parentFrameId:.-1,.......proc
15680 65 73 73 49 64 3a 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 67 65 74 50 72 6f 63 65 73 73 49 64 28 essId:.webContents.getProcessId(
156a0 29 2c 0a 20 20 20 20 20 20 74 61 62 49 64 3a 20 74 61 62 49 64 2c 0a 20 20 20 20 20 20 74 69 6d ),.......tabId:.tabId,.......tim
156c0 65 53 74 61 6d 70 3a 20 44 61 74 65 2e 6e 6f 77 28 29 2c 0a 20 20 20 20 20 20 75 72 6c 3a 20 75 eStamp:.Date.now(),.......url:.u
156e0 72 6c 0a 20 20 20 20 7d 29 0a 20 20 7d 29 0a 0a 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e rl.....})...})....webContents.on
15700 63 65 28 27 64 65 73 74 72 6f 79 65 64 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 73 65 6e 64 ce('destroyed',.().=>.{.....send
15720 54 6f 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 4f ToBackgroundPages('CHROME_TABS_O
15740 4e 52 45 4d 4f 56 45 44 27 2c 20 74 61 62 49 64 29 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 48 61 6e NREMOVED',.tabId)...}).}..//.Han
15760 64 6c 65 20 74 68 65 20 63 68 72 6f 6d 65 2e 2a 20 41 50 49 20 6d 65 73 73 61 67 65 73 2e 0a 6c dle.the.chrome.*.API.messages..l
15780 65 74 20 6e 65 78 74 49 64 20 3d 20 30 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 43 48 52 4f 4d et.nextId.=.0..ipcMain.on('CHROM
157a0 45 5f 52 55 4e 54 49 4d 45 5f 43 4f 4e 4e 45 43 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 E_RUNTIME_CONNECT',.function.(ev
157c0 65 6e 74 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 29 20 7b ent,.extensionId,.connectInfo).{
157e0 0a 20 20 63 6f 6e 73 74 20 70 61 67 65 20 3d 20 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b ...const.page.=.backgroundPages[
15800 65 78 74 65 6e 73 69 6f 6e 49 64 5d 0a 20 20 69 66 20 28 21 70 61 67 65 29 20 7b 0a 20 20 20 20 extensionId]...if.(!page).{.....
15820 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 43 6f 6e 6e 65 63 74 20 74 6f 20 75 6e 6b 6e 6f 77 console.error(`Connect.to.unknow
15840 6e 20 65 78 74 65 6e 73 69 6f 6e 20 24 7b 65 78 74 65 6e 73 69 6f 6e 49 64 7d 60 29 0a 20 20 20 n.extension.${extensionId}`)....
15860 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 70 6f 72 74 49 64 20 3d 20 2b 2b .return...}....const.portId.=.++
15880 6e 65 78 74 49 64 0a 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 7b 74 61 nextId...event.returnValue.=.{ta
158a0 62 49 64 3a 20 70 61 67 65 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 64 2c 20 70 6f 72 74 49 64 bId:.page.webContents.id,.portId
158c0 3a 20 70 6f 72 74 49 64 7d 0a 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 6f 6e 63 65 28 27 :.portId}....event.sender.once('
158e0 72 65 6e 64 65 72 2d 76 69 65 77 2d 64 65 6c 65 74 65 64 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 render-view-deleted',.().=>.{...
15900 20 20 69 66 20 28 70 61 67 65 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 73 44 65 73 74 72 6f 79 ..if.(page.webContents.isDestroy
15920 65 64 28 29 29 20 72 65 74 75 72 6e 0a 20 20 20 20 70 61 67 65 2e 77 65 62 43 6f 6e 74 65 6e 74 ed()).return.....page.webContent
15940 73 2e 73 65 6e 64 54 6f 41 6c 6c 28 60 43 48 52 4f 4d 45 5f 50 4f 52 54 5f 44 49 53 43 4f 4e 4e s.sendToAll(`CHROME_PORT_DISCONN
15960 45 43 54 5f 24 7b 70 6f 72 74 49 64 7d 60 29 0a 20 20 7d 29 0a 20 20 70 61 67 65 2e 77 65 62 43 ECT_${portId}`)...})...page.webC
15980 6f 6e 74 65 6e 74 73 2e 73 65 6e 64 54 6f 41 6c 6c 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d ontents.sendToAll(`CHROME_RUNTIM
159a0 45 5f 4f 4e 43 4f 4e 4e 45 43 54 5f 24 7b 65 78 74 65 6e 73 69 6f 6e 49 64 7d 60 2c 20 65 76 65 E_ONCONNECT_${extensionId}`,.eve
159c0 6e 74 2e 73 65 6e 64 65 72 2e 69 64 2c 20 70 6f 72 74 49 64 2c 20 63 6f 6e 6e 65 63 74 49 6e 66 nt.sender.id,.portId,.connectInf
159e0 6f 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 49 31 38 4e 5f 4d o).})..ipcMain.on('CHROME_I18N_M
15a00 41 4e 49 46 45 53 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 78 74 65 6e ANIFEST',.function.(event,.exten
15a20 73 69 6f 6e 49 64 29 20 7b 0a 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 sionId).{...event.returnValue.=.
15a40 6d 61 6e 69 66 65 73 74 4d 61 70 5b 65 78 74 65 6e 73 69 6f 6e 49 64 5d 0a 7d 29 0a 0a 6c 65 74 manifestMap[extensionId].})..let
15a60 20 72 65 73 75 6c 74 49 44 20 3d 20 31 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 43 48 52 4f 4d 45 .resultID.=.1.ipcMain.on('CHROME
15a80 5f 52 55 4e 54 49 4d 45 5f 53 45 4e 44 4d 45 53 53 41 47 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 _RUNTIME_SENDMESSAGE',.function.
15aa0 28 65 76 65 6e 74 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 6f 72 (event,.extensionId,.message,.or
15ac0 69 67 69 6e 52 65 73 75 6c 74 49 44 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 61 67 65 20 3d 20 62 iginResultID).{...const.page.=.b
15ae0 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 65 78 74 65 6e 73 69 6f 6e 49 64 5d 0a 20 20 69 66 ackgroundPages[extensionId]...if
15b00 20 28 21 70 61 67 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 43 6f .(!page).{.....console.error(`Co
15b20 6e 6e 65 63 74 20 74 6f 20 75 6e 6b 6e 6f 77 6e 20 65 78 74 65 6e 73 69 6f 6e 20 24 7b 65 78 74 nnect.to.unknown.extension.${ext
15b40 65 6e 73 69 6f 6e 49 64 7d 60 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 70 61 ensionId}`).....return...}....pa
15b60 67 65 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 73 65 6e 64 54 6f 41 6c 6c 28 60 43 48 52 4f 4d 45 ge.webContents.sendToAll(`CHROME
15b80 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 24 7b 65 78 74 65 6e 73 69 6f 6e 49 64 _RUNTIME_ONMESSAGE_${extensionId
15ba0 7d 60 2c 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 64 2c 20 6d 65 73 73 61 67 65 2c 20 72 65 }`,.event.sender.id,.message,.re
15bc0 73 75 6c 74 49 44 29 0a 20 20 69 70 63 4d 61 69 6e 2e 6f 6e 63 65 28 60 43 48 52 4f 4d 45 5f 52 sultID)...ipcMain.once(`CHROME_R
15be0 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 72 65 73 75 6c 74 UNTIME_ONMESSAGE_RESULT_${result
15c00 49 44 7d 60 2c 20 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 29 20 3d 3e 20 7b 0a 20 20 20 20 65 ID}`,.(event,.result).=>.{.....e
15c20 76 65 6e 74 2e 73 65 6e 64 65 72 2e 73 65 6e 64 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 vent.sender.send(`CHROME_RUNTIME
15c40 5f 53 45 4e 44 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 6f 72 69 67 69 6e 52 65 73 75 _SENDMESSAGE_RESULT_${originResu
15c60 6c 74 49 44 7d 60 2c 20 72 65 73 75 6c 74 29 0a 20 20 7d 29 0a 20 20 72 65 73 75 6c 74 49 44 2b ltID}`,.result)...})...resultID+
15c80 2b 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 53 45 +.})..ipcMain.on('CHROME_TABS_SE
15ca0 4e 44 5f 4d 45 53 53 41 47 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 74 61 ND_MESSAGE',.function.(event,.ta
15cc0 62 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 bId,.extensionId,.isBackgroundPa
15ce0 67 65 2c 20 6d 65 73 73 61 67 65 2c 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 29 20 7b 0a 20 ge,.message,.originResultID).{..
15d00 20 63 6f 6e 73 74 20 63 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 .const.contents.=.webContents.fr
15d20 6f 6d 49 64 28 74 61 62 49 64 29 0a 20 20 69 66 20 28 21 63 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 omId(tabId)...if.(!contents).{..
15d40 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 53 65 6e 64 69 6e 67 20 6d 65 73 73 61 67 ...console.error(`Sending.messag
15d60 65 20 74 6f 20 75 6e 6b 6e 6f 77 6e 20 74 61 62 20 24 7b 74 61 62 49 64 7d 60 29 0a 20 20 20 20 e.to.unknown.tab.${tabId}`).....
15d80 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 73 65 6e 64 65 72 54 61 62 49 64 20 return...}....const.senderTabId.
15da0 3d 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 20 3f 20 6e 75 6c 6c 20 3a 20 65 76 65 6e =.isBackgroundPage.?.null.:.even
15dc0 74 2e 73 65 6e 64 65 72 2e 69 64 0a 0a 20 20 63 6f 6e 74 65 6e 74 73 2e 73 65 6e 64 54 6f 41 6c t.sender.id....contents.sendToAl
15de0 6c 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 24 7b 65 78 l(`CHROME_RUNTIME_ONMESSAGE_${ex
15e00 74 65 6e 73 69 6f 6e 49 64 7d 60 2c 20 73 65 6e 64 65 72 54 61 62 49 64 2c 20 6d 65 73 73 61 67 tensionId}`,.senderTabId,.messag
15e20 65 2c 20 72 65 73 75 6c 74 49 44 29 0a 20 20 69 70 63 4d 61 69 6e 2e 6f 6e 63 65 28 60 43 48 52 e,.resultID)...ipcMain.once(`CHR
15e40 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 72 OME_RUNTIME_ONMESSAGE_RESULT_${r
15e60 65 73 75 6c 74 49 44 7d 60 2c 20 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 29 20 3d 3e 20 7b 0a esultID}`,.(event,.result).=>.{.
15e80 20 20 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 73 65 6e 64 28 60 43 48 52 4f 4d 45 5f 54 41 ....event.sender.send(`CHROME_TA
15ea0 42 53 5f 53 45 4e 44 5f 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 6f 72 69 67 69 6e 52 BS_SEND_MESSAGE_RESULT_${originR
15ec0 65 73 75 6c 74 49 44 7d 60 2c 20 72 65 73 75 6c 74 29 0a 20 20 7d 29 0a 20 20 72 65 73 75 6c 74 esultID}`,.result)...})...result
15ee0 49 44 2b 2b 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 ID++.})..ipcMain.on('CHROME_TABS
15f00 5f 45 58 45 43 55 54 45 53 43 52 49 50 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 _EXECUTESCRIPT',.function.(event
15f20 2c 20 72 65 71 75 65 73 74 49 64 2c 20 74 61 62 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c ,.requestId,.tabId,.extensionId,
15f40 20 64 65 74 61 69 6c 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6e 74 65 6e 74 73 20 3d 20 77 .details).{...const.contents.=.w
15f60 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 74 61 62 49 64 29 0a 20 20 69 66 20 28 21 ebContents.fromId(tabId)...if.(!
15f80 63 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 53 contents).{.....console.error(`S
15fa0 65 6e 64 69 6e 67 20 6d 65 73 73 61 67 65 20 74 6f 20 75 6e 6b 6e 6f 77 6e 20 74 61 62 20 24 7b ending.message.to.unknown.tab.${
15fc0 74 61 62 49 64 7d 60 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 6c 65 74 20 63 tabId}`).....return...}....let.c
15fe0 6f 64 65 2c 20 75 72 6c 0a 20 20 69 66 20 28 64 65 74 61 69 6c 73 2e 66 69 6c 65 29 20 7b 0a 20 ode,.url...if.(details.file).{..
16000 20 20 20 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 20 3d 20 6d 61 6e 69 66 65 73 74 4d 61 70 5b ...const.manifest.=.manifestMap[
16020 65 78 74 65 6e 73 69 6f 6e 49 64 5d 0a 20 20 20 20 63 6f 64 65 20 3d 20 53 74 72 69 6e 67 28 66 extensionId].....code.=.String(f
16040 73 2e 72 65 61 64 46 69 6c 65 53 79 6e 63 28 70 61 74 68 2e 6a 6f 69 6e 28 6d 61 6e 69 66 65 73 s.readFileSync(path.join(manifes
16060 74 2e 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 64 65 74 61 69 6c 73 2e 66 69 6c 65 29 29 29 0a t.srcDirectory,.details.file))).
16080 20 20 20 20 75 72 6c 20 3d 20 60 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 2f 2f 24 7b ....url.=.`chrome-extension://${
160a0 65 78 74 65 6e 73 69 6f 6e 49 64 7d 24 7b 64 65 74 61 69 6c 73 2e 66 69 6c 65 7d 60 0a 20 20 7d extensionId}${details.file}`...}
160c0 20 65 6c 73 65 20 7b 0a 20 20 20 20 63 6f 64 65 20 3d 20 64 65 74 61 69 6c 73 2e 63 6f 64 65 0a .else.{.....code.=.details.code.
160e0 20 20 20 20 75 72 6c 20 3d 20 60 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 2f 2f 24 7b ....url.=.`chrome-extension://${
16100 65 78 74 65 6e 73 69 6f 6e 49 64 7d 2f 24 7b 53 74 72 69 6e 67 28 4d 61 74 68 2e 72 61 6e 64 6f extensionId}/${String(Math.rando
16120 6d 28 29 29 2e 73 75 62 73 74 72 28 32 2c 20 38 29 7d 2e 6a 73 60 0a 20 20 7d 0a 0a 20 20 63 6f m()).substr(2,.8)}.js`...}....co
16140 6e 74 65 6e 74 73 2e 73 65 6e 64 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 45 ntents.send('CHROME_TABS_EXECUTE
16160 53 43 52 49 50 54 27 2c 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 64 2c 20 72 65 71 75 65 73 SCRIPT',.event.sender.id,.reques
16180 74 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 75 72 6c 2c 20 63 6f 64 65 29 0a 7d 29 0a tId,.extensionId,.url,.code).}).
161a0 0a 2f 2f 20 54 72 61 6e 73 66 65 72 20 74 68 65 20 63 6f 6e 74 65 6e 74 20 73 63 72 69 70 74 73 .//.Transfer.the.content.scripts
161c0 20 74 6f 20 72 65 6e 64 65 72 65 72 2e 0a 63 6f 6e 73 74 20 63 6f 6e 74 65 6e 74 53 63 72 69 70 .to.renderer..const.contentScrip
161e0 74 73 20 3d 20 7b 7d 0a 0a 63 6f 6e 73 74 20 69 6e 6a 65 63 74 43 6f 6e 74 65 6e 74 53 63 72 69 ts.=.{}..const.injectContentScri
16200 70 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e 69 66 65 73 74 29 20 7b 0a 20 20 69 66 pts.=.function.(manifest).{...if
16220 20 28 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 5b 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 5d 20 .(contentScripts[manifest.name].
16240 7c 7c 20 21 6d 61 6e 69 66 65 73 74 2e 63 6f 6e 74 65 6e 74 5f 73 63 72 69 70 74 73 29 20 72 65 ||.!manifest.content_scripts).re
16260 74 75 72 6e 0a 0a 20 20 63 6f 6e 73 74 20 72 65 61 64 41 72 72 61 79 4f 66 46 69 6c 65 73 20 3d turn....const.readArrayOfFiles.=
16280 20 66 75 6e 63 74 69 6f 6e 20 28 72 65 6c 61 74 69 76 65 50 61 74 68 29 20 7b 0a 20 20 20 20 72 .function.(relativePath).{.....r
162a0 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 75 72 6c 3a 20 60 63 68 72 6f 6d 65 2d 65 78 74 65 6e eturn.{.......url:.`chrome-exten
162c0 73 69 6f 6e 3a 2f 2f 24 7b 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 69 6f 6e 49 64 7d 2f 24 sion://${manifest.extensionId}/$
162e0 7b 72 65 6c 61 74 69 76 65 50 61 74 68 7d 60 2c 0a 20 20 20 20 20 20 63 6f 64 65 3a 20 53 74 72 {relativePath}`,.......code:.Str
16300 69 6e 67 28 66 73 2e 72 65 61 64 46 69 6c 65 53 79 6e 63 28 70 61 74 68 2e 6a 6f 69 6e 28 6d 61 ing(fs.readFileSync(path.join(ma
16320 6e 69 66 65 73 74 2e 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 72 65 6c 61 74 69 76 65 50 61 74 nifest.srcDirectory,.relativePat
16340 68 29 29 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 63 6f 6e 74 65 6e 74 53 h))).....}...}....const.contentS
16360 63 72 69 70 74 54 6f 45 6e 74 72 79 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 63 72 69 70 74 29 criptToEntry.=.function.(script)
16380 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 6d 61 74 63 68 65 73 3a 20 73 .{.....return.{.......matches:.s
163a0 63 72 69 70 74 2e 6d 61 74 63 68 65 73 2c 0a 20 20 20 20 20 20 6a 73 3a 20 73 63 72 69 70 74 2e cript.matches,.......js:.script.
163c0 6a 73 20 3f 20 73 63 72 69 70 74 2e 6a 73 2e 6d 61 70 28 72 65 61 64 41 72 72 61 79 4f 66 46 69 js.?.script.js.map(readArrayOfFi
163e0 6c 65 73 29 20 3a 20 5b 5d 2c 0a 20 20 20 20 20 20 63 73 73 3a 20 73 63 72 69 70 74 2e 63 73 73 les).:.[],.......css:.script.css
16400 20 3f 20 73 63 72 69 70 74 2e 63 73 73 2e 6d 61 70 28 72 65 61 64 41 72 72 61 79 4f 66 46 69 6c .?.script.css.map(readArrayOfFil
16420 65 73 29 20 3a 20 5b 5d 2c 0a 20 20 20 20 20 20 72 75 6e 41 74 3a 20 73 63 72 69 70 74 2e 72 75 es).:.[],.......runAt:.script.ru
16440 6e 5f 61 74 20 7c 7c 20 27 64 6f 63 75 6d 65 6e 74 5f 69 64 6c 65 27 0a 20 20 20 20 7d 0a 20 20 n_at.||.'document_idle'.....}...
16460 7d 0a 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 65 6e 74 72 79 20 3d 20 7b 0a 20 }....try.{.....const.entry.=.{..
16480 20 20 20 20 20 65 78 74 65 6e 73 69 6f 6e 49 64 3a 20 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e .....extensionId:.manifest.exten
164a0 73 69 6f 6e 49 64 2c 0a 20 20 20 20 20 20 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 3a 20 6d 61 sionId,.......contentScripts:.ma
164c0 6e 69 66 65 73 74 2e 63 6f 6e 74 65 6e 74 5f 73 63 72 69 70 74 73 2e 6d 61 70 28 63 6f 6e 74 65 nifest.content_scripts.map(conte
164e0 6e 74 53 63 72 69 70 74 54 6f 45 6e 74 72 79 29 0a 20 20 20 20 7d 0a 20 20 20 20 63 6f 6e 74 65 ntScriptToEntry).....}.....conte
16500 6e 74 53 63 72 69 70 74 73 5b 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 5d 20 3d 20 72 65 6e 64 65 ntScripts[manifest.name].=.rende
16520 72 50 72 6f 63 65 73 73 50 72 65 66 65 72 65 6e 63 65 73 2e 61 64 64 45 6e 74 72 79 28 65 6e 74 rProcessPreferences.addEntry(ent
16540 72 79 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e ry)...}.catch.(e).{.....console.
16560 65 72 72 6f 72 28 27 46 61 69 6c 65 64 20 74 6f 20 72 65 61 64 20 63 6f 6e 74 65 6e 74 20 73 63 error('Failed.to.read.content.sc
16580 72 69 70 74 73 27 2c 20 65 29 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 6d 6f 76 65 43 6f ripts',.e)...}.}..const.removeCo
165a0 6e 74 65 6e 74 53 63 72 69 70 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e 69 66 65 73 ntentScripts.=.function.(manifes
165c0 74 29 20 7b 0a 20 20 69 66 20 28 21 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 5b 6d 61 6e 69 66 t).{...if.(!contentScripts[manif
165e0 65 73 74 2e 6e 61 6d 65 5d 29 20 72 65 74 75 72 6e 0a 0a 20 20 72 65 6e 64 65 72 50 72 6f 63 65 est.name]).return....renderProce
16600 73 73 50 72 65 66 65 72 65 6e 63 65 73 2e 72 65 6d 6f 76 65 45 6e 74 72 79 28 63 6f 6e 74 65 6e ssPreferences.removeEntry(conten
16620 74 53 63 72 69 70 74 73 5b 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 5d 29 0a 20 20 64 65 6c 65 74 tScripts[manifest.name])...delet
16640 65 20 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 5b 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 5d 0a e.contentScripts[manifest.name].
16660 7d 0a 0a 2f 2f 20 54 72 61 6e 73 66 65 72 20 74 68 65 20 7c 6d 61 6e 69 66 65 73 74 7c 20 74 6f }..//.Transfer.the.|manifest|.to
16680 20 61 20 66 6f 72 6d 61 74 20 74 68 61 74 20 63 61 6e 20 62 65 20 72 65 63 6f 67 6e 69 7a 65 64 .a.format.that.can.be.recognized
166a0 20 62 79 20 74 68 65 0a 2f 2f 20 7c 44 65 76 54 6f 6f 6c 73 41 50 49 2e 61 64 64 45 78 74 65 6e .by.the.//.|DevToolsAPI.addExten
166c0 73 69 6f 6e 73 7c 2e 0a 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 54 6f 45 78 74 65 6e 73 69 6f sions|..const.manifestToExtensio
166e0 6e 49 6e 66 6f 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e 69 66 65 73 74 29 20 7b 0a 20 20 nInfo.=.function.(manifest).{...
16700 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 73 74 61 72 74 50 61 67 65 3a 20 6d 61 6e 69 66 65 73 74 return.{.....startPage:.manifest
16720 2e 73 74 61 72 74 50 61 67 65 2c 0a 20 20 20 20 73 72 63 44 69 72 65 63 74 6f 72 79 3a 20 6d 61 .startPage,.....srcDirectory:.ma
16740 6e 69 66 65 73 74 2e 73 72 63 44 69 72 65 63 74 6f 72 79 2c 0a 20 20 20 20 6e 61 6d 65 3a 20 6d nifest.srcDirectory,.....name:.m
16760 61 6e 69 66 65 73 74 2e 6e 61 6d 65 2c 0a 20 20 20 20 65 78 70 6f 73 65 45 78 70 65 72 69 6d 65 anifest.name,.....exposeExperime
16780 6e 74 61 6c 41 50 49 73 3a 20 74 72 75 65 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4c 6f 61 64 20 74 68 ntalAPIs:.true...}.}..//.Load.th
167a0 65 20 65 78 74 65 6e 73 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 77 69 6e 64 6f 77 2e 0a 63 6f 6e e.extensions.for.the.window..con
167c0 73 74 20 6c 6f 61 64 45 78 74 65 6e 73 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e st.loadExtension.=.function.(man
167e0 69 66 65 73 74 29 20 7b 0a 20 20 73 74 61 72 74 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 28 ifest).{...startBackgroundPages(
16800 6d 61 6e 69 66 65 73 74 29 0a 20 20 69 6e 6a 65 63 74 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 manifest)...injectContentScripts
16820 28 6d 61 6e 69 66 65 73 74 29 0a 7d 0a 0a 63 6f 6e 73 74 20 6c 6f 61 64 44 65 76 54 6f 6f 6c 73 (manifest).}..const.loadDevTools
16840 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 69 6e 2c 20 6d 61 6e 69 Extensions.=.function.(win,.mani
16860 66 65 73 74 73 29 20 7b 0a 20 20 69 66 20 28 21 77 69 6e 2e 64 65 76 54 6f 6f 6c 73 57 65 62 43 fests).{...if.(!win.devToolsWebC
16880 6f 6e 74 65 6e 74 73 29 20 72 65 74 75 72 6e 0a 0a 20 20 6d 61 6e 69 66 65 73 74 73 2e 66 6f 72 ontents).return....manifests.for
168a0 45 61 63 68 28 6c 6f 61 64 45 78 74 65 6e 73 69 6f 6e 29 0a 0a 20 20 63 6f 6e 73 74 20 65 78 74 Each(loadExtension)....const.ext
168c0 65 6e 73 69 6f 6e 49 6e 66 6f 41 72 72 61 79 20 3d 20 6d 61 6e 69 66 65 73 74 73 2e 6d 61 70 28 ensionInfoArray.=.manifests.map(
168e0 6d 61 6e 69 66 65 73 74 54 6f 45 78 74 65 6e 73 69 6f 6e 49 6e 66 6f 29 0a 20 20 65 78 74 65 6e manifestToExtensionInfo)...exten
16900 73 69 6f 6e 49 6e 66 6f 41 72 72 61 79 2e 66 6f 72 45 61 63 68 28 28 65 78 74 65 6e 73 69 6f 6e sionInfoArray.forEach((extension
16920 29 20 3d 3e 20 7b 0a 20 20 20 20 77 69 6e 2e 64 65 76 54 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e ).=>.{.....win.devToolsWebConten
16940 74 73 2e 5f 67 72 61 6e 74 4f 72 69 67 69 6e 41 63 63 65 73 73 28 65 78 74 65 6e 73 69 6f 6e 2e ts._grantOriginAccess(extension.
16960 73 74 61 72 74 50 61 67 65 29 0a 20 20 7d 29 0a 20 20 77 69 6e 2e 64 65 76 54 6f 6f 6c 73 57 65 startPage)...})...win.devToolsWe
16980 62 43 6f 6e 74 65 6e 74 73 2e 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 28 60 44 65 76 bContents.executeJavaScript(`Dev
169a0 54 6f 6f 6c 73 41 50 49 2e 61 64 64 45 78 74 65 6e 73 69 6f 6e 73 28 24 7b 4a 53 4f 4e 2e 73 74 ToolsAPI.addExtensions(${JSON.st
169c0 72 69 6e 67 69 66 79 28 65 78 74 65 6e 73 69 6f 6e 49 6e 66 6f 41 72 72 61 79 29 7d 29 60 29 0a ringify(extensionInfoArray)})`).
169e0 7d 0a 0a 61 70 70 2e 6f 6e 28 27 77 65 62 2d 63 6f 6e 74 65 6e 74 73 2d 63 72 65 61 74 65 64 27 }..app.on('web-contents-created'
16a00 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 ,.function.(event,.webContents).
16a20 7b 0a 20 20 69 66 20 28 21 69 73 57 69 6e 64 6f 77 4f 72 57 65 62 56 69 65 77 28 77 65 62 43 6f {...if.(!isWindowOrWebView(webCo
16a40 6e 74 65 6e 74 73 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 68 6f 6f 6b 57 65 62 43 6f 6e 74 65 6e ntents)).return....hookWebConten
16a60 74 73 45 76 65 6e 74 73 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 0a 20 20 77 65 62 43 6f 6e 74 65 tsEvents(webContents)...webConte
16a80 6e 74 73 2e 6f 6e 28 27 64 65 76 74 6f 6f 6c 73 2d 6f 70 65 6e 65 64 27 2c 20 66 75 6e 63 74 69 nts.on('devtools-opened',.functi
16aa0 6f 6e 20 28 29 20 7b 0a 20 20 20 20 6c 6f 61 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f on.().{.....loadDevToolsExtensio
16ac0 6e 73 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 6f 62 6a 65 63 74 56 61 6c 75 65 73 28 6d 61 6e ns(webContents,.objectValues(man
16ae0 69 66 65 73 74 4d 61 70 29 29 0a 20 20 7d 29 0a 7d 29 0a 0a 2f 2f 20 54 68 65 20 63 68 72 6f 6d ifestMap))...}).})..//.The.chrom
16b00 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 20 63 61 6e 20 6d 61 70 20 61 20 65 78 74 65 6e 73 69 6f 6e e-extension:.can.map.a.extension
16b20 20 55 52 4c 20 72 65 71 75 65 73 74 20 74 6f 20 72 65 61 6c 20 66 69 6c 65 20 70 61 74 68 2e 0a .URL.request.to.real.file.path..
16b40 63 6f 6e 73 74 20 63 68 72 6f 6d 65 45 78 74 65 6e 73 69 6f 6e 48 61 6e 64 6c 65 72 20 3d 20 66 const.chromeExtensionHandler.=.f
16b60 75 6e 63 74 69 6f 6e 20 28 72 65 71 75 65 73 74 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 unction.(request,.callback).{...
16b80 63 6f 6e 73 74 20 70 61 72 73 65 64 20 3d 20 75 72 6c 2e 70 61 72 73 65 28 72 65 71 75 65 73 74 const.parsed.=.url.parse(request
16ba0 2e 75 72 6c 29 0a 20 20 69 66 20 28 21 70 61 72 73 65 64 2e 68 6f 73 74 6e 61 6d 65 20 7c 7c 20 .url)...if.(!parsed.hostname.||.
16bc0 21 70 61 72 73 65 64 2e 70 61 74 68 29 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 29 0a !parsed.path).return.callback().
16be0 0a 20 20 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 20 3d 20 6d 61 6e 69 66 65 73 74 4d 61 70 5b ...const.manifest.=.manifestMap[
16c00 70 61 72 73 65 64 2e 68 6f 73 74 6e 61 6d 65 5d 0a 20 20 69 66 20 28 21 6d 61 6e 69 66 65 73 74 parsed.hostname]...if.(!manifest
16c20 29 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 29 0a 0a 20 20 63 6f 6e 73 74 20 70 61 67 ).return.callback()....const.pag
16c40 65 20 3d 20 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 70 61 72 73 65 64 2e 68 6f 73 74 6e e.=.backgroundPages[parsed.hostn
16c60 61 6d 65 5d 0a 20 20 69 66 20 28 70 61 67 65 20 26 26 20 70 61 72 73 65 64 2e 70 61 74 68 20 3d ame]...if.(page.&&.parsed.path.=
16c80 3d 3d 20 60 2f 24 7b 70 61 67 65 2e 6e 61 6d 65 7d 60 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e ==.`/${page.name}`).{.....return
16ca0 20 63 61 6c 6c 62 61 63 6b 28 7b 0a 20 20 20 20 20 20 6d 69 6d 65 54 79 70 65 3a 20 27 74 65 78 .callback({.......mimeType:.'tex
16cc0 74 2f 68 74 6d 6c 27 2c 0a 20 20 20 20 20 20 64 61 74 61 3a 20 70 61 67 65 2e 68 74 6d 6c 0a 20 t/html',.......data:.page.html..
16ce0 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 66 73 2e 72 65 61 64 46 69 6c 65 28 70 61 74 68 2e 6a 6f ...})...}....fs.readFile(path.jo
16d00 69 6e 28 6d 61 6e 69 66 65 73 74 2e 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 70 61 72 73 65 64 in(manifest.srcDirectory,.parsed
16d20 2e 70 61 74 68 29 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 72 72 2c 20 63 6f 6e 74 65 6e 74 29 20 .path),.function.(err,.content).
16d40 7b 0a 20 20 20 20 69 66 20 28 65 72 72 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 {.....if.(err).{.......return.ca
16d60 6c 6c 62 61 63 6b 28 2d 36 29 20 20 2f 2f 20 46 49 4c 45 5f 4e 4f 54 5f 46 4f 55 4e 44 0a 20 20 llback(-6)..//.FILE_NOT_FOUND...
16d80 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b ..}.else.{.......return.callback
16da0 28 63 6f 6e 74 65 6e 74 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 61 70 70 2e 6f 6e 28 27 (content).....}...}).}..app.on('
16dc0 73 65 73 73 69 6f 6e 2d 63 72 65 61 74 65 64 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 73 29 session-created',.function.(ses)
16de0 20 7b 0a 20 20 73 65 73 2e 70 72 6f 74 6f 63 6f 6c 2e 72 65 67 69 73 74 65 72 42 75 66 66 65 72 .{...ses.protocol.registerBuffer
16e00 50 72 6f 74 6f 63 6f 6c 28 27 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 27 2c 20 63 68 72 Protocol('chrome-extension',.chr
16e20 6f 6d 65 45 78 74 65 6e 73 69 6f 6e 48 61 6e 64 6c 65 72 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 omeExtensionHandler,.function.(e
16e40 72 72 6f 72 29 20 7b 0a 20 20 20 20 69 66 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 63 rror).{.....if.(error).{.......c
16e60 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 55 6e 61 62 6c 65 20 74 6f 20 72 65 67 69 73 74 65 72 onsole.error(`Unable.to.register
16e80 20 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 20 70 72 6f 74 6f 63 6f 6c 3a 20 24 7b 65 72 .chrome-extension.protocol:.${er
16ea0 72 6f 72 7d 60 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 29 0a 0a 2f 2f 20 54 68 65 20 70 65 72 ror}`).....}...}).})..//.The.per
16ec0 73 69 73 74 65 6e 74 20 70 61 74 68 20 6f 66 20 22 44 65 76 54 6f 6f 6c 73 20 45 78 74 65 6e 73 sistent.path.of."DevTools.Extens
16ee0 69 6f 6e 73 22 20 70 72 65 66 65 72 65 6e 63 65 20 66 69 6c 65 2e 0a 6c 65 74 20 6c 6f 61 64 65 ions".preference.file..let.loade
16f00 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 74 68 20 3d 20 6e 75 6c 6c 0a 0a dDevToolsExtensionsPath.=.null..
16f20 61 70 70 2e 6f 6e 28 27 77 69 6c 6c 2d 71 75 69 74 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 app.on('will-quit',.function.().
16f40 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6c 6f 61 64 65 64 44 65 76 54 6f 6f {...try.{.....const.loadedDevToo
16f60 6c 73 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 41 72 72 61 79 2e 66 72 6f 6d 28 64 65 76 54 6f 6f lsExtensions.=.Array.from(devToo
16f80 6c 73 45 78 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 29 0a 20 20 20 20 20 20 2e 6d 61 70 28 6e 61 6d lsExtensionNames)........map(nam
16fa0 65 20 3d 3e 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 5b 6e 61 6d 65 5d 2e 73 72 63 44 69 e.=>.manifestNameMap[name].srcDi
16fc0 72 65 63 74 6f 72 79 29 0a 20 20 20 20 69 66 20 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 rectory).....if.(loadedDevToolsE
16fe0 78 74 65 6e 73 69 6f 6e 73 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 20 20 74 72 xtensions.length.>.0).{.......tr
17000 79 20 7b 0a 20 20 20 20 20 20 20 20 66 73 2e 6d 6b 64 69 72 53 79 6e 63 28 70 61 74 68 2e 64 69 y.{.........fs.mkdirSync(path.di
17020 72 6e 61 6d 65 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 rname(loadedDevToolsExtensionsPa
17040 74 68 29 29 0a 20 20 20 20 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 th)).......}.catch.(error).{....
17060 20 20 20 20 20 2f 2f 20 49 67 6e 6f 72 65 20 65 72 72 6f 72 0a 20 20 20 20 20 20 7d 0a 20 20 20 .....//.Ignore.error.......}....
17080 20 20 20 66 73 2e 77 72 69 74 65 46 69 6c 65 53 79 6e 63 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f ...fs.writeFileSync(loadedDevToo
170a0 6c 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 74 68 2c 20 4a 53 4f 4e 2e 73 74 72 69 6e 67 69 66 79 lsExtensionsPath,.JSON.stringify
170c0 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 29 29 0a 20 20 20 20 (loadedDevToolsExtensions)).....
170e0 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 66 73 2e 75 6e 6c 69 6e 6b 53 79 6e 63 28 6c 6f 61 }.else.{.......fs.unlinkSync(loa
17100 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 74 68 29 0a 20 20 20 20 7d dedDevToolsExtensionsPath).....}
17120 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 2f 2f 20 49 67 6e 6f ...}.catch.(error).{.....//.Igno
17140 72 65 20 65 72 72 6f 72 0a 20 20 7d 0a 7d 29 0a 0a 2f 2f 20 57 65 20 63 61 6e 20 6e 6f 74 20 75 re.error...}.})..//.We.can.not.u
17160 73 65 20 70 72 6f 74 6f 63 6f 6c 20 6f 72 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 20 75 6e 74 se.protocol.or.BrowserWindow.unt
17180 69 6c 20 61 70 70 20 69 73 20 72 65 61 64 79 2e 0a 61 70 70 2e 6f 6e 63 65 28 27 72 65 61 64 79 il.app.is.ready..app.once('ready
171a0 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 2f 2f 20 4c 6f 61 64 20 70 65 72 73 69 ',.function.().{...//.Load.persi
171c0 73 74 65 64 20 65 78 74 65 6e 73 69 6f 6e 73 2e 0a 20 20 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c sted.extensions....loadedDevTool
171e0 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 74 68 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 61 70 70 2e sExtensionsPath.=.path.join(app.
17200 67 65 74 50 61 74 68 28 27 75 73 65 72 44 61 74 61 27 29 2c 20 27 44 65 76 54 6f 6f 6c 73 20 45 getPath('userData'),.'DevTools.E
17220 78 74 65 6e 73 69 6f 6e 73 27 29 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6c 6f xtensions')...try.{.....const.lo
17240 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 4a 53 4f 4e 2e 70 61 adedDevToolsExtensions.=.JSON.pa
17260 72 73 65 28 66 73 2e 72 65 61 64 46 69 6c 65 53 79 6e 63 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f rse(fs.readFileSync(loadedDevToo
17280 6c 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 74 68 29 29 0a 20 20 20 20 69 66 20 28 41 72 72 61 79 lsExtensionsPath)).....if.(Array
172a0 2e 69 73 41 72 72 61 79 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e .isArray(loadedDevToolsExtension
172c0 73 29 29 20 7b 0a 20 20 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 73 72 63 44 69 72 65 63 74 s)).{.......for.(const.srcDirect
172e0 6f 72 79 20 6f 66 20 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 29 ory.of.loadedDevToolsExtensions)
17300 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 53 74 61 72 74 20 62 61 63 6b 67 72 6f 75 6e 64 20 70 .{.........//.Start.background.p
17320 61 67 65 73 20 61 6e 64 20 73 65 74 20 63 6f 6e 74 65 6e 74 20 73 63 72 69 70 74 73 2e 0a 20 20 ages.and.set.content.scripts....
17340 20 20 20 20 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 61 64 64 44 65 76 54 6f 6f 6c 73 45 ......BrowserWindow.addDevToolsE
17360 78 74 65 6e 73 69 6f 6e 28 73 72 63 44 69 72 65 63 74 6f 72 79 29 0a 20 20 20 20 20 20 7d 0a 20 xtension(srcDirectory).......}..
17380 20 20 20 7d 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 2f 2f 20 ...}...}.catch.(error).{.....//.
173a0 49 67 6e 6f 72 65 20 65 72 72 6f 72 0a 20 20 7d 0a 0a 20 20 2f 2f 20 54 68 65 20 70 75 62 6c 69 Ignore.error...}....//.The.publi
173c0 63 20 41 50 49 20 74 6f 20 61 64 64 2f 72 65 6d 6f 76 65 20 65 78 74 65 6e 73 69 6f 6e 73 2e 0a c.API.to.add/remove.extensions..
173e0 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 61 64 64 45 78 74 65 6e 73 69 6f 6e 20 3d 20 66 ..BrowserWindow.addExtension.=.f
17400 75 6e 63 74 69 6f 6e 20 28 73 72 63 44 69 72 65 63 74 6f 72 79 29 20 7b 0a 20 20 20 20 63 6f 6e unction.(srcDirectory).{.....con
17420 73 74 20 6d 61 6e 69 66 65 73 74 20 3d 20 67 65 74 4d 61 6e 69 66 65 73 74 46 72 6f 6d 50 61 74 st.manifest.=.getManifestFromPat
17440 68 28 73 72 63 44 69 72 65 63 74 6f 72 79 29 0a 20 20 20 20 69 66 20 28 6d 61 6e 69 66 65 73 74 h(srcDirectory).....if.(manifest
17460 29 20 7b 0a 20 20 20 20 20 20 6c 6f 61 64 45 78 74 65 6e 73 69 6f 6e 28 6d 61 6e 69 66 65 73 74 ).{.......loadExtension(manifest
17480 29 0a 20 20 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 6f ).......for.(const.webContents.o
174a0 66 20 67 65 74 41 6c 6c 57 65 62 43 6f 6e 74 65 6e 74 73 28 29 29 20 7b 0a 20 20 20 20 20 20 20 f.getAllWebContents()).{........
174c0 20 69 66 20 28 69 73 57 69 6e 64 6f 77 4f 72 57 65 62 56 69 65 77 28 77 65 62 43 6f 6e 74 65 6e .if.(isWindowOrWebView(webConten
174e0 74 73 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 6c 6f 61 64 44 65 76 54 6f 6f 6c 73 45 78 74 ts)).{...........loadDevToolsExt
17500 65 6e 73 69 6f 6e 73 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 5b 6d 61 6e 69 66 65 73 74 5d 29 ensions(webContents,.[manifest])
17520 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 .........}.......}.......return.
17540 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 42 72 6f 77 73 manifest.name.....}...}....Brows
17560 65 72 57 69 6e 64 6f 77 2e 72 65 6d 6f 76 65 45 78 74 65 6e 73 69 6f 6e 20 3d 20 66 75 6e 63 74 erWindow.removeExtension.=.funct
17580 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 20 ion.(name).{.....const.manifest.
175a0 3d 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 5b 6e 61 6d 65 5d 0a 20 20 20 20 69 66 20 28 =.manifestNameMap[name].....if.(
175c0 21 6d 61 6e 69 66 65 73 74 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 72 65 6d 6f 76 65 42 61 63 !manifest).return......removeBac
175e0 6b 67 72 6f 75 6e 64 50 61 67 65 73 28 6d 61 6e 69 66 65 73 74 29 0a 20 20 20 20 72 65 6d 6f 76 kgroundPages(manifest).....remov
17600 65 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 28 6d 61 6e 69 66 65 73 74 29 0a 20 20 20 20 64 65 eContentScripts(manifest).....de
17620 6c 65 74 65 20 6d 61 6e 69 66 65 73 74 4d 61 70 5b 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 lete.manifestMap[manifest.extens
17640 69 6f 6e 49 64 5d 0a 20 20 20 20 64 65 6c 65 74 65 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 ionId].....delete.manifestNameMa
17660 70 5b 6e 61 6d 65 5d 0a 20 20 7d 0a 0a 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 p[name]...}....BrowserWindow.get
17680 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 63 Extensions.=.function.().{.....c
176a0 6f 6e 73 74 20 65 78 74 65 6e 73 69 6f 6e 73 20 3d 20 7b 7d 0a 20 20 20 20 4f 62 6a 65 63 74 2e onst.extensions.=.{}.....Object.
176c0 6b 65 79 73 28 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 29 2e 66 6f 72 45 61 63 68 28 66 75 keys(manifestNameMap).forEach(fu
176e0 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 6d 61 6e 69 nction.(name).{.......const.mani
17700 66 65 73 74 20 3d 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 5b 6e 61 6d 65 5d 0a 20 20 20 fest.=.manifestNameMap[name]....
17720 20 20 20 65 78 74 65 6e 73 69 6f 6e 73 5b 6e 61 6d 65 5d 20 3d 20 7b 6e 61 6d 65 3a 20 6d 61 6e ...extensions[name].=.{name:.man
17740 69 66 65 73 74 2e 6e 61 6d 65 2c 20 76 65 72 73 69 6f 6e 3a 20 6d 61 6e 69 66 65 73 74 2e 76 65 ifest.name,.version:.manifest.ve
17760 72 73 69 6f 6e 7d 0a 20 20 20 20 7d 29 0a 20 20 20 20 72 65 74 75 72 6e 20 65 78 74 65 6e 73 69 rsion}.....}).....return.extensi
17780 6f 6e 73 0a 20 20 7d 0a 0a 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 61 64 64 44 65 76 54 ons...}....BrowserWindow.addDevT
177a0 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 72 63 44 69 72 oolsExtension.=.function.(srcDir
177c0 65 63 74 6f 72 79 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 ectory).{.....const.manifestName
177e0 20 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 61 64 64 45 78 74 65 6e 73 69 6f 6e 28 73 72 .=.BrowserWindow.addExtension(sr
17800 63 44 69 72 65 63 74 6f 72 79 29 0a 20 20 20 20 69 66 20 28 6d 61 6e 69 66 65 73 74 4e 61 6d 65 cDirectory).....if.(manifestName
17820 29 20 7b 0a 20 20 20 20 20 20 64 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 ).{.......devToolsExtensionNames
17840 2e 61 64 64 28 6d 61 6e 69 66 65 73 74 4e 61 6d 65 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 .add(manifestName).....}.....ret
17860 75 72 6e 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 0a 20 20 7d 0a 0a 20 20 42 72 6f 77 73 65 72 57 urn.manifestName...}....BrowserW
17880 69 6e 64 6f 77 2e 72 65 6d 6f 76 65 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 20 3d 20 indow.removeDevToolsExtension.=.
178a0 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 42 72 6f 77 73 65 72 57 69 6e function.(name).{.....BrowserWin
178c0 64 6f 77 2e 72 65 6d 6f 76 65 45 78 74 65 6e 73 69 6f 6e 28 6e 61 6d 65 29 0a 20 20 20 20 64 65 dow.removeExtension(name).....de
178e0 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 2e 64 65 6c 65 74 65 28 6e 61 6d 65 vToolsExtensionNames.delete(name
17900 29 0a 20 20 7d 0a 0a 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 44 65 76 54 6f 6f )...}....BrowserWindow.getDevToo
17920 6c 73 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 lsExtensions.=.function.().{....
17940 20 63 6f 6e 73 74 20 65 78 74 65 6e 73 69 6f 6e 73 20 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f .const.extensions.=.BrowserWindo
17960 77 2e 67 65 74 45 78 74 65 6e 73 69 6f 6e 73 28 29 0a 20 20 20 20 63 6f 6e 73 74 20 64 65 76 45 w.getExtensions().....const.devE
17980 78 74 65 6e 73 69 6f 6e 73 20 3d 20 7b 7d 0a 20 20 20 20 41 72 72 61 79 2e 66 72 6f 6d 28 64 65 xtensions.=.{}.....Array.from(de
179a0 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 29 2e 66 6f 72 45 61 63 68 28 66 75 vToolsExtensionNames).forEach(fu
179c0 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 21 65 78 74 65 6e nction.(name).{.......if.(!exten
179e0 73 69 6f 6e 73 5b 6e 61 6d 65 5d 29 20 72 65 74 75 72 6e 0a 20 20 20 20 20 20 64 65 76 45 78 74 sions[name]).return.......devExt
17a00 65 6e 73 69 6f 6e 73 5b 6e 61 6d 65 5d 20 3d 20 65 78 74 65 6e 73 69 6f 6e 73 5b 6e 61 6d 65 5d ensions[name].=.extensions[name]
17a20 0a 20 20 20 20 7d 29 0a 20 20 20 20 72 65 74 75 72 6e 20 64 65 76 45 78 74 65 6e 73 69 6f 6e 73 .....}).....return.devExtensions
17a40 0a 20 20 7d 0a 7d 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 69 70 63 ...}.}).'use.strict'..const.{ipc
17a60 4d 61 69 6e 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 Main}.=.require('electron').cons
17a80 74 20 7b 64 65 73 6b 74 6f 70 43 61 70 74 75 72 65 72 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 t.{desktopCapturer}.=.process.at
17aa0 6f 6d 42 69 6e 64 69 6e 67 28 27 64 65 73 6b 74 6f 70 5f 63 61 70 74 75 72 65 72 27 29 0a 0a 63 omBinding('desktop_capturer')..c
17ac0 6f 6e 73 74 20 64 65 65 70 45 71 75 61 6c 20 3d 20 28 61 2c 20 62 29 20 3d 3e 20 4a 53 4f 4e 2e onst.deepEqual.=.(a,.b).=>.JSON.
17ae0 73 74 72 69 6e 67 69 66 79 28 61 29 20 3d 3d 3d 20 4a 53 4f 4e 2e 73 74 72 69 6e 67 69 66 79 28 stringify(a).===.JSON.stringify(
17b00 62 29 0a 0a 2f 2f 20 41 20 71 75 65 75 65 20 66 6f 72 20 68 6f 6c 64 69 6e 67 20 61 6c 6c 20 72 b)..//.A.queue.for.holding.all.r
17b20 65 71 75 65 73 74 73 20 66 72 6f 6d 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 2e 0a 6c equests.from.renderer.process..l
17b40 65 74 20 72 65 71 75 65 73 74 73 51 75 65 75 65 20 3d 20 5b 5d 0a 0a 63 6f 6e 73 74 20 65 6c 65 et.requestsQueue.=.[]..const.ele
17b60 63 74 72 6f 6e 53 6f 75 72 63 65 73 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 ctronSources.=.'ELECTRON_BROWSER
17b80 5f 44 45 53 4b 54 4f 50 5f 43 41 50 54 55 52 45 52 5f 47 45 54 5f 53 4f 55 52 43 45 53 27 0a 63 _DESKTOP_CAPTURER_GET_SOURCES'.c
17ba0 6f 6e 73 74 20 63 61 70 74 75 72 65 72 52 65 73 75 6c 74 20 3d 20 28 69 64 29 20 3d 3e 20 60 45 onst.capturerResult.=.(id).=>.`E
17bc0 4c 45 43 54 52 4f 4e 5f 52 45 4e 44 45 52 45 52 5f 44 45 53 4b 54 4f 50 5f 43 41 50 54 55 52 45 LECTRON_RENDERER_DESKTOP_CAPTURE
17be0 52 5f 52 45 53 55 4c 54 5f 24 7b 69 64 7d 60 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 65 6c 65 63 R_RESULT_${id}`..ipcMain.on(elec
17c00 74 72 6f 6e 53 6f 75 72 63 65 73 2c 20 28 65 76 65 6e 74 2c 20 63 61 70 74 75 72 65 57 69 6e 64 tronSources,.(event,.captureWind
17c20 6f 77 2c 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c 20 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 ow,.captureScreen,.thumbnailSize
17c40 2c 20 69 64 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 72 65 71 75 65 73 74 20 3d 20 7b 0a 20 ,.id).=>.{...const.request.=.{..
17c60 20 20 20 69 64 2c 0a 20 20 20 20 6f 70 74 69 6f 6e 73 3a 20 7b 0a 20 20 20 20 20 20 63 61 70 74 ...id,.....options:.{.......capt
17c80 75 72 65 57 69 6e 64 6f 77 2c 0a 20 20 20 20 20 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c 0a ureWindow,.......captureScreen,.
17ca0 20 20 20 20 20 20 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 0a 20 20 20 20 7d 2c 0a 20 20 20 20 77 ......thumbnailSize.....},.....w
17cc0 65 62 43 6f 6e 74 65 6e 74 73 3a 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 0a 20 20 7d 0a 20 20 72 ebContents:.event.sender...}...r
17ce0 65 71 75 65 73 74 73 51 75 65 75 65 2e 70 75 73 68 28 72 65 71 75 65 73 74 29 0a 20 20 69 66 20 equestsQueue.push(request)...if.
17d00 28 72 65 71 75 65 73 74 73 51 75 65 75 65 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 31 29 20 7b 0a 20 (requestsQueue.length.===.1).{..
17d20 20 20 20 64 65 73 6b 74 6f 70 43 61 70 74 75 72 65 72 2e 73 74 61 72 74 48 61 6e 64 6c 69 6e 67 ...desktopCapturer.startHandling
17d40 28 63 61 70 74 75 72 65 57 69 6e 64 6f 77 2c 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c 20 74 (captureWindow,.captureScreen,.t
17d60 68 75 6d 62 6e 61 69 6c 53 69 7a 65 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 49 66 20 74 68 65 20 57 humbnailSize)...}....//.If.the.W
17d80 65 62 43 6f 6e 74 65 6e 74 73 20 69 73 20 64 65 73 74 72 6f 79 65 64 20 62 65 66 6f 72 65 20 72 ebContents.is.destroyed.before.r
17da0 65 63 65 69 76 69 6e 67 20 72 65 73 75 6c 74 2c 20 6a 75 73 74 20 72 65 6d 6f 76 65 20 74 68 65 eceiving.result,.just.remove.the
17dc0 0a 20 20 2f 2f 20 72 65 66 65 72 65 6e 63 65 20 66 72 6f 6d 20 72 65 71 75 65 73 74 73 51 75 65 ...//.reference.from.requestsQue
17de0 75 65 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 6d 6f 64 75 6c 65 20 6e 6f 74 20 73 65 6e 64 20 74 ue.to.make.the.module.not.send.t
17e00 68 65 20 72 65 73 75 6c 74 20 74 6f 20 69 74 2e 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e he.result.to.it....event.sender.
17e20 6f 6e 63 65 28 27 64 65 73 74 72 6f 79 65 64 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 72 65 once('destroyed',.().=>.{.....re
17e40 71 75 65 73 74 2e 77 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 6e 75 6c 6c 0a 20 20 7d 29 0a 7d 29 quest.webContents.=.null...}).})
17e60 0a 0a 64 65 73 6b 74 6f 70 43 61 70 74 75 72 65 72 2e 65 6d 69 74 20 3d 20 28 65 76 65 6e 74 2c ..desktopCapturer.emit.=.(event,
17e80 20 6e 61 6d 65 2c 20 73 6f 75 72 63 65 73 29 20 3d 3e 20 7b 0a 20 20 2f 2f 20 52 65 63 65 69 76 .name,.sources).=>.{...//.Receiv
17ea0 69 6e 67 20 73 6f 75 72 63 65 73 20 72 65 73 75 6c 74 20 66 72 6f 6d 20 6d 61 69 6e 20 70 72 6f ing.sources.result.from.main.pro
17ec0 63 65 73 73 2c 20 6e 6f 77 20 73 65 6e 64 20 74 68 65 6d 20 62 61 63 6b 20 74 6f 20 72 65 6e 64 cess,.now.send.them.back.to.rend
17ee0 65 72 65 72 2e 0a 20 20 63 6f 6e 73 74 20 68 61 6e 64 6c 65 64 52 65 71 75 65 73 74 20 3d 20 72 erer....const.handledRequest.=.r
17f00 65 71 75 65 73 74 73 51 75 65 75 65 2e 73 68 69 66 74 28 29 0a 20 20 63 6f 6e 73 74 20 68 61 6e equestsQueue.shift()...const.han
17f20 64 6c 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 68 61 6e 64 6c 65 64 52 65 71 75 65 73 74 dledWebContents.=.handledRequest
17f40 2e 77 65 62 43 6f 6e 74 65 6e 74 73 0a 20 20 63 6f 6e 73 74 20 75 6e 68 61 6e 64 6c 65 64 52 65 .webContents...const.unhandledRe
17f60 71 75 65 73 74 73 51 75 65 75 65 20 3d 20 5b 5d 0a 0a 20 20 63 6f 6e 73 74 20 72 65 73 75 6c 74 questsQueue.=.[]....const.result
17f80 20 3d 20 73 6f 75 72 63 65 73 2e 6d 61 70 28 73 6f 75 72 63 65 20 3d 3e 20 7b 0a 20 20 20 20 72 .=.sources.map(source.=>.{.....r
17fa0 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 69 64 3a 20 73 6f 75 72 63 65 2e 69 64 2c 0a 20 20 20 eturn.{.......id:.source.id,....
17fc0 20 20 20 6e 61 6d 65 3a 20 73 6f 75 72 63 65 2e 6e 61 6d 65 2c 0a 20 20 20 20 20 20 74 68 75 6d ...name:.source.name,.......thum
17fe0 62 6e 61 69 6c 3a 20 73 6f 75 72 63 65 2e 74 68 75 6d 62 6e 61 69 6c 2e 74 6f 44 61 74 61 55 52 bnail:.source.thumbnail.toDataUR
18000 4c 28 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a 20 20 69 66 20 28 68 61 6e 64 6c 65 64 57 65 62 L().....}...})....if.(handledWeb
18020 43 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 68 61 6e 64 6c 65 64 57 65 62 43 6f 6e 74 65 6e Contents).{.....handledWebConten
18040 74 73 2e 73 65 6e 64 28 63 61 70 74 75 72 65 72 52 65 73 75 6c 74 28 68 61 6e 64 6c 65 64 52 65 ts.send(capturerResult(handledRe
18060 71 75 65 73 74 2e 69 64 29 2c 20 72 65 73 75 6c 74 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 43 68 65 quest.id),.result)...}....//.Che
18080 63 6b 20 74 68 65 20 71 75 65 75 65 20 74 6f 20 73 65 65 20 77 68 65 74 68 65 72 20 74 68 65 72 ck.the.queue.to.see.whether.ther
180a0 65 20 69 73 20 61 6e 6f 74 68 65 72 20 69 64 65 6e 74 69 63 61 6c 20 72 65 71 75 65 73 74 20 26 e.is.another.identical.request.&
180c0 20 68 61 6e 64 6c 65 0a 20 20 72 65 71 75 65 73 74 73 51 75 65 75 65 2e 66 6f 72 45 61 63 68 28 .handle...requestsQueue.forEach(
180e0 72 65 71 75 65 73 74 20 3d 3e 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 77 65 62 43 6f 6e 74 65 6e request.=>.{.....const.webConten
18100 74 73 20 3d 20 72 65 71 75 65 73 74 2e 77 65 62 43 6f 6e 74 65 6e 74 73 0a 20 20 20 20 69 66 20 ts.=.request.webContents.....if.
18120 28 64 65 65 70 45 71 75 61 6c 28 68 61 6e 64 6c 65 64 52 65 71 75 65 73 74 2e 6f 70 74 69 6f 6e (deepEqual(handledRequest.option
18140 73 2c 20 72 65 71 75 65 73 74 2e 6f 70 74 69 6f 6e 73 29 29 20 7b 0a 20 20 20 20 20 20 69 66 20 s,.request.options)).{.......if.
18160 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 73 65 6e 64 28 63 (webContents).webContents.send(c
18180 61 70 74 75 72 65 72 52 65 73 75 6c 74 28 72 65 71 75 65 73 74 2e 69 64 29 2c 20 72 65 73 75 6c apturerResult(request.id),.resul
181a0 74 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 75 6e 68 61 6e 64 6c 65 64 52 t).....}.else.{.......unhandledR
181c0 65 71 75 65 73 74 73 51 75 65 75 65 2e 70 75 73 68 28 72 65 71 75 65 73 74 29 0a 20 20 20 20 7d equestsQueue.push(request).....}
181e0 0a 20 20 7d 29 0a 20 20 72 65 71 75 65 73 74 73 51 75 65 75 65 20 3d 20 75 6e 68 61 6e 64 6c 65 ...})...requestsQueue.=.unhandle
18200 64 52 65 71 75 65 73 74 73 51 75 65 75 65 0a 0a 20 20 2f 2f 20 49 66 20 74 68 65 20 72 65 71 75 dRequestsQueue....//.If.the.requ
18220 65 73 74 73 51 75 65 75 65 20 69 73 20 6e 6f 74 20 65 6d 70 74 79 2c 20 73 74 61 72 74 20 61 20 estsQueue.is.not.empty,.start.a.
18240 6e 65 77 20 72 65 71 75 65 73 74 20 68 61 6e 64 6c 69 6e 67 2e 0a 20 20 69 66 20 28 72 65 71 75 new.request.handling....if.(requ
18260 65 73 74 73 51 75 65 75 65 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 63 6f 6e 73 estsQueue.length.>.0).{.....cons
18280 74 20 7b 63 61 70 74 75 72 65 57 69 6e 64 6f 77 2c 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c t.{captureWindow,.captureScreen,
182a0 20 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 7d 20 3d 20 72 65 71 75 65 73 74 73 51 75 65 75 65 5b .thumbnailSize}.=.requestsQueue[
182c0 30 5d 2e 6f 70 74 69 6f 6e 73 0a 20 20 20 20 72 65 74 75 72 6e 20 64 65 73 6b 74 6f 70 43 61 70 0].options.....return.desktopCap
182e0 74 75 72 65 72 2e 73 74 61 72 74 48 61 6e 64 6c 69 6e 67 28 63 61 70 74 75 72 65 57 69 6e 64 6f turer.startHandling(captureWindo
18300 77 2c 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c 20 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 29 w,.captureScreen,.thumbnailSize)
18320 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 69 70 63 4d ...}.}.'use.strict'..const.{ipcM
18340 61 69 6e 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 ain,.webContents}.=.require('ele
18360 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 70 61 72 73 65 46 65 61 74 75 72 65 73 53 74 72 69 6e ctron').const.parseFeaturesStrin
18380 67 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 70 61 72 73 65 2d 66 65 61 g.=.require('../common/parse-fea
183a0 74 75 72 65 73 2d 73 74 72 69 6e 67 27 29 0a 0a 2f 2f 20 44 6f 65 73 6e 27 74 20 65 78 69 73 74 tures-string')..//.Doesn't.exist
183c0 20 69 6e 20 65 61 72 6c 79 20 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 2e 0a 6c 65 74 20 77 65 .in.early.initialization..let.we
183e0 62 56 69 65 77 4d 61 6e 61 67 65 72 20 3d 20 6e 75 6c 6c 0a 0a 63 6f 6e 73 74 20 73 75 70 70 6f bViewManager.=.null..const.suppo
18400 72 74 65 64 57 65 62 56 69 65 77 45 76 65 6e 74 73 20 3d 20 5b 0a 20 20 27 6c 6f 61 64 2d 63 6f rtedWebViewEvents.=.[...'load-co
18420 6d 6d 69 74 27 2c 0a 20 20 27 64 69 64 2d 61 74 74 61 63 68 27 2c 0a 20 20 27 64 69 64 2d 66 69 mmit',...'did-attach',...'did-fi
18440 6e 69 73 68 2d 6c 6f 61 64 27 2c 0a 20 20 27 64 69 64 2d 66 61 69 6c 2d 6c 6f 61 64 27 2c 0a 20 nish-load',...'did-fail-load',..
18460 20 27 64 69 64 2d 66 72 61 6d 65 2d 66 69 6e 69 73 68 2d 6c 6f 61 64 27 2c 0a 20 20 27 64 69 64 .'did-frame-finish-load',...'did
18480 2d 73 74 61 72 74 2d 6c 6f 61 64 69 6e 67 27 2c 0a 20 20 27 64 69 64 2d 73 74 6f 70 2d 6c 6f 61 -start-loading',...'did-stop-loa
184a0 64 69 6e 67 27 2c 0a 20 20 27 64 69 64 2d 67 65 74 2d 72 65 73 70 6f 6e 73 65 2d 64 65 74 61 69 ding',...'did-get-response-detai
184c0 6c 73 27 2c 0a 20 20 27 64 69 64 2d 67 65 74 2d 72 65 64 69 72 65 63 74 2d 72 65 71 75 65 73 74 ls',...'did-get-redirect-request
184e0 27 2c 0a 20 20 27 64 6f 6d 2d 72 65 61 64 79 27 2c 0a 20 20 27 63 6f 6e 73 6f 6c 65 2d 6d 65 73 ',...'dom-ready',...'console-mes
18500 73 61 67 65 27 2c 0a 20 20 27 63 6f 6e 74 65 78 74 2d 6d 65 6e 75 27 2c 0a 20 20 27 64 65 76 74 sage',...'context-menu',...'devt
18520 6f 6f 6c 73 2d 6f 70 65 6e 65 64 27 2c 0a 20 20 27 64 65 76 74 6f 6f 6c 73 2d 63 6c 6f 73 65 64 ools-opened',...'devtools-closed
18540 27 2c 0a 20 20 27 64 65 76 74 6f 6f 6c 73 2d 66 6f 63 75 73 65 64 27 2c 0a 20 20 27 6e 65 77 2d ',...'devtools-focused',...'new-
18560 77 69 6e 64 6f 77 27 2c 0a 20 20 27 77 69 6c 6c 2d 6e 61 76 69 67 61 74 65 27 2c 0a 20 20 27 64 window',...'will-navigate',...'d
18580 69 64 2d 6e 61 76 69 67 61 74 65 27 2c 0a 20 20 27 64 69 64 2d 6e 61 76 69 67 61 74 65 2d 69 6e id-navigate',...'did-navigate-in
185a0 2d 70 61 67 65 27 2c 0a 20 20 27 63 6c 6f 73 65 27 2c 0a 20 20 27 63 72 61 73 68 65 64 27 2c 0a -page',...'close',...'crashed',.
185c0 20 20 27 67 70 75 2d 63 72 61 73 68 65 64 27 2c 0a 20 20 27 70 6c 75 67 69 6e 2d 63 72 61 73 68 ..'gpu-crashed',...'plugin-crash
185e0 65 64 27 2c 0a 20 20 27 64 65 73 74 72 6f 79 65 64 27 2c 0a 20 20 27 70 61 67 65 2d 74 69 74 6c ed',...'destroyed',...'page-titl
18600 65 2d 75 70 64 61 74 65 64 27 2c 0a 20 20 27 70 61 67 65 2d 66 61 76 69 63 6f 6e 2d 75 70 64 61 e-updated',...'page-favicon-upda
18620 74 65 64 27 2c 0a 20 20 27 65 6e 74 65 72 2d 68 74 6d 6c 2d 66 75 6c 6c 2d 73 63 72 65 65 6e 27 ted',...'enter-html-full-screen'
18640 2c 0a 20 20 27 6c 65 61 76 65 2d 68 74 6d 6c 2d 66 75 6c 6c 2d 73 63 72 65 65 6e 27 2c 0a 20 20 ,...'leave-html-full-screen',...
18660 27 6d 65 64 69 61 2d 73 74 61 72 74 65 64 2d 70 6c 61 79 69 6e 67 27 2c 0a 20 20 27 6d 65 64 69 'media-started-playing',...'medi
18680 61 2d 70 61 75 73 65 64 27 2c 0a 20 20 27 66 6f 75 6e 64 2d 69 6e 2d 70 61 67 65 27 2c 0a 20 20 a-paused',...'found-in-page',...
186a0 27 64 69 64 2d 63 68 61 6e 67 65 2d 74 68 65 6d 65 2d 63 6f 6c 6f 72 27 2c 0a 20 20 27 75 70 64 'did-change-theme-color',...'upd
186c0 61 74 65 2d 74 61 72 67 65 74 2d 75 72 6c 27 0a 5d 0a 0a 6c 65 74 20 6e 65 78 74 47 75 65 73 74 ate-target-url'.]..let.nextGuest
186e0 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 30 0a 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e InstanceId.=.0.const.guestInstan
18700 63 65 73 20 3d 20 7b 7d 0a 63 6f 6e 73 74 20 65 6d 62 65 64 64 65 72 45 6c 65 6d 65 6e 74 73 4d ces.=.{}.const.embedderElementsM
18720 61 70 20 3d 20 7b 7d 0a 0a 2f 2f 20 4d 6f 76 65 73 20 74 68 65 20 6c 61 73 74 20 65 6c 65 6d 65 ap.=.{}..//.Moves.the.last.eleme
18740 6e 74 20 6f 66 20 61 72 72 61 79 20 74 6f 20 74 68 65 20 66 69 72 73 74 20 6f 6e 65 2e 0a 63 6f nt.of.array.to.the.first.one..co
18760 6e 73 74 20 6d 6f 76 65 4c 61 73 74 54 6f 46 69 72 73 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 nst.moveLastToFirst.=.function.(
18780 6c 69 73 74 29 20 7b 0a 20 20 6c 69 73 74 2e 75 6e 73 68 69 66 74 28 6c 69 73 74 2e 70 6f 70 28 list).{...list.unshift(list.pop(
187a0 29 29 0a 7d 0a 0a 2f 2f 20 47 65 6e 65 72 61 74 65 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 )).}..//.Generate.guestInstanceI
187c0 64 2e 0a 63 6f 6e 73 74 20 67 65 74 4e 65 78 74 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 d..const.getNextGuestInstanceId.
187e0 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 2b 2b 6e 65 78 74 47 =.function.().{...return.++nextG
18800 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 0a 7d 0a 0a 2f 2f 20 43 72 65 61 74 65 20 61 20 6e 65 uestInstanceId.}..//.Create.a.ne
18820 77 20 67 75 65 73 74 20 69 6e 73 74 61 6e 63 65 2e 0a 63 6f 6e 73 74 20 63 72 65 61 74 65 47 75 w.guest.instance..const.createGu
18840 65 73 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 6d 62 65 64 64 65 72 2c 20 70 61 72 61 6d 73 est.=.function.(embedder,.params
18860 29 20 7b 0a 20 20 69 66 20 28 77 65 62 56 69 65 77 4d 61 6e 61 67 65 72 20 3d 3d 20 6e 75 6c 6c ).{...if.(webViewManager.==.null
18880 29 20 7b 0a 20 20 20 20 77 65 62 56 69 65 77 4d 61 6e 61 67 65 72 20 3d 20 70 72 6f 63 65 73 73 ).{.....webViewManager.=.process
188a0 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 77 65 62 5f 76 69 65 77 5f 6d 61 6e 61 67 65 72 27 29 .atomBinding('web_view_manager')
188c0 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 ...}....const.guestInstanceId.=.
188e0 67 65 74 4e 65 78 74 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 28 65 6d 62 65 64 64 65 72 29 getNextGuestInstanceId(embedder)
18900 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 63 72 65 ...const.guest.=.webContents.cre
18920 61 74 65 28 7b 0a 20 20 20 20 69 73 47 75 65 73 74 3a 20 74 72 75 65 2c 0a 20 20 20 20 70 61 72 ate({.....isGuest:.true,.....par
18940 74 69 74 69 6f 6e 3a 20 70 61 72 61 6d 73 2e 70 61 72 74 69 74 69 6f 6e 2c 0a 20 20 20 20 65 6d tition:.params.partition,.....em
18960 62 65 64 64 65 72 3a 20 65 6d 62 65 64 64 65 72 0a 20 20 7d 29 0a 20 20 67 75 65 73 74 49 6e 73 bedder:.embedder...})...guestIns
18980 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 5d 20 3d 20 7b 0a 20 20 20 20 tances[guestInstanceId].=.{.....
189a0 67 75 65 73 74 3a 20 67 75 65 73 74 2c 0a 20 20 20 20 65 6d 62 65 64 64 65 72 3a 20 65 6d 62 65 guest:.guest,.....embedder:.embe
189c0 64 64 65 72 0a 20 20 7d 0a 0a 20 20 77 61 74 63 68 45 6d 62 65 64 64 65 72 28 65 6d 62 65 64 64 dder...}....watchEmbedder(embedd
189e0 65 72 29 0a 0a 20 20 2f 2f 20 49 6e 69 74 20 67 75 65 73 74 20 77 65 62 20 76 69 65 77 20 61 66 er)....//.Init.guest.web.view.af
18a00 74 65 72 20 61 74 74 61 63 68 65 64 2e 0a 20 20 67 75 65 73 74 2e 6f 6e 28 27 64 69 64 2d 61 74 ter.attached....guest.on('did-at
18a20 74 61 63 68 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 20 20 20 70 61 tach',.function.(event).{.....pa
18a40 72 61 6d 73 20 3d 20 74 68 69 73 2e 61 74 74 61 63 68 50 61 72 61 6d 73 0a 20 20 20 20 64 65 6c rams.=.this.attachParams.....del
18a60 65 74 65 20 74 68 69 73 2e 61 74 74 61 63 68 50 61 72 61 6d 73 0a 0a 20 20 20 20 63 6f 6e 73 74 ete.this.attachParams......const
18a80 20 70 72 65 76 69 6f 75 73 6c 79 41 74 74 61 63 68 65 64 20 3d 20 74 68 69 73 2e 76 69 65 77 49 .previouslyAttached.=.this.viewI
18aa0 6e 73 74 61 6e 63 65 49 64 20 21 3d 20 6e 75 6c 6c 0a 20 20 20 20 74 68 69 73 2e 76 69 65 77 49 nstanceId.!=.null.....this.viewI
18ac0 6e 73 74 61 6e 63 65 49 64 20 3d 20 70 61 72 61 6d 73 2e 69 6e 73 74 61 6e 63 65 49 64 0a 0a 20 nstanceId.=.params.instanceId...
18ae0 20 20 20 2f 2f 20 4f 6e 6c 79 20 6c 6f 61 64 20 55 52 4c 20 61 6e 64 20 73 65 74 20 73 69 7a 65 ...//.Only.load.URL.and.set.size
18b00 20 6f 6e 20 66 69 72 73 74 20 61 74 74 61 63 68 0a 20 20 20 20 69 66 20 28 70 72 65 76 69 6f 75 .on.first.attach.....if.(previou
18b20 73 6c 79 41 74 74 61 63 68 65 64 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 slyAttached).{.......return.....
18b40 7d 0a 0a 20 20 20 20 74 68 69 73 2e 73 65 74 53 69 7a 65 28 7b 0a 20 20 20 20 20 20 6e 6f 72 6d }......this.setSize({.......norm
18b60 61 6c 3a 20 7b 0a 20 20 20 20 20 20 20 20 77 69 64 74 68 3a 20 70 61 72 61 6d 73 2e 65 6c 65 6d al:.{.........width:.params.elem
18b80 65 6e 74 57 69 64 74 68 2c 0a 20 20 20 20 20 20 20 20 68 65 69 67 68 74 3a 20 70 61 72 61 6d 73 entWidth,.........height:.params
18ba0 2e 65 6c 65 6d 65 6e 74 48 65 69 67 68 74 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 65 6e .elementHeight.......},.......en
18bc0 61 62 6c 65 41 75 74 6f 53 69 7a 65 3a 20 70 61 72 61 6d 73 2e 61 75 74 6f 73 69 7a 65 2c 0a 20 ableAutoSize:.params.autosize,..
18be0 20 20 20 20 20 6d 69 6e 3a 20 7b 0a 20 20 20 20 20 20 20 20 77 69 64 74 68 3a 20 70 61 72 61 6d .....min:.{.........width:.param
18c00 73 2e 6d 69 6e 77 69 64 74 68 2c 0a 20 20 20 20 20 20 20 20 68 65 69 67 68 74 3a 20 70 61 72 61 s.minwidth,.........height:.para
18c20 6d 73 2e 6d 69 6e 68 65 69 67 68 74 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 6d 61 78 3a ms.minheight.......},.......max:
18c40 20 7b 0a 20 20 20 20 20 20 20 20 77 69 64 74 68 3a 20 70 61 72 61 6d 73 2e 6d 61 78 77 69 64 74 .{.........width:.params.maxwidt
18c60 68 2c 0a 20 20 20 20 20 20 20 20 68 65 69 67 68 74 3a 20 70 61 72 61 6d 73 2e 6d 61 78 68 65 69 h,.........height:.params.maxhei
18c80 67 68 74 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 20 20 20 20 69 66 20 28 70 61 72 61 6d ght.......}.....}).....if.(param
18ca0 73 2e 73 72 63 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 6f 70 74 73 20 3d 20 7b 7d 0a 20 s.src).{.......const.opts.=.{}..
18cc0 20 20 20 20 20 69 66 20 28 70 61 72 61 6d 73 2e 68 74 74 70 72 65 66 65 72 72 65 72 29 20 7b 0a .....if.(params.httpreferrer).{.
18ce0 20 20 20 20 20 20 20 20 6f 70 74 73 2e 68 74 74 70 52 65 66 65 72 72 65 72 20 3d 20 70 61 72 61 ........opts.httpReferrer.=.para
18d00 6d 73 2e 68 74 74 70 72 65 66 65 72 72 65 72 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 69 66 ms.httpreferrer.......}.......if
18d20 20 28 70 61 72 61 6d 73 2e 75 73 65 72 61 67 65 6e 74 29 20 7b 0a 20 20 20 20 20 20 20 20 6f 70 .(params.useragent).{.........op
18d40 74 73 2e 75 73 65 72 41 67 65 6e 74 20 3d 20 70 61 72 61 6d 73 2e 75 73 65 72 61 67 65 6e 74 0a ts.userAgent.=.params.useragent.
18d60 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 74 68 69 73 2e 6c 6f 61 64 55 52 4c 28 70 61 72 61 6d ......}.......this.loadURL(param
18d80 73 2e 73 72 63 2c 20 6f 70 74 73 29 0a 20 20 20 20 7d 0a 20 20 20 20 67 75 65 73 74 2e 61 6c 6c s.src,.opts).....}.....guest.all
18da0 6f 77 50 6f 70 75 70 73 20 3d 20 70 61 72 61 6d 73 2e 61 6c 6c 6f 77 70 6f 70 75 70 73 0a 20 20 owPopups.=.params.allowpopups...
18dc0 20 20 65 6d 62 65 64 64 65 72 2e 65 6d 69 74 28 27 64 69 64 2d 61 74 74 61 63 68 2d 77 65 62 76 ..embedder.emit('did-attach-webv
18de0 69 65 77 27 2c 20 65 76 65 6e 74 2c 20 67 75 65 73 74 29 0a 20 20 7d 29 0a 0a 20 20 63 6f 6e 73 iew',.event,.guest)...})....cons
18e00 74 20 73 65 6e 64 54 6f 45 6d 62 65 64 64 65 72 20 3d 20 28 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e t.sendToEmbedder.=.(channel,....
18e20 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 65 6d 62 65 64 64 65 72 20 3d 20 args).=>.{.....const.embedder.=.
18e40 67 65 74 45 6d 62 65 64 64 65 72 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 getEmbedder(guestInstanceId)....
18e60 20 69 66 20 28 65 6d 62 65 64 64 65 72 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 65 .if.(embedder.!=.null).{.......e
18e80 6d 62 65 64 64 65 72 2e 73 65 6e 64 28 60 24 7b 63 68 61 6e 6e 65 6c 7d 2d 24 7b 67 75 65 73 74 mbedder.send(`${channel}-${guest
18ea0 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 .viewInstanceId}`,....args).....
18ec0 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 44 69 73 70 61 74 63 68 20 65 76 65 6e 74 73 20 74 6f 20 65 }...}....//.Dispatch.events.to.e
18ee0 6d 62 65 64 64 65 72 2e 0a 20 20 63 6f 6e 73 74 20 66 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 mbedder....const.fn.=.function.(
18f00 65 76 65 6e 74 29 20 7b 0a 20 20 20 20 67 75 65 73 74 2e 6f 6e 28 65 76 65 6e 74 2c 20 66 75 6e event).{.....guest.on(event,.fun
18f20 63 74 69 6f 6e 20 28 5f 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 73 65 6e 64 54 ction.(_,....args).{.......sendT
18f40 6f 45 6d 62 65 64 64 65 72 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 oEmbedder('ELECTRON_GUEST_VIEW_I
18f60 4e 54 45 52 4e 41 4c 5f 44 49 53 50 41 54 43 48 5f 45 56 45 4e 54 27 2c 20 65 76 65 6e 74 2c 20 NTERNAL_DISPATCH_EVENT',.event,.
18f80 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 ...args).....})...}...for.(const
18fa0 20 65 76 65 6e 74 20 6f 66 20 73 75 70 70 6f 72 74 65 64 57 65 62 56 69 65 77 45 76 65 6e 74 73 .event.of.supportedWebViewEvents
18fc0 29 20 7b 0a 20 20 20 20 66 6e 28 65 76 65 6e 74 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 44 69 73 70 ).{.....fn(event)...}....//.Disp
18fe0 61 74 63 68 20 67 75 65 73 74 27 73 20 49 50 43 20 6d 65 73 73 61 67 65 73 20 74 6f 20 65 6d 62 atch.guest's.IPC.messages.to.emb
19000 65 64 64 65 72 2e 0a 20 20 67 75 65 73 74 2e 6f 6e 28 27 69 70 63 2d 6d 65 73 73 61 67 65 2d 68 edder....guest.on('ipc-message-h
19020 6f 73 74 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 5f 2c 20 5b 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e ost',.function.(_,.[channel,....
19040 61 72 67 73 5d 29 20 7b 0a 20 20 20 20 73 65 6e 64 54 6f 45 6d 62 65 64 64 65 72 28 27 45 4c 45 args]).{.....sendToEmbedder('ELE
19060 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 49 50 43 5f 4d 45 CTRON_GUEST_VIEW_INTERNAL_IPC_ME
19080 53 53 41 47 45 27 2c 20 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 29 0a 0a SSAGE',.channel,....args)...})..
190a0 20 20 2f 2f 20 41 75 74 6f 73 69 7a 65 2e 0a 20 20 67 75 65 73 74 2e 6f 6e 28 27 73 69 7a 65 2d ..//.Autosize....guest.on('size-
190c0 63 68 61 6e 67 65 64 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 5f 2c 20 2e 2e 2e 61 72 67 73 29 20 changed',.function.(_,....args).
190e0 7b 0a 20 20 20 20 73 65 6e 64 54 6f 45 6d 62 65 64 64 65 72 28 27 45 4c 45 43 54 52 4f 4e 5f 47 {.....sendToEmbedder('ELECTRON_G
19100 55 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 53 49 5a 45 5f 43 48 41 4e 47 45 44 27 UEST_VIEW_INTERNAL_SIZE_CHANGED'
19120 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 4e 6f 74 69 66 79 20 67 75 65 ,....args)...})....//.Notify.gue
19140 73 74 20 6f 66 20 65 6d 62 65 64 64 65 72 20 77 69 6e 64 6f 77 20 76 69 73 69 62 69 6c 69 74 79 st.of.embedder.window.visibility
19160 20 77 68 65 6e 20 69 74 20 69 73 20 72 65 61 64 79 0a 20 20 2f 2f 20 46 49 58 4d 45 20 52 65 6d .when.it.is.ready...//.FIXME.Rem
19180 6f 76 65 20 6f 6e 63 65 20 68 74 74 70 73 3a 2f 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 65 6c 65 63 ove.once.https://github.com/elec
191a0 74 72 6f 6e 2f 65 6c 65 63 74 72 6f 6e 2f 69 73 73 75 65 73 2f 36 38 32 38 20 69 73 20 66 69 78 tron/electron/issues/6828.is.fix
191c0 65 64 0a 20 20 67 75 65 73 74 2e 6f 6e 28 27 64 6f 6d 2d 72 65 61 64 79 27 2c 20 66 75 6e 63 74 ed...guest.on('dom-ready',.funct
191e0 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 ion.().{.....const.guestInstance
19200 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 .=.guestInstances[guestInstanceI
19220 64 5d 0a 20 20 20 20 69 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 20 21 3d 20 6e 75 6c 6c d].....if.(guestInstance.!=.null
19240 20 26 26 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 .&&.guestInstance.visibilityStat
19260 65 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 67 75 65 73 74 2e 73 65 6e 64 28 27 45 e.!=.null).{.......guest.send('E
19280 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 49 4e 53 54 41 4e 43 45 5f 56 49 53 49 42 49 4c 49 54 LECTRON_GUEST_INSTANCE_VISIBILIT
192a0 59 5f 43 48 41 4e 47 45 27 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 76 69 73 69 62 69 6c Y_CHANGE',.guestInstance.visibil
192c0 69 74 79 53 74 61 74 65 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 46 6f 72 77 61 ityState).....}...})....//.Forwa
192e0 72 64 20 69 6e 74 65 72 6e 61 6c 20 77 65 62 20 63 6f 6e 74 65 6e 74 73 20 65 76 65 6e 74 20 74 rd.internal.web.contents.event.t
19300 6f 20 65 6d 62 65 64 64 65 72 20 74 6f 20 68 61 6e 64 6c 65 0a 20 20 2f 2f 20 6e 61 74 69 76 65 o.embedder.to.handle...//.native
19320 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 73 65 74 75 70 0a 20 20 67 75 65 73 74 2e 6f 6e 28 27 2d .window.open.setup...guest.on('-
19340 61 64 64 2d 6e 65 77 2d 63 6f 6e 74 65 6e 74 73 27 2c 20 28 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 add-new-contents',.(...args).=>.
19360 7b 0a 20 20 20 20 69 66 20 28 67 75 65 73 74 2e 67 65 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 {.....if.(guest.getWebPreference
19380 73 28 29 2e 6e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 20 3d 3d 3d 20 74 72 75 65 29 20 7b s().nativeWindowOpen.===.true).{
193a0 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 65 6d 62 65 64 64 65 72 20 3d 20 67 65 74 45 6d 62 65 64 .......const.embedder.=.getEmbed
193c0 64 65 72 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 20 20 69 66 20 28 65 der(guestInstanceId).......if.(e
193e0 6d 62 65 64 64 65 72 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 65 6d 62 65 64 mbedder.!=.null).{.........embed
19400 64 65 72 2e 65 6d 69 74 28 27 2d 61 64 64 2d 6e 65 77 2d 63 6f 6e 74 65 6e 74 73 27 2c 20 2e 2e der.emit('-add-new-contents',...
19420 2e 61 72 67 73 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 20 20 67 75 65 73 .args).......}.....}...})...gues
19440 74 2e 6f 6e 28 27 2d 77 65 62 2d 63 6f 6e 74 65 6e 74 73 2d 63 72 65 61 74 65 64 27 2c 20 28 2e t.on('-web-contents-created',.(.
19460 2e 2e 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 67 75 65 73 74 2e 67 65 74 57 65 ..args).=>.{.....if.(guest.getWe
19480 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 2e 6e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 20 bPreferences().nativeWindowOpen.
194a0 3d 3d 3d 20 74 72 75 65 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 65 6d 62 65 64 64 65 72 ===.true).{.......const.embedder
194c0 20 3d 20 67 65 74 45 6d 62 65 64 64 65 72 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a .=.getEmbedder(guestInstanceId).
194e0 20 20 20 20 20 20 69 66 20 28 65 6d 62 65 64 64 65 72 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 ......if.(embedder.!=.null).{...
19500 20 20 20 20 20 20 65 6d 62 65 64 64 65 72 2e 65 6d 69 74 28 27 2d 77 65 62 2d 63 6f 6e 74 65 6e ......embedder.emit('-web-conten
19520 74 73 2d 63 72 65 61 74 65 64 27 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 20 20 7d 0a 20 20 ts-created',....args).......}...
19540 20 20 7d 0a 20 20 7d 29 0a 0a 20 20 72 65 74 75 72 6e 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 ..}...})....return.guestInstance
19560 49 64 0a 7d 0a 0a 2f 2f 20 41 74 74 61 63 68 20 74 68 65 20 67 75 65 73 74 20 74 6f 20 61 6e 20 Id.}..//.Attach.the.guest.to.an.
19580 65 6c 65 6d 65 6e 74 20 6f 66 20 65 6d 62 65 64 64 65 72 2e 0a 63 6f 6e 73 74 20 61 74 74 61 63 element.of.embedder..const.attac
195a0 68 47 75 65 73 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 6c 65 6d 65 6e hGuest.=.function.(event,.elemen
195c0 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 70 61 tInstanceId,.guestInstanceId,.pa
195e0 72 61 6d 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 65 6d 62 65 64 64 65 72 20 3d 20 65 76 65 6e 74 rams).{...const.embedder.=.event
19600 2e 73 65 6e 64 65 72 0a 20 20 2f 2f 20 44 65 73 74 72 6f 79 20 74 68 65 20 6f 6c 64 20 67 75 65 .sender...//.Destroy.the.old.gue
19620 73 74 20 77 68 65 6e 20 61 74 74 61 63 68 69 6e 67 2e 0a 20 20 63 6f 6e 73 74 20 6b 65 79 20 3d st.when.attaching....const.key.=
19640 20 60 24 7b 65 6d 62 65 64 64 65 72 2e 67 65 74 49 64 28 29 7d 2d 24 7b 65 6c 65 6d 65 6e 74 49 .`${embedder.getId()}-${elementI
19660 6e 73 74 61 6e 63 65 49 64 7d 60 0a 20 20 63 6f 6e 73 74 20 6f 6c 64 47 75 65 73 74 49 6e 73 74 nstanceId}`...const.oldGuestInst
19680 61 6e 63 65 49 64 20 3d 20 65 6d 62 65 64 64 65 72 45 6c 65 6d 65 6e 74 73 4d 61 70 5b 6b 65 79 anceId.=.embedderElementsMap[key
196a0 5d 0a 20 20 69 66 20 28 6f 6c 64 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 21 3d 20 6e 75 ]...if.(oldGuestInstanceId.!=.nu
196c0 6c 6c 29 20 7b 0a 20 20 20 20 2f 2f 20 52 65 61 74 74 61 63 68 6d 65 6e 74 20 74 6f 20 74 68 65 ll).{.....//.Reattachment.to.the
196e0 20 73 61 6d 65 20 67 75 65 73 74 20 69 73 20 6a 75 73 74 20 61 20 6e 6f 2d 6f 70 2e 0a 20 20 20 .same.guest.is.just.a.no-op.....
19700 20 69 66 20 28 6f 6c 64 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 3d 3d 20 67 75 65 73 .if.(oldGuestInstanceId.===.gues
19720 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 tInstanceId).{.......return.....
19740 7d 0a 0a 20 20 20 20 64 65 73 74 72 6f 79 47 75 65 73 74 28 65 6d 62 65 64 64 65 72 2c 20 6f 6c }......destroyGuest(embedder,.ol
19760 64 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 67 dGuestInstanceId)...}....const.g
19780 75 65 73 74 49 6e 73 74 61 6e 63 65 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 uestInstance.=.guestInstances[gu
197a0 65 73 74 49 6e 73 74 61 6e 63 65 49 64 5d 0a 20 20 2f 2f 20 49 66 20 74 68 69 73 20 69 73 6e 27 estInstanceId]...//.If.this.isn'
197c0 74 20 61 20 76 61 6c 69 64 20 67 75 65 73 74 20 69 6e 73 74 61 6e 63 65 20 74 68 65 6e 20 64 6f t.a.valid.guest.instance.then.do
197e0 20 6e 6f 74 68 69 6e 67 2e 0a 20 20 69 66 20 28 21 67 75 65 73 74 49 6e 73 74 61 6e 63 65 29 20 .nothing....if.(!guestInstance).
19800 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 7b 67 75 65 73 74 7d {.....return...}...const.{guest}
19820 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 0a 0a 20 20 2f 2f 20 49 66 20 74 68 69 73 20 67 .=.guestInstance....//.If.this.g
19840 75 65 73 74 20 69 73 20 61 6c 72 65 61 64 79 20 61 74 74 61 63 68 65 64 20 74 6f 20 61 6e 20 65 uest.is.already.attached.to.an.e
19860 6c 65 6d 65 6e 74 20 74 68 65 6e 20 72 65 6d 6f 76 65 20 69 74 0a 20 20 69 66 20 28 67 75 65 73 lement.then.remove.it...if.(gues
19880 74 49 6e 73 74 61 6e 63 65 2e 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 tInstance.elementInstanceId).{..
198a0 20 20 20 63 6f 6e 73 74 20 6f 6c 64 4b 65 79 20 3d 20 60 24 7b 67 75 65 73 74 49 6e 73 74 61 6e ...const.oldKey.=.`${guestInstan
198c0 63 65 2e 65 6d 62 65 64 64 65 72 2e 67 65 74 49 64 28 29 7d 2d 24 7b 67 75 65 73 74 49 6e 73 74 ce.embedder.getId()}-${guestInst
198e0 61 6e 63 65 2e 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 7d 60 0a 20 20 20 20 64 65 6c ance.elementInstanceId}`.....del
19900 65 74 65 20 65 6d 62 65 64 64 65 72 45 6c 65 6d 65 6e 74 73 4d 61 70 5b 6f 6c 64 4b 65 79 5d 0a ete.embedderElementsMap[oldKey].
19920 0a 20 20 20 20 2f 2f 20 52 65 6d 6f 76 65 20 67 75 65 73 74 20 66 72 6f 6d 20 65 6d 62 65 64 64 .....//.Remove.guest.from.embedd
19940 65 72 20 69 66 20 6d 6f 76 69 6e 67 20 61 63 72 6f 73 73 20 77 65 62 20 76 69 65 77 73 0a 20 20 er.if.moving.across.web.views...
19960 20 20 69 66 20 28 67 75 65 73 74 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 20 21 3d 3d 20 70 ..if.(guest.viewInstanceId.!==.p
19980 61 72 61 6d 73 2e 69 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 20 20 77 65 62 56 69 65 arams.instanceId).{.......webVie
199a0 77 4d 61 6e 61 67 65 72 2e 72 65 6d 6f 76 65 47 75 65 73 74 28 67 75 65 73 74 49 6e 73 74 61 6e wManager.removeGuest(guestInstan
199c0 63 65 2e 65 6d 62 65 64 64 65 72 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 ce.embedder,.guestInstanceId)...
199e0 20 20 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 72 2e 73 65 6e 64 28 ....guestInstance.embedder.send(
19a00 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 44 45 `ELECTRON_GUEST_VIEW_INTERNAL_DE
19a20 53 54 52 4f 59 5f 47 55 45 53 54 2d 24 7b 67 75 65 73 74 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 STROY_GUEST-${guest.viewInstance
19a40 49 64 7d 60 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 77 65 62 50 72 65 66 Id}`).....}...}....const.webPref
19a60 65 72 65 6e 63 65 73 20 3d 20 7b 0a 20 20 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 3a erences.=.{.....guestInstanceId:
19a80 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 0a 20 20 20 20 6e 6f 64 65 49 6e 74 65 67 72 .guestInstanceId,.....nodeIntegr
19aa0 61 74 69 6f 6e 3a 20 70 61 72 61 6d 73 2e 6e 6f 64 65 69 6e 74 65 67 72 61 74 69 6f 6e 20 21 3d ation:.params.nodeintegration.!=
19ac0 20 6e 75 6c 6c 20 3f 20 70 61 72 61 6d 73 2e 6e 6f 64 65 69 6e 74 65 67 72 61 74 69 6f 6e 20 3a .null.?.params.nodeintegration.:
19ae0 20 66 61 6c 73 65 2c 0a 20 20 20 20 70 6c 75 67 69 6e 73 3a 20 70 61 72 61 6d 73 2e 70 6c 75 67 .false,.....plugins:.params.plug
19b00 69 6e 73 2c 0a 20 20 20 20 7a 6f 6f 6d 46 61 63 74 6f 72 3a 20 65 6d 62 65 64 64 65 72 2e 5f 67 ins,.....zoomFactor:.embedder._g
19b20 65 74 5a 6f 6f 6d 46 61 63 74 6f 72 28 29 2c 0a 20 20 20 20 77 65 62 53 65 63 75 72 69 74 79 3a etZoomFactor(),.....webSecurity:
19b40 20 21 70 61 72 61 6d 73 2e 64 69 73 61 62 6c 65 77 65 62 73 65 63 75 72 69 74 79 2c 0a 20 20 20 .!params.disablewebsecurity,....
19b60 20 62 6c 69 6e 6b 46 65 61 74 75 72 65 73 3a 20 70 61 72 61 6d 73 2e 62 6c 69 6e 6b 66 65 61 74 .blinkFeatures:.params.blinkfeat
19b80 75 72 65 73 2c 0a 20 20 20 20 64 69 73 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 3a 20 ures,.....disableBlinkFeatures:.
19ba0 70 61 72 61 6d 73 2e 64 69 73 61 62 6c 65 62 6c 69 6e 6b 66 65 61 74 75 72 65 73 0a 20 20 7d 0a params.disableblinkfeatures...}.
19bc0 0a 20 20 2f 2f 20 70 61 72 73 65 20 74 68 65 20 27 77 65 62 70 72 65 66 65 72 65 6e 63 65 73 27 ...//.parse.the.'webpreferences'
19be0 20 61 74 74 72 69 62 75 74 65 20 73 74 72 69 6e 67 2c 20 69 66 20 73 65 74 0a 20 20 2f 2f 20 74 .attribute.string,.if.set...//.t
19c00 68 69 73 20 75 73 65 73 20 74 68 65 20 73 61 6d 65 20 70 61 72 73 69 6e 67 20 72 75 6c 65 73 20 his.uses.the.same.parsing.rules.
19c20 61 73 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 75 73 65 73 20 66 6f 72 20 69 74 73 20 66 65 61 74 as.window.open.uses.for.its.feat
19c40 75 72 65 73 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 70 61 72 61 6d 73 2e 77 65 62 70 72 65 66 ures...if.(typeof.params.webpref
19c60 65 72 65 6e 63 65 73 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 70 61 72 73 erences.===.'string').{.....pars
19c80 65 46 65 61 74 75 72 65 73 53 74 72 69 6e 67 28 70 61 72 61 6d 73 2e 77 65 62 70 72 65 66 65 72 eFeaturesString(params.webprefer
19ca0 65 6e 63 65 73 2c 20 66 75 6e 63 74 69 6f 6e 20 28 6b 65 79 2c 20 76 61 6c 75 65 29 20 7b 0a 20 ences,.function.(key,.value).{..
19cc0 20 20 20 20 20 69 66 20 28 76 61 6c 75 65 20 3d 3d 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a .....if.(value.===.undefined).{.
19ce0 20 20 20 20 20 20 20 20 2f 2f 20 6e 6f 20 76 61 6c 75 65 20 77 61 73 20 73 70 65 63 69 66 69 65 ........//.no.value.was.specifie
19d00 64 2c 20 64 65 66 61 75 6c 74 20 69 74 20 74 6f 20 74 72 75 65 0a 20 20 20 20 20 20 20 20 76 61 d,.default.it.to.true.........va
19d20 6c 75 65 20 3d 20 74 72 75 65 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 77 65 62 50 72 65 66 lue.=.true.......}.......webPref
19d40 65 72 65 6e 63 65 73 5b 6b 65 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 7d 29 0a 20 20 7d 0a erences[key].=.value.....})...}.
19d60 0a 20 20 69 66 20 28 70 61 72 61 6d 73 2e 70 72 65 6c 6f 61 64 29 20 7b 0a 20 20 20 20 77 65 62 ...if.(params.preload).{.....web
19d80 50 72 65 66 65 72 65 6e 63 65 73 2e 70 72 65 6c 6f 61 64 55 52 4c 20 3d 20 70 61 72 61 6d 73 2e Preferences.preloadURL.=.params.
19da0 70 72 65 6c 6f 61 64 0a 20 20 7d 0a 0a 20 20 2f 2f 20 52 65 74 75 72 6e 20 6e 75 6c 6c 20 66 72 preload...}....//.Return.null.fr
19dc0 6f 6d 20 6e 61 74 69 76 65 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 69 66 20 61 6c 6c 6f 77 70 6f om.native.window.open.if.allowpo
19de0 70 75 70 73 20 69 73 20 75 6e 73 65 74 0a 20 20 69 66 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 pups.is.unset...if.(webPreferenc
19e00 65 73 2e 6e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 20 3d 3d 3d 20 74 72 75 65 20 26 26 20 es.nativeWindowOpen.===.true.&&.
19e20 21 70 61 72 61 6d 73 2e 61 6c 6c 6f 77 70 6f 70 75 70 73 29 20 7b 0a 20 20 20 20 77 65 62 50 72 !params.allowpopups).{.....webPr
19e40 65 66 65 72 65 6e 63 65 73 2e 64 69 73 61 62 6c 65 50 6f 70 75 70 73 20 3d 20 74 72 75 65 0a 20 eferences.disablePopups.=.true..
19e60 20 7d 0a 0a 20 20 65 6d 62 65 64 64 65 72 2e 65 6d 69 74 28 27 77 69 6c 6c 2d 61 74 74 61 63 68 .}....embedder.emit('will-attach
19e80 2d 77 65 62 76 69 65 77 27 2c 20 65 76 65 6e 74 2c 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 -webview',.event,.webPreferences
19ea0 2c 20 70 61 72 61 6d 73 29 0a 20 20 69 66 20 28 65 76 65 6e 74 2e 64 65 66 61 75 6c 74 50 72 65 ,.params)...if.(event.defaultPre
19ec0 76 65 6e 74 65 64 29 20 7b 0a 20 20 20 20 69 66 20 28 67 75 65 73 74 2e 76 69 65 77 49 6e 73 74 vented).{.....if.(guest.viewInst
19ee0 61 6e 63 65 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 67 75 65 73 74 2e 76 69 65 77 49 6e 73 74 61 6e anceId.==.null).guest.viewInstan
19f00 63 65 49 64 20 3d 20 70 61 72 61 6d 73 2e 69 6e 73 74 61 6e 63 65 49 64 0a 20 20 20 20 64 65 73 ceId.=.params.instanceId.....des
19f20 74 72 6f 79 47 75 65 73 74 28 65 6d 62 65 64 64 65 72 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 troyGuest(embedder,.guestInstanc
19f40 65 49 64 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 77 65 62 56 69 65 77 4d 61 eId).....return...}....webViewMa
19f60 6e 61 67 65 72 2e 61 64 64 47 75 65 73 74 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 nager.addGuest(guestInstanceId,.
19f80 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 65 6d 62 65 64 64 65 72 2c 20 67 75 65 elementInstanceId,.embedder,.gue
19fa0 73 74 2c 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 0a 20 20 67 75 65 73 74 2e 61 74 74 61 st,.webPreferences)...guest.atta
19fc0 63 68 50 61 72 61 6d 73 20 3d 20 70 61 72 61 6d 73 0a 20 20 65 6d 62 65 64 64 65 72 45 6c 65 6d chParams.=.params...embedderElem
19fe0 65 6e 74 73 4d 61 70 5b 6b 65 79 5d 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 0a 0a entsMap[key].=.guestInstanceId..
1a000 20 20 67 75 65 73 74 2e 73 65 74 45 6d 62 65 64 64 65 72 28 65 6d 62 65 64 64 65 72 29 0a 20 20 ..guest.setEmbedder(embedder)...
1a020 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 72 20 3d 20 65 6d 62 65 64 64 65 guestInstance.embedder.=.embedde
1a040 72 0a 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 r...guestInstance.elementInstanc
1a060 65 49 64 20 3d 20 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 0a 0a 20 20 77 61 74 63 68 eId.=.elementInstanceId....watch
1a080 45 6d 62 65 64 64 65 72 28 65 6d 62 65 64 64 65 72 29 0a 7d 0a 0a 2f 2f 20 44 65 73 74 72 6f 79 Embedder(embedder).}..//.Destroy
1a0a0 20 61 6e 20 65 78 69 73 74 69 6e 67 20 67 75 65 73 74 20 69 6e 73 74 61 6e 63 65 2e 0a 63 6f 6e .an.existing.guest.instance..con
1a0c0 73 74 20 64 65 73 74 72 6f 79 47 75 65 73 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 6d 62 65 st.destroyGuest.=.function.(embe
1a0e0 64 64 65 72 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 69 66 20 28 21 dder,.guestInstanceId).{...if.(!
1a100 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 69 6e 20 67 75 65 73 74 49 6e 73 74 61 6e 63 (guestInstanceId.in.guestInstanc
1a120 65 73 29 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 67 es)).{.....return...}....const.g
1a140 75 65 73 74 49 6e 73 74 61 6e 63 65 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 uestInstance.=.guestInstances[gu
1a160 65 73 74 49 6e 73 74 61 6e 63 65 49 64 5d 0a 20 20 69 66 20 28 65 6d 62 65 64 64 65 72 20 21 3d estInstanceId]...if.(embedder.!=
1a180 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 72 29 20 7b 0a 20 20 20 20 =.guestInstance.embedder).{.....
1a1a0 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 77 65 62 56 69 65 77 4d 61 6e 61 67 65 72 2e 72 65 6d return...}....webViewManager.rem
1a1c0 6f 76 65 47 75 65 73 74 28 65 6d 62 65 64 64 65 72 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 oveGuest(embedder,.guestInstance
1a1e0 49 64 29 0a 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 67 75 65 73 74 2e 64 65 73 74 72 6f Id)...guestInstance.guest.destro
1a200 79 28 29 0a 20 20 64 65 6c 65 74 65 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 y()...delete.guestInstances[gues
1a220 74 49 6e 73 74 61 6e 63 65 49 64 5d 0a 0a 20 20 63 6f 6e 73 74 20 6b 65 79 20 3d 20 60 24 7b 65 tInstanceId]....const.key.=.`${e
1a240 6d 62 65 64 64 65 72 2e 67 65 74 49 64 28 29 7d 2d 24 7b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 mbedder.getId()}-${guestInstance
1a260 2e 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 7d 60 0a 20 20 64 65 6c 65 74 65 20 65 6d .elementInstanceId}`...delete.em
1a280 62 65 64 64 65 72 45 6c 65 6d 65 6e 74 73 4d 61 70 5b 6b 65 79 5d 0a 7d 0a 0a 2f 2f 20 4f 6e 63 bedderElementsMap[key].}..//.Onc
1a2a0 65 20 61 6e 20 65 6d 62 65 64 64 65 72 20 68 61 73 20 68 61 64 20 61 20 67 75 65 73 74 20 61 74 e.an.embedder.has.had.a.guest.at
1a2c0 74 61 63 68 65 64 20 77 65 20 77 61 74 63 68 20 69 74 20 66 6f 72 20 64 65 73 74 72 75 63 74 69 tached.we.watch.it.for.destructi
1a2e0 6f 6e 20 74 6f 0a 2f 2f 20 64 65 73 74 72 6f 79 20 61 6e 79 20 72 65 6d 61 69 6e 69 6e 67 20 67 on.to.//.destroy.any.remaining.g
1a300 75 65 73 74 73 2e 0a 63 6f 6e 73 74 20 77 61 74 63 68 65 64 45 6d 62 65 64 64 65 72 73 20 3d 20 uests..const.watchedEmbedders.=.
1a320 6e 65 77 20 53 65 74 28 29 0a 63 6f 6e 73 74 20 77 61 74 63 68 45 6d 62 65 64 64 65 72 20 3d 20 new.Set().const.watchEmbedder.=.
1a340 66 75 6e 63 74 69 6f 6e 20 28 65 6d 62 65 64 64 65 72 29 20 7b 0a 20 20 69 66 20 28 77 61 74 63 function.(embedder).{...if.(watc
1a360 68 65 64 45 6d 62 65 64 64 65 72 73 2e 68 61 73 28 65 6d 62 65 64 64 65 72 29 29 20 7b 0a 20 20 hedEmbedders.has(embedder)).{...
1a380 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 20 20 77 61 74 63 68 65 64 45 6d 62 65 64 64 65 72 73 2e ..return...}...watchedEmbedders.
1a3a0 61 64 64 28 65 6d 62 65 64 64 65 72 29 0a 0a 20 20 2f 2f 20 46 6f 72 77 61 72 64 20 65 6d 62 65 add(embedder)....//.Forward.embe
1a3c0 64 64 65 72 20 77 69 6e 64 6f 77 20 76 69 73 69 62 6c 69 74 79 20 63 68 61 6e 67 65 20 65 76 65 dder.window.visiblity.change.eve
1a3e0 6e 74 73 20 74 6f 20 67 75 65 73 74 0a 20 20 63 6f 6e 73 74 20 6f 6e 56 69 73 69 62 69 6c 69 74 nts.to.guest...const.onVisibilit
1a400 79 43 68 61 6e 67 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 76 69 73 69 62 69 6c 69 74 79 53 74 yChange.=.function.(visibilitySt
1a420 61 74 65 29 20 7b 0a 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 ate).{.....for.(const.guestInsta
1a440 6e 63 65 49 64 20 6f 66 20 4f 62 6a 65 63 74 2e 6b 65 79 73 28 67 75 65 73 74 49 6e 73 74 61 6e nceId.of.Object.keys(guestInstan
1a460 63 65 73 29 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 ces)).{.......const.guestInstanc
1a480 65 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 e.=.guestInstances[guestInstance
1a4a0 49 64 5d 0a 20 20 20 20 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 76 69 73 69 62 69 6c 69 Id].......guestInstance.visibili
1a4c0 74 79 53 74 61 74 65 20 3d 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 0a 20 20 20 20 20 20 tyState.=.visibilityState.......
1a4e0 69 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 72 20 3d 3d 3d 20 65 if.(guestInstance.embedder.===.e
1a500 6d 62 65 64 64 65 72 29 20 7b 0a 20 20 20 20 20 20 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 mbedder).{.........guestInstance
1a520 2e 67 75 65 73 74 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 49 4e 53 54 .guest.send('ELECTRON_GUEST_INST
1a540 41 4e 43 45 5f 56 49 53 49 42 49 4c 49 54 59 5f 43 48 41 4e 47 45 27 2c 20 76 69 73 69 62 69 6c ANCE_VISIBILITY_CHANGE',.visibil
1a560 69 74 79 53 74 61 74 65 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 65 6d ityState).......}.....}...}...em
1a580 62 65 64 64 65 72 2e 6f 6e 28 27 2d 77 69 6e 64 6f 77 2d 76 69 73 69 62 69 6c 69 74 79 2d 63 68 bedder.on('-window-visibility-ch
1a5a0 61 6e 67 65 27 2c 20 6f 6e 56 69 73 69 62 69 6c 69 74 79 43 68 61 6e 67 65 29 0a 0a 20 20 63 6f ange',.onVisibilityChange)....co
1a5c0 6e 73 74 20 64 65 73 74 72 6f 79 45 76 65 6e 74 73 20 3d 20 5b 27 77 69 6c 6c 2d 64 65 73 74 72 nst.destroyEvents.=.['will-destr
1a5e0 6f 79 27 2c 20 27 63 72 61 73 68 65 64 27 2c 20 27 64 69 64 2d 6e 61 76 69 67 61 74 65 27 5d 0a oy',.'crashed',.'did-navigate'].
1a600 20 20 63 6f 6e 73 74 20 64 65 73 74 72 6f 79 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a ..const.destroy.=.function.().{.
1a620 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 6f ....for.(const.guestInstanceId.o
1a640 66 20 4f 62 6a 65 63 74 2e 6b 65 79 73 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 29 29 20 7b f.Object.keys(guestInstances)).{
1a660 0a 20 20 20 20 20 20 69 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 .......if.(guestInstances[guestI
1a680 6e 73 74 61 6e 63 65 49 64 5d 2e 65 6d 62 65 64 64 65 72 20 3d 3d 3d 20 65 6d 62 65 64 64 65 72 nstanceId].embedder.===.embedder
1a6a0 29 20 7b 0a 20 20 20 20 20 20 20 20 64 65 73 74 72 6f 79 47 75 65 73 74 28 65 6d 62 65 64 64 65 ).{.........destroyGuest(embedde
1a6c0 72 2c 20 70 61 72 73 65 49 6e 74 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 29 0a 20 20 r,.parseInt(guestInstanceId))...
1a6e0 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 65 76 65 6e ....}.....}......for.(const.even
1a700 74 20 6f 66 20 64 65 73 74 72 6f 79 45 76 65 6e 74 73 29 20 7b 0a 20 20 20 20 20 20 65 6d 62 65 t.of.destroyEvents).{.......embe
1a720 64 64 65 72 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 65 76 65 6e 74 2c 20 64 65 73 74 72 dder.removeListener(event,.destr
1a740 6f 79 29 0a 20 20 20 20 7d 0a 20 20 20 20 65 6d 62 65 64 64 65 72 2e 72 65 6d 6f 76 65 4c 69 73 oy).....}.....embedder.removeLis
1a760 74 65 6e 65 72 28 27 2d 77 69 6e 64 6f 77 2d 76 69 73 69 62 69 6c 69 74 79 2d 63 68 61 6e 67 65 tener('-window-visibility-change
1a780 27 2c 20 6f 6e 56 69 73 69 62 69 6c 69 74 79 43 68 61 6e 67 65 29 0a 0a 20 20 20 20 77 61 74 63 ',.onVisibilityChange)......watc
1a7a0 68 65 64 45 6d 62 65 64 64 65 72 73 2e 64 65 6c 65 74 65 28 65 6d 62 65 64 64 65 72 29 0a 20 20 hedEmbedders.delete(embedder)...
1a7c0 7d 0a 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 65 76 65 6e 74 20 6f 66 20 64 65 73 74 72 6f 79 }....for.(const.event.of.destroy
1a7e0 45 76 65 6e 74 73 29 20 7b 0a 20 20 20 20 65 6d 62 65 64 64 65 72 2e 6f 6e 63 65 28 65 76 65 6e Events).{.....embedder.once(even
1a800 74 2c 20 64 65 73 74 72 6f 79 29 0a 0a 20 20 20 20 2f 2f 20 55 73 65 72 73 20 6d 69 67 68 74 20 t,.destroy)......//.Users.might.
1a820 61 6c 73 6f 20 6c 69 73 74 65 6e 20 74 6f 20 74 68 65 20 63 72 61 73 68 65 64 20 65 76 65 6e 74 also.listen.to.the.crashed.event
1a840 2c 20 73 6f 20 77 65 20 6d 75 73 74 20 65 6e 73 75 72 65 20 74 68 65 20 67 75 65 73 74 0a 20 20 ,.so.we.must.ensure.the.guest...
1a860 20 20 2f 2f 20 69 73 20 64 65 73 74 72 6f 79 65 64 20 62 65 66 6f 72 65 20 75 73 65 72 73 27 20 ..//.is.destroyed.before.users'.
1a880 6c 69 73 74 65 6e 65 72 20 67 65 74 73 20 63 61 6c 6c 65 64 2e 20 49 74 20 69 73 20 64 6f 6e 65 listener.gets.called..It.is.done
1a8a0 20 62 79 20 6d 6f 76 69 6e 67 20 6f 75 72 0a 20 20 20 20 2f 2f 20 6c 69 73 74 65 6e 65 72 20 74 .by.moving.our.....//.listener.t
1a8c0 6f 20 74 68 65 20 66 69 72 73 74 20 6f 6e 65 20 69 6e 20 71 75 65 75 65 2e 0a 20 20 20 20 63 6f o.the.first.one.in.queue......co
1a8e0 6e 73 74 20 6c 69 73 74 65 6e 65 72 73 20 3d 20 65 6d 62 65 64 64 65 72 2e 5f 65 76 65 6e 74 73 nst.listeners.=.embedder._events
1a900 5b 65 76 65 6e 74 5d 0a 20 20 20 20 69 66 20 28 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 6c 69 [event].....if.(Array.isArray(li
1a920 73 74 65 6e 65 72 73 29 29 20 7b 0a 20 20 20 20 20 20 6d 6f 76 65 4c 61 73 74 54 6f 46 69 72 73 steners)).{.......moveLastToFirs
1a940 74 28 6c 69 73 74 65 6e 65 72 73 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 69 70 63 4d 61 69 t(listeners).....}...}.}..ipcMai
1a960 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 n.on('ELECTRON_GUEST_VIEW_MANAGE
1a980 52 5f 43 52 45 41 54 45 5f 47 55 45 53 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 R_CREATE_GUEST',.function.(event
1a9a0 2c 20 70 61 72 61 6d 73 2c 20 72 65 71 75 65 73 74 49 64 29 20 7b 0a 20 20 65 76 65 6e 74 2e 73 ,.params,.requestId).{...event.s
1a9c0 65 6e 64 65 72 2e 73 65 6e 64 28 60 45 4c 45 43 54 52 4f 4e 5f 52 45 53 50 4f 4e 53 45 5f 24 7b ender.send(`ELECTRON_RESPONSE_${
1a9e0 72 65 71 75 65 73 74 49 64 7d 60 2c 20 63 72 65 61 74 65 47 75 65 73 74 28 65 76 65 6e 74 2e 73 requestId}`,.createGuest(event.s
1aa00 65 6e 64 65 72 2c 20 70 61 72 61 6d 73 29 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 ender,.params)).})..ipcMain.on('
1aa20 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 41 54 54 41 ELECTRON_GUEST_VIEW_MANAGER_ATTA
1aa40 43 48 5f 47 55 45 53 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 6c 65 6d CH_GUEST',.function.(event,.elem
1aa60 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 entInstanceId,.guestInstanceId,.
1aa80 70 61 72 61 6d 73 29 20 7b 0a 20 20 61 74 74 61 63 68 47 75 65 73 74 28 65 76 65 6e 74 2c 20 65 params).{...attachGuest(event,.e
1aaa0 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 lementInstanceId,.guestInstanceI
1aac0 64 2c 20 70 61 72 61 6d 73 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 d,.params).})..ipcMain.on('ELECT
1aae0 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 44 45 53 54 52 4f 59 5f 47 RON_GUEST_VIEW_MANAGER_DESTROY_G
1ab00 55 45 53 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 6e 73 UEST',.function.(event,.guestIns
1ab20 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 64 65 73 74 72 6f 79 47 75 65 73 74 28 65 76 65 6e 74 2e tanceId).{...destroyGuest(event.
1ab40 73 65 6e 64 65 72 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 7d 29 0a 0a 69 70 63 sender,.guestInstanceId).})..ipc
1ab60 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e Main.on('ELECTRON_GUEST_VIEW_MAN
1ab80 41 47 45 52 5f 53 45 54 5f 53 49 5a 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c AGER_SET_SIZE',.function.(event,
1aba0 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 70 61 72 61 6d 73 29 20 7b 0a 20 20 63 6f .guestInstanceId,.params).{...co
1abc0 6e 73 74 20 67 75 65 73 74 20 3d 20 67 65 74 47 75 65 73 74 28 67 75 65 73 74 49 6e 73 74 61 6e nst.guest.=.getGuest(guestInstan
1abe0 63 65 49 64 29 0a 20 20 69 66 20 28 67 75 65 73 74 20 21 3d 20 6e 75 6c 6c 29 20 67 75 65 73 74 ceId)...if.(guest.!=.null).guest
1ac00 2e 73 65 74 53 69 7a 65 28 70 61 72 61 6d 73 29 0a 7d 29 0a 0a 2f 2f 20 52 65 74 75 72 6e 73 20 .setSize(params).})..//.Returns.
1ac20 57 65 62 43 6f 6e 74 65 6e 74 73 20 66 72 6f 6d 20 69 74 73 20 67 75 65 73 74 20 69 64 2e 0a 63 WebContents.from.its.guest.id..c
1ac40 6f 6e 73 74 20 67 65 74 47 75 65 73 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 67 75 65 73 74 49 onst.getGuest.=.function.(guestI
1ac60 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e nstanceId).{...const.guestInstan
1ac80 63 65 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 ce.=.guestInstances[guestInstanc
1aca0 65 49 64 5d 0a 20 20 69 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 20 21 3d 20 6e 75 6c 6c eId]...if.(guestInstance.!=.null
1acc0 29 20 72 65 74 75 72 6e 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 67 75 65 73 74 0a 7d 0a 0a ).return.guestInstance.guest.}..
1ace0 2f 2f 20 52 65 74 75 72 6e 73 20 74 68 65 20 65 6d 62 65 64 64 65 72 20 6f 66 20 74 68 65 20 67 //.Returns.the.embedder.of.the.g
1ad00 75 65 73 74 2e 0a 63 6f 6e 73 74 20 67 65 74 45 6d 62 65 64 64 65 72 20 3d 20 66 75 6e 63 74 69 uest..const.getEmbedder.=.functi
1ad20 6f 6e 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 63 6f 6e 73 74 20 67 on.(guestInstanceId).{...const.g
1ad40 75 65 73 74 49 6e 73 74 61 6e 63 65 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 uestInstance.=.guestInstances[gu
1ad60 65 73 74 49 6e 73 74 61 6e 63 65 49 64 5d 0a 20 20 69 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e estInstanceId]...if.(guestInstan
1ad80 63 65 20 21 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 ce.!=.null).return.guestInstance
1ada0 2e 65 6d 62 65 64 64 65 72 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 67 65 74 47 75 65 73 74 20 3d 20 .embedder.}..exports.getGuest.=.
1adc0 67 65 74 47 75 65 73 74 0a 65 78 70 6f 72 74 73 2e 67 65 74 45 6d 62 65 64 64 65 72 20 3d 20 67 getGuest.exports.getEmbedder.=.g
1ade0 65 74 45 6d 62 65 64 64 65 72 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b etEmbedder.'use.strict'..const.{
1ae00 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2c 20 69 70 63 4d 61 69 6e 2c 20 77 65 62 43 6f 6e 74 65 BrowserWindow,.ipcMain,.webConte
1ae20 6e 74 73 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 nts}.=.require('electron').const
1ae40 20 7b 69 73 53 61 6d 65 4f 72 69 67 69 6e 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 .{isSameOrigin}.=.process.atomBi
1ae60 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 63 6f 6e 73 74 20 70 61 72 73 65 46 65 61 74 nding('v8_util').const.parseFeat
1ae80 75 72 65 73 53 74 72 69 6e 67 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f uresString.=.require('../common/
1aea0 70 61 72 73 65 2d 66 65 61 74 75 72 65 73 2d 73 74 72 69 6e 67 27 29 0a 0a 63 6f 6e 73 74 20 68 parse-features-string')..const.h
1aec0 61 73 50 72 6f 70 20 3d 20 7b 7d 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 0a 63 6f 6e 73 74 asProp.=.{}.hasOwnProperty.const
1aee0 20 66 72 61 6d 65 54 6f 47 75 65 73 74 20 3d 20 6e 65 77 20 4d 61 70 28 29 0a 0a 2f 2f 20 53 65 .frameToGuest.=.new.Map()..//.Se
1af00 63 75 72 69 74 79 20 6f 70 74 69 6f 6e 73 20 74 68 61 74 20 63 68 69 6c 64 20 77 69 6e 64 6f 77 curity.options.that.child.window
1af20 73 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 69 6e 68 65 72 69 74 20 66 72 6f 6d 20 70 61 72 65 6e s.will.always.inherit.from.paren
1af40 74 20 77 69 6e 64 6f 77 73 0a 63 6f 6e 73 74 20 69 6e 68 65 72 69 74 65 64 57 65 62 50 72 65 66 t.windows.const.inheritedWebPref
1af60 65 72 65 6e 63 65 73 20 3d 20 6e 65 77 20 4d 61 70 28 5b 0a 20 20 5b 27 63 6f 6e 74 65 78 74 49 erences.=.new.Map([...['contextI
1af80 73 6f 6c 61 74 69 6f 6e 27 2c 20 74 72 75 65 5d 2c 0a 20 20 5b 27 6a 61 76 61 73 63 72 69 70 74 solation',.true],...['javascript
1afa0 27 2c 20 66 61 6c 73 65 5d 2c 0a 20 20 5b 27 6e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 27 ',.false],...['nativeWindowOpen'
1afc0 2c 20 74 72 75 65 5d 2c 0a 20 20 5b 27 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 27 2c 20 66 ,.true],...['nodeIntegration',.f
1afe0 61 6c 73 65 5d 2c 0a 20 20 5b 27 73 61 6e 64 62 6f 78 27 2c 20 74 72 75 65 5d 2c 0a 20 20 5b 27 alse],...['sandbox',.true],...['
1b000 77 65 62 76 69 65 77 54 61 67 27 2c 20 66 61 6c 73 65 5d 0a 5d 29 0a 0a 2f 2f 20 43 6f 70 79 20 webviewTag',.false].])..//.Copy.
1b020 61 74 74 72 69 62 75 74 65 20 6f 66 20 7c 70 61 72 65 6e 74 7c 20 74 6f 20 7c 63 68 69 6c 64 7c attribute.of.|parent|.to.|child|
1b040 20 69 66 20 69 74 20 69 73 20 6e 6f 74 20 64 65 66 69 6e 65 64 20 69 6e 20 7c 63 68 69 6c 64 7c .if.it.is.not.defined.in.|child|
1b060 2e 0a 63 6f 6e 73 74 20 6d 65 72 67 65 4f 70 74 69 6f 6e 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 ..const.mergeOptions.=.function.
1b080 28 63 68 69 6c 64 2c 20 70 61 72 65 6e 74 2c 20 76 69 73 69 74 65 64 29 20 7b 0a 20 20 2f 2f 20 (child,.parent,.visited).{...//.
1b0a0 43 68 65 63 6b 20 66 6f 72 20 63 69 72 63 75 6c 61 72 20 72 65 66 65 72 65 6e 63 65 2e 0a 20 20 Check.for.circular.reference....
1b0c0 69 66 20 28 76 69 73 69 74 65 64 20 3d 3d 20 6e 75 6c 6c 29 20 76 69 73 69 74 65 64 20 3d 20 6e if.(visited.==.null).visited.=.n
1b0e0 65 77 20 53 65 74 28 29 0a 20 20 69 66 20 28 76 69 73 69 74 65 64 2e 68 61 73 28 70 61 72 65 6e ew.Set()...if.(visited.has(paren
1b100 74 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 76 69 73 69 74 65 64 2e 61 64 64 28 70 61 72 65 6e 74 t)).return....visited.add(parent
1b120 29 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6b 65 79 20 69 6e 20 70 61 72 65 6e 74 29 20 7b 0a )...for.(const.key.in.parent).{.
1b140 20 20 20 20 69 66 20 28 21 68 61 73 50 72 6f 70 2e 63 61 6c 6c 28 70 61 72 65 6e 74 2c 20 6b 65 ....if.(!hasProp.call(parent,.ke
1b160 79 29 29 20 63 6f 6e 74 69 6e 75 65 0a 20 20 20 20 69 66 20 28 6b 65 79 20 69 6e 20 63 68 69 6c y)).continue.....if.(key.in.chil
1b180 64 29 20 63 6f 6e 74 69 6e 75 65 0a 0a 20 20 20 20 63 6f 6e 73 74 20 76 61 6c 75 65 20 3d 20 70 d).continue......const.value.=.p
1b1a0 61 72 65 6e 74 5b 6b 65 79 5d 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 76 61 6c 75 65 20 arent[key].....if.(typeof.value.
1b1c0 3d 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 20 20 63 68 69 6c 64 5b 6b 65 79 5d ===.'object').{.......child[key]
1b1e0 20 3d 20 6d 65 72 67 65 4f 70 74 69 6f 6e 73 28 7b 7d 2c 20 76 61 6c 75 65 2c 20 76 69 73 69 74 .=.mergeOptions({},.value,.visit
1b200 65 64 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 63 68 69 6c 64 5b 6b 65 79 ed).....}.else.{.......child[key
1b220 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 76 69 73 69 74 65 64 2e 64 65 ].=.value.....}...}...visited.de
1b240 6c 65 74 65 28 70 61 72 65 6e 74 29 0a 0a 20 20 72 65 74 75 72 6e 20 63 68 69 6c 64 0a 7d 0a 0a lete(parent)....return.child.}..
1b260 2f 2f 20 4d 65 72 67 65 20 7c 6f 70 74 69 6f 6e 73 7c 20 77 69 74 68 20 74 68 65 20 7c 65 6d 62 //.Merge.|options|.with.the.|emb
1b280 65 64 64 65 72 7c 27 73 20 77 69 6e 64 6f 77 27 73 20 6f 70 74 69 6f 6e 73 2e 0a 63 6f 6e 73 74 edder|'s.window's.options..const
1b2a0 20 6d 65 72 67 65 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 4f 70 74 69 6f 6e 73 20 3d 20 66 75 6e .mergeBrowserWindowOptions.=.fun
1b2c0 63 74 69 6f 6e 20 28 65 6d 62 65 64 64 65 72 2c 20 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 69 66 ction.(embedder,.options).{...if
1b2e0 20 28 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 3d 20 6e 75 6c 6c .(options.webPreferences.==.null
1b300 29 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d ).{.....options.webPreferences.=
1b320 20 7b 7d 0a 20 20 7d 0a 20 20 69 66 20 28 65 6d 62 65 64 64 65 72 2e 62 72 6f 77 73 65 72 57 69 .{}...}...if.(embedder.browserWi
1b340 6e 64 6f 77 4f 70 74 69 6f 6e 73 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 2f 2f 20 49 6e ndowOptions.!=.null).{.....//.In
1b360 68 65 72 69 74 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 6f 70 74 69 6f 6e 73 20 69 66 20 69 74 herit.the.original.options.if.it
1b380 20 69 73 20 61 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 0a 20 20 20 20 6d 65 72 67 65 4f 70 .is.a.BrowserWindow......mergeOp
1b3a0 74 69 6f 6e 73 28 6f 70 74 69 6f 6e 73 2c 20 65 6d 62 65 64 64 65 72 2e 62 72 6f 77 73 65 72 57 tions(options,.embedder.browserW
1b3c0 69 6e 64 6f 77 4f 70 74 69 6f 6e 73 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 2f 2f 20 indowOptions)...}.else.{.....//.
1b3e0 4f 72 20 6f 6e 6c 79 20 69 6e 68 65 72 69 74 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 69 Or.only.inherit.webPreferences.i
1b400 66 20 69 74 20 69 73 20 61 20 77 65 62 76 69 65 77 2e 0a 20 20 20 20 6d 65 72 67 65 4f 70 74 69 f.it.is.a.webview......mergeOpti
1b420 6f 6e 73 28 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2c 20 65 6d 62 65 ons(options.webPreferences,.embe
1b440 64 64 65 72 2e 67 65 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 29 0a 20 20 7d 0a 0a 20 dder.getWebPreferences())...}...
1b460 20 2f 2f 20 49 6e 68 65 72 69 74 20 63 65 72 74 61 69 6e 20 6f 70 74 69 6f 6e 20 76 61 6c 75 65 .//.Inherit.certain.option.value
1b480 73 20 66 72 6f 6d 20 70 61 72 65 6e 74 20 77 69 6e 64 6f 77 0a 20 20 66 6f 72 20 28 63 6f 6e 73 s.from.parent.window...for.(cons
1b4a0 74 20 5b 6e 61 6d 65 2c 20 76 61 6c 75 65 5d 20 6f 66 20 69 6e 68 65 72 69 74 65 64 57 65 62 50 t.[name,.value].of.inheritedWebP
1b4c0 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 20 20 69 66 20 28 65 6d 62 65 64 64 65 72 2e 67 references).{.....if.(embedder.g
1b4e0 65 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 5b 6e 61 6d 65 5d 20 3d 3d 3d 20 76 61 6c etWebPreferences()[name].===.val
1b500 75 65 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 ue).{.......options.webPreferenc
1b520 65 73 5b 6e 61 6d 65 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 2f 2f es[name].=.value.....}...}....//
1b540 20 53 65 74 73 20 63 6f 72 72 65 63 74 20 6f 70 65 6e 65 72 49 64 20 68 65 72 65 20 74 6f 20 67 .Sets.correct.openerId.here.to.g
1b560 69 76 65 20 63 6f 72 72 65 63 74 20 6f 70 74 69 6f 6e 73 20 74 6f 20 27 6e 65 77 2d 77 69 6e 64 ive.correct.options.to.'new-wind
1b580 6f 77 27 20 65 76 65 6e 74 20 68 61 6e 64 6c 65 72 0a 20 20 6f 70 74 69 6f 6e 73 2e 77 65 62 50 ow'.event.handler...options.webP
1b5a0 72 65 66 65 72 65 6e 63 65 73 2e 6f 70 65 6e 65 72 49 64 20 3d 20 65 6d 62 65 64 64 65 72 2e 69 references.openerId.=.embedder.i
1b5c0 64 0a 0a 20 20 72 65 74 75 72 6e 20 6f 70 74 69 6f 6e 73 0a 7d 0a 0a 2f 2f 20 53 65 74 75 70 20 d....return.options.}..//.Setup.
1b5e0 61 20 6e 65 77 20 67 75 65 73 74 20 77 69 74 68 20 7c 65 6d 62 65 64 64 65 72 7c 0a 63 6f 6e 73 a.new.guest.with.|embedder|.cons
1b600 74 20 73 65 74 75 70 47 75 65 73 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 6d 62 65 64 64 65 t.setupGuest.=.function.(embedde
1b620 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 67 75 65 73 74 2c 20 6f 70 74 69 6f 6e 73 29 20 7b 0a r,.frameName,.guest,.options).{.
1b640 20 20 2f 2f 20 57 68 65 6e 20 7c 65 6d 62 65 64 64 65 72 7c 20 69 73 20 64 65 73 74 72 6f 79 65 ..//.When.|embedder|.is.destroye
1b660 64 20 77 65 20 73 68 6f 75 6c 64 20 61 6c 73 6f 20 64 65 73 74 72 6f 79 20 61 74 74 61 63 68 65 d.we.should.also.destroy.attache
1b680 64 20 67 75 65 73 74 2c 20 61 6e 64 20 69 66 0a 20 20 2f 2f 20 67 75 65 73 74 20 69 73 20 63 6c d.guest,.and.if...//.guest.is.cl
1b6a0 6f 73 65 64 20 62 79 20 75 73 65 72 20 74 68 65 6e 20 77 65 20 73 68 6f 75 6c 64 20 70 72 65 76 osed.by.user.then.we.should.prev
1b6c0 65 6e 74 20 7c 65 6d 62 65 64 64 65 72 7c 20 66 72 6f 6d 20 64 6f 75 62 6c 65 0a 20 20 2f 2f 20 ent.|embedder|.from.double...//.
1b6e0 63 6c 6f 73 69 6e 67 20 67 75 65 73 74 2e 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 64 20 3d closing.guest....const.guestId.=
1b700 20 67 75 65 73 74 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 64 0a 20 20 63 6f 6e 73 74 20 63 6c .guest.webContents.id...const.cl
1b720 6f 73 65 64 42 79 45 6d 62 65 64 64 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 osedByEmbedder.=.function.().{..
1b740 20 20 20 67 75 65 73 74 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 63 6c 6f 73 65 64 27 ...guest.removeListener('closed'
1b760 2c 20 63 6c 6f 73 65 64 42 79 55 73 65 72 29 0a 20 20 20 20 67 75 65 73 74 2e 64 65 73 74 72 6f ,.closedByUser).....guest.destro
1b780 79 28 29 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 63 6c 6f 73 65 64 42 79 55 73 65 72 20 3d 20 66 y()...}...const.closedByUser.=.f
1b7a0 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 65 6d 62 65 64 64 65 72 2e 73 65 6e 64 28 27 unction.().{.....embedder.send('
1b7c0 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 ELECTRON_GUEST_WINDOW_MANAGER_WI
1b7e0 4e 44 4f 57 5f 43 4c 4f 53 45 44 5f 27 20 2b 20 67 75 65 73 74 49 64 29 0a 20 20 20 20 65 6d 62 NDOW_CLOSED_'.+.guestId).....emb
1b800 65 64 64 65 72 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 72 65 6e 64 65 72 2d 76 69 65 edder.removeListener('render-vie
1b820 77 2d 64 65 6c 65 74 65 64 27 2c 20 63 6c 6f 73 65 64 42 79 45 6d 62 65 64 64 65 72 29 0a 20 20 w-deleted',.closedByEmbedder)...
1b840 7d 0a 20 20 65 6d 62 65 64 64 65 72 2e 6f 6e 63 65 28 27 72 65 6e 64 65 72 2d 76 69 65 77 2d 64 }...embedder.once('render-view-d
1b860 65 6c 65 74 65 64 27 2c 20 63 6c 6f 73 65 64 42 79 45 6d 62 65 64 64 65 72 29 0a 20 20 67 75 65 eleted',.closedByEmbedder)...gue
1b880 73 74 2e 6f 6e 63 65 28 27 63 6c 6f 73 65 64 27 2c 20 63 6c 6f 73 65 64 42 79 55 73 65 72 29 0a st.once('closed',.closedByUser).
1b8a0 20 20 69 66 20 28 66 72 61 6d 65 4e 61 6d 65 29 20 7b 0a 20 20 20 20 66 72 61 6d 65 54 6f 47 75 ..if.(frameName).{.....frameToGu
1b8c0 65 73 74 2e 73 65 74 28 66 72 61 6d 65 4e 61 6d 65 2c 20 67 75 65 73 74 29 0a 20 20 20 20 67 75 est.set(frameName,.guest).....gu
1b8e0 65 73 74 2e 66 72 61 6d 65 4e 61 6d 65 20 3d 20 66 72 61 6d 65 4e 61 6d 65 0a 20 20 20 20 67 75 est.frameName.=.frameName.....gu
1b900 65 73 74 2e 6f 6e 63 65 28 27 63 6c 6f 73 65 64 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b est.once('closed',.function.().{
1b920 0a 20 20 20 20 20 20 66 72 61 6d 65 54 6f 47 75 65 73 74 2e 64 65 6c 65 74 65 28 66 72 61 6d 65 .......frameToGuest.delete(frame
1b940 4e 61 6d 65 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 67 75 65 73 74 49 Name).....})...}...return.guestI
1b960 64 0a 7d 0a 0a 2f 2f 20 43 72 65 61 74 65 20 61 20 6e 65 77 20 67 75 65 73 74 20 63 72 65 61 74 d.}..//.Create.a.new.guest.creat
1b980 65 64 20 62 79 20 7c 65 6d 62 65 64 64 65 72 7c 20 77 69 74 68 20 7c 6f 70 74 69 6f 6e 73 7c 2e ed.by.|embedder|.with.|options|.
1b9a0 0a 63 6f 6e 73 74 20 63 72 65 61 74 65 47 75 65 73 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 .const.createGuest.=.function.(e
1b9c0 6d 62 65 64 64 65 72 2c 20 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 6f 70 74 69 6f 6e 73 mbedder,.url,.frameName,.options
1b9e0 2c 20 70 6f 73 74 44 61 74 61 29 20 7b 0a 20 20 6c 65 74 20 67 75 65 73 74 20 3d 20 66 72 61 6d ,.postData).{...let.guest.=.fram
1ba00 65 54 6f 47 75 65 73 74 2e 67 65 74 28 66 72 61 6d 65 4e 61 6d 65 29 0a 20 20 69 66 20 28 66 72 eToGuest.get(frameName)...if.(fr
1ba20 61 6d 65 4e 61 6d 65 20 26 26 20 28 67 75 65 73 74 20 21 3d 20 6e 75 6c 6c 29 29 20 7b 0a 20 20 ameName.&&.(guest.!=.null)).{...
1ba40 20 20 67 75 65 73 74 2e 6c 6f 61 64 55 52 4c 28 75 72 6c 29 0a 20 20 20 20 72 65 74 75 72 6e 20 ..guest.loadURL(url).....return.
1ba60 67 75 65 73 74 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 64 0a 20 20 7d 0a 0a 20 20 2f 2f 20 52 guest.webContents.id...}....//.R
1ba80 65 6d 65 6d 62 65 72 20 74 68 65 20 65 6d 62 65 64 64 65 72 20 77 69 6e 64 6f 77 27 73 20 69 64 emember.the.embedder.window's.id
1baa0 2e 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d ....if.(options.webPreferences.=
1bac0 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 =.null).{.....options.webPrefere
1bae0 6e 63 65 73 20 3d 20 7b 7d 0a 20 20 7d 0a 0a 20 20 67 75 65 73 74 20 3d 20 6e 65 77 20 42 72 6f nces.=.{}...}....guest.=.new.Bro
1bb00 77 73 65 72 57 69 6e 64 6f 77 28 6f 70 74 69 6f 6e 73 29 0a 20 20 69 66 20 28 21 6f 70 74 69 6f wserWindow(options)...if.(!optio
1bb20 6e 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 20 7c 7c 20 75 72 6c 20 21 3d 3d 20 27 61 62 6f 75 74 ns.webContents.||.url.!==.'about
1bb40 3a 62 6c 61 6e 6b 27 29 20 7b 0a 20 20 20 20 2f 2f 20 57 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 :blank').{.....//.We.should.not.
1bb60 63 61 6c 6c 20 60 6c 6f 61 64 55 52 4c 60 20 69 66 20 74 68 65 20 77 69 6e 64 6f 77 20 77 61 73 call.`loadURL`.if.the.window.was
1bb80 20 63 6f 6e 73 74 72 75 63 74 65 64 20 66 72 6f 6d 20 61 6e 0a 20 20 20 20 2f 2f 20 65 78 69 73 .constructed.from.an.....//.exis
1bba0 74 69 6e 67 20 77 65 62 43 6f 6e 74 65 6e 74 73 28 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 69 6e 20 ting.webContents(window.open.in.
1bbc0 61 20 73 61 6e 64 62 6f 78 65 64 20 72 65 6e 64 65 72 65 72 29 20 61 6e 64 20 69 66 20 74 68 65 a.sandboxed.renderer).and.if.the
1bbe0 20 75 72 6c 0a 20 20 20 20 2f 2f 20 69 73 20 6e 6f 74 20 27 61 62 6f 75 74 3a 62 6c 61 6e 6b 27 .url.....//.is.not.'about:blank'
1bc00 2e 0a 20 20 20 20 2f 2f 0a 20 20 20 20 2f 2f 20 4e 61 76 69 67 61 74 69 6e 67 20 74 6f 20 74 68 ......//.....//.Navigating.to.th
1bc20 65 20 75 72 6c 20 77 68 65 6e 20 63 72 65 61 74 69 6e 67 20 74 68 65 20 77 69 6e 64 6f 77 20 66 e.url.when.creating.the.window.f
1bc40 72 6f 6d 20 61 6e 20 65 78 69 73 74 69 6e 67 0a 20 20 20 20 2f 2f 20 77 65 62 43 6f 6e 74 65 6e rom.an.existing.....//.webConten
1bc60 74 73 20 77 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72 79 28 69 74 20 77 69 6c ts.would.not.be.necessary(it.wil
1bc80 6c 20 6e 61 76 69 67 61 74 65 20 74 68 65 72 65 20 61 6e 79 77 61 79 29 2c 20 62 75 74 0a 20 20 l.navigate.there.anyway),.but...
1bca0 20 20 2f 2f 20 61 70 70 61 72 65 6e 74 6c 79 20 74 68 65 72 65 27 73 20 61 20 62 75 67 20 74 68 ..//.apparently.there's.a.bug.th
1bcc0 61 74 20 61 6c 6c 6f 77 73 20 74 68 65 20 63 68 69 6c 64 20 77 69 6e 64 6f 77 20 74 6f 20 62 65 at.allows.the.child.window.to.be
1bce0 20 73 63 72 69 70 74 65 64 20 62 79 0a 20 20 20 20 2f 2f 20 74 68 65 20 6f 70 65 6e 65 72 2c 20 .scripted.by.....//.the.opener,.
1bd00 65 76 65 6e 20 77 68 65 6e 20 74 68 65 20 63 68 69 6c 64 20 77 69 6e 64 6f 77 20 69 73 20 66 72 even.when.the.child.window.is.fr
1bd20 6f 6d 20 61 6e 6f 74 68 65 72 20 6f 72 69 67 69 6e 2e 0a 20 20 20 20 2f 2f 0a 20 20 20 20 2f 2f om.another.origin......//.....//
1bd40 20 54 68 61 74 27 73 20 77 68 79 20 74 68 65 20 73 65 63 6f 6e 64 20 63 6f 6e 64 69 74 69 6f 6e .That's.why.the.second.condition
1bd60 28 75 72 6c 20 21 3d 3d 20 22 61 62 6f 75 74 3a 62 6c 61 6e 6b 22 29 20 69 73 20 72 65 71 75 69 (url.!==."about:blank").is.requi
1bd80 72 65 64 3a 20 74 6f 0a 20 20 20 20 2f 2f 20 66 6f 72 63 65 20 60 4f 76 65 72 72 69 64 65 53 69 red:.to.....//.force.`OverrideSi
1bda0 74 65 49 6e 73 74 61 6e 63 65 46 6f 72 4e 61 76 69 67 61 74 69 6f 6e 60 20 74 6f 20 62 65 20 63 teInstanceForNavigation`.to.be.c
1bdc0 61 6c 6c 65 64 20 61 6e 64 20 63 6f 6e 73 65 71 75 65 6e 74 6c 79 0a 20 20 20 20 2f 2f 20 73 70 alled.and.consequently.....//.sp
1bde0 61 77 6e 20 61 20 6e 65 77 20 72 65 6e 64 65 72 65 72 20 69 66 20 74 68 65 20 6e 65 77 20 77 69 awn.a.new.renderer.if.the.new.wi
1be00 6e 64 6f 77 20 69 73 20 74 61 72 67 65 74 69 6e 67 20 61 20 64 69 66 66 65 72 65 6e 74 20 6f 72 ndow.is.targeting.a.different.or
1be20 69 67 69 6e 2e 0a 20 20 20 20 2f 2f 0a 20 20 20 20 2f 2f 20 49 66 20 74 68 65 20 55 52 4c 20 69 igin......//.....//.If.the.URL.i
1be40 73 20 22 61 62 6f 75 74 3a 62 6c 61 6e 6b 22 2c 20 74 68 65 6e 20 69 74 20 69 73 20 76 65 72 79 s."about:blank",.then.it.is.very
1be60 20 6c 69 6b 65 6c 79 20 74 68 61 74 20 74 68 65 20 6f 70 65 6e 65 72 20 6a 75 73 74 0a 20 20 20 .likely.that.the.opener.just....
1be80 20 2f 2f 20 77 61 6e 74 73 20 74 6f 20 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 20 73 63 72 69 70 .//.wants.to.synchronously.scrip
1bea0 74 20 74 68 65 20 70 6f 70 75 70 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 3a 0a 20 20 20 20 2f 2f t.the.popup,.for.example:.....//
1bec0 0a 20 20 20 20 2f 2f 20 20 20 20 20 6c 65 74 20 70 6f 70 75 70 20 3d 20 77 69 6e 64 6f 77 2e 6f .....//.....let.popup.=.window.o
1bee0 70 65 6e 28 29 0a 20 20 20 20 2f 2f 20 20 20 20 20 70 6f 70 75 70 2e 64 6f 63 75 6d 65 6e 74 2e pen().....//.....popup.document.
1bf00 62 6f 64 79 2e 77 72 69 74 65 28 27 3c 68 31 3e 68 65 6c 6c 6f 3c 2f 68 31 3e 27 29 0a 20 20 20 body.write('<h1>hello</h1>')....
1bf20 20 2f 2f 0a 20 20 20 20 2f 2f 20 54 68 65 20 61 62 6f 76 65 20 63 6f 64 65 20 77 6f 75 6c 64 20 .//.....//.The.above.code.would.
1bf40 6e 6f 74 20 77 6f 72 6b 20 69 66 20 61 20 6e 61 76 69 67 61 74 69 6f 6e 20 74 6f 20 22 61 62 6f not.work.if.a.navigation.to."abo
1bf60 75 74 3a 62 6c 61 6e 6b 22 20 69 73 20 64 6f 6e 65 0a 20 20 20 20 2f 2f 20 68 65 72 65 2c 20 73 ut:blank".is.done.....//.here,.s
1bf80 69 6e 63 65 20 74 68 65 20 77 69 6e 64 6f 77 20 77 6f 75 6c 64 20 62 65 20 63 6c 65 61 72 65 64 ince.the.window.would.be.cleared
1bfa0 20 6f 66 20 61 6c 6c 20 63 68 61 6e 67 65 73 20 69 6e 20 74 68 65 20 6e 65 78 74 20 74 69 63 6b .of.all.changes.in.the.next.tick
1bfc0 2e 0a 20 20 20 20 63 6f 6e 73 74 20 6c 6f 61 64 4f 70 74 69 6f 6e 73 20 3d 20 7b 7d 0a 20 20 20 ......const.loadOptions.=.{}....
1bfe0 20 69 66 20 28 70 6f 73 74 44 61 74 61 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6c .if.(postData.!=.null).{.......l
1c000 6f 61 64 4f 70 74 69 6f 6e 73 2e 70 6f 73 74 44 61 74 61 20 3d 20 70 6f 73 74 44 61 74 61 0a 20 oadOptions.postData.=.postData..
1c020 20 20 20 20 20 6c 6f 61 64 4f 70 74 69 6f 6e 73 2e 65 78 74 72 61 48 65 61 64 65 72 73 20 3d 20 .....loadOptions.extraHeaders.=.
1c040 27 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 'content-type:.application/x-www
1c060 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 27 0a 20 20 20 20 20 20 69 66 20 28 70 6f 73 74 -form-urlencoded'.......if.(post
1c080 44 61 74 61 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 Data.length.>.0).{.........const
1c0a0 20 70 6f 73 74 44 61 74 61 46 72 6f 6e 74 20 3d 20 70 6f 73 74 44 61 74 61 5b 30 5d 2e 62 79 74 .postDataFront.=.postData[0].byt
1c0c0 65 73 2e 74 6f 53 74 72 69 6e 67 28 29 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 62 6f 75 6e es.toString().........const.boun
1c0e0 64 61 72 79 20 3d 20 2f 5e 2d 2d 2e 2a 5b 5e 2d 5c 72 5c 6e 5d 2f 2e 65 78 65 63 28 70 6f 73 74 dary.=./^--.*[^-\r\n]/.exec(post
1c100 44 61 74 61 46 72 6f 6e 74 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 62 6f 75 6e 64 61 72 79 20 DataFront).........if.(boundary.
1c120 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 6c 6f 61 64 4f 70 74 69 6f 6e 73 !=.null).{...........loadOptions
1c140 2e 65 78 74 72 61 48 65 61 64 65 72 73 20 3d 20 60 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 20 6d .extraHeaders.=.`content-type:.m
1c160 75 6c 74 69 70 61 72 74 2f 66 6f 72 6d 2d 64 61 74 61 3b 20 62 6f 75 6e 64 61 72 79 3d 24 7b 62 ultipart/form-data;.boundary=${b
1c180 6f 75 6e 64 61 72 79 5b 30 5d 2e 73 75 62 73 74 72 28 32 29 7d 60 0a 20 20 20 20 20 20 20 20 7d oundary[0].substr(2)}`.........}
1c1a0 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 67 75 65 73 74 2e 6c 6f 61 64 55 52 4c .......}.....}.....guest.loadURL
1c1c0 28 75 72 6c 2c 20 6c 6f 61 64 4f 70 74 69 6f 6e 73 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e (url,.loadOptions)...}....return
1c1e0 20 73 65 74 75 70 47 75 65 73 74 28 65 6d 62 65 64 64 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c .setupGuest(embedder,.frameName,
1c200 20 67 75 65 73 74 2c 20 6f 70 74 69 6f 6e 73 29 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 47 75 65 .guest,.options).}..const.getGue
1c220 73 74 57 69 6e 64 6f 77 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 67 75 65 73 74 43 6f 6e 74 65 6e stWindow.=.function.(guestConten
1c240 74 73 29 20 7b 0a 20 20 6c 65 74 20 67 75 65 73 74 57 69 6e 64 6f 77 20 3d 20 42 72 6f 77 73 65 ts).{...let.guestWindow.=.Browse
1c260 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 57 65 62 43 6f 6e 74 65 6e 74 73 28 67 75 65 73 74 43 6f 6e rWindow.fromWebContents(guestCon
1c280 74 65 6e 74 73 29 0a 20 20 69 66 20 28 67 75 65 73 74 57 69 6e 64 6f 77 20 3d 3d 20 6e 75 6c 6c tents)...if.(guestWindow.==.null
1c2a0 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 68 6f 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 67 75 65 ).{.....const.hostContents.=.gue
1c2c0 73 74 43 6f 6e 74 65 6e 74 73 2e 68 6f 73 74 57 65 62 43 6f 6e 74 65 6e 74 73 0a 20 20 20 20 69 stContents.hostWebContents.....i
1c2e0 66 20 28 68 6f 73 74 43 6f 6e 74 65 6e 74 73 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 f.(hostContents.!=.null).{......
1c300 20 67 75 65 73 74 57 69 6e 64 6f 77 20 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 66 72 6f .guestWindow.=.BrowserWindow.fro
1c320 6d 57 65 62 43 6f 6e 74 65 6e 74 73 28 68 6f 73 74 43 6f 6e 74 65 6e 74 73 29 0a 20 20 20 20 7d mWebContents(hostContents).....}
1c340 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 67 75 65 73 74 57 69 6e 64 6f 77 0a 7d 0a 0a 2f 2f 20 ...}...return.guestWindow.}..//.
1c360 43 68 65 63 6b 73 20 77 68 65 74 68 65 72 20 7c 73 65 6e 64 65 72 7c 20 63 61 6e 20 61 63 63 65 Checks.whether.|sender|.can.acce
1c380 73 73 20 74 68 65 20 7c 74 61 72 67 65 74 7c 3a 0a 2f 2f 20 31 2e 20 43 68 65 63 6b 20 77 68 65 ss.the.|target|:.//.1..Check.whe
1c3a0 74 68 65 72 20 7c 73 65 6e 64 65 72 7c 20 69 73 20 74 68 65 20 70 61 72 65 6e 74 20 6f 66 20 7c ther.|sender|.is.the.parent.of.|
1c3c0 74 61 72 67 65 74 7c 2e 0a 2f 2f 20 32 2e 20 43 68 65 63 6b 20 77 68 65 74 68 65 72 20 7c 73 65 target|..//.2..Check.whether.|se
1c3e0 6e 64 65 72 7c 20 68 61 73 20 6e 6f 64 65 20 69 6e 74 65 67 72 61 74 69 6f 6e 2c 20 69 66 20 73 nder|.has.node.integration,.if.s
1c400 6f 20 69 74 20 69 73 20 61 6c 6c 6f 77 65 64 20 74 6f 0a 2f 2f 20 20 20 20 64 6f 20 61 6e 79 74 o.it.is.allowed.to.//....do.anyt
1c420 68 69 6e 67 20 69 74 20 77 61 6e 74 73 2e 0a 2f 2f 20 33 2e 20 43 68 65 63 6b 20 77 68 65 74 68 hing.it.wants..//.3..Check.wheth
1c440 65 72 20 74 68 65 20 6f 72 69 67 69 6e 73 20 6d 61 74 63 68 2e 0a 2f 2f 0a 2f 2f 20 48 6f 77 65 er.the.origins.match..//.//.Howe
1c460 76 65 72 20 69 74 20 61 6c 6c 6f 77 73 20 61 20 63 68 69 6c 64 20 77 69 6e 64 6f 77 20 77 69 74 ver.it.allows.a.child.window.wit
1c480 68 6f 75 74 20 6e 6f 64 65 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 62 75 74 20 77 69 74 68 20 73 hout.node.integration.but.with.s
1c4a0 61 6d 65 0a 2f 2f 20 6f 72 69 67 69 6e 20 74 6f 20 64 6f 20 61 6e 79 74 68 69 6e 67 20 69 74 20 ame.//.origin.to.do.anything.it.
1c4c0 77 61 6e 74 73 2c 20 77 68 65 6e 20 69 74 73 20 6f 70 65 6e 65 72 20 77 69 6e 64 6f 77 20 68 61 wants,.when.its.opener.window.ha
1c4e0 73 20 6e 6f 64 65 20 69 6e 74 65 67 72 61 74 69 6f 6e 2e 0a 2f 2f 20 54 68 65 20 57 33 43 20 64 s.node.integration..//.The.W3C.d
1c500 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 61 6e 79 74 68 69 6e 67 20 6f 6e 20 74 68 69 73 2c 20 62 oes.not.have.anything.on.this,.b
1c520 75 74 20 66 72 6f 6d 20 6d 79 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 6f 66 20 74 68 65 0a ut.from.my.understanding.of.the.
1c540 2f 2f 20 73 65 63 75 72 69 74 79 20 6d 6f 64 65 6c 20 6f 66 20 7c 77 69 6e 64 6f 77 2e 6f 70 65 //.security.model.of.|window.ope
1c560 6e 65 72 7c 2c 20 74 68 69 73 20 73 68 6f 75 6c 64 20 62 65 20 66 69 6e 65 2e 0a 63 6f 6e 73 74 ner|,.this.should.be.fine..const
1c580 20 63 61 6e 41 63 63 65 73 73 57 69 6e 64 6f 77 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 6e .canAccessWindow.=.function.(sen
1c5a0 64 65 72 2c 20 74 61 72 67 65 74 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 28 74 61 72 67 65 74 2e der,.target).{...return.(target.
1c5c0 67 65 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 2e 6f 70 65 6e 65 72 49 64 20 3d 3d 3d getWebPreferences().openerId.===
1c5e0 20 73 65 6e 64 65 72 2e 69 64 29 20 7c 7c 0a 20 20 20 20 20 20 20 20 20 28 73 65 6e 64 65 72 2e .sender.id).||..........(sender.
1c600 67 65 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 2e 6e 6f 64 65 49 6e 74 65 67 72 61 74 getWebPreferences().nodeIntegrat
1c620 69 6f 6e 20 3d 3d 3d 20 74 72 75 65 29 20 7c 7c 0a 20 20 20 20 20 20 20 20 20 69 73 53 61 6d 65 ion.===.true).||..........isSame
1c640 4f 72 69 67 69 6e 28 73 65 6e 64 65 72 2e 67 65 74 55 52 4c 28 29 2c 20 74 61 72 67 65 74 2e 67 Origin(sender.getURL(),.target.g
1c660 65 74 55 52 4c 28 29 29 0a 7d 0a 0a 2f 2f 20 52 6f 75 74 65 64 20 77 69 6e 64 6f 77 2e 6f 70 65 etURL()).}..//.Routed.window.ope
1c680 6e 20 6d 65 73 73 61 67 65 73 20 77 69 74 68 20 72 61 77 20 6f 70 74 69 6f 6e 73 0a 69 70 63 4d n.messages.with.raw.options.ipcM
1c6a0 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 ain.on('ELECTRON_GUEST_WINDOW_MA
1c6c0 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 20 28 65 76 65 6e 74 2c 20 75 72 6c 2c NAGER_WINDOW_OPEN',.(event,.url,
1c6e0 20 66 72 61 6d 65 4e 61 6d 65 2c 20 66 65 61 74 75 72 65 73 29 20 3d 3e 20 7b 0a 20 20 69 66 20 .frameName,.features).=>.{...if.
1c700 28 75 72 6c 20 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 75 72 6c 20 3d 3d 3d 20 27 27 29 20 75 72 6c 20 (url.==.null.||.url.===.'').url.
1c720 3d 20 27 61 62 6f 75 74 3a 62 6c 61 6e 6b 27 0a 20 20 69 66 20 28 66 72 61 6d 65 4e 61 6d 65 20 =.'about:blank'...if.(frameName.
1c740 3d 3d 20 6e 75 6c 6c 29 20 66 72 61 6d 65 4e 61 6d 65 20 3d 20 27 27 0a 20 20 69 66 20 28 66 65 ==.null).frameName.=.''...if.(fe
1c760 61 74 75 72 65 73 20 3d 3d 20 6e 75 6c 6c 29 20 66 65 61 74 75 72 65 73 20 3d 20 27 27 0a 0a 20 atures.==.null).features.=.''...
1c780 20 63 6f 6e 73 74 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 7d 0a 0a 20 20 63 6f 6e 73 74 20 69 6e 74 .const.options.=.{}....const.int
1c7a0 73 20 3d 20 5b 27 78 27 2c 20 27 79 27 2c 20 27 77 69 64 74 68 27 2c 20 27 68 65 69 67 68 74 27 s.=.['x',.'y',.'width',.'height'
1c7c0 2c 20 27 6d 69 6e 57 69 64 74 68 27 2c 20 27 6d 61 78 57 69 64 74 68 27 2c 20 27 6d 69 6e 48 65 ,.'minWidth',.'maxWidth',.'minHe
1c7e0 69 67 68 74 27 2c 20 27 6d 61 78 48 65 69 67 68 74 27 2c 20 27 7a 6f 6f 6d 46 61 63 74 6f 72 27 ight',.'maxHeight',.'zoomFactor'
1c800 5d 0a 20 20 63 6f 6e 73 74 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 20 5b 27 7a 6f 6f ]...const.webPreferences.=.['zoo
1c820 6d 46 61 63 74 6f 72 27 2c 20 27 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 27 2c 20 27 70 72 mFactor',.'nodeIntegration',.'pr
1c840 65 6c 6f 61 64 27 2c 20 27 6a 61 76 61 73 63 72 69 70 74 27 2c 20 27 63 6f 6e 74 65 78 74 49 73 eload',.'javascript',.'contextIs
1c860 6f 6c 61 74 69 6f 6e 27 2c 20 27 77 65 62 76 69 65 77 54 61 67 27 5d 0a 20 20 63 6f 6e 73 74 20 olation',.'webviewTag']...const.
1c880 64 69 73 70 6f 73 69 74 69 6f 6e 20 3d 20 27 6e 65 77 2d 77 69 6e 64 6f 77 27 0a 0a 20 20 2f 2f disposition.=.'new-window'....//
1c8a0 20 55 73 65 64 20 74 6f 20 73 74 6f 72 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 66 65 61 74 75 72 .Used.to.store.additional.featur
1c8c0 65 73 0a 20 20 63 6f 6e 73 74 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 73 20 3d 20 es...const.additionalFeatures.=.
1c8e0 5b 5d 0a 0a 20 20 2f 2f 20 50 61 72 73 65 20 74 68 65 20 66 65 61 74 75 72 65 73 0a 20 20 70 61 []....//.Parse.the.features...pa
1c900 72 73 65 46 65 61 74 75 72 65 73 53 74 72 69 6e 67 28 66 65 61 74 75 72 65 73 2c 20 66 75 6e 63 rseFeaturesString(features,.func
1c920 74 69 6f 6e 20 28 6b 65 79 2c 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 69 66 20 28 76 61 6c 75 tion.(key,.value).{.....if.(valu
1c940 65 20 3d 3d 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 20 20 61 64 64 69 74 69 6f e.===.undefined).{.......additio
1c960 6e 61 6c 46 65 61 74 75 72 65 73 2e 70 75 73 68 28 6b 65 79 29 0a 20 20 20 20 7d 20 65 6c 73 65 nalFeatures.push(key).....}.else
1c980 20 7b 0a 20 20 20 20 20 20 2f 2f 20 44 6f 6e 27 74 20 61 6c 6c 6f 77 20 77 65 62 50 72 65 66 65 .{.......//.Don't.allow.webPrefe
1c9a0 72 65 6e 63 65 73 20 74 6f 20 62 65 20 73 65 74 20 73 69 6e 63 65 20 69 74 20 6d 75 73 74 20 62 rences.to.be.set.since.it.must.b
1c9c0 65 20 61 6e 20 6f 62 6a 65 63 74 0a 20 20 20 20 20 20 2f 2f 20 74 68 61 74 20 63 61 6e 6e 6f 74 e.an.object.......//.that.cannot
1c9e0 20 62 65 20 64 69 72 65 63 74 6c 79 20 6f 76 65 72 72 69 64 64 65 6e 0a 20 20 20 20 20 20 69 66 .be.directly.overridden.......if
1ca00 20 28 6b 65 79 20 3d 3d 3d 20 27 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 27 29 20 72 65 74 75 .(key.===.'webPreferences').retu
1ca20 72 6e 0a 0a 20 20 20 20 20 20 69 66 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 69 6e 63 rn........if.(webPreferences.inc
1ca40 6c 75 64 65 73 28 6b 65 79 29 29 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e ludes(key)).{.........if.(option
1ca60 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 s.webPreferences.==.null).{.....
1ca80 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 20 7b ......options.webPreferences.=.{
1caa0 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 65 62 50 }.........}.........options.webP
1cac0 72 65 66 65 72 65 6e 63 65 73 5b 6b 65 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 7d 20 references[key].=.value.......}.
1cae0 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 5b 6b 65 79 5d 20 3d 20 76 61 else.{.........options[key].=.va
1cb00 6c 75 65 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 20 20 69 66 20 28 6f 70 74 lue.......}.....}...})...if.(opt
1cb20 69 6f 6e 73 2e 6c 65 66 74 29 20 7b 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 78 20 3d ions.left).{.....if.(options.x.=
1cb40 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 78 20 3d 20 6f 70 74 69 =.null).{.......options.x.=.opti
1cb60 6f 6e 73 2e 6c 65 66 74 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 ons.left.....}...}...if.(options
1cb80 2e 74 6f 70 29 20 7b 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 79 20 3d 3d 20 6e 75 6c .top).{.....if.(options.y.==.nul
1cba0 6c 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 79 20 3d 20 6f 70 74 69 6f 6e 73 2e 74 l).{.......options.y.=.options.t
1cbc0 6f 70 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 74 69 74 6c 65 op.....}...}...if.(options.title
1cbe0 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 74 69 74 6c 65 20 3d 20 .==.null).{.....options.title.=.
1cc00 66 72 61 6d 65 4e 61 6d 65 0a 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 77 69 64 74 frameName...}...if.(options.widt
1cc20 68 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 69 64 74 68 20 3d h.==.null).{.....options.width.=
1cc40 20 38 30 30 0a 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 68 65 69 67 68 74 20 3d 3d .800...}...if.(options.height.==
1cc60 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 68 65 69 67 68 74 20 3d 20 36 30 .null).{.....options.height.=.60
1cc80 30 0a 20 20 7d 0a 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6e 61 6d 65 20 6f 66 20 69 6e 74 73 0...}....for.(const.name.of.ints
1cca0 29 20 7b 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 5b 6e 61 6d 65 5d 20 21 3d 20 6e 75 6c ).{.....if.(options[name].!=.nul
1ccc0 6c 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 5b 6e 61 6d 65 5d 20 3d 20 70 61 72 73 65 l).{.......options[name].=.parse
1cce0 49 6e 74 28 6f 70 74 69 6f 6e 73 5b 6e 61 6d 65 5d 2c 20 31 30 29 0a 20 20 20 20 7d 0a 20 20 7d Int(options[name],.10).....}...}
1cd00 0a 0a 20 20 69 70 63 4d 61 69 6e 2e 65 6d 69 74 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 ....ipcMain.emit('ELECTRON_GUEST
1cd20 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 49 4e 54 45 52 4e 41 4c 5f 57 49 4e 44 4f 57 5f _WINDOW_MANAGER_INTERNAL_WINDOW_
1cd40 4f 50 45 4e 27 2c 20 65 76 65 6e 74 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 75 72 6c OPEN',.event,................url
1cd60 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 64 69 73 70 6f 73 69 74 69 6f 6e 2c 20 6f 70 74 69 6f 6e ,.frameName,.disposition,.option
1cd80 73 2c 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 73 29 0a 7d 29 0a 0a 2f 2f 20 52 6f s,.additionalFeatures).})..//.Ro
1cda0 75 74 65 64 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 6d 65 73 73 61 67 65 73 20 77 69 74 68 20 66 uted.window.open.messages.with.f
1cdc0 75 6c 6c 79 20 70 61 72 73 65 64 20 6f 70 74 69 6f 6e 73 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 ully.parsed.options.ipcMain.on('
1cde0 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 49 4e ELECTRON_GUEST_WINDOW_MANAGER_IN
1ce00 54 45 52 4e 41 4c 5f 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 TERNAL_WINDOW_OPEN',.function.(e
1ce20 76 65 6e 74 2c 20 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 0a 20 20 20 20 20 20 20 20 20 20 vent,.url,.frameName,...........
1ce40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ................................
1ce60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 69 73 70 6f 73 69 74 ........................disposit
1ce80 69 6f 6e 2c 20 6f 70 74 69 6f 6e 73 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ion,.options,...................
1cea0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ................................
1cec0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 ................additionalFeatur
1cee0 65 73 2c 20 70 6f 73 74 44 61 74 61 29 20 7b 0a 20 20 6f 70 74 69 6f 6e 73 20 3d 20 6d 65 72 67 es,.postData).{...options.=.merg
1cf00 65 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 4f 70 74 69 6f 6e 73 28 65 76 65 6e 74 2e 73 65 6e 64 eBrowserWindowOptions(event.send
1cf20 65 72 2c 20 6f 70 74 69 6f 6e 73 29 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 65 6d 69 74 er,.options)...event.sender.emit
1cf40 28 27 6e 65 77 2d 77 69 6e 64 6f 77 27 2c 20 65 76 65 6e 74 2c 20 75 72 6c 2c 20 66 72 61 6d 65 ('new-window',.event,.url,.frame
1cf60 4e 61 6d 65 2c 20 64 69 73 70 6f 73 69 74 69 6f 6e 2c 20 6f 70 74 69 6f 6e 73 2c 20 61 64 64 69 Name,.disposition,.options,.addi
1cf80 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 73 29 0a 20 20 63 6f 6e 73 74 20 7b 6e 65 77 47 75 65 73 tionalFeatures)...const.{newGues
1cfa0 74 7d 20 3d 20 65 76 65 6e 74 0a 20 20 69 66 20 28 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 t}.=.event...if.((event.sender.i
1cfc0 73 47 75 65 73 74 28 29 20 26 26 20 21 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 61 6c 6c 6f 77 50 sGuest().&&.!event.sender.allowP
1cfe0 6f 70 75 70 73 29 20 7c 7c 20 65 76 65 6e 74 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 opups).||.event.defaultPrevented
1d000 29 20 7b 0a 20 20 20 20 69 66 20 28 6e 65 77 47 75 65 73 74 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a ).{.....if.(newGuest.!=.null).{.
1d020 20 20 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 20 3d 3d ......if.(options.webContents.==
1d040 3d 20 6e 65 77 47 75 65 73 74 2e 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 20 20 =.newGuest.webContents).{.......
1d060 20 20 2f 2f 20 74 68 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 69 73 20 6e 6f 74 20 63 68 61 6e ..//.the.webContents.is.not.chan
1d080 67 65 64 2c 20 73 6f 20 73 65 74 20 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 20 74 6f 20 ged,.so.set.defaultPrevented.to.
1d0a0 66 61 6c 73 65 20 74 6f 0a 20 20 20 20 20 20 20 20 2f 2f 20 73 74 6f 70 20 74 68 65 20 63 61 6c false.to.........//.stop.the.cal
1d0c0 6c 65 72 73 20 6f 66 20 74 68 69 73 20 65 76 65 6e 74 20 66 72 6f 6d 20 64 65 73 74 72 6f 79 69 lers.of.this.event.from.destroyi
1d0e0 6e 67 20 74 68 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 0a 20 20 20 20 20 20 20 20 65 76 65 6e ng.the.webContents..........even
1d100 74 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 20 3d 20 66 61 6c 73 65 0a 20 20 20 20 20 t.defaultPrevented.=.false......
1d120 20 7d 0a 20 20 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 73 65 74 .}.......event.returnValue.=.set
1d140 75 70 47 75 65 73 74 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c upGuest(event.sender,.frameName,
1d160 20 6e 65 77 47 75 65 73 74 2c 20 6f 70 74 69 6f 6e 73 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b .newGuest,.options).....}.else.{
1d180 0a 20 20 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a .......event.returnValue.=.null.
1d1a0 20 20 20 20 7d 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 ....}...}.else.{.....event.retur
1d1c0 6e 56 61 6c 75 65 20 3d 20 63 72 65 61 74 65 47 75 65 73 74 28 65 76 65 6e 74 2e 73 65 6e 64 65 nValue.=.createGuest(event.sende
1d1e0 72 2c 20 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 6f 70 74 69 6f 6e 73 2c 20 70 6f 73 74 r,.url,.frameName,.options,.post
1d200 44 61 74 61 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 Data)...}.})..ipcMain.on('ELECTR
1d220 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 43 ON_GUEST_WINDOW_MANAGER_WINDOW_C
1d240 4c 4f 53 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 64 29 LOSE',.function.(event,.guestId)
1d260 20 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f .{...const.guestContents.=.webCo
1d280 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 67 75 65 73 74 49 64 29 0a 20 20 69 66 20 28 67 75 65 ntents.fromId(guestId)...if.(gue
1d2a0 73 74 43 6f 6e 74 65 6e 74 73 20 3d 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e 0a 0a 20 20 69 66 stContents.==.null).return....if
1d2c0 20 28 21 63 61 6e 41 63 63 65 73 73 57 69 6e 64 6f 77 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c .(!canAccessWindow(event.sender,
1d2e0 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 .guestContents)).{.....console.e
1d300 72 72 6f 72 28 60 42 6c 6f 63 6b 65 64 20 24 7b 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 rror(`Blocked.${event.sender.get
1d320 55 52 4c 28 29 7d 20 66 72 6f 6d 20 63 6c 6f 73 69 6e 67 20 69 74 73 20 6f 70 65 6e 65 72 2e 60 URL()}.from.closing.its.opener.`
1d340 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 57 ).....return...}....const.guestW
1d360 69 6e 64 6f 77 20 3d 20 67 65 74 47 75 65 73 74 57 69 6e 64 6f 77 28 67 75 65 73 74 43 6f 6e 74 indow.=.getGuestWindow(guestCont
1d380 65 6e 74 73 29 0a 20 20 69 66 20 28 67 75 65 73 74 57 69 6e 64 6f 77 20 21 3d 20 6e 75 6c 6c 29 ents)...if.(guestWindow.!=.null)
1d3a0 20 67 75 65 73 74 57 69 6e 64 6f 77 2e 64 65 73 74 72 6f 79 28 29 0a 7d 29 0a 0a 69 70 63 4d 61 .guestWindow.destroy().})..ipcMa
1d3c0 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e in.on('ELECTRON_GUEST_WINDOW_MAN
1d3e0 41 47 45 52 5f 57 49 4e 44 4f 57 5f 4d 45 54 48 4f 44 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 AGER_WINDOW_METHOD',.function.(e
1d400 76 65 6e 74 2c 20 67 75 65 73 74 49 64 2c 20 6d 65 74 68 6f 64 2c 20 2e 2e 2e 61 72 67 73 29 20 vent,.guestId,.method,....args).
1d420 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e {...const.guestContents.=.webCon
1d440 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 67 75 65 73 74 49 64 29 0a 20 20 69 66 20 28 67 75 65 73 tents.fromId(guestId)...if.(gues
1d460 74 43 6f 6e 74 65 6e 74 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 tContents.==.null).{.....event.r
1d480 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d eturnValue.=.null.....return...}
1d4a0 0a 0a 20 20 69 66 20 28 21 63 61 6e 41 63 63 65 73 73 57 69 6e 64 6f 77 28 65 76 65 6e 74 2e 73 ....if.(!canAccessWindow(event.s
1d4c0 65 6e 64 65 72 2c 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 20 20 63 6f 6e ender,.guestContents)).{.....con
1d4e0 73 6f 6c 65 2e 65 72 72 6f 72 28 60 42 6c 6f 63 6b 65 64 20 24 7b 65 76 65 6e 74 2e 73 65 6e 64 sole.error(`Blocked.${event.send
1d500 65 72 2e 67 65 74 55 52 4c 28 29 7d 20 66 72 6f 6d 20 63 61 6c 6c 69 6e 67 20 24 7b 6d 65 74 68 er.getURL()}.from.calling.${meth
1d520 6f 64 7d 20 6f 6e 20 69 74 73 20 6f 70 65 6e 65 72 2e 60 29 0a 20 20 20 20 65 76 65 6e 74 2e 72 od}.on.its.opener.`).....event.r
1d540 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d eturnValue.=.null.....return...}
1d560 0a 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 57 69 6e 64 6f 77 20 3d 20 67 65 74 47 75 65 73 74 ....const.guestWindow.=.getGuest
1d580 57 69 6e 64 6f 77 28 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 29 0a 20 20 69 66 20 28 67 75 65 73 Window(guestContents)...if.(gues
1d5a0 74 57 69 6e 64 6f 77 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 tWindow.!=.null).{.....event.ret
1d5c0 75 72 6e 56 61 6c 75 65 20 3d 20 67 75 65 73 74 57 69 6e 64 6f 77 5b 6d 65 74 68 6f 64 5d 28 2e urnValue.=.guestWindow[method](.
1d5e0 2e 2e 61 72 67 73 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 ..args)...}.else.{.....event.ret
1d600 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e urnValue.=.null...}.})..ipcMain.
1d620 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 on('ELECTRON_GUEST_WINDOW_MANAGE
1d640 52 5f 57 49 4e 44 4f 57 5f 50 4f 53 54 4d 45 53 53 41 47 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 R_WINDOW_POSTMESSAGE',.function.
1d660 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 74 61 72 67 65 74 (event,.guestId,.message,.target
1d680 4f 72 69 67 69 6e 2c 20 73 6f 75 72 63 65 4f 72 69 67 69 6e 29 20 7b 0a 20 20 69 66 20 28 74 61 Origin,.sourceOrigin).{...if.(ta
1d6a0 72 67 65 74 4f 72 69 67 69 6e 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 61 72 67 65 74 rgetOrigin.==.null).{.....target
1d6c0 4f 72 69 67 69 6e 20 3d 20 27 2a 27 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 43 Origin.=.'*'...}....const.guestC
1d6e0 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 67 75 65 ontents.=.webContents.fromId(gue
1d700 73 74 49 64 29 0a 20 20 69 66 20 28 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 3d 20 6e 75 6c stId)...if.(guestContents.==.nul
1d720 6c 29 20 72 65 74 75 72 6e 0a 0a 20 20 2f 2f 20 54 68 65 20 57 33 43 20 64 6f 65 73 20 6e 6f 74 l).return....//.The.W3C.does.not
1d740 20 73 65 65 6d 20 74 6f 20 68 61 76 65 20 77 6f 72 64 20 6f 6e 20 68 6f 77 20 70 6f 73 74 4d 65 .seem.to.have.word.on.how.postMe
1d760 73 73 61 67 65 20 73 68 6f 75 6c 64 20 77 6f 72 6b 20 77 68 65 6e 20 74 68 65 0a 20 20 2f 2f 20 ssage.should.work.when.the...//.
1d780 6f 72 69 67 69 6e 73 20 64 6f 20 6e 6f 74 20 6d 61 74 63 68 2c 20 73 6f 20 77 65 20 64 6f 20 6e origins.do.not.match,.so.we.do.n
1d7a0 6f 74 20 64 6f 20 7c 63 61 6e 41 63 63 65 73 73 57 69 6e 64 6f 77 7c 20 63 68 65 63 6b 20 68 65 ot.do.|canAccessWindow|.check.he
1d7c0 72 65 20 73 69 6e 63 65 0a 20 20 2f 2f 20 70 6f 73 74 4d 65 73 73 61 67 65 20 61 63 72 6f 73 73 re.since...//.postMessage.across
1d7e0 20 6f 72 69 67 69 6e 73 20 69 73 20 75 73 65 66 75 6c 20 61 6e 64 20 6e 6f 74 20 68 61 72 6d 66 .origins.is.useful.and.not.harmf
1d800 75 6c 2e 0a 20 20 69 66 20 28 74 61 72 67 65 74 4f 72 69 67 69 6e 20 3d 3d 3d 20 27 2a 27 20 7c ul....if.(targetOrigin.===.'*'.|
1d820 7c 20 69 73 53 61 6d 65 4f 72 69 67 69 6e 28 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 2e 67 65 74 |.isSameOrigin(guestContents.get
1d840 55 52 4c 28 29 2c 20 74 61 72 67 65 74 4f 72 69 67 69 6e 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 URL(),.targetOrigin)).{.....cons
1d860 74 20 73 6f 75 72 63 65 49 64 20 3d 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 64 0a 20 20 20 t.sourceId.=.event.sender.id....
1d880 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 .guestContents.send('ELECTRON_GU
1d8a0 45 53 54 5f 57 49 4e 44 4f 57 5f 50 4f 53 54 4d 45 53 53 41 47 45 27 2c 20 73 6f 75 72 63 65 49 EST_WINDOW_POSTMESSAGE',.sourceI
1d8c0 64 2c 20 6d 65 73 73 61 67 65 2c 20 73 6f 75 72 63 65 4f 72 69 67 69 6e 29 0a 20 20 7d 0a 7d 29 d,.message,.sourceOrigin)...}.})
1d8e0 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e ..ipcMain.on('ELECTRON_GUEST_WIN
1d900 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 27 DOW_MANAGER_WEB_CONTENTS_METHOD'
1d920 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 64 2c 20 6d 65 74 68 ,.function.(event,.guestId,.meth
1d940 6f 64 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 43 6f 6e 74 od,....args).{...const.guestCont
1d960 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 67 75 65 73 74 49 ents.=.webContents.fromId(guestI
1d980 64 29 0a 20 20 69 66 20 28 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 3d 20 6e 75 6c 6c 29 20 d)...if.(guestContents.==.null).
1d9a0 72 65 74 75 72 6e 0a 0a 20 20 69 66 20 28 63 61 6e 41 63 63 65 73 73 57 69 6e 64 6f 77 28 65 76 return....if.(canAccessWindow(ev
1d9c0 65 6e 74 2e 73 65 6e 64 65 72 2c 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 ent.sender,.guestContents)).{...
1d9e0 20 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 29 ..guestContents[method](...args)
1da00 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 42 ...}.else.{.....console.error(`B
1da20 6c 6f 63 6b 65 64 20 24 7b 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 55 52 4c 28 29 7d 20 locked.${event.sender.getURL()}.
1da40 66 72 6f 6d 20 63 61 6c 6c 69 6e 67 20 24 7b 6d 65 74 68 6f 64 7d 20 6f 6e 20 69 74 73 20 6f 70 from.calling.${method}.on.its.op
1da60 65 6e 65 72 2e 60 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 ener.`)...}.})..ipcMain.on('ELEC
1da80 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 45 42 5f 43 4f TRON_GUEST_WINDOW_MANAGER_WEB_CO
1daa0 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 5f 53 59 4e 43 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 NTENTS_METHOD_SYNC',.function.(e
1dac0 76 65 6e 74 2c 20 67 75 65 73 74 49 64 2c 20 6d 65 74 68 6f 64 2c 20 2e 2e 2e 61 72 67 73 29 20 vent,.guestId,.method,....args).
1dae0 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e {...const.guestContents.=.webCon
1db00 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 67 75 65 73 74 49 64 29 0a 20 20 69 66 20 28 67 75 65 73 tents.fromId(guestId)...if.(gues
1db20 74 43 6f 6e 74 65 6e 74 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 tContents.==.null).{.....event.r
1db40 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d eturnValue.=.null.....return...}
1db60 0a 0a 20 20 69 66 20 28 63 61 6e 41 63 63 65 73 73 57 69 6e 64 6f 77 28 65 76 65 6e 74 2e 73 65 ....if.(canAccessWindow(event.se
1db80 6e 64 65 72 2c 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 20 20 65 76 65 6e nder,.guestContents)).{.....even
1dba0 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 5b 6d 65 t.returnValue.=.guestContents[me
1dbc0 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 63 6f thod](...args)...}.else.{.....co
1dbe0 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 42 6c 6f 63 6b 65 64 20 24 7b 65 76 65 6e 74 2e 73 65 6e nsole.error(`Blocked.${event.sen
1dc00 64 65 72 2e 67 65 74 55 52 4c 28 29 7d 20 66 72 6f 6d 20 63 61 6c 6c 69 6e 67 20 24 7b 6d 65 74 der.getURL()}.from.calling.${met
1dc20 68 6f 64 7d 20 6f 6e 20 69 74 73 20 6f 70 65 6e 65 72 2e 60 29 0a 20 20 20 20 65 76 65 6e 74 2e hod}.on.its.opener.`).....event.
1dc40 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 20 20 7d 0a 7d 29 0a 27 75 73 65 20 73 returnValue.=.null...}.}).'use.s
1dc60 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 42 75 66 66 65 72 7d 20 3d 20 72 65 71 75 69 72 65 trict'..const.{Buffer}.=.require
1dc80 28 27 62 75 66 66 65 72 27 29 0a 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 ('buffer').const.fs.=.require('f
1dca0 73 27 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 s').const.path.=.require('path')
1dcc0 0a 63 6f 6e 73 74 20 75 74 69 6c 20 3d 20 72 65 71 75 69 72 65 28 27 75 74 69 6c 27 29 0a 63 6f .const.util.=.require('util').co
1dce0 6e 73 74 20 4d 6f 64 75 6c 65 20 3d 20 72 65 71 75 69 72 65 28 27 6d 6f 64 75 6c 65 27 29 0a 63 nst.Module.=.require('module').c
1dd00 6f 6e 73 74 20 76 38 20 3d 20 72 65 71 75 69 72 65 28 27 76 38 27 29 0a 0a 2f 2f 20 57 65 20 6d onst.v8.=.require('v8')..//.We.m
1dd20 6f 64 69 66 69 65 64 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 72 6f 63 65 73 73 2e 61 72 67 odified.the.original.process.arg
1dd40 76 20 74 6f 20 6c 65 74 20 6e 6f 64 65 2e 6a 73 20 6c 6f 61 64 20 74 68 65 20 61 74 6f 6d 2e 6a v.to.let.node.js.load.the.atom.j
1dd60 73 2c 0a 2f 2f 20 77 65 20 6e 65 65 64 20 74 6f 20 72 65 73 74 6f 72 65 20 69 74 20 68 65 72 65 s,.//.we.need.to.restore.it.here
1dd80 2e 0a 70 72 6f 63 65 73 73 2e 61 72 67 76 2e 73 70 6c 69 63 65 28 31 2c 20 31 29 0a 0a 2f 2f 20 ..process.argv.splice(1,.1)..//.
1dda0 43 6c 65 61 72 20 73 65 61 72 63 68 20 70 61 74 68 73 2e 0a 72 65 71 75 69 72 65 28 27 2e 2e 2f Clear.search.paths..require('../
1ddc0 63 6f 6d 6d 6f 6e 2f 72 65 73 65 74 2d 73 65 61 72 63 68 2d 70 61 74 68 73 27 29 0a 0a 2f 2f 20 common/reset-search-paths')..//.
1dde0 49 6d 70 6f 72 74 20 63 6f 6d 6d 6f 6e 20 73 65 74 74 69 6e 67 73 2e 0a 72 65 71 75 69 72 65 28 Import.common.settings..require(
1de00 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 69 6e 69 74 27 29 0a 0a 76 61 72 20 67 6c 6f 62 61 6c 50 61 74 '../common/init')..var.globalPat
1de20 68 73 20 3d 20 4d 6f 64 75 6c 65 2e 67 6c 6f 62 61 6c 50 61 74 68 73 0a 0a 2f 2f 20 45 78 70 6f hs.=.Module.globalPaths..//.Expo
1de40 73 65 20 70 75 62 6c 69 63 20 41 50 49 73 2e 0a 67 6c 6f 62 61 6c 50 61 74 68 73 2e 70 75 73 68 se.public.APIs..globalPaths.push
1de60 28 70 61 74 68 2e 6a 6f 69 6e 28 5f 5f 64 69 72 6e 61 6d 65 2c 20 27 61 70 69 27 2c 20 27 65 78 (path.join(__dirname,.'api',.'ex
1de80 70 6f 72 74 73 27 29 29 0a 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d ports'))..if.(process.platform.=
1dea0 3d 3d 20 27 77 69 6e 33 32 27 29 20 7b 0a 20 20 2f 2f 20 52 65 64 69 72 65 63 74 20 6e 6f 64 65 ==.'win32').{...//.Redirect.node
1dec0 27 73 20 63 6f 6e 73 6f 6c 65 20 74 6f 20 75 73 65 20 6f 75 72 20 6f 77 6e 20 69 6d 70 6c 65 6d 's.console.to.use.our.own.implem
1dee0 65 6e 74 61 74 69 6f 6e 73 2c 20 73 69 6e 63 65 20 6e 6f 64 65 20 63 61 6e 20 6e 6f 74 0a 20 20 entations,.since.node.can.not...
1df00 2f 2f 20 68 61 6e 64 6c 65 20 63 6f 6e 73 6f 6c 65 20 6f 75 74 70 75 74 20 77 68 65 6e 20 72 75 //.handle.console.output.when.ru
1df20 6e 6e 69 6e 67 20 61 73 20 47 55 49 20 70 72 6f 67 72 61 6d 2e 0a 20 20 76 61 72 20 63 6f 6e 73 nning.as.GUI.program....var.cons
1df40 6f 6c 65 4c 6f 67 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 oleLog.=.function.(...args).{...
1df60 20 20 72 65 74 75 72 6e 20 70 72 6f 63 65 73 73 2e 6c 6f 67 28 75 74 69 6c 2e 66 6f 72 6d 61 74 ..return.process.log(util.format
1df80 28 2e 2e 2e 61 72 67 73 29 20 2b 20 27 5c 6e 27 29 0a 20 20 7d 0a 20 20 76 61 72 20 73 74 72 65 (...args).+.'\n')...}...var.stre
1dfa0 61 6d 57 72 69 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 68 75 6e 6b 2c 20 65 6e 63 6f 64 amWrite.=.function.(chunk,.encod
1dfc0 69 6e 67 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 69 66 20 28 42 75 66 66 65 72 2e ing,.callback).{.....if.(Buffer.
1dfe0 69 73 42 75 66 66 65 72 28 63 68 75 6e 6b 29 29 20 7b 0a 20 20 20 20 20 20 63 68 75 6e 6b 20 3d isBuffer(chunk)).{.......chunk.=
1e000 20 63 68 75 6e 6b 2e 74 6f 53 74 72 69 6e 67 28 65 6e 63 6f 64 69 6e 67 29 0a 20 20 20 20 7d 0a .chunk.toString(encoding).....}.
1e020 20 20 20 20 70 72 6f 63 65 73 73 2e 6c 6f 67 28 63 68 75 6e 6b 29 0a 20 20 20 20 69 66 20 28 63 ....process.log(chunk).....if.(c
1e040 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 29 0a 20 20 20 20 allback).{.......callback().....
1e060 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 7d 0a 20 20 63 6f 6e 73 6f 6c 65 2e }.....return.true...}...console.
1e080 6c 6f 67 20 3d 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 20 3d 20 63 6f 6e 73 6f 6c 65 2e 77 61 log.=.console.error.=.console.wa
1e0a0 72 6e 20 3d 20 63 6f 6e 73 6f 6c 65 4c 6f 67 0a 20 20 70 72 6f 63 65 73 73 2e 73 74 64 6f 75 74 rn.=.consoleLog...process.stdout
1e0c0 2e 77 72 69 74 65 20 3d 20 70 72 6f 63 65 73 73 2e 73 74 64 65 72 72 2e 77 72 69 74 65 20 3d 20 .write.=.process.stderr.write.=.
1e0e0 73 74 72 65 61 6d 57 72 69 74 65 0a 7d 0a 0a 2f 2f 20 44 6f 6e 27 74 20 71 75 69 74 20 6f 6e 20 streamWrite.}..//.Don't.quit.on.
1e100 66 61 74 61 6c 20 65 72 72 6f 72 2e 0a 70 72 6f 63 65 73 73 2e 6f 6e 28 27 75 6e 63 61 75 67 68 fatal.error..process.on('uncaugh
1e120 74 45 78 63 65 70 74 69 6f 6e 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 72 72 6f 72 29 20 7b 0a tException',.function.(error).{.
1e140 20 20 2f 2f 20 44 6f 20 6e 6f 74 68 69 6e 67 20 69 66 20 74 68 65 20 75 73 65 72 20 68 61 73 20 ..//.Do.nothing.if.the.user.has.
1e160 61 20 63 75 73 74 6f 6d 20 75 6e 63 61 75 67 68 74 20 65 78 63 65 70 74 69 6f 6e 20 68 61 6e 64 a.custom.uncaught.exception.hand
1e180 6c 65 72 2e 0a 20 20 76 61 72 20 64 69 61 6c 6f 67 2c 20 6d 65 73 73 61 67 65 2c 20 72 65 66 2c ler....var.dialog,.message,.ref,
1e1a0 20 73 74 61 63 6b 0a 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 6c 69 73 74 65 6e 65 72 73 28 27 .stack...if.(process.listeners('
1e1c0 75 6e 63 61 75 67 68 74 45 78 63 65 70 74 69 6f 6e 27 29 2e 6c 65 6e 67 74 68 20 3e 20 31 29 20 uncaughtException').length.>.1).
1e1e0 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 2f 2f 20 53 68 6f 77 20 65 72 72 6f {.....return...}....//.Show.erro
1e200 72 20 69 6e 20 47 55 49 2e 0a 20 20 64 69 61 6c 6f 67 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c r.in.GUI....dialog.=.require('el
1e220 65 63 74 72 6f 6e 27 29 2e 64 69 61 6c 6f 67 0a 20 20 73 74 61 63 6b 20 3d 20 28 72 65 66 20 3d ectron').dialog...stack.=.(ref.=
1e240 20 65 72 72 6f 72 2e 73 74 61 63 6b 29 20 21 3d 20 6e 75 6c 6c 20 3f 20 72 65 66 20 3a 20 65 72 .error.stack).!=.null.?.ref.:.er
1e260 72 6f 72 2e 6e 61 6d 65 20 2b 20 27 3a 20 27 20 2b 20 65 72 72 6f 72 2e 6d 65 73 73 61 67 65 0a ror.name.+.':.'.+.error.message.
1e280 20 20 6d 65 73 73 61 67 65 20 3d 20 27 55 6e 63 61 75 67 68 74 20 45 78 63 65 70 74 69 6f 6e 3a ..message.=.'Uncaught.Exception:
1e2a0 5c 6e 27 20 2b 20 73 74 61 63 6b 0a 20 20 64 69 61 6c 6f 67 2e 73 68 6f 77 45 72 72 6f 72 42 6f \n'.+.stack...dialog.showErrorBo
1e2c0 78 28 27 41 20 4a 61 76 61 53 63 72 69 70 74 20 65 72 72 6f 72 20 6f 63 63 75 72 72 65 64 20 69 x('A.JavaScript.error.occurred.i
1e2e0 6e 20 74 68 65 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 27 2c 20 6d 65 73 73 61 67 65 29 0a 7d 29 n.the.main.process',.message).})
1e300 0a 0a 2f 2f 20 45 6d 69 74 20 27 65 78 69 74 27 20 65 76 65 6e 74 20 6f 6e 20 71 75 69 74 2e 0a ..//.Emit.'exit'.event.on.quit..
1e320 63 6f 6e 73 74 20 7b 61 70 70 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 const.{app}.=.require('electron'
1e340 29 0a 0a 61 70 70 2e 6f 6e 28 27 71 75 69 74 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e )..app.on('quit',.function.(even
1e360 74 2c 20 65 78 69 74 43 6f 64 65 29 20 7b 0a 20 20 70 72 6f 63 65 73 73 2e 65 6d 69 74 28 27 65 t,.exitCode).{...process.emit('e
1e380 78 69 74 27 2c 20 65 78 69 74 43 6f 64 65 29 0a 7d 29 0a 0a 69 66 20 28 70 72 6f 63 65 73 73 2e xit',.exitCode).})..if.(process.
1e3a0 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 29 20 7b 0a 20 20 2f 2f 20 49 66 20 platform.===.'win32').{...//.If.
1e3c0 77 65 20 61 72 65 20 61 20 53 71 75 69 72 72 65 6c 2e 57 69 6e 64 6f 77 73 2d 69 6e 73 74 61 6c we.are.a.Squirrel.Windows-instal
1e3e0 6c 65 64 20 61 70 70 2c 20 73 65 74 20 61 70 70 20 75 73 65 72 20 6d 6f 64 65 6c 20 49 44 0a 20 led.app,.set.app.user.model.ID..
1e400 20 2f 2f 20 73 6f 20 74 68 61 74 20 75 73 65 72 73 20 64 6f 6e 27 74 20 68 61 76 65 20 74 6f 20 .//.so.that.users.don't.have.to.
1e420 64 6f 20 74 68 69 73 2e 0a 20 20 2f 2f 0a 20 20 2f 2f 20 53 71 75 69 72 72 65 6c 20 70 61 63 6b do.this....//...//.Squirrel.pack
1e440 61 67 65 73 20 61 72 65 20 61 6c 77 61 79 73 20 6f 66 20 74 68 65 20 66 6f 72 6d 3a 0a 20 20 2f ages.are.always.of.the.form:.../
1e460 2f 0a 20 20 2f 2f 20 50 41 43 4b 41 47 45 2d 4e 41 4d 45 0a 20 20 2f 2f 20 2d 20 55 70 64 61 74 /...//.PACKAGE-NAME...//.-.Updat
1e480 65 2e 65 78 65 0a 20 20 2f 2f 20 2d 20 61 70 70 2d 56 45 52 53 49 4f 4e 0a 20 20 2f 2f 20 20 20 e.exe...//.-.app-VERSION...//...
1e4a0 2d 20 4f 55 52 45 58 45 2e 65 78 65 0a 20 20 2f 2f 0a 20 20 2f 2f 20 53 71 75 69 72 72 65 6c 20 -.OUREXE.exe...//...//.Squirrel.
1e4c0 69 74 73 65 6c 66 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 73 65 74 20 74 68 65 20 73 68 6f 72 74 itself.will.always.set.the.short
1e4e0 63 75 74 27 73 20 41 70 70 20 55 73 65 72 20 4d 6f 64 65 6c 20 49 44 20 74 6f 20 74 68 65 0a 20 cut's.App.User.Model.ID.to.the..
1e500 20 2f 2f 20 66 6f 72 6d 20 60 63 6f 6d 2e 73 71 75 69 72 72 65 6c 2e 50 41 43 4b 41 47 45 2d 4e .//.form.`com.squirrel.PACKAGE-N
1e520 41 4d 45 2e 4f 55 52 45 58 45 60 2e 20 57 65 20 6e 65 65 64 20 74 6f 20 63 61 6c 6c 0a 20 20 2f AME.OUREXE`..We.need.to.call.../
1e540 2f 20 61 70 70 2e 73 65 74 41 70 70 55 73 65 72 4d 6f 64 65 6c 49 64 20 77 69 74 68 20 61 20 6d /.app.setAppUserModelId.with.a.m
1e560 61 74 63 68 69 6e 67 20 69 64 65 6e 74 69 66 69 65 72 20 73 6f 20 74 68 61 74 20 72 65 6e 64 65 atching.identifier.so.that.rende
1e580 72 65 72 20 70 72 6f 63 65 73 73 65 73 0a 20 20 2f 2f 20 77 69 6c 6c 20 69 6e 68 65 72 69 74 20 rer.processes...//.will.inherit.
1e5a0 74 68 69 73 20 76 61 6c 75 65 2e 0a 20 20 63 6f 6e 73 74 20 75 70 64 61 74 65 44 6f 74 45 78 65 this.value....const.updateDotExe
1e5c0 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 70 61 74 68 2e 64 69 72 6e 61 6d 65 28 70 72 6f 63 65 73 .=.path.join(path.dirname(proces
1e5e0 73 2e 65 78 65 63 50 61 74 68 29 2c 20 27 2e 2e 27 2c 20 27 75 70 64 61 74 65 2e 65 78 65 27 29 s.execPath),.'..',.'update.exe')
1e600 0a 0a 20 20 69 66 20 28 66 73 2e 65 78 69 73 74 73 53 79 6e 63 28 75 70 64 61 74 65 44 6f 74 45 ....if.(fs.existsSync(updateDotE
1e620 78 65 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 70 61 63 6b 61 67 65 44 69 72 20 3d 20 70 61 xe)).{.....const.packageDir.=.pa
1e640 74 68 2e 64 69 72 6e 61 6d 65 28 70 61 74 68 2e 72 65 73 6f 6c 76 65 28 75 70 64 61 74 65 44 6f th.dirname(path.resolve(updateDo
1e660 74 45 78 65 29 29 0a 20 20 20 20 63 6f 6e 73 74 20 70 61 63 6b 61 67 65 4e 61 6d 65 20 3d 20 70 tExe)).....const.packageName.=.p
1e680 61 74 68 2e 62 61 73 65 6e 61 6d 65 28 70 61 63 6b 61 67 65 44 69 72 29 2e 72 65 70 6c 61 63 65 ath.basename(packageDir).replace
1e6a0 28 2f 5c 73 2f 67 2c 20 27 27 29 0a 20 20 20 20 63 6f 6e 73 74 20 65 78 65 4e 61 6d 65 20 3d 20 (/\s/g,.'').....const.exeName.=.
1e6c0 70 61 74 68 2e 62 61 73 65 6e 61 6d 65 28 70 72 6f 63 65 73 73 2e 65 78 65 63 50 61 74 68 29 2e path.basename(process.execPath).
1e6e0 72 65 70 6c 61 63 65 28 2f 5c 2e 65 78 65 24 2f 69 2c 20 27 27 29 2e 72 65 70 6c 61 63 65 28 2f replace(/\.exe$/i,.'').replace(/
1e700 5c 73 2f 67 2c 20 27 27 29 0a 0a 20 20 20 20 61 70 70 2e 73 65 74 41 70 70 55 73 65 72 4d 6f 64 \s/g,.'')......app.setAppUserMod
1e720 65 6c 49 64 28 60 63 6f 6d 2e 73 71 75 69 72 72 65 6c 2e 24 7b 70 61 63 6b 61 67 65 4e 61 6d 65 elId(`com.squirrel.${packageName
1e740 7d 2e 24 7b 65 78 65 4e 61 6d 65 7d 60 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4d 61 70 20 70 72 6f }.${exeName}`)...}.}..//.Map.pro
1e760 63 65 73 73 2e 65 78 69 74 20 74 6f 20 61 70 70 2e 65 78 69 74 2c 20 77 68 69 63 68 20 71 75 69 cess.exit.to.app.exit,.which.qui
1e780 74 73 20 67 72 61 63 65 66 75 6c 6c 79 2e 0a 70 72 6f 63 65 73 73 2e 65 78 69 74 20 3d 20 61 70 ts.gracefully..process.exit.=.ap
1e7a0 70 2e 65 78 69 74 0a 0a 2f 2f 20 4c 6f 61 64 20 74 68 65 20 52 50 43 20 73 65 72 76 65 72 2e 0a p.exit..//.Load.the.RPC.server..
1e7c0 72 65 71 75 69 72 65 28 27 2e 2f 72 70 63 2d 73 65 72 76 65 72 27 29 0a 0a 2f 2f 20 4c 6f 61 64 require('./rpc-server')..//.Load
1e7e0 20 74 68 65 20 67 75 65 73 74 20 76 69 65 77 20 6d 61 6e 61 67 65 72 2e 0a 72 65 71 75 69 72 65 .the.guest.view.manager..require
1e800 28 27 2e 2f 67 75 65 73 74 2d 76 69 65 77 2d 6d 61 6e 61 67 65 72 27 29 0a 72 65 71 75 69 72 65 ('./guest-view-manager').require
1e820 28 27 2e 2f 67 75 65 73 74 2d 77 69 6e 64 6f 77 2d 6d 61 6e 61 67 65 72 27 29 0a 0a 2f 2f 20 4e ('./guest-window-manager')..//.N
1e840 6f 77 20 77 65 20 74 72 79 20 74 6f 20 6c 6f 61 64 20 61 70 70 27 73 20 70 61 63 6b 61 67 65 2e ow.we.try.to.load.app's.package.
1e860 6a 73 6f 6e 2e 0a 6c 65 74 20 70 61 63 6b 61 67 65 50 61 74 68 20 3d 20 6e 75 6c 6c 0a 6c 65 74 json..let.packagePath.=.null.let
1e880 20 70 61 63 6b 61 67 65 4a 73 6f 6e 20 3d 20 6e 75 6c 6c 0a 63 6f 6e 73 74 20 73 65 61 72 63 68 .packageJson.=.null.const.search
1e8a0 50 61 74 68 73 20 3d 20 5b 27 61 70 70 27 2c 20 27 61 70 70 2e 61 73 61 72 27 2c 20 27 64 65 66 Paths.=.['app',.'app.asar',.'def
1e8c0 61 75 6c 74 5f 61 70 70 2e 61 73 61 72 27 5d 0a 66 6f 72 20 28 70 61 63 6b 61 67 65 50 61 74 68 ault_app.asar'].for.(packagePath
1e8e0 20 6f 66 20 73 65 61 72 63 68 50 61 74 68 73 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 70 .of.searchPaths).{...try.{.....p
1e900 61 63 6b 61 67 65 50 61 74 68 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 70 72 6f 63 65 73 73 2e 72 ackagePath.=.path.join(process.r
1e920 65 73 6f 75 72 63 65 73 50 61 74 68 2c 20 70 61 63 6b 61 67 65 50 61 74 68 29 0a 20 20 20 20 70 esourcesPath,.packagePath).....p
1e940 61 63 6b 61 67 65 4a 73 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 70 61 74 68 2e 6a 6f 69 6e 28 70 ackageJson.=.require(path.join(p
1e960 61 63 6b 61 67 65 50 61 74 68 2c 20 27 70 61 63 6b 61 67 65 2e 6a 73 6f 6e 27 29 29 0a 20 20 20 ackagePath,.'package.json'))....
1e980 20 62 72 65 61 6b 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 63 .break...}.catch.(error).{.....c
1e9a0 6f 6e 74 69 6e 75 65 0a 20 20 7d 0a 7d 0a 0a 69 66 20 28 70 61 63 6b 61 67 65 4a 73 6f 6e 20 3d ontinue...}.}..if.(packageJson.=
1e9c0 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 66 75 6e =.null).{...process.nextTick(fun
1e9e0 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 70 72 6f 63 65 73 73 2e 65 78 ction.().{.....return.process.ex
1ea00 69 74 28 31 29 0a 20 20 7d 29 0a 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 55 6e it(1)...})...throw.new.Error('Un
1ea20 61 62 6c 65 20 74 6f 20 66 69 6e 64 20 61 20 76 61 6c 69 64 20 61 70 70 27 29 0a 7d 0a 0a 2f 2f able.to.find.a.valid.app').}..//
1ea40 20 53 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 27 73 20 76 65 72 73 69 6f 6e 2e 0a 69 66 20 28 .Set.application's.version..if.(
1ea60 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 76 65 72 73 69 6f 6e 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 packageJson.version.!=.null).{..
1ea80 20 61 70 70 2e 73 65 74 56 65 72 73 69 6f 6e 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 76 65 72 73 .app.setVersion(packageJson.vers
1eaa0 69 6f 6e 29 0a 7d 0a 0a 2f 2f 20 53 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 27 73 20 6e 61 6d ion).}..//.Set.application's.nam
1eac0 65 2e 0a 69 66 20 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 70 72 6f 64 75 63 74 4e 61 6d 65 20 21 e..if.(packageJson.productName.!
1eae0 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 61 70 70 2e 73 65 74 4e 61 6d 65 28 70 61 63 6b 61 67 65 4a =.null).{...app.setName(packageJ
1eb00 73 6f 6e 2e 70 72 6f 64 75 63 74 4e 61 6d 65 29 0a 7d 20 65 6c 73 65 20 69 66 20 28 70 61 63 6b son.productName).}.else.if.(pack
1eb20 61 67 65 4a 73 6f 6e 2e 6e 61 6d 65 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 61 70 70 2e 73 65 ageJson.name.!=.null).{...app.se
1eb40 74 4e 61 6d 65 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 6e 61 6d 65 29 0a 7d 0a 0a 2f 2f 20 53 65 tName(packageJson.name).}..//.Se
1eb60 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 27 73 20 64 65 73 6b 74 6f 70 20 6e 61 6d 65 2e 0a 69 66 t.application's.desktop.name..if
1eb80 20 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 64 65 73 6b 74 6f 70 4e 61 6d 65 20 21 3d 20 6e 75 6c .(packageJson.desktopName.!=.nul
1eba0 6c 29 20 7b 0a 20 20 61 70 70 2e 73 65 74 44 65 73 6b 74 6f 70 4e 61 6d 65 28 70 61 63 6b 61 67 l).{...app.setDesktopName(packag
1ebc0 65 4a 73 6f 6e 2e 64 65 73 6b 74 6f 70 4e 61 6d 65 29 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 61 70 eJson.desktopName).}.else.{...ap
1ebe0 70 2e 73 65 74 44 65 73 6b 74 6f 70 4e 61 6d 65 28 28 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 29 p.setDesktopName((app.getName())
1ec00 20 2b 20 27 2e 64 65 73 6b 74 6f 70 27 29 0a 7d 0a 0a 2f 2f 20 53 65 74 20 76 38 20 66 6c 61 67 .+.'.desktop').}..//.Set.v8.flag
1ec20 73 0a 69 66 20 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 76 38 46 6c 61 67 73 20 21 3d 20 6e 75 6c s.if.(packageJson.v8Flags.!=.nul
1ec40 6c 29 20 7b 0a 20 20 76 38 2e 73 65 74 46 6c 61 67 73 46 72 6f 6d 53 74 72 69 6e 67 28 70 61 63 l).{...v8.setFlagsFromString(pac
1ec60 6b 61 67 65 4a 73 6f 6e 2e 76 38 46 6c 61 67 73 29 0a 7d 0a 0a 2f 2f 20 53 65 74 20 74 68 65 20 kageJson.v8Flags).}..//.Set.the.
1ec80 75 73 65 72 20 70 61 74 68 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 61 70 70 6c 69 63 61 74 69 user.path.according.to.applicati
1eca0 6f 6e 27 73 20 6e 61 6d 65 2e 0a 61 70 70 2e 73 65 74 50 61 74 68 28 27 75 73 65 72 44 61 74 61 on's.name..app.setPath('userData
1ecc0 27 2c 20 70 61 74 68 2e 6a 6f 69 6e 28 61 70 70 2e 67 65 74 50 61 74 68 28 27 61 70 70 44 61 74 ',.path.join(app.getPath('appDat
1ece0 61 27 29 2c 20 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 29 29 0a 61 70 70 2e 73 65 74 50 61 74 68 a'),.app.getName())).app.setPath
1ed00 28 27 75 73 65 72 43 61 63 68 65 27 2c 20 70 61 74 68 2e 6a 6f 69 6e 28 61 70 70 2e 67 65 74 50 ('userCache',.path.join(app.getP
1ed20 61 74 68 28 27 63 61 63 68 65 27 29 2c 20 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 29 29 0a 61 70 ath('cache'),.app.getName())).ap
1ed40 70 2e 73 65 74 41 70 70 50 61 74 68 28 70 61 63 6b 61 67 65 50 61 74 68 29 0a 0a 2f 2f 20 4c 6f p.setAppPath(packagePath)..//.Lo
1ed60 61 64 20 74 68 65 20 63 68 72 6f 6d 65 20 65 78 74 65 6e 73 69 6f 6e 20 73 75 70 70 6f 72 74 2e ad.the.chrome.extension.support.
1ed80 0a 72 65 71 75 69 72 65 28 27 2e 2f 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 27 29 0a 0a .require('./chrome-extension')..
1eda0 2f 2f 20 4c 6f 61 64 20 69 6e 74 65 72 6e 61 6c 20 64 65 73 6b 74 6f 70 2d 63 61 70 74 75 72 65 //.Load.internal.desktop-capture
1edc0 72 20 6d 6f 64 75 6c 65 2e 0a 72 65 71 75 69 72 65 28 27 2e 2f 64 65 73 6b 74 6f 70 2d 63 61 70 r.module..require('./desktop-cap
1ede0 74 75 72 65 72 27 29 0a 0a 2f 2f 20 4c 6f 61 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 6f 64 75 6c 65 turer')..//.Load.protocol.module
1ee00 20 74 6f 20 65 6e 73 75 72 65 20 69 74 20 69 73 20 70 6f 70 75 6c 61 74 65 64 20 6f 6e 20 61 70 .to.ensure.it.is.populated.on.ap
1ee20 70 20 72 65 61 64 79 0a 72 65 71 75 69 72 65 28 27 2e 2f 61 70 69 2f 70 72 6f 74 6f 63 6f 6c 27 p.ready.require('./api/protocol'
1ee40 29 0a 0a 2f 2f 20 53 65 74 20 6d 61 69 6e 20 73 74 61 72 74 75 70 20 73 63 72 69 70 74 20 6f 66 )..//.Set.main.startup.script.of
1ee60 20 74 68 65 20 61 70 70 2e 0a 63 6f 6e 73 74 20 6d 61 69 6e 53 74 61 72 74 75 70 53 63 72 69 70 .the.app..const.mainStartupScrip
1ee80 74 20 3d 20 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 6d 61 69 6e 20 7c 7c 20 27 69 6e 64 65 78 2e 6a t.=.packageJson.main.||.'index.j
1eea0 73 27 0a 0a 2f 2f 20 57 6f 72 6b 61 72 6f 75 6e 64 20 66 6f 72 20 65 6c 65 63 74 72 6f 6e 2f 65 s'..//.Workaround.for.electron/e
1eec0 6c 65 63 74 72 6f 6e 23 35 30 35 30 20 61 6e 64 20 65 6c 65 63 74 72 6f 6e 2f 65 6c 65 63 74 72 lectron#5050.and.electron/electr
1eee0 6f 6e 23 39 30 34 36 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d on#9046.if.(process.platform.===
1ef00 20 27 6c 69 6e 75 78 27 20 26 26 20 5b 27 50 61 6e 74 68 65 6f 6e 27 2c 20 27 55 6e 69 74 79 3a .'linux'.&&.['Pantheon',.'Unity:
1ef20 55 6e 69 74 79 37 27 2c 20 27 75 62 75 6e 74 75 3a 47 4e 4f 4d 45 27 5d 2e 69 6e 63 6c 75 64 65 Unity7',.'ubuntu:GNOME'].include
1ef40 73 28 70 72 6f 63 65 73 73 2e 65 6e 76 2e 58 44 47 5f 43 55 52 52 45 4e 54 5f 44 45 53 4b 54 4f s(process.env.XDG_CURRENT_DESKTO
1ef60 50 29 29 20 7b 0a 20 20 70 72 6f 63 65 73 73 2e 65 6e 76 2e 58 44 47 5f 43 55 52 52 45 4e 54 5f P)).{...process.env.XDG_CURRENT_
1ef80 44 45 53 4b 54 4f 50 20 3d 20 27 55 6e 69 74 79 27 0a 7d 0a 0a 2f 2f 20 46 69 6e 61 6c 6c 79 20 DESKTOP.=.'Unity'.}..//.Finally.
1efa0 6c 6f 61 64 20 61 70 70 27 73 20 6d 61 69 6e 2e 6a 73 20 61 6e 64 20 74 72 61 6e 73 66 65 72 20 load.app's.main.js.and.transfer.
1efc0 63 6f 6e 74 72 6f 6c 20 74 6f 20 43 2b 2b 2e 0a 4d 6f 64 75 6c 65 2e 5f 6c 6f 61 64 28 70 61 74 control.to.C++..Module._load(pat
1efe0 68 2e 6a 6f 69 6e 28 70 61 63 6b 61 67 65 50 61 74 68 2c 20 6d 61 69 6e 53 74 61 72 74 75 70 53 h.join(packagePath,.mainStartupS
1f000 63 72 69 70 74 29 2c 20 4d 6f 64 75 6c 65 2c 20 74 72 75 65 29 0a 27 75 73 65 20 73 74 72 69 63 cript),.Module,.true).'use.stric
1f020 74 27 0a 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 t'..const.v8Util.=.process.atomB
1f040 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 0a 63 6c 61 73 73 20 4f 62 6a 65 63 74 73 inding('v8_util')..class.Objects
1f060 52 65 67 69 73 74 72 79 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 29 20 7b 0a 20 20 Registry.{...constructor.().{...
1f080 20 20 74 68 69 73 2e 6e 65 78 74 49 64 20 3d 20 30 0a 0a 20 20 20 20 2f 2f 20 53 74 6f 72 65 73 ..this.nextId.=.0......//.Stores
1f0a0 20 61 6c 6c 20 6f 62 6a 65 63 74 73 20 62 79 20 72 65 66 2d 63 6f 75 6e 74 69 6e 67 2e 0a 20 20 .all.objects.by.ref-counting....
1f0c0 20 20 2f 2f 20 28 69 64 29 20 3d 3e 20 7b 6f 62 6a 65 63 74 2c 20 63 6f 75 6e 74 7d 0a 20 20 20 ..//.(id).=>.{object,.count}....
1f0e0 20 74 68 69 73 2e 73 74 6f 72 61 67 65 20 3d 20 7b 7d 0a 0a 20 20 20 20 2f 2f 20 53 74 6f 72 65 .this.storage.=.{}......//.Store
1f100 73 20 74 68 65 20 49 44 73 20 6f 66 20 6f 62 6a 65 63 74 73 20 72 65 66 65 72 65 6e 63 65 64 20 s.the.IDs.of.objects.referenced.
1f120 62 79 20 57 65 62 43 6f 6e 74 65 6e 74 73 2e 0a 20 20 20 20 2f 2f 20 28 77 65 62 43 6f 6e 74 65 by.WebContents......//.(webConte
1f140 6e 74 73 49 64 29 20 3d 3e 20 5b 69 64 5d 0a 20 20 20 20 74 68 69 73 2e 6f 77 6e 65 72 73 20 3d ntsId).=>.[id].....this.owners.=
1f160 20 7b 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 52 65 67 69 73 74 65 72 20 61 20 6e 65 77 20 6f 62 6a .{}...}....//.Register.a.new.obj
1f180 65 63 74 20 61 6e 64 20 72 65 74 75 72 6e 20 69 74 73 20 61 73 73 69 67 6e 65 64 20 49 44 2e 20 ect.and.return.its.assigned.ID..
1f1a0 49 66 20 74 68 65 20 6f 62 6a 65 63 74 20 69 73 20 61 6c 72 65 61 64 79 0a 20 20 2f 2f 20 72 65 If.the.object.is.already...//.re
1f1c0 67 69 73 74 65 72 65 64 20 74 68 65 6e 20 74 68 65 20 61 6c 72 65 61 64 79 20 61 73 73 69 67 6e gistered.then.the.already.assign
1f1e0 65 64 20 49 44 20 77 6f 75 6c 64 20 62 65 20 72 65 74 75 72 6e 65 64 2e 0a 20 20 61 64 64 20 28 ed.ID.would.be.returned....add.(
1f200 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 6f 62 6a 29 20 7b 0a 20 20 20 20 2f 2f 20 47 65 74 20 6f webContents,.obj).{.....//.Get.o
1f220 72 20 61 73 73 69 67 6e 20 61 6e 20 49 44 20 74 6f 20 74 68 65 20 6f 62 6a 65 63 74 2e 0a 20 20 r.assign.an.ID.to.the.object....
1f240 20 20 63 6f 6e 73 74 20 69 64 20 3d 20 74 68 69 73 2e 73 61 76 65 54 6f 53 74 6f 72 61 67 65 28 ..const.id.=.this.saveToStorage(
1f260 6f 62 6a 29 0a 0a 20 20 20 20 2f 2f 20 41 64 64 20 6f 62 6a 65 63 74 20 74 6f 20 74 68 65 20 73 obj)......//.Add.object.to.the.s
1f280 65 74 20 6f 66 20 72 65 66 65 72 65 6e 63 65 64 20 6f 62 6a 65 63 74 73 2e 0a 20 20 20 20 63 6f et.of.referenced.objects......co
1f2a0 6e 73 74 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e nst.webContentsId.=.webContents.
1f2c0 67 65 74 49 64 28 29 0a 20 20 20 20 6c 65 74 20 6f 77 6e 65 72 20 3d 20 74 68 69 73 2e 6f 77 6e getId().....let.owner.=.this.own
1f2e0 65 72 73 5b 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 5d 0a 20 20 20 20 69 66 20 28 21 6f 77 6e 65 ers[webContentsId].....if.(!owne
1f300 72 29 20 7b 0a 20 20 20 20 20 20 6f 77 6e 65 72 20 3d 20 74 68 69 73 2e 6f 77 6e 65 72 73 5b 77 r).{.......owner.=.this.owners[w
1f320 65 62 43 6f 6e 74 65 6e 74 73 49 64 5d 20 3d 20 6e 65 77 20 53 65 74 28 29 0a 20 20 20 20 20 20 ebContentsId].=.new.Set().......
1f340 74 68 69 73 2e 72 65 67 69 73 74 65 72 44 65 6c 65 74 65 4c 69 73 74 65 6e 65 72 28 77 65 62 43 this.registerDeleteListener(webC
1f360 6f 6e 74 65 6e 74 73 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 29 0a 20 20 20 20 7d 0a 20 20 ontents,.webContentsId).....}...
1f380 20 20 69 66 20 28 21 6f 77 6e 65 72 2e 68 61 73 28 69 64 29 29 20 7b 0a 20 20 20 20 20 20 6f 77 ..if.(!owner.has(id)).{.......ow
1f3a0 6e 65 72 2e 61 64 64 28 69 64 29 0a 20 20 20 20 20 20 2f 2f 20 49 6e 63 72 65 61 73 65 20 72 65 ner.add(id).......//.Increase.re
1f3c0 66 65 72 65 6e 63 65 20 63 6f 75 6e 74 20 69 66 20 6e 6f 74 20 72 65 66 65 72 65 6e 63 65 64 20 ference.count.if.not.referenced.
1f3e0 62 65 66 6f 72 65 2e 0a 20 20 20 20 20 20 74 68 69 73 2e 73 74 6f 72 61 67 65 5b 69 64 5d 2e 63 before........this.storage[id].c
1f400 6f 75 6e 74 2b 2b 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 69 64 0a 20 20 7d 0a 0a ount++.....}.....return.id...}..
1f420 20 20 2f 2f 20 47 65 74 20 61 6e 20 6f 62 6a 65 63 74 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 ..//.Get.an.object.according.to.
1f440 69 74 73 20 49 44 2e 0a 20 20 67 65 74 20 28 69 64 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 70 its.ID....get.(id).{.....const.p
1f460 6f 69 6e 74 65 72 20 3d 20 74 68 69 73 2e 73 74 6f 72 61 67 65 5b 69 64 5d 0a 20 20 20 20 69 66 ointer.=.this.storage[id].....if
1f480 20 28 70 6f 69 6e 74 65 72 20 21 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e 20 70 6f 69 6e 74 65 .(pointer.!=.null).return.pointe
1f4a0 72 2e 6f 62 6a 65 63 74 0a 20 20 7d 0a 0a 20 20 2f 2f 20 44 65 72 65 66 65 72 65 6e 63 65 20 61 r.object...}....//.Dereference.a
1f4c0 6e 20 6f 62 6a 65 63 74 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 69 74 73 20 49 44 2e 0a 20 20 n.object.according.to.its.ID....
1f4e0 72 65 6d 6f 76 65 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c 20 69 64 29 20 7b 0a 20 20 20 remove.(webContentsId,.id).{....
1f500 20 2f 2f 20 44 65 72 65 66 65 72 65 6e 63 65 20 66 72 6f 6d 20 74 68 65 20 73 74 6f 72 61 67 65 .//.Dereference.from.the.storage
1f520 2e 0a 20 20 20 20 74 68 69 73 2e 64 65 72 65 66 65 72 65 6e 63 65 28 69 64 29 0a 0a 20 20 20 20 ......this.dereference(id)......
1f540 2f 2f 20 41 6c 73 6f 20 72 65 6d 6f 76 65 20 74 68 65 20 72 65 66 65 72 65 6e 63 65 20 69 6e 20 //.Also.remove.the.reference.in.
1f560 6f 77 6e 65 72 2e 0a 20 20 20 20 6c 65 74 20 6f 77 6e 65 72 20 3d 20 74 68 69 73 2e 6f 77 6e 65 owner......let.owner.=.this.owne
1f580 72 73 5b 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 5d 0a 20 20 20 20 69 66 20 28 6f 77 6e 65 72 29 rs[webContentsId].....if.(owner)
1f5a0 20 7b 0a 20 20 20 20 20 20 6f 77 6e 65 72 2e 64 65 6c 65 74 65 28 69 64 29 0a 20 20 20 20 7d 0a .{.......owner.delete(id).....}.
1f5c0 20 20 7d 0a 0a 20 20 2f 2f 20 43 6c 65 61 72 20 61 6c 6c 20 72 65 66 65 72 65 6e 63 65 73 20 74 ..}....//.Clear.all.references.t
1f5e0 6f 20 6f 62 6a 65 63 74 73 20 72 65 66 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 57 65 62 43 6f o.objects.refrenced.by.the.WebCo
1f600 6e 74 65 6e 74 73 2e 0a 20 20 63 6c 65 61 72 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 29 20 ntents....clear.(webContentsId).
1f620 7b 0a 20 20 20 20 6c 65 74 20 6f 77 6e 65 72 20 3d 20 74 68 69 73 2e 6f 77 6e 65 72 73 5b 77 65 {.....let.owner.=.this.owners[we
1f640 62 43 6f 6e 74 65 6e 74 73 49 64 5d 0a 20 20 20 20 69 66 20 28 21 6f 77 6e 65 72 29 20 72 65 74 bContentsId].....if.(!owner).ret
1f660 75 72 6e 0a 0a 20 20 20 20 66 6f 72 20 28 6c 65 74 20 69 64 20 6f 66 20 6f 77 6e 65 72 29 20 74 urn......for.(let.id.of.owner).t
1f680 68 69 73 2e 64 65 72 65 66 65 72 65 6e 63 65 28 69 64 29 0a 0a 20 20 20 20 64 65 6c 65 74 65 20 his.dereference(id)......delete.
1f6a0 74 68 69 73 2e 6f 77 6e 65 72 73 5b 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 5d 0a 20 20 7d 0a 0a this.owners[webContentsId]...}..
1f6c0 20 20 2f 2f 20 50 72 69 76 61 74 65 3a 20 53 61 76 65 73 20 74 68 65 20 6f 62 6a 65 63 74 20 69 ..//.Private:.Saves.the.object.i
1f6e0 6e 74 6f 20 73 74 6f 72 61 67 65 20 61 6e 64 20 61 73 73 69 67 6e 73 20 61 6e 20 49 44 20 66 6f nto.storage.and.assigns.an.ID.fo
1f700 72 20 69 74 2e 0a 20 20 73 61 76 65 54 6f 53 74 6f 72 61 67 65 20 28 6f 62 6a 65 63 74 29 20 7b r.it....saveToStorage.(object).{
1f720 0a 20 20 20 20 6c 65 74 20 69 64 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 .....let.id.=.v8Util.getHiddenVa
1f740 6c 75 65 28 6f 62 6a 65 63 74 2c 20 27 61 74 6f 6d 49 64 27 29 0a 20 20 20 20 69 66 20 28 21 69 lue(object,.'atomId').....if.(!i
1f760 64 29 20 7b 0a 20 20 20 20 20 20 69 64 20 3d 20 2b 2b 74 68 69 73 2e 6e 65 78 74 49 64 0a 20 20 d).{.......id.=.++this.nextId...
1f780 20 20 20 20 74 68 69 73 2e 73 74 6f 72 61 67 65 5b 69 64 5d 20 3d 20 7b 0a 20 20 20 20 20 20 20 ....this.storage[id].=.{........
1f7a0 20 63 6f 75 6e 74 3a 20 30 2c 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 3a 20 6f 62 6a 65 63 .count:.0,.........object:.objec
1f7c0 74 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e t.......}.......v8Util.setHidden
1f7e0 56 61 6c 75 65 28 6f 62 6a 65 63 74 2c 20 27 61 74 6f 6d 49 64 27 2c 20 69 64 29 0a 20 20 20 20 Value(object,.'atomId',.id).....
1f800 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 69 64 0a 20 20 7d 0a 0a 20 20 2f 2f 20 50 72 69 76 61 74 }.....return.id...}....//.Privat
1f820 65 3a 20 44 65 72 65 66 65 72 65 6e 63 65 20 74 68 65 20 6f 62 6a 65 63 74 20 66 72 6f 6d 20 73 e:.Dereference.the.object.from.s
1f840 74 6f 72 65 2e 0a 20 20 64 65 72 65 66 65 72 65 6e 63 65 20 28 69 64 29 20 7b 0a 20 20 20 20 6c tore....dereference.(id).{.....l
1f860 65 74 20 70 6f 69 6e 74 65 72 20 3d 20 74 68 69 73 2e 73 74 6f 72 61 67 65 5b 69 64 5d 0a 20 20 et.pointer.=.this.storage[id]...
1f880 20 20 69 66 20 28 70 6f 69 6e 74 65 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 72 ..if.(pointer.==.null).{.......r
1f8a0 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 70 6f 69 6e 74 65 72 2e 63 6f 75 6e 74 20 2d 3d eturn.....}.....pointer.count.-=
1f8c0 20 31 0a 20 20 20 20 69 66 20 28 70 6f 69 6e 74 65 72 2e 63 6f 75 6e 74 20 3d 3d 3d 20 30 29 20 .1.....if.(pointer.count.===.0).
1f8e0 7b 0a 20 20 20 20 20 20 76 38 55 74 69 6c 2e 64 65 6c 65 74 65 48 69 64 64 65 6e 56 61 6c 75 65 {.......v8Util.deleteHiddenValue
1f900 28 70 6f 69 6e 74 65 72 2e 6f 62 6a 65 63 74 2c 20 27 61 74 6f 6d 49 64 27 29 0a 20 20 20 20 20 (pointer.object,.'atomId')......
1f920 20 64 65 6c 65 74 65 20 74 68 69 73 2e 73 74 6f 72 61 67 65 5b 69 64 5d 0a 20 20 20 20 7d 0a 20 .delete.this.storage[id].....}..
1f940 20 7d 0a 0a 20 20 2f 2f 20 50 72 69 76 61 74 65 3a 20 43 6c 65 61 72 20 74 68 65 20 73 74 6f 72 .}....//.Private:.Clear.the.stor
1f960 61 67 65 20 77 68 65 6e 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 69 73 20 72 65 6c 6f 61 64 65 64 age.when.webContents.is.reloaded
1f980 2f 6e 61 76 69 67 61 74 65 64 2e 0a 20 20 72 65 67 69 73 74 65 72 44 65 6c 65 74 65 4c 69 73 74 /navigated....registerDeleteList
1f9a0 65 6e 65 72 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 ener.(webContents,.webContentsId
1f9c0 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 70 72 6f 63 65 73 73 49 64 20 3d 20 77 65 62 43 6f 6e ).{.....const.processId.=.webCon
1f9e0 74 65 6e 74 73 2e 67 65 74 50 72 6f 63 65 73 73 49 64 28 29 0a 20 20 20 20 63 6f 6e 73 74 20 6c tents.getProcessId().....const.l
1fa00 69 73 74 65 6e 65 72 20 3d 20 28 65 76 65 6e 74 2c 20 64 65 6c 65 74 65 64 50 72 6f 63 65 73 73 istener.=.(event,.deletedProcess
1fa20 49 64 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 66 20 28 64 65 6c 65 74 65 64 50 72 6f 63 65 73 Id).=>.{.......if.(deletedProces
1fa40 73 49 64 20 3d 3d 3d 20 70 72 6f 63 65 73 73 49 64 29 20 7b 0a 20 20 20 20 20 20 20 20 77 65 62 sId.===.processId).{.........web
1fa60 43 6f 6e 74 65 6e 74 73 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 72 65 6e 64 65 72 2d Contents.removeListener('render-
1fa80 76 69 65 77 2d 64 65 6c 65 74 65 64 27 2c 20 6c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 20 20 20 view-deleted',.listener)........
1faa0 20 74 68 69 73 2e 63 6c 65 61 72 28 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 29 0a 20 20 20 20 20 .this.clear(webContentsId)......
1fac0 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 72 65 6e .}.....}.....webContents.on('ren
1fae0 64 65 72 2d 76 69 65 77 2d 64 65 6c 65 74 65 64 27 2c 20 6c 69 73 74 65 6e 65 72 29 0a 20 20 7d der-view-deleted',.listener)...}
1fb00 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 6e 65 77 20 4f 62 6a 65 63 74 73 .}..module.exports.=.new.Objects
1fb20 52 65 67 69 73 74 72 79 28 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b Registry().'use.strict'..const.{
1fb40 42 75 66 66 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 62 75 66 66 65 72 27 29 0a 63 6f 6e 73 Buffer}.=.require('buffer').cons
1fb60 74 20 65 6c 65 63 74 72 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 t.electron.=.require('electron')
1fb80 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 .const.v8Util.=.process.atomBind
1fba0 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 63 6f 6e 73 74 20 7b 57 65 62 43 6f 6e 74 65 6e 74 ing('v8_util').const.{WebContent
1fbc0 73 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 77 65 62 5f 63 6f s}.=.process.atomBinding('web_co
1fbe0 6e 74 65 6e 74 73 27 29 0a 0a 63 6f 6e 73 74 20 7b 69 70 63 4d 61 69 6e 2c 20 69 73 50 72 6f 6d ntents')..const.{ipcMain,.isProm
1fc00 69 73 65 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 7d 20 3d 20 65 6c 65 63 74 72 6f 6e 0a 0a 63 6f ise,.webContents}.=.electron..co
1fc20 6e 73 74 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 20 3d 20 72 65 71 75 69 72 65 28 27 2e nst.objectsRegistry.=.require('.
1fc40 2f 6f 62 6a 65 63 74 73 2d 72 65 67 69 73 74 72 79 27 29 0a 0a 63 6f 6e 73 74 20 68 61 73 50 72 /objects-registry')..const.hasPr
1fc60 6f 70 20 3d 20 7b 7d 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 0a 0a 2f 2f 20 54 68 65 20 69 op.=.{}.hasOwnProperty..//.The.i
1fc80 6e 74 65 72 6e 61 6c 20 70 72 6f 70 65 72 74 69 65 73 20 6f 66 20 46 75 6e 63 74 69 6f 6e 2e 0a nternal.properties.of.Function..
1fca0 63 6f 6e 73 74 20 46 55 4e 43 54 49 4f 4e 5f 50 52 4f 50 45 52 54 49 45 53 20 3d 20 5b 0a 20 20 const.FUNCTION_PROPERTIES.=.[...
1fcc0 27 6c 65 6e 67 74 68 27 2c 20 27 6e 61 6d 65 27 2c 20 27 61 72 67 75 6d 65 6e 74 73 27 2c 20 27 'length',.'name',.'arguments',.'
1fce0 63 61 6c 6c 65 72 27 2c 20 27 70 72 6f 74 6f 74 79 70 65 27 0a 5d 0a 0a 2f 2f 20 54 68 65 20 72 caller',.'prototype'.]..//.The.r
1fd00 65 6d 6f 74 65 20 66 75 6e 63 74 69 6f 6e 73 20 69 6e 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 emote.functions.in.renderer.proc
1fd20 65 73 73 65 73 2e 0a 2f 2f 20 69 64 20 3d 3e 20 46 75 6e 63 74 69 6f 6e 0a 6c 65 74 20 72 65 6e esses..//.id.=>.Function.let.ren
1fd40 64 65 72 65 72 46 75 6e 63 74 69 6f 6e 73 20 3d 20 76 38 55 74 69 6c 2e 63 72 65 61 74 65 44 6f dererFunctions.=.v8Util.createDo
1fd60 75 62 6c 65 49 44 57 65 61 6b 4d 61 70 28 29 0a 0a 2f 2f 20 52 65 74 75 72 6e 20 74 68 65 20 64 ubleIDWeakMap()..//.Return.the.d
1fd80 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 6f 62 6a 65 63 74 27 73 20 6d 65 6d 62 65 72 73 3a 0a escription.of.object's.members:.
1fda0 6c 65 74 20 67 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 let.getObjectMembers.=.function.
1fdc0 28 6f 62 6a 65 63 74 29 20 7b 0a 20 20 6c 65 74 20 6e 61 6d 65 73 20 3d 20 4f 62 6a 65 63 74 2e (object).{...let.names.=.Object.
1fde0 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 4e 61 6d 65 73 28 6f 62 6a 65 63 74 29 0a 20 20 2f 2f getOwnPropertyNames(object)...//
1fe00 20 46 6f 72 20 46 75 6e 63 74 69 6f 6e 2c 20 77 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 6f 76 65 .For.Function,.we.should.not.ove
1fe20 72 72 69 64 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 70 65 72 74 69 65 73 20 65 76 65 6e 20 rride.following.properties.even.
1fe40 74 68 6f 75 67 68 20 74 68 65 79 0a 20 20 2f 2f 20 61 72 65 20 22 6f 77 6e 22 20 70 72 6f 70 65 though.they...//.are."own".prope
1fe60 72 74 69 65 73 2e 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 6f 62 6a 65 63 74 20 3d 3d 3d 20 27 rties....if.(typeof.object.===.'
1fe80 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 6e 61 6d 65 73 20 3d 20 6e 61 6d 65 73 2e 66 function').{.....names.=.names.f
1fea0 69 6c 74 65 72 28 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 21 ilter((name).=>.{.......return.!
1fec0 46 55 4e 43 54 49 4f 4e 5f 50 52 4f 50 45 52 54 49 45 53 2e 69 6e 63 6c 75 64 65 73 28 6e 61 6d FUNCTION_PROPERTIES.includes(nam
1fee0 65 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 20 20 2f 2f 20 4d 61 70 20 70 72 6f 70 65 72 74 69 65 e).....})...}...//.Map.propertie
1ff00 73 20 74 6f 20 64 65 73 63 72 69 70 74 6f 72 73 2e 0a 20 20 72 65 74 75 72 6e 20 6e 61 6d 65 73 s.to.descriptors....return.names
1ff20 2e 6d 61 70 28 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 6c 65 74 20 64 65 73 63 72 69 70 .map((name).=>.{.....let.descrip
1ff40 74 6f 72 20 3d 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 72 tor.=.Object.getOwnPropertyDescr
1ff60 69 70 74 6f 72 28 6f 62 6a 65 63 74 2c 20 6e 61 6d 65 29 0a 20 20 20 20 6c 65 74 20 6d 65 6d 62 iptor(object,.name).....let.memb
1ff80 65 72 20 3d 20 7b 6e 61 6d 65 2c 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 64 65 73 63 72 69 70 74 er.=.{name,.enumerable:.descript
1ffa0 6f 72 2e 65 6e 75 6d 65 72 61 62 6c 65 2c 20 77 72 69 74 61 62 6c 65 3a 20 66 61 6c 73 65 7d 0a or.enumerable,.writable:.false}.
1ffc0 20 20 20 20 69 66 20 28 64 65 73 63 72 69 70 74 6f 72 2e 67 65 74 20 3d 3d 3d 20 75 6e 64 65 66 ....if.(descriptor.get.===.undef
1ffe0 69 6e 65 64 20 26 26 20 74 79 70 65 6f 66 20 6f 62 6a 65 63 74 5b 6e 61 6d 65 5d 20 3d 3d 3d 20 ined.&&.typeof.object[name].===.
20000 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 6d 65 6d 62 65 72 2e 74 79 70 65 20 'function').{.......member.type.
20020 3d 20 27 6d 65 74 68 6f 64 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 69 66 =.'method'.....}.else.{.......if
20040 20 28 64 65 73 63 72 69 70 74 6f 72 2e 73 65 74 20 7c 7c 20 64 65 73 63 72 69 70 74 6f 72 2e 77 .(descriptor.set.||.descriptor.w
20060 72 69 74 61 62 6c 65 29 20 6d 65 6d 62 65 72 2e 77 72 69 74 61 62 6c 65 20 3d 20 74 72 75 65 0a ritable).member.writable.=.true.
20080 20 20 20 20 20 20 6d 65 6d 62 65 72 2e 74 79 70 65 20 3d 20 27 67 65 74 27 0a 20 20 20 20 7d 0a ......member.type.=.'get'.....}.
200a0 20 20 20 20 72 65 74 75 72 6e 20 6d 65 6d 62 65 72 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 52 65 74 ....return.member...}).}..//.Ret
200c0 75 72 6e 20 74 68 65 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 6f 62 6a 65 63 74 27 73 20 urn.the.description.of.object's.
200e0 70 72 6f 74 6f 74 79 70 65 2e 0a 6c 65 74 20 67 65 74 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 prototype..let.getObjectPrototyp
20100 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 62 6a 65 63 74 29 20 7b 0a 20 20 6c 65 74 20 70 72 e.=.function.(object).{...let.pr
20120 6f 74 6f 20 3d 20 4f 62 6a 65 63 74 2e 67 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 6f 62 6a 65 oto.=.Object.getPrototypeOf(obje
20140 63 74 29 0a 20 20 69 66 20 28 70 72 6f 74 6f 20 3d 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 70 72 6f 74 ct)...if.(proto.===.null.||.prot
20160 6f 20 3d 3d 3d 20 4f 62 6a 65 63 74 2e 70 72 6f 74 6f 74 79 70 65 29 20 72 65 74 75 72 6e 20 6e o.===.Object.prototype).return.n
20180 75 6c 6c 0a 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 6d 65 6d 62 65 72 73 3a 20 67 65 74 4f ull...return.{.....members:.getO
201a0 62 6a 65 63 74 4d 65 6d 62 65 72 73 28 70 72 6f 74 6f 29 2c 0a 20 20 20 20 70 72 6f 74 6f 3a 20 bjectMembers(proto),.....proto:.
201c0 67 65 74 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 65 28 70 72 6f 74 6f 29 0a 20 20 7d 0a 7d 0a getObjectPrototype(proto)...}.}.
201e0 0a 2f 2f 20 43 6f 6e 76 65 72 74 20 61 20 72 65 61 6c 20 76 61 6c 75 65 20 69 6e 74 6f 20 6d 65 .//.Convert.a.real.value.into.me
20200 74 61 20 64 61 74 61 2e 0a 6c 65 74 20 76 61 6c 75 65 54 6f 4d 65 74 61 20 3d 20 66 75 6e 63 74 ta.data..let.valueToMeta.=.funct
20220 69 6f 6e 20 28 73 65 6e 64 65 72 2c 20 76 61 6c 75 65 2c 20 6f 70 74 69 6d 69 7a 65 53 69 6d 70 ion.(sender,.value,.optimizeSimp
20240 6c 65 4f 62 6a 65 63 74 20 3d 20 66 61 6c 73 65 29 20 7b 0a 20 20 2f 2f 20 44 65 74 65 72 6d 69 leObject.=.false).{...//.Determi
20260 6e 65 20 74 68 65 20 74 79 70 65 20 6f 66 20 76 61 6c 75 65 2e 0a 20 20 63 6f 6e 73 74 20 6d 65 ne.the.type.of.value....const.me
20280 74 61 20 3d 20 7b 20 74 79 70 65 3a 20 74 79 70 65 6f 66 20 76 61 6c 75 65 20 7d 0a 20 20 69 66 ta.=.{.type:.typeof.value.}...if
202a0 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 .(meta.type.===.'object').{.....
202c0 2f 2f 20 52 65 63 6f 67 6e 69 7a 65 20 63 65 72 74 61 69 6e 20 74 79 70 65 73 20 6f 66 20 6f 62 //.Recognize.certain.types.of.ob
202e0 6a 65 63 74 73 2e 0a 20 20 20 20 69 66 20 28 76 61 6c 75 65 20 3d 3d 3d 20 6e 75 6c 6c 29 20 7b jects......if.(value.===.null).{
20300 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 76 61 6c 75 65 27 0a 20 20 20 20 7d .......meta.type.=.'value'.....}
20320 20 65 6c 73 65 20 69 66 20 28 41 72 72 61 79 42 75 66 66 65 72 2e 69 73 56 69 65 77 28 76 61 6c .else.if.(ArrayBuffer.isView(val
20340 75 65 29 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 62 75 66 66 65 72 ue)).{.......meta.type.=.'buffer
20360 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 76 '.....}.else.if.(Array.isArray(v
20380 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 61 72 72 61 alue)).{.......meta.type.=.'arra
203a0 79 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 76 61 6c 75 65 20 69 6e 73 74 61 6e 63 65 y'.....}.else.if.(value.instance
203c0 6f 66 20 45 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 65 of.Error).{.......meta.type.=.'e
203e0 72 72 6f 72 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 76 61 6c 75 65 20 69 6e 73 74 61 rror'.....}.else.if.(value.insta
20400 6e 63 65 6f 66 20 44 61 74 65 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 nceof.Date).{.......meta.type.=.
20420 27 64 61 74 65 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 69 73 50 72 6f 6d 69 73 65 28 'date'.....}.else.if.(isPromise(
20440 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 70 72 6f value)).{.......meta.type.=.'pro
20460 6d 69 73 65 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 68 61 73 50 72 6f 70 2e 63 61 6c mise'.....}.else.if.(hasProp.cal
20480 6c 28 76 61 6c 75 65 2c 20 27 63 61 6c 6c 65 65 27 29 20 26 26 20 76 61 6c 75 65 2e 6c 65 6e 67 l(value,.'callee').&&.value.leng
204a0 74 68 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 54 72 65 61 74 20 74 68 65 th.!=.null).{.......//.Treat.the
204c0 20 61 72 67 75 6d 65 6e 74 73 20 6f 62 6a 65 63 74 20 61 73 20 61 72 72 61 79 2e 0a 20 20 20 20 .arguments.object.as.array......
204e0 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 61 72 72 61 79 27 0a 20 20 20 20 7d 20 65 6c 73 65 ..meta.type.=.'array'.....}.else
20500 20 69 66 20 28 6f 70 74 69 6d 69 7a 65 53 69 6d 70 6c 65 4f 62 6a 65 63 74 20 26 26 20 76 38 55 .if.(optimizeSimpleObject.&&.v8U
20520 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 76 61 6c 75 65 2c 20 27 73 69 6d 70 6c til.getHiddenValue(value,.'simpl
20540 65 27 29 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 54 72 65 61 74 20 73 69 6d 70 6c 65 20 6f 62 6a e')).{.......//.Treat.simple.obj
20560 65 63 74 73 20 61 73 20 76 61 6c 75 65 2e 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d ects.as.value........meta.type.=
20580 20 27 76 61 6c 75 65 27 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 46 69 6c 6c 20 74 68 .'value'.....}...}....//.Fill.th
205a0 65 20 6d 65 74 61 20 6f 62 6a 65 63 74 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 76 61 6c 75 65 e.meta.object.according.to.value
205c0 27 73 20 74 79 70 65 2e 0a 20 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 61 72 's.type....if.(meta.type.===.'ar
205e0 72 61 79 27 29 20 7b 0a 20 20 20 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 20 3d 20 76 61 6c 75 65 ray').{.....meta.members.=.value
20600 2e 6d 61 70 28 28 65 6c 29 20 3d 3e 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 73 65 6e 64 65 72 2c .map((el).=>.valueToMeta(sender,
20620 20 65 6c 29 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d .el))...}.else.if.(meta.type.===
20640 20 27 6f 62 6a 65 63 74 27 20 7c 7c 20 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 66 75 6e 63 .'object'.||.meta.type.===.'func
20660 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 6d 65 74 61 2e 6e 61 6d 65 20 3d 20 76 61 6c 75 65 2e 63 tion').{.....meta.name.=.value.c
20680 6f 6e 73 74 72 75 63 74 6f 72 20 3f 20 76 61 6c 75 65 2e 63 6f 6e 73 74 72 75 63 74 6f 72 2e 6e onstructor.?.value.constructor.n
206a0 61 6d 65 20 3a 20 27 27 0a 0a 20 20 20 20 2f 2f 20 52 65 66 65 72 65 6e 63 65 20 74 68 65 20 6f ame.:.''......//.Reference.the.o
206c0 72 69 67 69 6e 61 6c 20 76 61 6c 75 65 20 69 66 20 69 74 27 73 20 61 6e 20 6f 62 6a 65 63 74 2c riginal.value.if.it's.an.object,
206e0 20 62 65 63 61 75 73 65 20 77 68 65 6e 20 69 74 27 73 0a 20 20 20 20 2f 2f 20 70 61 73 73 65 64 .because.when.it's.....//.passed
20700 20 74 6f 20 72 65 6e 64 65 72 65 72 20 77 65 20 77 6f 75 6c 64 20 61 73 73 75 6d 65 20 74 68 65 .to.renderer.we.would.assume.the
20720 20 72 65 6e 64 65 72 65 72 20 6b 65 65 70 73 20 61 20 72 65 66 65 72 65 6e 63 65 20 6f 66 0a 20 .renderer.keeps.a.reference.of..
20740 20 20 20 2f 2f 20 69 74 2e 0a 20 20 20 20 6d 65 74 61 2e 69 64 20 3d 20 6f 62 6a 65 63 74 73 52 ...//.it......meta.id.=.objectsR
20760 65 67 69 73 74 72 79 2e 61 64 64 28 73 65 6e 64 65 72 2c 20 76 61 6c 75 65 29 0a 20 20 20 20 6d egistry.add(sender,.value).....m
20780 65 74 61 2e 6d 65 6d 62 65 72 73 20 3d 20 67 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 73 28 76 eta.members.=.getObjectMembers(v
207a0 61 6c 75 65 29 0a 20 20 20 20 6d 65 74 61 2e 70 72 6f 74 6f 20 3d 20 67 65 74 4f 62 6a 65 63 74 alue).....meta.proto.=.getObject
207c0 50 72 6f 74 6f 74 79 70 65 28 76 61 6c 75 65 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6d 65 Prototype(value)...}.else.if.(me
207e0 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 62 75 66 66 65 72 27 29 20 7b 0a 20 20 20 20 6d 65 74 61 ta.type.===.'buffer').{.....meta
20800 2e 76 61 6c 75 65 20 3d 20 42 75 66 66 65 72 2e 66 72 6f 6d 28 76 61 6c 75 65 29 0a 20 20 7d 20 .value.=.Buffer.from(value)...}.
20820 65 6c 73 65 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 70 72 6f 6d 69 73 65 27 else.if.(meta.type.===.'promise'
20840 29 20 7b 0a 20 20 20 20 2f 2f 20 41 64 64 20 64 65 66 61 75 6c 74 20 68 61 6e 64 6c 65 72 20 74 ).{.....//.Add.default.handler.t
20860 6f 20 70 72 65 76 65 6e 74 20 75 6e 68 61 6e 64 6c 65 64 20 72 65 6a 65 63 74 69 6f 6e 73 20 69 o.prevent.unhandled.rejections.i
20880 6e 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 0a 20 20 20 20 2f 2f 20 49 6e 73 74 65 61 64 20 74 68 n.main.process.....//.Instead.th
208a0 65 79 20 73 68 6f 75 6c 64 20 61 70 70 65 61 72 20 69 6e 20 74 68 65 20 72 65 6e 64 65 72 65 72 ey.should.appear.in.the.renderer
208c0 20 70 72 6f 63 65 73 73 0a 20 20 20 20 76 61 6c 75 65 2e 74 68 65 6e 28 66 75 6e 63 74 69 6f 6e .process.....value.then(function
208e0 20 28 29 20 7b 7d 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 7d 29 0a 0a 20 20 20 20 6d 65 74 .().{},.function.().{})......met
20900 61 2e 74 68 65 6e 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 73 65 6e 64 65 72 2c 20 66 75 6e a.then.=.valueToMeta(sender,.fun
20920 63 74 69 6f 6e 20 28 6f 6e 46 75 6c 66 69 6c 6c 65 64 2c 20 6f 6e 52 65 6a 65 63 74 65 64 29 20 ction.(onFulfilled,.onRejected).
20940 7b 0a 20 20 20 20 20 20 76 61 6c 75 65 2e 74 68 65 6e 28 6f 6e 46 75 6c 66 69 6c 6c 65 64 2c 20 {.......value.then(onFulfilled,.
20960 6f 6e 52 65 6a 65 63 74 65 64 29 0a 20 20 20 20 7d 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 onRejected).....})...}.else.if.(
20980 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 65 72 72 6f 72 27 29 20 7b 0a 20 20 20 20 6d 65 74 meta.type.===.'error').{.....met
209a0 61 2e 6d 65 6d 62 65 72 73 20 3d 20 70 6c 61 69 6e 4f 62 6a 65 63 74 54 6f 4d 65 74 61 28 76 61 a.members.=.plainObjectToMeta(va
209c0 6c 75 65 29 0a 0a 20 20 20 20 2f 2f 20 45 72 72 6f 72 2e 6e 61 6d 65 20 69 73 20 6e 6f 74 20 70 lue)......//.Error.name.is.not.p
209e0 61 72 74 20 6f 66 20 6f 77 6e 20 70 72 6f 70 65 72 74 69 65 73 2e 0a 20 20 20 20 6d 65 74 61 2e art.of.own.properties......meta.
20a00 6d 65 6d 62 65 72 73 2e 70 75 73 68 28 7b 0a 20 20 20 20 20 20 6e 61 6d 65 3a 20 27 6e 61 6d 65 members.push({.......name:.'name
20a20 27 2c 0a 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 2e 6e 61 6d 65 0a 20 20 20 20 7d ',.......value:.value.name.....}
20a40 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 64 61 )...}.else.if.(meta.type.===.'da
20a60 74 65 27 29 20 7b 0a 20 20 20 20 6d 65 74 61 2e 76 61 6c 75 65 20 3d 20 76 61 6c 75 65 2e 67 65 te').{.....meta.value.=.value.ge
20a80 74 54 69 6d 65 28 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 6d 65 74 61 2e 74 79 70 65 tTime()...}.else.{.....meta.type
20aa0 20 3d 20 27 76 61 6c 75 65 27 0a 20 20 20 20 6d 65 74 61 2e 76 61 6c 75 65 20 3d 20 76 61 6c 75 .=.'value'.....meta.value.=.valu
20ac0 65 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 0a 7d 0a 0a 2f 2f 20 43 6f 6e 76 65 72 e...}...return.meta.}..//.Conver
20ae0 74 20 6f 62 6a 65 63 74 20 74 6f 20 6d 65 74 61 20 62 79 20 76 61 6c 75 65 2e 0a 63 6f 6e 73 74 t.object.to.meta.by.value..const
20b00 20 70 6c 61 69 6e 4f 62 6a 65 63 74 54 6f 4d 65 74 61 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f .plainObjectToMeta.=.function.(o
20b20 62 6a 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 bj).{...return.Object.getOwnProp
20b40 65 72 74 79 4e 61 6d 65 73 28 6f 62 6a 29 2e 6d 61 70 28 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d ertyNames(obj).map(function.(nam
20b60 65 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 6e 61 6d 65 3a 20 6e 61 e).{.....return.{.......name:.na
20b80 6d 65 2c 0a 20 20 20 20 20 20 76 61 6c 75 65 3a 20 6f 62 6a 5b 6e 61 6d 65 5d 0a 20 20 20 20 7d me,.......value:.obj[name].....}
20ba0 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 43 6f 6e 76 65 72 74 20 45 72 72 6f 72 20 69 6e 74 6f 20 6d ...}).}..//.Convert.Error.into.m
20bc0 65 74 61 20 64 61 74 61 2e 0a 63 6f 6e 73 74 20 65 78 63 65 70 74 69 6f 6e 54 6f 4d 65 74 61 20 eta.data..const.exceptionToMeta.
20be0 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 7b 0a =.function.(error).{...return.{.
20c00 20 20 20 20 74 79 70 65 3a 20 27 65 78 63 65 70 74 69 6f 6e 27 2c 0a 20 20 20 20 6d 65 73 73 61 ....type:.'exception',.....messa
20c20 67 65 3a 20 65 72 72 6f 72 2e 6d 65 73 73 61 67 65 2c 0a 20 20 20 20 73 74 61 63 6b 3a 20 65 72 ge:.error.message,.....stack:.er
20c40 72 6f 72 2e 73 74 61 63 6b 20 7c 7c 20 65 72 72 6f 72 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e 73 74 20 ror.stack.||.error...}.}..const.
20c60 74 68 72 6f 77 52 50 43 45 72 72 6f 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 65 73 73 61 67 throwRPCError.=.function.(messag
20c80 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 65 72 72 6f 72 20 3d 20 6e 65 77 20 45 72 72 6f 72 28 6d e).{...const.error.=.new.Error(m
20ca0 65 73 73 61 67 65 29 0a 20 20 65 72 72 6f 72 2e 63 6f 64 65 20 3d 20 27 45 42 41 44 52 50 43 27 essage)...error.code.=.'EBADRPC'
20cc0 0a 20 20 65 72 72 6f 72 2e 65 72 72 6e 6f 20 3d 20 2d 37 32 0a 20 20 74 68 72 6f 77 20 65 72 72 ...error.errno.=.-72...throw.err
20ce0 6f 72 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 6d 6f 76 65 52 65 6d 6f 74 65 4c 69 73 74 65 6e 65 72 or.}..const.removeRemoteListener
20d00 73 41 6e 64 4c 6f 67 57 61 72 6e 69 6e 67 20 3d 20 28 6d 65 74 61 2c 20 61 72 67 73 2c 20 63 61 sAndLogWarning.=.(meta,.args,.ca
20d20 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 29 20 3d 3e 20 7b 0a 20 20 6c 65 74 20 6d 65 73 73 61 llIntoRenderer).=>.{...let.messa
20d40 67 65 20 3d 20 60 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 61 6c 6c 20 61 20 66 75 6e 63 74 ge.=.`Attempting.to.call.a.funct
20d60 69 6f 6e 20 69 6e 20 61 20 72 65 6e 64 65 72 65 72 20 77 69 6e 64 6f 77 20 74 68 61 74 20 68 61 ion.in.a.renderer.window.that.ha
20d80 73 20 62 65 65 6e 20 63 6c 6f 73 65 64 20 6f 72 20 72 65 6c 65 61 73 65 64 2e 60 20 2b 0a 20 20 s.been.closed.or.released.`.+...
20da0 20 20 60 5c 6e 46 75 6e 63 74 69 6f 6e 20 70 72 6f 76 69 64 65 64 20 68 65 72 65 3a 20 24 7b 6d ..`\nFunction.provided.here:.${m
20dc0 65 74 61 2e 6c 6f 63 61 74 69 6f 6e 7d 60 0a 0a 20 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 eta.location}`....if.(args.lengt
20de0 68 20 3e 20 30 20 26 26 20 28 61 72 67 73 5b 30 5d 2e 73 65 6e 64 65 72 20 69 6e 73 74 61 6e 63 h.>.0.&&.(args[0].sender.instanc
20e00 65 6f 66 20 57 65 62 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 7b 73 eof.WebContents)).{.....const.{s
20e20 65 6e 64 65 72 7d 20 3d 20 61 72 67 73 5b 30 5d 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 6d 6f 74 ender}.=.args[0].....const.remot
20e40 65 45 76 65 6e 74 73 20 3d 20 73 65 6e 64 65 72 2e 65 76 65 6e 74 4e 61 6d 65 73 28 29 2e 66 69 eEvents.=.sender.eventNames().fi
20e60 6c 74 65 72 28 28 65 76 65 6e 74 4e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 72 65 74 75 lter((eventName).=>.{.......retu
20e80 72 6e 20 73 65 6e 64 65 72 2e 6c 69 73 74 65 6e 65 72 73 28 65 76 65 6e 74 4e 61 6d 65 29 2e 69 rn.sender.listeners(eventName).i
20ea0 6e 63 6c 75 64 65 73 28 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 29 0a 20 20 20 20 7d 29 ncludes(callIntoRenderer).....})
20ec0 0a 0a 20 20 20 20 69 66 20 28 72 65 6d 6f 74 65 45 76 65 6e 74 73 2e 6c 65 6e 67 74 68 20 3e 20 ......if.(remoteEvents.length.>.
20ee0 30 29 20 7b 0a 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 2b 3d 20 60 5c 6e 52 65 6d 6f 74 65 20 0).{.......message.+=.`\nRemote.
20f00 65 76 65 6e 74 20 6e 61 6d 65 73 3a 20 24 7b 72 65 6d 6f 74 65 45 76 65 6e 74 73 2e 6a 6f 69 6e event.names:.${remoteEvents.join
20f20 28 27 2c 20 27 29 7d 60 0a 20 20 20 20 20 20 72 65 6d 6f 74 65 45 76 65 6e 74 73 2e 66 6f 72 45 (',.')}`.......remoteEvents.forE
20f40 61 63 68 28 28 65 76 65 6e 74 4e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 73 65 6e ach((eventName).=>.{.........sen
20f60 64 65 72 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 65 76 65 6e 74 4e 61 6d 65 2c 20 63 61 der.removeListener(eventName,.ca
20f80 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 llIntoRenderer).......}).....}..
20fa0 20 7d 0a 0a 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 6d 65 73 73 61 67 65 29 0a 7d 0a 0a 2f .}....console.warn(message).}../
20fc0 2f 20 43 6f 6e 76 65 72 74 20 61 72 72 61 79 20 6f 66 20 6d 65 74 61 20 64 61 74 61 20 66 72 6f /.Convert.array.of.meta.data.fro
20fe0 6d 20 72 65 6e 64 65 72 65 72 20 69 6e 74 6f 20 61 72 72 61 79 20 6f 66 20 72 65 61 6c 20 76 61 m.renderer.into.array.of.real.va
21000 6c 75 65 73 2e 0a 63 6f 6e 73 74 20 75 6e 77 72 61 70 41 72 67 73 20 3d 20 66 75 6e 63 74 69 6f lues..const.unwrapArgs.=.functio
21020 6e 20 28 73 65 6e 64 65 72 2c 20 61 72 67 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 54 n.(sender,.args).{...const.metaT
21040 6f 56 61 6c 75 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 65 74 61 29 20 7b 0a 20 20 20 20 6c oValue.=.function.(meta).{.....l
21060 65 74 20 69 2c 20 6c 65 6e 2c 20 6d 65 6d 62 65 72 2c 20 72 65 66 2c 20 72 65 74 75 72 6e 56 61 et.i,.len,.member,.ref,.returnVa
21080 6c 75 65 0a 20 20 20 20 73 77 69 74 63 68 20 28 6d 65 74 61 2e 74 79 70 65 29 20 7b 0a 20 20 20 lue.....switch.(meta.type).{....
210a0 20 20 20 63 61 73 65 20 27 76 61 6c 75 65 27 3a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 ...case.'value':.........return.
210c0 6d 65 74 61 2e 76 61 6c 75 65 0a 20 20 20 20 20 20 63 61 73 65 20 27 72 65 6d 6f 74 65 2d 6f 62 meta.value.......case.'remote-ob
210e0 6a 65 63 74 27 3a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6f 62 6a 65 63 74 73 52 65 67 ject':.........return.objectsReg
21100 69 73 74 72 79 2e 67 65 74 28 6d 65 74 61 2e 69 64 29 0a 20 20 20 20 20 20 63 61 73 65 20 27 61 istry.get(meta.id).......case.'a
21120 72 72 61 79 27 3a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 75 6e 77 72 61 70 41 72 67 73 rray':.........return.unwrapArgs
21140 28 73 65 6e 64 65 72 2c 20 6d 65 74 61 2e 76 61 6c 75 65 29 0a 20 20 20 20 20 20 63 61 73 65 20 (sender,.meta.value).......case.
21160 27 62 75 66 66 65 72 27 3a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 42 75 66 66 65 72 2e 'buffer':.........return.Buffer.
21180 66 72 6f 6d 28 6d 65 74 61 2e 76 61 6c 75 65 29 0a 20 20 20 20 20 20 63 61 73 65 20 27 64 61 74 from(meta.value).......case.'dat
211a0 65 27 3a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 77 20 44 61 74 65 28 6d 65 74 61 e':.........return.new.Date(meta
211c0 2e 76 61 6c 75 65 29 0a 20 20 20 20 20 20 63 61 73 65 20 27 70 72 6f 6d 69 73 65 27 3a 0a 20 20 .value).......case.'promise':...
211e0 20 20 20 20 20 20 72 65 74 75 72 6e 20 50 72 6f 6d 69 73 65 2e 72 65 73 6f 6c 76 65 28 7b 0a 20 ......return.Promise.resolve({..
21200 20 20 20 20 20 20 20 20 20 74 68 65 6e 3a 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 2e .........then:.metaToValue(meta.
21220 74 68 65 6e 29 0a 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 63 61 73 65 20 27 6f 62 6a then).........}).......case.'obj
21240 65 63 74 27 3a 20 7b 0a 20 20 20 20 20 20 20 20 6c 65 74 20 72 65 74 20 3d 20 7b 7d 0a 20 20 20 ect':.{.........let.ret.=.{}....
21260 20 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 72 65 74 2e 63 .....Object.defineProperty(ret.c
21280 6f 6e 73 74 72 75 63 74 6f 72 2c 20 27 6e 61 6d 65 27 2c 20 7b 20 76 61 6c 75 65 3a 20 6d 65 74 onstructor,.'name',.{.value:.met
212a0 61 2e 6e 61 6d 65 20 7d 29 0a 0a 20 20 20 20 20 20 20 20 72 65 66 20 3d 20 6d 65 74 61 2e 6d 65 a.name.})..........ref.=.meta.me
212c0 6d 62 65 72 73 0a 20 20 20 20 20 20 20 20 66 6f 72 20 28 69 20 3d 20 30 2c 20 6c 65 6e 20 3d 20 mbers.........for.(i.=.0,.len.=.
212e0 72 65 66 2e 6c 65 6e 67 74 68 3b 20 69 20 3c 20 6c 65 6e 3b 20 69 2b 2b 29 20 7b 0a 20 20 20 20 ref.length;.i.<.len;.i++).{.....
21300 20 20 20 20 20 20 6d 65 6d 62 65 72 20 3d 20 72 65 66 5b 69 5d 0a 20 20 20 20 20 20 20 20 20 20 ......member.=.ref[i]...........
21320 72 65 74 5b 6d 65 6d 62 65 72 2e 6e 61 6d 65 5d 20 3d 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d ret[member.name].=.metaToValue(m
21340 65 6d 62 65 72 2e 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 72 ember.value).........}.........r
21360 65 74 75 72 6e 20 72 65 74 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 63 61 73 65 20 27 66 75 eturn.ret.......}.......case.'fu
21380 6e 63 74 69 6f 6e 2d 77 69 74 68 2d 72 65 74 75 72 6e 2d 76 61 6c 75 65 27 3a 0a 20 20 20 20 20 nction-with-return-value':......
213a0 20 20 20 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 ...returnValue.=.metaToValue(met
213c0 61 2e 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e a.value).........return.function
213e0 20 28 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 72 65 74 75 72 6e 56 61 6c .().{...........return.returnVal
21400 75 65 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 63 61 73 65 20 27 66 75 6e 63 74 69 6f ue.........}.......case.'functio
21420 6e 27 3a 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 4d 65 72 67 65 20 77 65 62 43 6f 6e 74 65 6e n':.{.........//.Merge.webConten
21440 74 73 49 64 20 61 6e 64 20 6d 65 74 61 2e 69 64 2c 20 73 69 6e 63 65 20 6d 65 74 61 2e 69 64 20 tsId.and.meta.id,.since.meta.id.
21460 63 61 6e 20 62 65 20 74 68 65 20 73 61 6d 65 20 69 6e 0a 20 20 20 20 20 20 20 20 2f 2f 20 64 69 can.be.the.same.in.........//.di
21480 66 66 65 72 65 6e 74 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 0a 20 20 20 20 20 20 20 20 63 6f 6e fferent.webContents..........con
214a0 73 74 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 20 3d 20 73 65 6e 64 65 72 2e 67 65 74 49 64 28 st.webContentsId.=.sender.getId(
214c0 29 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 6f 62 6a 65 63 74 49 64 20 3d 20 5b 77 65 62 43 ).........const.objectId.=.[webC
214e0 6f 6e 74 65 6e 74 73 49 64 2c 20 6d 65 74 61 2e 69 64 5d 0a 0a 20 20 20 20 20 20 20 20 2f 2f 20 ontentsId,.meta.id]..........//.
21500 43 61 63 68 65 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 73 20 69 6e 20 72 65 6e 64 65 72 65 72 2e Cache.the.callbacks.in.renderer.
21520 0a 20 20 20 20 20 20 20 20 69 66 20 28 72 65 6e 64 65 72 65 72 46 75 6e 63 74 69 6f 6e 73 2e 68 .........if.(rendererFunctions.h
21540 61 73 28 6f 62 6a 65 63 74 49 64 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e as(objectId)).{...........return
21560 20 72 65 6e 64 65 72 65 72 46 75 6e 63 74 69 6f 6e 73 2e 67 65 74 28 6f 62 6a 65 63 74 49 64 29 .rendererFunctions.get(objectId)
21580 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 20 20 6c 65 74 20 63 61 6c 6c 49 6e 74 6f .........}..........let.callInto
215a0 52 65 6e 64 65 72 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a Renderer.=.function.(...args).{.
215c0 20 20 20 20 20 20 20 20 20 20 69 66 20 28 21 73 65 6e 64 65 72 2e 69 73 44 65 73 74 72 6f 79 65 ..........if.(!sender.isDestroye
215e0 64 28 29 20 26 26 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 20 3d 3d 3d 20 73 65 6e 64 65 72 2e d().&&.webContentsId.===.sender.
21600 67 65 74 49 64 28 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 6e 64 65 72 2e 73 65 getId()).{.............sender.se
21620 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 52 45 4e 44 45 52 45 52 5f 43 41 4c 4c 42 41 43 4b 27 2c nd('ELECTRON_RENDERER_CALLBACK',
21640 20 6d 65 74 61 2e 69 64 2c 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 73 65 6e 64 65 72 2c 20 61 72 .meta.id,.valueToMeta(sender,.ar
21660 67 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 gs))...........}.else.{.........
21680 20 20 20 20 72 65 6d 6f 76 65 52 65 6d 6f 74 65 4c 69 73 74 65 6e 65 72 73 41 6e 64 4c 6f 67 57 ....removeRemoteListenersAndLogW
216a0 61 72 6e 69 6e 67 28 6d 65 74 61 2c 20 61 72 67 73 2c 20 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 arning(meta,.args,.callIntoRende
216c0 72 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 rer)...........}.........}......
216e0 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 63 61 6c 6c 49 6e 74 ...Object.defineProperty(callInt
21700 6f 52 65 6e 64 65 72 65 72 2c 20 27 6c 65 6e 67 74 68 27 2c 20 7b 20 76 61 6c 75 65 3a 20 6d 65 oRenderer,.'length',.{.value:.me
21720 74 61 2e 6c 65 6e 67 74 68 20 7d 29 0a 0a 20 20 20 20 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 ta.length.})..........v8Util.set
21740 52 65 6d 6f 74 65 43 61 6c 6c 62 61 63 6b 46 72 65 65 72 28 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 RemoteCallbackFreer(callIntoRend
21760 65 72 65 72 2c 20 6d 65 74 61 2e 69 64 2c 20 73 65 6e 64 65 72 29 0a 20 20 20 20 20 20 20 20 72 erer,.meta.id,.sender).........r
21780 65 6e 64 65 72 65 72 46 75 6e 63 74 69 6f 6e 73 2e 73 65 74 28 6f 62 6a 65 63 74 49 64 2c 20 63 endererFunctions.set(objectId,.c
217a0 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 allIntoRenderer).........return.
217c0 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 64 callIntoRenderer.......}.......d
217e0 65 66 61 75 6c 74 3a 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 efault:.........throw.new.TypeEr
21800 72 6f 72 28 60 55 6e 6b 6e 6f 77 6e 20 74 79 70 65 3a 20 24 7b 6d 65 74 61 2e 74 79 70 65 7d 60 ror(`Unknown.type:.${meta.type}`
21820 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 61 72 67 73 2e 6d 61 70 28 6d 65 ).....}...}...return.args.map(me
21840 74 61 54 6f 56 61 6c 75 65 29 0a 7d 0a 0a 2f 2f 20 43 61 6c 6c 20 61 20 66 75 6e 63 74 69 6f 6e taToValue).}..//.Call.a.function
21860 20 61 6e 64 20 73 65 6e 64 20 72 65 70 6c 79 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 20 69 .and.send.reply.asynchronously.i
21880 66 20 69 74 27 73 20 61 20 61 6e 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 0a 2f 2f 20 73 74 79 6c f.it's.a.an.asynchronous.//.styl
218a0 65 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 74 68 65 20 63 61 6c 6c 65 72 20 64 69 64 6e 27 74 e.function.and.the.caller.didn't
218c0 20 70 61 73 73 20 61 20 63 61 6c 6c 62 61 63 6b 2e 0a 63 6f 6e 73 74 20 63 61 6c 6c 46 75 6e 63 .pass.a.callback..const.callFunc
218e0 74 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 66 75 6e 63 2c 20 63 61 tion.=.function.(event,.func,.ca
21900 6c 6c 65 72 2c 20 61 72 67 73 29 20 7b 0a 20 20 6c 65 74 20 66 75 6e 63 4d 61 72 6b 65 64 41 73 ller,.args).{...let.funcMarkedAs
21920 79 6e 63 2c 20 66 75 6e 63 4e 61 6d 65 2c 20 66 75 6e 63 50 61 73 73 65 64 43 61 6c 6c 62 61 63 ync,.funcName,.funcPassedCallbac
21940 6b 2c 20 72 65 66 2c 20 72 65 74 0a 20 20 66 75 6e 63 4d 61 72 6b 65 64 41 73 79 6e 63 20 3d 20 k,.ref,.ret...funcMarkedAsync.=.
21960 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 66 75 6e 63 2c 20 27 61 73 79 v8Util.getHiddenValue(func,.'asy
21980 6e 63 68 72 6f 6e 6f 75 73 27 29 0a 20 20 66 75 6e 63 50 61 73 73 65 64 43 61 6c 6c 62 61 63 6b nchronous')...funcPassedCallback
219a0 20 3d 20 74 79 70 65 6f 66 20 61 72 67 73 5b 61 72 67 73 2e 6c 65 6e 67 74 68 20 2d 20 31 5d 20 .=.typeof.args[args.length.-.1].
219c0 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 69 66 20 28 66 ===.'function'...try.{.....if.(f
219e0 75 6e 63 4d 61 72 6b 65 64 41 73 79 6e 63 20 26 26 20 21 66 75 6e 63 50 61 73 73 65 64 43 61 6c uncMarkedAsync.&&.!funcPassedCal
21a00 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 61 72 67 73 2e 70 75 73 68 28 66 75 6e 63 74 69 6f lback).{.......args.push(functio
21a20 6e 20 28 72 65 74 29 20 7b 0a 20 20 20 20 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 n.(ret).{.........event.returnVa
21a40 6c 75 65 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 lue.=.valueToMeta(event.sender,.
21a60 72 65 74 2c 20 74 72 75 65 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 66 75 6e 63 2e 61 ret,.true).......}).......func.a
21a80 70 70 6c 79 28 63 61 6c 6c 65 72 2c 20 61 72 67 73 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a pply(caller,.args).....}.else.{.
21aa0 20 20 20 20 20 20 72 65 74 20 3d 20 66 75 6e 63 2e 61 70 70 6c 79 28 63 61 6c 6c 65 72 2c 20 61 ......ret.=.func.apply(caller,.a
21ac0 72 67 73 29 0a 20 20 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 76 rgs).......event.returnValue.=.v
21ae0 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 72 65 74 2c 20 74 72 alueToMeta(event.sender,.ret,.tr
21b00 75 65 29 0a 20 20 20 20 7d 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 ue).....}...}.catch.(error).{...
21b20 20 20 2f 2f 20 43 61 74 63 68 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 72 6f 77 6e 20 66 75 72 74 ..//.Catch.functions.thrown.furt
21b40 68 65 72 20 64 6f 77 6e 20 69 6e 20 66 75 6e 63 74 69 6f 6e 20 69 6e 76 6f 63 61 74 69 6f 6e 20 her.down.in.function.invocation.
21b60 61 6e 64 20 77 72 61 70 0a 20 20 20 20 2f 2f 20 74 68 65 6d 20 77 69 74 68 20 74 68 65 20 66 75 and.wrap.....//.them.with.the.fu
21b80 6e 63 74 69 6f 6e 20 6e 61 6d 65 20 73 6f 20 69 74 27 73 20 65 61 73 69 65 72 20 74 6f 20 74 72 nction.name.so.it's.easier.to.tr
21ba0 61 63 65 20 74 68 69 6e 67 73 20 6c 69 6b 65 0a 20 20 20 20 2f 2f 20 60 45 72 72 6f 72 20 70 72 ace.things.like.....//.`Error.pr
21bc0 6f 63 65 73 73 69 6e 67 20 61 72 67 75 6d 65 6e 74 20 2d 31 2e 60 0a 20 20 20 20 66 75 6e 63 4e ocessing.argument.-1.`.....funcN
21be0 61 6d 65 20 3d 20 28 28 72 65 66 20 3d 20 66 75 6e 63 2e 6e 61 6d 65 29 20 21 3d 20 6e 75 6c 6c ame.=.((ref.=.func.name).!=.null
21c00 29 20 3f 20 72 65 66 20 3a 20 27 61 6e 6f 6e 79 6d 6f 75 73 27 0a 20 20 20 20 74 68 72 6f 77 20 ).?.ref.:.'anonymous'.....throw.
21c20 6e 65 77 20 45 72 72 6f 72 28 60 43 6f 75 6c 64 20 6e 6f 74 20 63 61 6c 6c 20 72 65 6d 6f 74 65 new.Error(`Could.not.call.remote
21c40 20 66 75 6e 63 74 69 6f 6e 20 27 24 7b 66 75 6e 63 4e 61 6d 65 7d 27 2e 20 43 68 65 63 6b 20 74 .function.'${funcName}'..Check.t
21c60 68 61 74 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 73 69 67 6e 61 74 75 72 65 20 69 73 20 63 6f hat.the.function.signature.is.co
21c80 72 72 65 63 74 2e 20 55 6e 64 65 72 6c 79 69 6e 67 20 65 72 72 6f 72 3a 20 24 7b 65 72 72 6f 72 rrect..Underlying.error:.${error
21ca0 2e 6d 65 73 73 61 67 65 7d 60 29 0a 20 20 7d 0a 7d 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 .message}`)...}.}..ipcMain.on('E
21cc0 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 52 45 51 55 49 52 45 27 2c 20 66 75 6e 63 74 69 LECTRON_BROWSER_REQUIRE',.functi
21ce0 6f 6e 20 28 65 76 65 6e 74 2c 20 6d 6f 64 75 6c 65 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 on.(event,.module).{...try.{....
21d00 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 .event.returnValue.=.valueToMeta
21d20 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 70 72 6f 63 65 73 73 2e 6d 61 69 6e 4d 6f 64 75 6c (event.sender,.process.mainModul
21d40 65 2e 72 65 71 75 69 72 65 28 6d 6f 64 75 6c 65 29 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 e.require(module))...}.catch.(er
21d60 72 6f 72 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 ror).{.....event.returnValue.=.e
21d80 78 63 65 70 74 69 6f 6e 54 6f 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 xceptionToMeta(error)...}.})..ip
21da0 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 47 45 54 5f 42 cMain.on('ELECTRON_BROWSER_GET_B
21dc0 55 49 4c 54 49 4e 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 6d 6f 64 75 6c 65 UILTIN',.function.(event,.module
21de0 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 ).{...try.{.....event.returnValu
21e00 65 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 65 6c e.=.valueToMeta(event.sender,.el
21e20 65 63 74 72 6f 6e 5b 6d 6f 64 75 6c 65 5d 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 ectron[module])...}.catch.(error
21e40 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 65 ).{.....event.returnValue.=.exce
21e60 70 74 69 6f 6e 54 6f 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 ptionToMeta(error)...}.})..ipcMa
21e80 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 47 4c 4f 42 41 4c 27 2c in.on('ELECTRON_BROWSER_GLOBAL',
21ea0 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 6e 61 6d 65 29 20 7b 0a 20 20 74 72 79 20 .function.(event,.name).{...try.
21ec0 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 76 61 6c 75 65 54 {.....event.returnValue.=.valueT
21ee0 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 67 6c 6f 62 61 6c 5b 6e 61 6d 65 5d oMeta(event.sender,.global[name]
21f00 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e )...}.catch.(error).{.....event.
21f20 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 65 70 74 69 6f 6e 54 6f 4d 65 74 61 28 65 72 returnValue.=.exceptionToMeta(er
21f40 72 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f ror)...}.})..ipcMain.on('ELECTRO
21f60 4e 5f 42 52 4f 57 53 45 52 5f 43 55 52 52 45 4e 54 5f 57 49 4e 44 4f 57 27 2c 20 66 75 6e 63 74 N_BROWSER_CURRENT_WINDOW',.funct
21f80 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e ion.(event).{...try.{.....event.
21fa0 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e returnValue.=.valueToMeta(event.
21fc0 73 65 6e 64 65 72 2c 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 4f 77 6e 65 72 42 72 6f sender,.event.sender.getOwnerBro
21fe0 77 73 65 72 57 69 6e 64 6f 77 28 29 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 wserWindow())...}.catch.(error).
22000 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 65 70 74 {.....event.returnValue.=.except
22020 69 6f 6e 54 6f 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e ionToMeta(error)...}.})..ipcMain
22040 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 55 52 52 45 4e 54 5f 57 45 .on('ELECTRON_BROWSER_CURRENT_WE
22060 42 5f 43 4f 4e 54 45 4e 54 53 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a B_CONTENTS',.function.(event).{.
22080 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 ..event.returnValue.=.valueToMet
220a0 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 29 0a 7d 29 a(event.sender,.event.sender).})
220c0 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 ..ipcMain.on('ELECTRON_BROWSER_C
220e0 4f 4e 53 54 52 55 43 54 4f 52 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 69 64 ONSTRUCTOR',.function.(event,.id
22100 2c 20 61 72 67 73 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 61 72 67 73 20 3d 20 75 6e 77 ,.args).{...try.{.....args.=.unw
22120 72 61 70 41 72 67 73 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 61 72 67 73 29 0a 20 20 20 20 rapArgs(event.sender,.args).....
22140 6c 65 74 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 3d 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 let.constructor.=.objectsRegistr
22160 79 2e 67 65 74 28 69 64 29 0a 0a 20 20 20 20 69 66 20 28 63 6f 6e 73 74 72 75 63 74 6f 72 20 3d y.get(id)......if.(constructor.=
22180 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 52 50 43 45 72 72 6f 72 28 60 43 =.null).{.......throwRPCError(`C
221a0 61 6e 6e 6f 74 20 63 61 6c 6c 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 6f 6e 20 6d 69 73 73 69 6e annot.call.constructor.on.missin
221c0 67 20 72 65 6d 6f 74 65 20 6f 62 6a 65 63 74 20 24 7b 69 64 7d 60 29 0a 20 20 20 20 7d 0a 0a 20 g.remote.object.${id}`).....}...
221e0 20 20 20 2f 2f 20 43 61 6c 6c 20 6e 65 77 20 77 69 74 68 20 61 72 72 61 79 20 6f 66 20 61 72 67 ...//.Call.new.with.array.of.arg
22200 75 6d 65 6e 74 73 2e 0a 20 20 20 20 2f 2f 20 68 74 74 70 3a 2f 2f 73 74 61 63 6b 6f 76 65 72 66 uments......//.http://stackoverf
22220 6c 6f 77 2e 63 6f 6d 2f 71 75 65 73 74 69 6f 6e 73 2f 31 36 30 36 37 39 37 2f 75 73 65 2d 6f 66 low.com/questions/1606797/use-of
22240 2d 61 70 70 6c 79 2d 77 69 74 68 2d 6e 65 77 2d 6f 70 65 72 61 74 6f 72 2d 69 73 2d 74 68 69 73 -apply-with-new-operator-is-this
22260 2d 70 6f 73 73 69 62 6c 65 0a 20 20 20 20 6c 65 74 20 6f 62 6a 20 3d 20 6e 65 77 20 28 46 75 6e -possible.....let.obj.=.new.(Fun
22280 63 74 69 6f 6e 2e 70 72 6f 74 6f 74 79 70 65 2e 62 69 6e 64 2e 61 70 70 6c 79 28 63 6f 6e 73 74 ction.prototype.bind.apply(const
222a0 72 75 63 74 6f 72 2c 20 5b 6e 75 6c 6c 5d 2e 63 6f 6e 63 61 74 28 61 72 67 73 29 29 29 28 29 0a ructor,.[null].concat(args)))().
222c0 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 76 61 6c 75 65 54 6f 4d ....event.returnValue.=.valueToM
222e0 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 6f 62 6a 29 0a 20 20 7d 20 63 61 74 63 68 eta(event.sender,.obj)...}.catch
22300 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 .(error).{.....event.returnValue
22320 20 3d 20 65 78 63 65 70 74 69 6f 6e 54 6f 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d 29 .=.exceptionToMeta(error)...}.})
22340 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 46 ..ipcMain.on('ELECTRON_BROWSER_F
22360 55 4e 43 54 49 4f 4e 5f 43 41 4c 4c 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 UNCTION_CALL',.function.(event,.
22380 69 64 2c 20 61 72 67 73 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 61 72 67 73 20 3d 20 75 id,.args).{...try.{.....args.=.u
223a0 6e 77 72 61 70 41 72 67 73 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 61 72 67 73 29 0a 20 20 nwrapArgs(event.sender,.args)...
223c0 20 20 6c 65 74 20 66 75 6e 63 20 3d 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 ..let.func.=.objectsRegistry.get
223e0 28 69 64 29 0a 0a 20 20 20 20 69 66 20 28 66 75 6e 63 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 (id)......if.(func.==.null).{...
22400 20 20 20 20 74 68 72 6f 77 52 50 43 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 63 61 6c 6c 20 66 ....throwRPCError(`Cannot.call.f
22420 75 6e 63 74 69 6f 6e 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d 6f 74 65 20 6f 62 6a 65 63 74 unction.on.missing.remote.object
22440 20 24 7b 69 64 7d 60 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 61 6c 6c 46 75 6e 63 74 69 6f 6e .${id}`).....}......callFunction
22460 28 65 76 65 6e 74 2c 20 66 75 6e 63 2c 20 67 6c 6f 62 61 6c 2c 20 61 72 67 73 29 0a 20 20 7d 20 (event,.func,.global,.args)...}.
22480 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e catch.(error).{.....event.return
224a0 56 61 6c 75 65 20 3d 20 65 78 63 65 70 74 69 6f 6e 54 6f 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 Value.=.exceptionToMeta(error)..
224c0 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 .}.})..ipcMain.on('ELECTRON_BROW
224e0 53 45 52 5f 4d 45 4d 42 45 52 5f 43 4f 4e 53 54 52 55 43 54 4f 52 27 2c 20 66 75 6e 63 74 69 6f SER_MEMBER_CONSTRUCTOR',.functio
22500 6e 20 28 65 76 65 6e 74 2c 20 69 64 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 29 20 7b 0a 20 20 n.(event,.id,.method,.args).{...
22520 74 72 79 20 7b 0a 20 20 20 20 61 72 67 73 20 3d 20 75 6e 77 72 61 70 41 72 67 73 28 65 76 65 6e try.{.....args.=.unwrapArgs(even
22540 74 2e 73 65 6e 64 65 72 2c 20 61 72 67 73 29 0a 20 20 20 20 6c 65 74 20 6f 62 6a 65 63 74 20 3d t.sender,.args).....let.object.=
22560 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 28 69 64 29 0a 0a 20 20 20 20 69 66 .objectsRegistry.get(id)......if
22580 20 28 6f 62 6a 65 63 74 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 52 .(object.==.null).{.......throwR
225a0 50 43 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 63 61 6c 6c 20 63 6f 6e 73 74 72 75 63 74 6f 72 PCError(`Cannot.call.constructor
225c0 20 27 24 7b 6d 65 74 68 6f 64 7d 27 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d 6f 74 65 20 6f .'${method}'.on.missing.remote.o
225e0 62 6a 65 63 74 20 24 7b 69 64 7d 60 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 43 61 6c 6c bject.${id}`).....}......//.Call
22600 20 6e 65 77 20 77 69 74 68 20 61 72 72 61 79 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 2e 0a 20 20 .new.with.array.of.arguments....
22620 20 20 6c 65 74 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 3d 20 6f 62 6a 65 63 74 5b 6d 65 74 68 6f ..let.constructor.=.object[metho
22640 64 5d 0a 20 20 20 20 6c 65 74 20 6f 62 6a 20 3d 20 6e 65 77 20 28 46 75 6e 63 74 69 6f 6e 2e 70 d].....let.obj.=.new.(Function.p
22660 72 6f 74 6f 74 79 70 65 2e 62 69 6e 64 2e 61 70 70 6c 79 28 63 6f 6e 73 74 72 75 63 74 6f 72 2c rototype.bind.apply(constructor,
22680 20 5b 6e 75 6c 6c 5d 2e 63 6f 6e 63 61 74 28 61 72 67 73 29 29 29 28 29 0a 20 20 20 20 65 76 65 .[null].concat(args)))().....eve
226a0 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 nt.returnValue.=.valueToMeta(eve
226c0 6e 74 2e 73 65 6e 64 65 72 2c 20 6f 62 6a 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 nt.sender,.obj)...}.catch.(error
226e0 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 65 ).{.....event.returnValue.=.exce
22700 70 74 69 6f 6e 54 6f 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 ptionToMeta(error)...}.})..ipcMa
22720 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 45 52 5f 43 in.on('ELECTRON_BROWSER_MEMBER_C
22740 41 4c 4c 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 69 64 2c 20 6d 65 74 68 6f ALL',.function.(event,.id,.metho
22760 64 2c 20 61 72 67 73 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 61 72 67 73 20 3d 20 75 6e d,.args).{...try.{.....args.=.un
22780 77 72 61 70 41 72 67 73 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 61 72 67 73 29 0a 20 20 20 wrapArgs(event.sender,.args)....
227a0 20 6c 65 74 20 6f 62 6a 20 3d 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 28 69 .let.obj.=.objectsRegistry.get(i
227c0 64 29 0a 0a 20 20 20 20 69 66 20 28 6f 62 6a 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 d)......if.(obj.==.null).{......
227e0 20 74 68 72 6f 77 52 50 43 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 63 61 6c 6c 20 66 75 6e 63 .throwRPCError(`Cannot.call.func
22800 74 69 6f 6e 20 27 24 7b 6d 65 74 68 6f 64 7d 27 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d 6f tion.'${method}'.on.missing.remo
22820 74 65 20 6f 62 6a 65 63 74 20 24 7b 69 64 7d 60 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 61 6c te.object.${id}`).....}......cal
22840 6c 46 75 6e 63 74 69 6f 6e 28 65 76 65 6e 74 2c 20 6f 62 6a 5b 6d 65 74 68 6f 64 5d 2c 20 6f 62 lFunction(event,.obj[method],.ob
22860 6a 2c 20 61 72 67 73 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 j,.args)...}.catch.(error).{....
22880 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 65 70 74 69 6f 6e 54 6f .event.returnValue.=.exceptionTo
228a0 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 Meta(error)...}.})..ipcMain.on('
228c0 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 45 52 5f 53 45 54 27 2c 20 66 75 ELECTRON_BROWSER_MEMBER_SET',.fu
228e0 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 69 64 2c 20 6e 61 6d 65 2c 20 61 72 67 73 29 20 7b nction.(event,.id,.name,.args).{
22900 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 61 72 67 73 20 3d 20 75 6e 77 72 61 70 41 72 67 73 28 65 ...try.{.....args.=.unwrapArgs(e
22920 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 61 72 67 73 29 0a 20 20 20 20 6c 65 74 20 6f 62 6a 20 3d vent.sender,.args).....let.obj.=
22940 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 28 69 64 29 0a 0a 20 20 20 20 69 66 .objectsRegistry.get(id)......if
22960 20 28 6f 62 6a 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 52 50 43 45 .(obj.==.null).{.......throwRPCE
22980 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 73 65 74 20 70 72 6f 70 65 72 74 79 20 27 24 7b 6e 61 6d rror(`Cannot.set.property.'${nam
229a0 65 7d 27 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d 6f 74 65 20 6f 62 6a 65 63 74 20 24 7b 69 e}'.on.missing.remote.object.${i
229c0 64 7d 60 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6f 62 6a 5b 6e 61 6d 65 5d 20 3d 20 61 72 67 73 d}`).....}......obj[name].=.args
229e0 5b 30 5d 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c [0].....event.returnValue.=.null
22a00 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 ...}.catch.(error).{.....event.r
22a20 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 65 70 74 69 6f 6e 54 6f 4d 65 74 61 28 65 72 72 eturnValue.=.exceptionToMeta(err
22a40 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e or)...}.})..ipcMain.on('ELECTRON
22a60 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 45 52 5f 47 45 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 _BROWSER_MEMBER_GET',.function.(
22a80 65 76 65 6e 74 2c 20 69 64 2c 20 6e 61 6d 65 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 6c event,.id,.name).{...try.{.....l
22aa0 65 74 20 6f 62 6a 20 3d 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 28 69 64 29 et.obj.=.objectsRegistry.get(id)
22ac0 0a 0a 20 20 20 20 69 66 20 28 6f 62 6a 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 ......if.(obj.==.null).{.......t
22ae0 68 72 6f 77 52 50 43 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 67 65 74 20 70 72 6f 70 65 72 74 hrowRPCError(`Cannot.get.propert
22b00 79 20 27 24 7b 6e 61 6d 65 7d 27 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d 6f 74 65 20 6f 62 y.'${name}'.on.missing.remote.ob
22b20 6a 65 63 74 20 24 7b 69 64 7d 60 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 ject.${id}`).....}......event.re
22b40 74 75 72 6e 56 61 6c 75 65 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 turnValue.=.valueToMeta(event.se
22b60 6e 64 65 72 2c 20 6f 62 6a 5b 6e 61 6d 65 5d 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f nder,.obj[name])...}.catch.(erro
22b80 72 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 r).{.....event.returnValue.=.exc
22ba0 65 70 74 69 6f 6e 54 6f 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d eptionToMeta(error)...}.})..ipcM
22bc0 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 44 45 52 45 46 45 52 ain.on('ELECTRON_BROWSER_DEREFER
22be0 45 4e 43 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 69 64 29 20 7b 0a 20 20 ENCE',.function.(event,.id).{...
22c00 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 72 65 6d 6f 76 65 28 65 76 65 6e 74 2e 73 65 6e objectsRegistry.remove(event.sen
22c20 64 65 72 2e 67 65 74 49 64 28 29 2c 20 69 64 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 der.getId(),.id).})..ipcMain.on(
22c40 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 4f 4e 54 45 58 54 5f 52 45 4c 45 41 53 'ELECTRON_BROWSER_CONTEXT_RELEAS
22c60 45 27 2c 20 28 65 29 20 3d 3e 20 7b 0a 20 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 63 E',.(e).=>.{...objectsRegistry.c
22c80 6c 65 61 72 28 65 2e 73 65 6e 64 65 72 2e 67 65 74 49 64 28 29 29 0a 20 20 65 2e 72 65 74 75 72 lear(e.sender.getId())...e.retur
22ca0 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c nValue.=.null.})..ipcMain.on('EL
22cc0 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 47 55 45 53 54 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 ECTRON_BROWSER_GUEST_WEB_CONTENT
22ce0 53 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 6e 73 74 61 6e S',.function.(event,.guestInstan
22d00 63 65 49 64 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 6c 65 74 20 67 75 65 73 74 56 69 65 ceId).{...try.{.....let.guestVie
22d20 77 4d 61 6e 61 67 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2f 67 75 65 73 74 2d 76 69 65 77 wManager.=.require('./guest-view
22d40 2d 6d 61 6e 61 67 65 72 27 29 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 -manager').....event.returnValue
22d60 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 67 75 65 .=.valueToMeta(event.sender,.gue
22d80 73 74 56 69 65 77 4d 61 6e 61 67 65 72 2e 67 65 74 47 75 65 73 74 28 67 75 65 73 74 49 6e 73 74 stViewManager.getGuest(guestInst
22da0 61 6e 63 65 49 64 29 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 anceId))...}.catch.(error).{....
22dc0 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 65 70 74 69 6f 6e 54 6f .event.returnValue.=.exceptionTo
22de0 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 Meta(error)...}.})..ipcMain.on('
22e00 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 41 53 59 4e 43 5f 43 41 4c 4c 5f 54 4f 5f 47 ELECTRON_BROWSER_ASYNC_CALL_TO_G
22e20 55 45 53 54 5f 56 49 45 57 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 72 65 71 UEST_VIEW',.function.(event,.req
22e40 75 65 73 74 49 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 6d 65 74 68 6f 64 2c uestId,.guestInstanceId,.method,
22e60 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 6c 65 74 20 67 75 65 73 ....args).{...try.{.....let.gues
22e80 74 56 69 65 77 4d 61 6e 61 67 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2f 67 75 65 73 74 2d tViewManager.=.require('./guest-
22ea0 76 69 65 77 2d 6d 61 6e 61 67 65 72 27 29 0a 20 20 20 20 6c 65 74 20 67 75 65 73 74 20 3d 20 67 view-manager').....let.guest.=.g
22ec0 75 65 73 74 56 69 65 77 4d 61 6e 61 67 65 72 2e 67 65 74 47 75 65 73 74 28 67 75 65 73 74 49 6e uestViewManager.getGuest(guestIn
22ee0 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 69 66 20 28 72 65 71 75 65 73 74 49 64 29 20 7b 0a 20 stanceId).....if.(requestId).{..
22f00 20 20 20 20 20 63 6f 6e 73 74 20 72 65 73 70 6f 6e 73 65 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 .....const.responseCallback.=.fu
22f20 6e 63 74 69 6f 6e 20 28 72 65 73 75 6c 74 29 20 7b 0a 20 20 20 20 20 20 20 20 65 76 65 6e 74 2e nction.(result).{.........event.
22f40 73 65 6e 64 65 72 2e 73 65 6e 64 28 60 45 4c 45 43 54 52 4f 4e 5f 52 45 4e 44 45 52 45 52 5f 41 sender.send(`ELECTRON_RENDERER_A
22f60 53 59 4e 43 5f 43 41 4c 4c 5f 54 4f 5f 47 55 45 53 54 5f 56 49 45 57 5f 52 45 53 50 4f 4e 53 45 SYNC_CALL_TO_GUEST_VIEW_RESPONSE
22f80 5f 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 72 65 73 75 6c 74 29 0a 20 20 20 20 20 20 7d 0a _${requestId}`,.result).......}.
22fa0 20 20 20 20 20 20 61 72 67 73 2e 70 75 73 68 28 72 65 73 70 6f 6e 73 65 43 61 6c 6c 62 61 63 6b ......args.push(responseCallback
22fc0 29 0a 20 20 20 20 7d 0a 20 20 20 20 67 75 65 73 74 5b 6d 65 74 68 6f 64 5d 2e 61 70 70 6c 79 28 ).....}.....guest[method].apply(
22fe0 67 75 65 73 74 2c 20 61 72 67 73 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b guest,.args)...}.catch.(error).{
23000 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 65 70 74 69 .....event.returnValue.=.excepti
23020 6f 6e 54 6f 4d 65 74 61 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e onToMeta(error)...}.})..ipcMain.
23040 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 53 45 4e 44 5f 54 4f 27 2c 20 66 on('ELECTRON_BROWSER_SEND_TO',.f
23060 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 73 65 6e 64 54 6f 41 6c 6c 2c 20 77 65 62 43 6f unction.(event,.sendToAll,.webCo
23080 6e 74 65 6e 74 73 49 64 2c 20 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 ntentsId,.channel,....args).{...
230a0 6c 65 74 20 63 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 let.contents.=.webContents.fromI
230c0 64 28 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 29 0a 20 20 69 66 20 28 21 63 6f 6e 74 65 6e 74 73 d(webContentsId)...if.(!contents
230e0 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 53 65 6e 64 69 6e 67 20 6d ).{.....console.error(`Sending.m
23100 65 73 73 61 67 65 20 74 6f 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 77 69 74 68 20 75 6e 6b 6e 6f essage.to.WebContents.with.unkno
23120 77 6e 20 49 44 20 24 7b 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 7d 60 29 0a 20 20 20 20 72 65 74 wn.ID.${webContentsId}`).....ret
23140 75 72 6e 0a 20 20 7d 0a 0a 20 20 69 66 20 28 73 65 6e 64 54 6f 41 6c 6c 29 20 7b 0a 20 20 20 20 urn...}....if.(sendToAll).{.....
23160 63 6f 6e 74 65 6e 74 73 2e 73 65 6e 64 54 6f 41 6c 6c 28 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 contents.sendToAll(channel,....a
23180 72 67 73 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 63 6f 6e 74 65 6e 74 73 2e 73 65 6e rgs)...}.else.{.....contents.sen
231a0 64 28 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 0a 7d 29 0a 0a 2f 2f 20 49 d(channel,....args)...}.})..//.I
231c0 6d 70 6c 65 6d 65 6e 74 73 20 77 69 6e 64 6f 77 2e 61 6c 65 72 74 28 6d 65 73 73 61 67 65 2c 20 mplements.window.alert(message,.
231e0 74 69 74 6c 65 29 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 title).ipcMain.on('ELECTRON_BROW
23200 53 45 52 5f 57 49 4e 44 4f 57 5f 41 4c 45 52 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 SER_WINDOW_ALERT',.function.(eve
23220 6e 74 2c 20 6d 65 73 73 61 67 65 2c 20 74 69 74 6c 65 29 20 7b 0a 20 20 69 66 20 28 6d 65 73 73 nt,.message,.title).{...if.(mess
23240 61 67 65 20 3d 3d 20 6e 75 6c 6c 29 20 6d 65 73 73 61 67 65 20 3d 20 27 27 0a 20 20 69 66 20 28 age.==.null).message.=.''...if.(
23260 74 69 74 6c 65 20 3d 3d 20 6e 75 6c 6c 29 20 74 69 74 6c 65 20 3d 20 27 27 0a 0a 20 20 63 6f 6e title.==.null).title.=.''....con
23280 73 74 20 64 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 20 3d 20 7b 0a 20 20 20 20 6d 65 73 73 st.dialogProperties.=.{.....mess
232a0 61 67 65 3a 20 60 24 7b 6d 65 73 73 61 67 65 7d 60 2c 0a 20 20 20 20 74 69 74 6c 65 3a 20 60 24 age:.`${message}`,.....title:.`$
232c0 7b 74 69 74 6c 65 7d 60 2c 0a 20 20 20 20 62 75 74 74 6f 6e 73 3a 20 5b 27 4f 4b 27 5d 0a 20 20 {title}`,.....buttons:.['OK']...
232e0 7d 0a 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 76 65 6e 74 2e 73 65 }...event.returnValue.=.event.se
23300 6e 64 65 72 2e 69 73 4f 66 66 73 63 72 65 65 6e 28 29 0a 20 20 20 20 3f 20 65 6c 65 63 74 72 6f nder.isOffscreen().....?.electro
23320 6e 2e 64 69 61 6c 6f 67 2e 73 68 6f 77 4d 65 73 73 61 67 65 42 6f 78 28 64 69 61 6c 6f 67 50 72 n.dialog.showMessageBox(dialogPr
23340 6f 70 65 72 74 69 65 73 29 0a 20 20 20 20 3a 20 65 6c 65 63 74 72 6f 6e 2e 64 69 61 6c 6f 67 2e operties).....:.electron.dialog.
23360 73 68 6f 77 4d 65 73 73 61 67 65 42 6f 78 28 0a 20 20 20 20 20 20 65 76 65 6e 74 2e 73 65 6e 64 showMessageBox(.......event.send
23380 65 72 2e 67 65 74 4f 77 6e 65 72 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 28 29 2c 20 64 69 61 6c er.getOwnerBrowserWindow(),.dial
233a0 6f 67 50 72 6f 70 65 72 74 69 65 73 29 0a 7d 29 0a 0a 2f 2f 20 49 6d 70 6c 65 6d 65 6e 74 73 20 ogProperties).})..//.Implements.
233c0 77 69 6e 64 6f 77 2e 63 6f 6e 66 69 72 6d 28 6d 65 73 73 61 67 65 2c 20 74 69 74 6c 65 29 0a 69 window.confirm(message,.title).i
233e0 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 57 49 4e 44 pcMain.on('ELECTRON_BROWSER_WIND
23400 4f 57 5f 43 4f 4e 46 49 52 4d 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 6d 65 OW_CONFIRM',.function.(event,.me
23420 73 73 61 67 65 2c 20 74 69 74 6c 65 29 20 7b 0a 20 20 69 66 20 28 6d 65 73 73 61 67 65 20 3d 3d ssage,.title).{...if.(message.==
23440 20 6e 75 6c 6c 29 20 6d 65 73 73 61 67 65 20 3d 20 27 27 0a 20 20 69 66 20 28 74 69 74 6c 65 20 .null).message.=.''...if.(title.
23460 3d 3d 20 6e 75 6c 6c 29 20 74 69 74 6c 65 20 3d 20 27 27 0a 0a 20 20 63 6f 6e 73 74 20 64 69 61 ==.null).title.=.''....const.dia
23480 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 20 3d 20 7b 0a 20 20 20 20 6d 65 73 73 61 67 65 3a 20 60 logProperties.=.{.....message:.`
234a0 24 7b 6d 65 73 73 61 67 65 7d 60 2c 0a 20 20 20 20 74 69 74 6c 65 3a 20 60 24 7b 74 69 74 6c 65 ${message}`,.....title:.`${title
234c0 7d 60 2c 0a 20 20 20 20 62 75 74 74 6f 6e 73 3a 20 5b 27 4f 4b 27 2c 20 27 43 61 6e 63 65 6c 27 }`,.....buttons:.['OK',.'Cancel'
234e0 5d 2c 0a 20 20 20 20 63 61 6e 63 65 6c 49 64 3a 20 31 0a 20 20 7d 0a 20 20 65 76 65 6e 74 2e 72 ],.....cancelId:.1...}...event.r
23500 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 21 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 73 4f 66 eturnValue.=.!(event.sender.isOf
23520 66 73 63 72 65 65 6e 28 29 0a 20 20 20 20 3f 20 65 6c 65 63 74 72 6f 6e 2e 64 69 61 6c 6f 67 2e fscreen().....?.electron.dialog.
23540 73 68 6f 77 4d 65 73 73 61 67 65 42 6f 78 28 64 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 29 showMessageBox(dialogProperties)
23560 0a 20 20 20 20 3a 20 65 6c 65 63 74 72 6f 6e 2e 64 69 61 6c 6f 67 2e 73 68 6f 77 4d 65 73 73 61 .....:.electron.dialog.showMessa
23580 67 65 42 6f 78 28 0a 20 20 20 20 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 4f 77 6e geBox(.......event.sender.getOwn
235a0 65 72 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 28 29 2c 20 64 69 61 6c 6f 67 50 72 6f 70 65 72 74 erBrowserWindow(),.dialogPropert
235c0 69 65 73 29 29 0a 7d 29 0a 0a 2f 2f 20 49 6d 70 6c 65 6d 65 6e 74 73 20 77 69 6e 64 6f 77 2e 63 ies)).})..//.Implements.window.c
235e0 6c 6f 73 65 28 29 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 lose().ipcMain.on('ELECTRON_BROW
23600 53 45 52 5f 57 49 4e 44 4f 57 5f 43 4c 4f 53 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 SER_WINDOW_CLOSE',.function.(eve
23620 6e 74 29 20 7b 0a 20 20 63 6f 6e 73 74 20 77 69 6e 64 6f 77 20 3d 20 65 76 65 6e 74 2e 73 65 6e nt).{...const.window.=.event.sen
23640 64 65 72 2e 67 65 74 4f 77 6e 65 72 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 28 29 0a 20 20 69 66 der.getOwnerBrowserWindow()...if
23660 20 28 77 69 6e 64 6f 77 29 20 7b 0a 20 20 20 20 77 69 6e 64 6f 77 2e 63 6c 6f 73 65 28 29 0a 20 .(window).{.....window.close()..
23680 20 7d 0a 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 7d 29 .}...event.returnValue.=.null.})
236a0 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 .'use.strict'..const.v8Util.=.pr
236c0 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 0a 63 6c ocess.atomBinding('v8_util')..cl
236e0 61 73 73 20 43 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 20 7b 0a 20 20 63 6f 6e 73 74 72 ass.CallbacksRegistry.{...constr
23700 75 63 74 6f 72 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 6e 65 78 74 49 64 20 3d 20 30 0a 20 uctor.().{.....this.nextId.=.0..
23720 20 20 20 74 68 69 73 2e 63 61 6c 6c 62 61 63 6b 73 20 3d 20 7b 7d 0a 20 20 7d 0a 0a 20 20 61 64 ...this.callbacks.=.{}...}....ad
23740 64 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 2f 2f 20 54 68 65 20 63 61 6c 6c 62 61 d.(callback).{.....//.The.callba
23760 63 6b 20 69 73 20 61 6c 72 65 61 64 79 20 61 64 64 65 64 2e 0a 20 20 20 20 6c 65 74 20 69 64 20 ck.is.already.added......let.id.
23780 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 63 61 6c 6c 62 61 63 6b =.v8Util.getHiddenValue(callback
237a0 2c 20 27 63 61 6c 6c 62 61 63 6b 49 64 27 29 0a 20 20 20 20 69 66 20 28 69 64 20 21 3d 20 6e 75 ,.'callbackId').....if.(id.!=.nu
237c0 6c 6c 29 20 72 65 74 75 72 6e 20 69 64 0a 0a 20 20 20 20 69 64 20 3d 20 74 68 69 73 2e 6e 65 78 ll).return.id......id.=.this.nex
237e0 74 49 64 20 2b 3d 20 31 0a 0a 20 20 20 20 2f 2f 20 43 61 70 74 75 72 65 20 74 68 65 20 6c 6f 63 tId.+=.1......//.Capture.the.loc
23800 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 70 75 74 20 69 74 ation.of.the.function.and.put.it
23820 20 69 6e 20 74 68 65 20 49 44 20 73 74 72 69 6e 67 2c 0a 20 20 20 20 2f 2f 20 73 6f 20 74 68 61 .in.the.ID.string,.....//.so.tha
23840 74 20 72 65 6c 65 61 73 65 20 65 72 72 6f 72 73 20 63 61 6e 20 62 65 20 74 72 61 63 6b 65 64 20 t.release.errors.can.be.tracked.
23860 64 6f 77 6e 20 65 61 73 69 6c 79 2e 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 67 65 78 70 20 3d 20 down.easily......const.regexp.=.
23880 2f 61 74 20 28 2e 2a 29 2f 67 69 0a 20 20 20 20 63 6f 6e 73 74 20 73 74 61 63 6b 53 74 72 69 6e /at.(.*)/gi.....const.stackStrin
238a0 67 20 3d 20 28 6e 65 77 20 45 72 72 6f 72 28 29 29 2e 73 74 61 63 6b 0a 0a 20 20 20 20 6c 65 74 g.=.(new.Error()).stack......let
238c0 20 66 69 6c 65 6e 61 6d 65 41 6e 64 4c 69 6e 65 0a 20 20 20 20 6c 65 74 20 6d 61 74 63 68 0a 0a .filenameAndLine.....let.match..
238e0 20 20 20 20 77 68 69 6c 65 20 28 28 6d 61 74 63 68 20 3d 20 72 65 67 65 78 70 2e 65 78 65 63 28 ....while.((match.=.regexp.exec(
23900 73 74 61 63 6b 53 74 72 69 6e 67 29 29 20 21 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 stackString)).!==.null).{.......
23920 63 6f 6e 73 74 20 6c 6f 63 61 74 69 6f 6e 20 3d 20 6d 61 74 63 68 5b 31 5d 0a 20 20 20 20 20 20 const.location.=.match[1].......
23940 69 66 20 28 6c 6f 63 61 74 69 6f 6e 2e 69 6e 63 6c 75 64 65 73 28 27 6e 61 74 69 76 65 27 29 29 if.(location.includes('native'))
23960 20 63 6f 6e 74 69 6e 75 65 0a 20 20 20 20 20 20 69 66 20 28 6c 6f 63 61 74 69 6f 6e 2e 69 6e 63 .continue.......if.(location.inc
23980 6c 75 64 65 73 28 27 65 6c 65 63 74 72 6f 6e 2e 61 73 61 72 27 29 29 20 63 6f 6e 74 69 6e 75 65 ludes('electron.asar')).continue
239a0 0a 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 66 20 3d 20 2f 28 5b 5e 2f 5e 29 5d 2a 29 5c 29 ........const.ref.=./([^/^)]*)\)
239c0 3f 24 2f 67 69 2e 65 78 65 63 28 6c 6f 63 61 74 69 6f 6e 29 0a 20 20 20 20 20 20 66 69 6c 65 6e ?$/gi.exec(location).......filen
239e0 61 6d 65 41 6e 64 4c 69 6e 65 20 3d 20 72 65 66 5b 31 5d 0a 20 20 20 20 20 20 62 72 65 61 6b 0a ameAndLine.=.ref[1].......break.
23a00 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 63 61 6c 6c 62 61 63 6b 73 5b 69 64 5d 20 3d 20 63 ....}.....this.callbacks[id].=.c
23a20 61 6c 6c 62 61 63 6b 0a 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 allback.....v8Util.setHiddenValu
23a40 65 28 63 61 6c 6c 62 61 63 6b 2c 20 27 63 61 6c 6c 62 61 63 6b 49 64 27 2c 20 69 64 29 0a 20 20 e(callback,.'callbackId',.id)...
23a60 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 63 61 6c 6c 62 61 63 6b ..v8Util.setHiddenValue(callback
23a80 2c 20 27 6c 6f 63 61 74 69 6f 6e 27 2c 20 66 69 6c 65 6e 61 6d 65 41 6e 64 4c 69 6e 65 29 0a 20 ,.'location',.filenameAndLine)..
23aa0 20 20 20 72 65 74 75 72 6e 20 69 64 0a 20 20 7d 0a 0a 20 20 67 65 74 20 28 69 64 29 20 7b 0a 20 ...return.id...}....get.(id).{..
23ac0 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 63 61 6c 6c 62 61 63 6b 73 5b 69 64 5d 20 7c 7c 20 ...return.this.callbacks[id].||.
23ae0 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 7d 0a 20 20 7d 0a 0a 20 20 61 70 70 6c 79 20 28 69 64 2c function.().{}...}....apply.(id,
23b00 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 28 ....args).{.....return.this.get(
23b20 69 64 29 2e 61 70 70 6c 79 28 67 6c 6f 62 61 6c 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 0a 0a id).apply(global,....args)...}..
23b40 20 20 72 65 6d 6f 76 65 20 28 69 64 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 61 6c 6c 62 61 ..remove.(id).{.....const.callba
23b60 63 6b 20 3d 20 74 68 69 73 2e 63 61 6c 6c 62 61 63 6b 73 5b 69 64 5d 0a 20 20 20 20 69 66 20 28 ck.=.this.callbacks[id].....if.(
23b80 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 76 38 55 74 69 6c 2e 64 65 6c 65 74 65 48 callback).{.......v8Util.deleteH
23ba0 69 64 64 65 6e 56 61 6c 75 65 28 63 61 6c 6c 62 61 63 6b 2c 20 27 63 61 6c 6c 62 61 63 6b 49 64 iddenValue(callback,.'callbackId
23bc0 27 29 0a 20 20 20 20 20 20 64 65 6c 65 74 65 20 74 68 69 73 2e 63 61 6c 6c 62 61 63 6b 73 5b 69 ').......delete.this.callbacks[i
23be0 64 5d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d d].....}...}.}..module.exports.=
23c00 20 43 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 .CallbacksRegistry.if.(process.p
23c20 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 6c 69 6e 75 78 27 20 26 26 20 70 72 6f 63 65 73 73 2e 74 latform.===.'linux'.&&.process.t
23c40 79 70 65 20 3d 3d 3d 20 27 72 65 6e 64 65 72 65 72 27 29 20 7b 0a 20 20 2f 2f 20 4f 6e 20 4c 69 ype.===.'renderer').{...//.On.Li
23c60 6e 75 78 20 77 65 20 63 6f 75 6c 64 20 6e 6f 74 20 61 63 63 65 73 73 20 63 6c 69 70 62 6f 61 72 nux.we.could.not.access.clipboar
23c80 64 20 69 6e 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 2e 0a 20 20 6d 6f 64 75 6c 65 2e d.in.renderer.process....module.
23ca0 65 78 70 6f 72 74 73 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 2e 72 65 exports.=.require('electron').re
23cc0 6d 6f 74 65 2e 63 6c 69 70 62 6f 61 72 64 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 63 6f 6e 73 74 20 mote.clipboard.}.else.{...const.
23ce0 63 6c 69 70 62 6f 61 72 64 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 clipboard.=.process.atomBinding(
23d00 27 63 6c 69 70 62 6f 61 72 64 27 29 0a 0a 20 20 2f 2f 20 52 65 61 64 2f 77 72 69 74 65 20 74 6f 'clipboard')....//.Read/write.to
23d20 20 66 69 6e 64 20 70 61 73 74 65 62 6f 61 72 64 20 6f 76 65 72 20 49 50 43 20 73 69 6e 63 65 20 .find.pasteboard.over.IPC.since.
23d40 6f 6e 6c 79 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 20 69 73 20 6e 6f 74 69 66 69 65 64 0a 20 20 only.main.process.is.notified...
23d60 2f 2f 20 6f 66 20 63 68 61 6e 67 65 73 0a 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 //.of.changes...if.(process.plat
23d80 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 26 26 20 70 72 6f 63 65 73 73 2e 74 79 70 form.===.'darwin'.&&.process.typ
23da0 65 20 3d 3d 3d 20 27 72 65 6e 64 65 72 65 72 27 29 20 7b 0a 20 20 20 20 63 6c 69 70 62 6f 61 72 e.===.'renderer').{.....clipboar
23dc0 64 2e 72 65 61 64 46 69 6e 64 54 65 78 74 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 d.readFindText.=.require('electr
23de0 6f 6e 27 29 2e 72 65 6d 6f 74 65 2e 63 6c 69 70 62 6f 61 72 64 2e 72 65 61 64 46 69 6e 64 54 65 on').remote.clipboard.readFindTe
23e00 78 74 0a 20 20 20 20 63 6c 69 70 62 6f 61 72 64 2e 77 72 69 74 65 46 69 6e 64 54 65 78 74 20 3d xt.....clipboard.writeFindText.=
23e20 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 2e 72 65 6d 6f 74 65 2e 63 6c 69 70 .require('electron').remote.clip
23e40 62 6f 61 72 64 2e 77 72 69 74 65 46 69 6e 64 54 65 78 74 0a 20 20 7d 0a 0a 20 20 6d 6f 64 75 6c board.writeFindText...}....modul
23e60 65 2e 65 78 70 6f 72 74 73 20 3d 20 63 6c 69 70 62 6f 61 72 64 0a 7d 0a 27 75 73 65 20 73 74 72 e.exports.=.clipboard.}.'use.str
23e80 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 73 70 61 77 6e 7d 20 3d 20 72 65 71 75 69 72 65 28 27 63 ict'..const.{spawn}.=.require('c
23ea0 68 69 6c 64 5f 70 72 6f 63 65 73 73 27 29 0a 63 6f 6e 73 74 20 6f 73 20 3d 20 72 65 71 75 69 72 hild_process').const.os.=.requir
23ec0 65 28 27 6f 73 27 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 e('os').const.path.=.require('pa
23ee0 74 68 27 29 0a 63 6f 6e 73 74 20 65 6c 65 63 74 72 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 65 th').const.electron.=.require('e
23f00 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b 61 70 70 7d 20 3d 20 70 72 6f 63 65 73 73 2e lectron').const.{app}.=.process.
23f20 74 79 70 65 20 3d 3d 3d 20 27 62 72 6f 77 73 65 72 27 20 3f 20 65 6c 65 63 74 72 6f 6e 20 3a 20 type.===.'browser'.?.electron.:.
23f40 65 6c 65 63 74 72 6f 6e 2e 72 65 6d 6f 74 65 0a 63 6f 6e 73 74 20 62 69 6e 64 69 6e 67 20 3d 20 electron.remote.const.binding.=.
23f60 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 63 72 61 73 68 5f 72 65 70 6f 72 process.atomBinding('crash_repor
23f80 74 65 72 27 29 0a 0a 63 6c 61 73 73 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 20 7b 0a 20 20 73 ter')..class.CrashReporter.{...s
23fa0 74 61 72 74 20 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 tart.(options).{.....if.(options
23fc0 20 3d 3d 20 6e 75 6c 6c 29 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e .==.null).options.=.{}.....this.
23fe0 70 72 6f 64 75 63 74 4e 61 6d 65 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 72 6f 64 75 63 74 4e 61 6d productName.=.options.productNam
24000 65 20 21 3d 20 6e 75 6c 6c 20 3f 20 6f 70 74 69 6f 6e 73 2e 70 72 6f 64 75 63 74 4e 61 6d 65 20 e.!=.null.?.options.productName.
24020 3a 20 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 0a 0a 20 20 20 20 6c 65 74 20 7b 0a 20 20 20 20 20 :.app.getName()......let.{......
24040 20 63 6f 6d 70 61 6e 79 4e 61 6d 65 2c 0a 20 20 20 20 20 20 65 78 74 72 61 2c 0a 20 20 20 20 20 .companyName,.......extra,......
24060 20 69 67 6e 6f 72 65 53 79 73 74 65 6d 43 72 61 73 68 48 61 6e 64 6c 65 72 2c 0a 20 20 20 20 20 .ignoreSystemCrashHandler,......
24080 20 73 75 62 6d 69 74 55 52 4c 2c 0a 20 20 20 20 20 20 75 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 .submitURL,.......uploadToServer
240a0 0a 20 20 20 20 7d 20 3d 20 6f 70 74 69 6f 6e 73 0a 0a 20 20 20 20 69 66 20 28 75 70 6c 6f 61 64 .....}.=.options......if.(upload
240c0 54 6f 53 65 72 76 65 72 20 3d 3d 20 6e 75 6c 6c 29 20 75 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 ToServer.==.null).uploadToServer
240e0 20 3d 20 6f 70 74 69 6f 6e 73 2e 61 75 74 6f 53 75 62 6d 69 74 0a 20 20 20 20 69 66 20 28 75 70 .=.options.autoSubmit.....if.(up
24100 6c 6f 61 64 54 6f 53 65 72 76 65 72 20 3d 3d 20 6e 75 6c 6c 29 20 75 70 6c 6f 61 64 54 6f 53 65 loadToServer.==.null).uploadToSe
24120 72 76 65 72 20 3d 20 74 72 75 65 0a 20 20 20 20 69 66 20 28 69 67 6e 6f 72 65 53 79 73 74 65 6d rver.=.true.....if.(ignoreSystem
24140 43 72 61 73 68 48 61 6e 64 6c 65 72 20 3d 3d 20 6e 75 6c 6c 29 20 69 67 6e 6f 72 65 53 79 73 74 CrashHandler.==.null).ignoreSyst
24160 65 6d 43 72 61 73 68 48 61 6e 64 6c 65 72 20 3d 20 66 61 6c 73 65 0a 20 20 20 20 69 66 20 28 65 emCrashHandler.=.false.....if.(e
24180 78 74 72 61 20 3d 3d 20 6e 75 6c 6c 29 20 65 78 74 72 61 20 3d 20 7b 7d 0a 0a 20 20 20 20 69 66 xtra.==.null).extra.=.{}......if
241a0 20 28 65 78 74 72 61 2e 5f 70 72 6f 64 75 63 74 4e 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 20 65 78 .(extra._productName.==.null).ex
241c0 74 72 61 2e 5f 70 72 6f 64 75 63 74 4e 61 6d 65 20 3d 20 74 68 69 73 2e 67 65 74 50 72 6f 64 75 tra._productName.=.this.getProdu
241e0 63 74 4e 61 6d 65 28 29 0a 20 20 20 20 69 66 20 28 65 78 74 72 61 2e 5f 63 6f 6d 70 61 6e 79 4e ctName().....if.(extra._companyN
24200 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 20 65 78 74 72 61 2e 5f 63 6f 6d 70 61 6e 79 4e 61 6d 65 20 ame.==.null).extra._companyName.
24220 3d 20 63 6f 6d 70 61 6e 79 4e 61 6d 65 0a 20 20 20 20 69 66 20 28 65 78 74 72 61 2e 5f 76 65 72 =.companyName.....if.(extra._ver
24240 73 69 6f 6e 20 3d 3d 20 6e 75 6c 6c 29 20 65 78 74 72 61 2e 5f 76 65 72 73 69 6f 6e 20 3d 20 61 sion.==.null).extra._version.=.a
24260 70 70 2e 67 65 74 56 65 72 73 69 6f 6e 28 29 0a 0a 20 20 20 20 69 66 20 28 63 6f 6d 70 61 6e 79 pp.getVersion()......if.(company
24280 4e 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 Name.==.null).{.......throw.new.
242a0 45 72 72 6f 72 28 27 63 6f 6d 70 61 6e 79 4e 61 6d 65 20 69 73 20 61 20 72 65 71 75 69 72 65 64 Error('companyName.is.a.required
242c0 20 6f 70 74 69 6f 6e 20 74 6f 20 63 72 61 73 68 52 65 70 6f 72 74 65 72 2e 73 74 61 72 74 27 29 .option.to.crashReporter.start')
242e0 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 73 75 62 6d 69 74 55 52 4c 20 3d 3d 20 6e 75 6c 6c .....}.....if.(submitURL.==.null
24300 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 73 75 62 6d 69 ).{.......throw.new.Error('submi
24320 74 55 52 4c 20 69 73 20 61 20 72 65 71 75 69 72 65 64 20 6f 70 74 69 6f 6e 20 74 6f 20 63 72 61 tURL.is.a.required.option.to.cra
24340 73 68 52 65 70 6f 72 74 65 72 2e 73 74 61 72 74 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 shReporter.start').....}......if
24360 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 29 20 .(process.platform.===.'win32').
24380 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 65 6e 76 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 45 4c {.......const.env.=.{.........EL
243a0 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 43 52 41 53 48 5f 53 45 52 56 49 43 45 3a 20 31 ECTRON_INTERNAL_CRASH_SERVICE:.1
243c0 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 61 72 67 73 20 3d 20 5b 0a 20 20 .......}.......const.args.=.[...
243e0 20 20 20 20 20 20 27 2d 2d 72 65 70 6f 72 74 65 72 2d 75 72 6c 3d 27 20 2b 20 73 75 62 6d 69 74 ......'--reporter-url='.+.submit
24400 55 52 4c 2c 0a 20 20 20 20 20 20 20 20 27 2d 2d 61 70 70 6c 69 63 61 74 69 6f 6e 2d 6e 61 6d 65 URL,.........'--application-name
24420 3d 27 20 2b 20 74 68 69 73 2e 67 65 74 50 72 6f 64 75 63 74 4e 61 6d 65 28 29 2c 0a 20 20 20 20 ='.+.this.getProductName(),.....
24440 20 20 20 20 27 2d 2d 63 72 61 73 68 65 73 2d 64 69 72 65 63 74 6f 72 79 3d 27 20 2b 20 74 68 69 ....'--crashes-directory='.+.thi
24460 73 2e 67 65 74 43 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 28 29 2c 0a 20 20 20 20 20 20 20 s.getCrashesDirectory(),........
24480 20 27 2d 2d 76 3d 31 27 0a 20 20 20 20 20 20 5d 0a 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 63 72 .'--v=1'.......]........this._cr
244a0 61 73 68 53 65 72 76 69 63 65 50 72 6f 63 65 73 73 20 3d 20 73 70 61 77 6e 28 70 72 6f 63 65 73 ashServiceProcess.=.spawn(proces
244c0 73 2e 65 78 65 63 50 61 74 68 2c 20 61 72 67 73 2c 20 7b 0a 20 20 20 20 20 20 20 20 65 6e 76 3a s.execPath,.args,.{.........env:
244e0 20 65 6e 76 2c 0a 20 20 20 20 20 20 20 20 64 65 74 61 63 68 65 64 3a 20 74 72 75 65 0a 20 20 20 .env,.........detached:.true....
24500 20 20 20 7d 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 62 69 6e 64 69 6e 67 2e 73 74 61 72 74 28 74 ...}).....}......binding.start(t
24520 68 69 73 2e 67 65 74 50 72 6f 64 75 63 74 4e 61 6d 65 28 29 2c 20 63 6f 6d 70 61 6e 79 4e 61 6d his.getProductName(),.companyNam
24540 65 2c 20 73 75 62 6d 69 74 55 52 4c 2c 20 74 68 69 73 2e 67 65 74 43 72 61 73 68 65 73 44 69 72 e,.submitURL,.this.getCrashesDir
24560 65 63 74 6f 72 79 28 29 2c 20 75 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 2c 20 69 67 6e 6f 72 65 ectory(),.uploadToServer,.ignore
24580 53 79 73 74 65 6d 43 72 61 73 68 48 61 6e 64 6c 65 72 2c 20 65 78 74 72 61 29 0a 20 20 7d 0a 0a SystemCrashHandler,.extra)...}..
245a0 20 20 67 65 74 4c 61 73 74 43 72 61 73 68 52 65 70 6f 72 74 20 28 29 20 7b 0a 20 20 20 20 63 6f ..getLastCrashReport.().{.....co
245c0 6e 73 74 20 72 65 70 6f 72 74 73 20 3d 20 74 68 69 73 2e 67 65 74 55 70 6c 6f 61 64 65 64 52 65 nst.reports.=.this.getUploadedRe
245e0 70 6f 72 74 73 28 29 0a 20 20 20 20 72 65 74 75 72 6e 20 28 72 65 70 6f 72 74 73 2e 6c 65 6e 67 ports().....return.(reports.leng
24600 74 68 20 3e 20 30 29 20 3f 20 72 65 70 6f 72 74 73 5b 30 5d 20 3a 20 6e 75 6c 6c 0a 20 20 7d 0a th.>.0).?.reports[0].:.null...}.
24620 0a 20 20 67 65 74 55 70 6c 6f 61 64 65 64 52 65 70 6f 72 74 73 20 28 29 20 7b 0a 20 20 20 20 72 ...getUploadedReports.().{.....r
24640 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 67 65 74 55 70 6c 6f 61 64 65 64 52 65 70 6f 72 74 73 eturn.binding.getUploadedReports
24660 28 74 68 69 73 2e 67 65 74 43 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 28 29 29 0a 20 20 7d (this.getCrashesDirectory())...}
24680 0a 0a 20 20 67 65 74 43 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 20 28 29 20 7b 0a 20 20 20 ....getCrashesDirectory.().{....
246a0 20 63 6f 6e 73 74 20 63 72 61 73 68 65 73 44 69 72 20 3d 20 60 24 7b 74 68 69 73 2e 67 65 74 50 .const.crashesDir.=.`${this.getP
246c0 72 6f 64 75 63 74 4e 61 6d 65 28 29 7d 20 43 72 61 73 68 65 73 60 0a 20 20 20 20 72 65 74 75 72 roductName()}.Crashes`.....retur
246e0 6e 20 70 61 74 68 2e 6a 6f 69 6e 28 74 68 69 73 2e 67 65 74 54 65 6d 70 44 69 72 65 63 74 6f 72 n.path.join(this.getTempDirector
24700 79 28 29 2c 20 63 72 61 73 68 65 73 44 69 72 29 0a 20 20 7d 0a 0a 20 20 67 65 74 50 72 6f 64 75 y(),.crashesDir)...}....getProdu
24720 63 74 4e 61 6d 65 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 70 72 6f 64 75 63 74 ctName.().{.....if.(this.product
24740 4e 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 70 72 6f 64 75 Name.==.null).{.......this.produ
24760 63 74 4e 61 6d 65 20 3d 20 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 0a 20 20 20 20 7d 0a 20 20 20 ctName.=.app.getName().....}....
24780 20 72 65 74 75 72 6e 20 74 68 69 73 2e 70 72 6f 64 75 63 74 4e 61 6d 65 0a 20 20 7d 0a 0a 20 20 .return.this.productName...}....
247a0 67 65 74 54 65 6d 70 44 69 72 65 63 74 6f 72 79 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 getTempDirectory.().{.....if.(th
247c0 69 73 2e 74 65 6d 70 44 69 72 65 63 74 6f 72 79 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 is.tempDirectory.==.null).{.....
247e0 20 20 74 72 79 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 74 65 6d 70 44 69 72 65 63 74 6f ..try.{.........this.tempDirecto
24800 72 79 20 3d 20 61 70 70 2e 67 65 74 50 61 74 68 28 27 74 65 6d 70 27 29 0a 20 20 20 20 20 20 7d ry.=.app.getPath('temp').......}
24820 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 74 65 .catch.(error).{.........this.te
24840 6d 70 44 69 72 65 63 74 6f 72 79 20 3d 20 6f 73 2e 74 6d 70 64 69 72 28 29 0a 20 20 20 20 20 20 mpDirectory.=.os.tmpdir().......
24860 7d 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 74 65 6d 70 44 69 72 65 }.....}.....return.this.tempDire
24880 63 74 6f 72 79 0a 20 20 7d 0a 0a 20 20 67 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 20 28 ctory...}....getUploadToServer.(
248a0 29 20 7b 0a 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 74 79 70 65 20 3d 3d 3d 20 27 62 72 ).{.....if.(process.type.===.'br
248c0 6f 77 73 65 72 27 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 67 owser').{.......return.binding.g
248e0 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 28 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a etUploadToServer().....}.else.{.
24900 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 67 65 74 55 70 6c 6f 61 64 ......throw.new.Error('getUpload
24920 54 6f 53 65 72 76 65 72 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 63 61 6c 6c 65 64 20 66 72 6f 6d ToServer.can.only.be.called.from
24940 20 74 68 65 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 27 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 .the.main.process').....}...}...
24960 20 73 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 20 28 75 70 6c 6f 61 64 54 6f 53 65 72 76 .setUploadToServer.(uploadToServ
24980 65 72 29 20 7b 0a 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 74 79 70 65 20 3d 3d 3d 20 27 er).{.....if.(process.type.===.'
249a0 62 72 6f 77 73 65 72 27 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 browser').{.......return.binding
249c0 2e 73 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 28 75 70 6c 6f 61 64 54 6f 53 65 72 76 65 .setUploadToServer(uploadToServe
249e0 72 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 r).....}.else.{.......throw.new.
24a00 45 72 72 6f 72 28 27 73 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 20 63 61 6e 20 6f 6e 6c Error('setUploadToServer.can.onl
24a20 79 20 62 65 20 63 61 6c 6c 65 64 20 66 72 6f 6d 20 74 68 65 20 6d 61 69 6e 20 70 72 6f 63 65 73 y.be.called.from.the.main.proces
24a40 73 27 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 54 4f 44 4f 28 32 2e 30 29 20 52 65 s').....}...}....//.TODO(2.0).Re
24a60 6d 6f 76 65 0a 20 20 73 65 74 45 78 74 72 61 50 61 72 61 6d 65 74 65 72 20 28 6b 65 79 2c 20 76 move...setExtraParameter.(key,.v
24a80 61 6c 75 65 29 20 7b 0a 20 20 20 20 2f 2f 20 54 4f 44 4f 28 61 6c 65 78 65 79 6b 75 7a 6d 69 6e alue).{.....//.TODO(alexeykuzmin
24aa0 29 3a 20 57 61 72 6e 69 6e 67 20 64 69 73 61 62 6c 65 64 20 73 69 6e 63 65 20 69 74 20 63 61 75 ):.Warning.disabled.since.it.cau
24ac0 73 65 64 0a 20 20 20 20 2f 2f 20 61 20 63 6f 75 70 6c 65 20 6f 66 20 43 72 61 73 68 20 52 65 70 sed.....//.a.couple.of.Crash.Rep
24ae0 6f 72 74 65 64 20 74 65 73 74 73 20 74 6f 20 74 69 6d 65 20 6f 75 74 20 6f 6e 20 4d 61 63 2e 20 orted.tests.to.time.out.on.Mac..
24b00 41 64 64 20 69 74 20 62 61 63 6b 2e 0a 20 20 20 20 2f 2f 20 68 74 74 70 73 3a 2f 2f 67 69 74 68 Add.it.back......//.https://gith
24b20 75 62 2e 63 6f 6d 2f 65 6c 65 63 74 72 6f 6e 2f 65 6c 65 63 74 72 6f 6e 2f 69 73 73 75 65 73 2f ub.com/electron/electron/issues/
24b40 31 31 30 31 32 0a 0a 20 20 20 20 2f 2f 20 69 66 20 28 21 70 72 6f 63 65 73 73 2e 6e 6f 44 65 70 11012......//.if.(!process.noDep
24b60 72 65 63 61 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 2f 2f 20 20 20 64 65 70 72 65 63 61 74 65 2e recations).{.....//...deprecate.
24b80 77 61 72 6e 28 27 63 72 61 73 68 52 65 70 6f 72 74 65 72 2e 73 65 74 45 78 74 72 61 50 61 72 61 warn('crashReporter.setExtraPara
24ba0 6d 65 74 65 72 27 2c 0a 20 20 20 20 2f 2f 20 20 20 20 20 27 63 72 61 73 68 52 65 70 6f 72 74 65 meter',.....//.....'crashReporte
24bc0 72 2e 61 64 64 45 78 74 72 61 50 61 72 61 6d 65 74 65 72 20 6f 72 20 63 72 61 73 68 52 65 70 6f r.addExtraParameter.or.crashRepo
24be0 72 74 65 72 2e 72 65 6d 6f 76 65 45 78 74 72 61 50 61 72 61 6d 65 74 65 72 27 29 0a 20 20 20 20 rter.removeExtraParameter').....
24c00 2f 2f 20 7d 0a 20 20 20 20 62 69 6e 64 69 6e 67 2e 73 65 74 45 78 74 72 61 50 61 72 61 6d 65 74 //.}.....binding.setExtraParamet
24c20 65 72 28 6b 65 79 2c 20 76 61 6c 75 65 29 0a 20 20 7d 0a 0a 20 20 61 64 64 45 78 74 72 61 50 61 er(key,.value)...}....addExtraPa
24c40 72 61 6d 65 74 65 72 20 28 6b 65 79 2c 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 62 69 6e 64 69 rameter.(key,.value).{.....bindi
24c60 6e 67 2e 61 64 64 45 78 74 72 61 50 61 72 61 6d 65 74 65 72 28 6b 65 79 2c 20 76 61 6c 75 65 29 ng.addExtraParameter(key,.value)
24c80 0a 20 20 7d 0a 0a 20 20 72 65 6d 6f 76 65 45 78 74 72 61 50 61 72 61 6d 65 74 65 72 20 28 6b 65 ...}....removeExtraParameter.(ke
24ca0 79 29 20 7b 0a 20 20 20 20 62 69 6e 64 69 6e 67 2e 72 65 6d 6f 76 65 45 78 74 72 61 50 61 72 61 y).{.....binding.removeExtraPara
24cc0 6d 65 74 65 72 28 6b 65 79 29 0a 20 20 7d 0a 0a 20 20 67 65 74 50 61 72 61 6d 65 74 65 72 73 20 meter(key)...}....getParameters.
24ce0 28 6b 65 79 2c 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e (key,.value).{.....return.bindin
24d00 67 2e 67 65 74 50 61 72 61 6d 65 74 65 72 73 28 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e g.getParameters()...}.}..module.
24d20 65 78 70 6f 72 74 73 20 3d 20 6e 65 77 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 28 29 0a 2f 2f exports.=.new.CrashReporter().//
24d40 20 44 65 70 72 65 63 61 74 65 20 61 20 6d 65 74 68 6f 64 2e 0a 63 6f 6e 73 74 20 64 65 70 72 65 .Deprecate.a.method..const.depre
24d60 63 61 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 6c 64 4e 61 6d 65 2c 20 6e 65 77 4e 61 6d cate.=.function.(oldName,.newNam
24d80 65 2c 20 66 6e 29 20 7b 0a 20 20 6c 65 74 20 77 61 72 6e 65 64 20 3d 20 66 61 6c 73 65 0a 20 20 e,.fn).{...let.warned.=.false...
24da0 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 21 28 77 return.function.().{.....if.(!(w
24dc0 61 72 6e 65 64 20 7c 7c 20 70 72 6f 63 65 73 73 2e 6e 6f 44 65 70 72 65 63 61 74 69 6f 6e 29 29 arned.||.process.noDeprecation))
24de0 20 7b 0a 20 20 20 20 20 20 77 61 72 6e 65 64 20 3d 20 74 72 75 65 0a 20 20 20 20 20 20 64 65 70 .{.......warned.=.true.......dep
24e00 72 65 63 61 74 65 2e 77 61 72 6e 28 6f 6c 64 4e 61 6d 65 2c 20 6e 65 77 4e 61 6d 65 29 0a 20 20 recate.warn(oldName,.newName)...
24e20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 66 6e 2e 61 70 70 6c 79 28 74 68 69 73 2c 20 61 72 ..}.....return.fn.apply(this,.ar
24e40 67 75 6d 65 6e 74 73 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 54 68 65 20 6d 65 74 68 6f 64 20 69 73 guments)...}.}..//.The.method.is
24e60 20 61 6c 69 61 73 65 73 20 61 6e 64 20 74 68 65 20 6f 6c 64 20 6d 65 74 68 6f 64 20 69 73 20 72 .aliases.and.the.old.method.is.r
24e80 65 74 61 69 6e 65 64 20 66 6f 72 20 62 61 63 6b 77 61 72 64 73 20 63 6f 6d 70 61 74 0a 64 65 70 etained.for.backwards.compat.dep
24ea0 72 65 63 61 74 65 2e 61 6c 69 61 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 62 6a 65 63 74 2c recate.alias.=.function.(object,
24ec0 20 64 65 70 72 65 63 61 74 65 64 4e 61 6d 65 2c 20 65 78 69 73 74 69 6e 67 4e 61 6d 65 29 20 7b .deprecatedName,.existingName).{
24ee0 0a 20 20 6c 65 74 20 77 61 72 6e 65 64 20 3d 20 66 61 6c 73 65 0a 20 20 63 6f 6e 73 74 20 6e 65 ...let.warned.=.false...const.ne
24f00 77 4d 65 74 68 6f 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 wMethod.=.function.().{.....if.(
24f20 21 28 77 61 72 6e 65 64 20 7c 7c 20 70 72 6f 63 65 73 73 2e 6e 6f 44 65 70 72 65 63 61 74 69 6f !(warned.||.process.noDeprecatio
24f40 6e 29 29 20 7b 0a 20 20 20 20 20 20 77 61 72 6e 65 64 20 3d 20 74 72 75 65 0a 20 20 20 20 20 20 n)).{.......warned.=.true.......
24f60 64 65 70 72 65 63 61 74 65 2e 77 61 72 6e 28 64 65 70 72 65 63 61 74 65 64 4e 61 6d 65 2c 20 65 deprecate.warn(deprecatedName,.e
24f80 78 69 73 74 69 6e 67 4e 61 6d 65 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 xistingName).....}.....return.th
24fa0 69 73 5b 65 78 69 73 74 69 6e 67 4e 61 6d 65 5d 2e 61 70 70 6c 79 28 74 68 69 73 2c 20 61 72 67 is[existingName].apply(this,.arg
24fc0 75 6d 65 6e 74 73 29 0a 20 20 7d 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 6f 62 6a 65 63 74 20 uments)...}...if.(typeof.object.
24fe0 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 6f 62 6a 65 63 74 2e 70 72 6f ===.'function').{.....object.pro
25000 74 6f 74 79 70 65 5b 64 65 70 72 65 63 61 74 65 64 4e 61 6d 65 5d 20 3d 20 6e 65 77 4d 65 74 68 totype[deprecatedName].=.newMeth
25020 6f 64 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 6f 62 6a 65 63 74 5b 64 65 70 72 65 63 61 od...}.else.{.....object[depreca
25040 74 65 64 4e 61 6d 65 5d 20 3d 20 6e 65 77 4d 65 74 68 6f 64 0a 20 20 7d 0a 7d 0a 0a 64 65 70 72 tedName].=.newMethod...}.}..depr
25060 65 63 61 74 65 2e 77 61 72 6e 20 3d 20 28 6f 6c 64 4e 61 6d 65 2c 20 6e 65 77 4e 61 6d 65 29 20 ecate.warn.=.(oldName,.newName).
25080 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 64 65 70 72 65 63 61 74 65 2e 6c 6f 67 28 60 27 24 7b =>.{...return.deprecate.log(`'${
250a0 6f 6c 64 4e 61 6d 65 7d 27 20 69 73 20 64 65 70 72 65 63 61 74 65 64 2e 20 55 73 65 20 27 24 7b oldName}'.is.deprecated..Use.'${
250c0 6e 65 77 4e 61 6d 65 7d 27 20 69 6e 73 74 65 61 64 2e 60 29 0a 7d 0a 0a 6c 65 74 20 64 65 70 72 newName}'.instead.`).}..let.depr
250e0 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 20 3d 20 6e 75 6c 6c 0a 0a 2f 2f 20 50 72 69 6e 74 20 ecationHandler.=.null..//.Print.
25100 64 65 70 72 65 63 61 74 69 6f 6e 20 6d 65 73 73 61 67 65 2e 0a 64 65 70 72 65 63 61 74 65 2e 6c deprecation.message..deprecate.l
25120 6f 67 20 3d 20 28 6d 65 73 73 61 67 65 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 74 79 70 65 6f 66 og.=.(message).=>.{...if.(typeof
25140 20 64 65 70 72 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f .deprecationHandler.===.'functio
25160 6e 27 29 20 7b 0a 20 20 20 20 64 65 70 72 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 28 6d 65 73 n').{.....deprecationHandler(mes
25180 73 61 67 65 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 70 72 6f 63 65 73 73 2e 74 68 72 6f 77 sage)...}.else.if.(process.throw
251a0 44 65 70 72 65 63 61 74 69 6f 6e 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 Deprecation).{.....throw.new.Err
251c0 6f 72 28 6d 65 73 73 61 67 65 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 70 72 6f 63 65 73 73 or(message)...}.else.if.(process
251e0 2e 74 72 61 63 65 44 65 70 72 65 63 61 74 69 6f 6e 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 .traceDeprecation).{.....return.
25200 63 6f 6e 73 6f 6c 65 2e 74 72 61 63 65 28 6d 65 73 73 61 67 65 29 0a 20 20 7d 20 65 6c 73 65 20 console.trace(message)...}.else.
25220 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 60 28 65 6c 65 63 {.....return.console.warn(`(elec
25240 74 72 6f 6e 29 20 24 7b 6d 65 73 73 61 67 65 7d 60 29 0a 20 20 7d 0a 7d 0a 0a 64 65 70 72 65 63 tron).${message}`)...}.}..deprec
25260 61 74 65 2e 73 65 74 48 61 6e 64 6c 65 72 20 3d 20 28 68 61 6e 64 6c 65 72 29 20 3d 3e 20 7b 0a ate.setHandler.=.(handler).=>.{.
25280 20 20 64 65 70 72 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 20 3d 20 68 61 6e 64 6c 65 72 0a 7d ..deprecationHandler.=.handler.}
252a0 0a 0a 64 65 70 72 65 63 61 74 65 2e 67 65 74 48 61 6e 64 6c 65 72 20 3d 20 28 29 20 3d 3e 20 64 ..deprecate.getHandler.=.().=>.d
252c0 65 70 72 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 0a 0a 2f 2f 20 4e 6f 6e 65 20 6f 66 20 74 68 eprecationHandler..//.None.of.th
252e0 65 20 62 65 6c 6f 77 20 6d 65 74 68 6f 64 73 20 61 72 65 20 75 73 65 64 2c 20 61 6e 64 20 73 6f e.below.methods.are.used,.and.so
25300 20 77 69 6c 6c 20 62 65 20 63 6f 6d 6d 65 6e 74 65 64 0a 2f 2f 20 6f 75 74 20 75 6e 74 69 6c 20 .will.be.commented.//.out.until.
25320 73 75 63 68 20 74 69 6d 65 20 74 68 61 74 20 74 68 65 79 20 61 72 65 20 6e 65 65 64 65 64 20 74 such.time.that.they.are.needed.t
25340 6f 20 62 65 20 75 73 65 64 20 61 6e 64 20 74 65 73 74 65 64 2e 0a 0a 2f 2f 20 2f 2f 20 46 6f 72 o.be.used.and.tested...//.//.For
25360 77 61 72 64 20 74 68 65 20 6d 65 74 68 6f 64 20 74 6f 20 6d 65 6d 62 65 72 2e 0a 2f 2f 20 64 65 ward.the.method.to.member..//.de
25380 70 72 65 63 61 74 65 2e 6d 65 6d 62 65 72 20 3d 20 28 6f 62 6a 65 63 74 2c 20 6d 65 74 68 6f 64 precate.member.=.(object,.method
253a0 2c 20 6d 65 6d 62 65 72 29 20 3d 3e 20 7b 0a 2f 2f 20 20 20 6c 65 74 20 77 61 72 6e 65 64 20 3d ,.member).=>.{.//...let.warned.=
253c0 20 66 61 6c 73 65 0a 2f 2f 20 20 20 6f 62 6a 65 63 74 2e 70 72 6f 74 6f 74 79 70 65 5b 6d 65 74 .false.//...object.prototype[met
253e0 68 6f 64 5d 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 2f 2f 20 20 20 20 20 69 66 20 28 hod].=.function.().{.//.....if.(
25400 21 28 77 61 72 6e 65 64 20 7c 7c 20 70 72 6f 63 65 73 73 2e 6e 6f 44 65 70 72 65 63 61 74 69 6f !(warned.||.process.noDeprecatio
25420 6e 29 29 20 7b 0a 2f 2f 20 20 20 20 20 20 20 77 61 72 6e 65 64 20 3d 20 74 72 75 65 0a 2f 2f 20 n)).{.//.......warned.=.true.//.
25440 20 20 20 20 20 20 64 65 70 72 65 63 61 74 65 2e 77 61 72 6e 28 6d 65 74 68 6f 64 2c 20 60 24 7b ......deprecate.warn(method,.`${
25460 6d 65 6d 62 65 72 7d 2e 24 7b 6d 65 74 68 6f 64 7d 60 29 0a 2f 2f 20 20 20 20 20 7d 0a 2f 2f 20 member}.${method}`).//.....}.//.
25480 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 5b 6d 65 6d 62 65 72 5d 5b 6d 65 74 68 6f 64 5d 2e ....return.this[member][method].
254a0 61 70 70 6c 79 28 74 68 69 73 5b 6d 65 6d 62 65 72 5d 2c 20 61 72 67 75 6d 65 6e 74 73 29 0a 2f apply(this[member],.arguments)./
254c0 2f 20 20 20 7d 0a 2f 2f 20 7d 0a 2f 2f 0a 2f 2f 20 2f 2f 20 44 65 70 72 65 63 61 74 65 20 61 20 /...}.//.}.//.//.//.Deprecate.a.
254e0 70 72 6f 70 65 72 74 79 2e 0a 2f 2f 20 64 65 70 72 65 63 61 74 65 2e 70 72 6f 70 65 72 74 79 20 property..//.deprecate.property.
25500 3d 20 28 6f 62 6a 65 63 74 2c 20 70 72 6f 70 65 72 74 79 2c 20 6d 65 74 68 6f 64 29 20 3d 3e 20 =.(object,.property,.method).=>.
25520 7b 0a 2f 2f 20 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 {.//...return.Object.definePrope
25540 72 74 79 28 6f 62 6a 65 63 74 2c 20 70 72 6f 70 65 72 74 79 2c 20 7b 0a 2f 2f 20 20 20 20 20 67 rty(object,.property,.{.//.....g
25560 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 2f 2f 20 20 20 20 20 20 20 6c 65 74 20 77 et:.function.().{.//.......let.w
25580 61 72 6e 65 64 20 3d 20 66 61 6c 73 65 0a 2f 2f 20 20 20 20 20 20 20 69 66 20 28 21 28 77 61 72 arned.=.false.//.......if.(!(war
255a0 6e 65 64 20 7c 7c 20 70 72 6f 63 65 73 73 2e 6e 6f 44 65 70 72 65 63 61 74 69 6f 6e 29 29 20 7b ned.||.process.noDeprecation)).{
255c0 0a 2f 2f 20 20 20 20 20 20 20 20 20 77 61 72 6e 65 64 20 3d 20 74 72 75 65 0a 2f 2f 20 20 20 20 .//.........warned.=.true.//....
255e0 20 20 20 20 20 64 65 70 72 65 63 61 74 65 2e 77 61 72 6e 28 60 24 7b 70 72 6f 70 65 72 74 79 7d .....deprecate.warn(`${property}
25600 20 70 72 6f 70 65 72 74 79 60 2c 20 60 24 7b 6d 65 74 68 6f 64 7d 20 6d 65 74 68 6f 64 60 29 0a .property`,.`${method}.method`).
25620 2f 2f 20 20 20 20 20 20 20 7d 0a 2f 2f 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 5b //.......}.//.......return.this[
25640 6d 65 74 68 6f 64 5d 28 29 0a 2f 2f 20 20 20 20 20 7d 0a 2f 2f 20 20 20 7d 29 0a 2f 2f 20 7d 0a method]().//.....}.//...}).//.}.
25660 2f 2f 0a 2f 2f 20 2f 2f 20 44 65 70 72 65 63 61 74 65 20 61 6e 20 65 76 65 6e 74 2e 0a 2f 2f 20 //.//.//.Deprecate.an.event..//.
25680 64 65 70 72 65 63 61 74 65 2e 65 76 65 6e 74 20 3d 20 28 65 6d 69 74 74 65 72 2c 20 6f 6c 64 4e deprecate.event.=.(emitter,.oldN
256a0 61 6d 65 2c 20 6e 65 77 4e 61 6d 65 2c 20 66 6e 29 20 3d 3e 20 7b 0a 2f 2f 20 20 20 6c 65 74 20 ame,.newName,.fn).=>.{.//...let.
256c0 77 61 72 6e 65 64 20 3d 20 66 61 6c 73 65 0a 2f 2f 20 20 20 72 65 74 75 72 6e 20 65 6d 69 74 74 warned.=.false.//...return.emitt
256e0 65 72 2e 6f 6e 28 6e 65 77 4e 61 6d 65 2c 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 er.on(newName,.function.(...args
25700 29 20 7b 0a 2f 2f 20 20 20 20 20 69 66 20 28 74 68 69 73 2e 6c 69 73 74 65 6e 65 72 43 6f 75 6e ).{.//.....if.(this.listenerCoun
25720 74 28 6f 6c 64 4e 61 6d 65 29 20 3e 20 30 29 20 7b 0a 2f 2f 20 20 20 20 20 20 20 69 66 20 28 21 t(oldName).>.0).{.//.......if.(!
25740 28 77 61 72 6e 65 64 20 7c 7c 20 70 72 6f 63 65 73 73 2e 6e 6f 44 65 70 72 65 63 61 74 69 6f 6e (warned.||.process.noDeprecation
25760 29 29 20 7b 0a 2f 2f 20 20 20 20 20 20 20 20 20 77 61 72 6e 65 64 20 3d 20 74 72 75 65 0a 2f 2f )).{.//.........warned.=.true.//
25780 20 20 20 20 20 20 20 20 20 64 65 70 72 65 63 61 74 65 2e 77 61 72 6e 28 60 27 24 7b 6f 6c 64 4e .........deprecate.warn(`'${oldN
257a0 61 6d 65 7d 27 20 65 76 65 6e 74 60 2c 20 60 27 24 7b 6e 65 77 4e 61 6d 65 7d 27 20 65 76 65 6e ame}'.event`,.`'${newName}'.even
257c0 74 60 29 0a 2f 2f 20 20 20 20 20 20 20 7d 0a 2f 2f 20 20 20 20 20 20 20 69 66 20 28 66 6e 20 21 t`).//.......}.//.......if.(fn.!
257e0 3d 20 6e 75 6c 6c 29 20 7b 0a 2f 2f 20 20 20 20 20 20 20 20 20 66 6e 2e 61 70 70 6c 79 28 74 68 =.null).{.//.........fn.apply(th
25800 69 73 2c 20 61 72 67 75 6d 65 6e 74 73 29 0a 2f 2f 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b is,.arguments).//.......}.else.{
25820 0a 2f 2f 20 20 20 20 20 20 20 20 20 74 68 69 73 2e 65 6d 69 74 2e 61 70 70 6c 79 28 74 68 69 73 .//.........this.emit.apply(this
25840 2c 20 5b 6f 6c 64 4e 61 6d 65 5d 2e 63 6f 6e 63 61 74 28 61 72 67 73 29 29 0a 2f 2f 20 20 20 20 ,.[oldName].concat(args)).//....
25860 20 20 20 7d 0a 2f 2f 20 20 20 20 20 7d 0a 2f 2f 20 20 20 7d 29 0a 2f 2f 20 7d 0a 0a 6d 6f 64 75 ...}.//.....}.//...}).//.}..modu
25880 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 64 65 70 72 65 63 61 74 65 0a 27 75 73 65 20 73 74 72 69 le.exports.=.deprecate.'use.stri
258a0 63 74 27 0a 0a 63 6f 6e 73 74 20 64 65 70 72 65 63 61 74 65 20 3d 20 72 65 71 75 69 72 65 28 27 ct'..const.deprecate.=.require('
258c0 65 6c 65 63 74 72 6f 6e 27 29 2e 64 65 70 72 65 63 61 74 65 0a 0a 65 78 70 6f 72 74 73 2e 73 65 electron').deprecate..exports.se
258e0 74 48 61 6e 64 6c 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 64 65 70 72 65 63 61 74 69 6f 6e tHandler.=.function.(deprecation
25900 48 61 6e 64 6c 65 72 29 20 7b 0a 20 20 64 65 70 72 65 63 61 74 65 2e 73 65 74 48 61 6e 64 6c 65 Handler).{...deprecate.setHandle
25920 72 28 64 65 70 72 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 29 0a 7d 0a 0a 65 78 70 6f 72 74 73 r(deprecationHandler).}..exports
25940 2e 67 65 74 48 61 6e 64 6c 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 .getHandler.=.function.().{...re
25960 74 75 72 6e 20 64 65 70 72 65 63 61 74 65 2e 67 65 74 48 61 6e 64 6c 65 72 28 29 0a 7d 0a 63 6f turn.deprecate.getHandler().}.co
25980 6e 73 74 20 6d 6f 64 75 6c 65 4c 69 73 74 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2e 2f 6d 6f 64 nst.moduleList.=.require('../mod
259a0 75 6c 65 2d 6c 69 73 74 27 29 0a 0a 2f 2f 20 41 74 74 61 63 68 65 73 20 70 72 6f 70 65 72 74 69 ule-list')..//.Attaches.properti
259c0 65 73 20 74 6f 20 7c 65 78 70 6f 72 74 73 7c 2e 0a 65 78 70 6f 72 74 73 2e 64 65 66 69 6e 65 50 es.to.|exports|..exports.defineP
259e0 72 6f 70 65 72 74 69 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 78 70 6f 72 74 73 29 20 7b roperties.=.function.(exports).{
25a00 0a 20 20 63 6f 6e 73 74 20 64 65 73 63 72 69 70 74 6f 72 73 20 3d 20 7b 7d 0a 20 20 66 6f 72 20 ...const.descriptors.=.{}...for.
25a20 28 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 20 6f 66 20 6d 6f 64 75 6c 65 4c 69 73 74 29 20 7b 0a 20 (const.module.of.moduleList).{..
25a40 20 20 20 64 65 73 63 72 69 70 74 6f 72 73 5b 6d 6f 64 75 6c 65 2e 6e 61 6d 65 5d 20 3d 20 7b 0a ...descriptors[module.name].=.{.
25a60 20 20 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 21 6d 6f 64 75 6c 65 2e 70 72 69 76 61 74 ......enumerable:.!module.privat
25a80 65 2c 0a 20 20 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 72 65 71 75 69 72 65 28 60 2e 2e 2f e,.......get:.().=>.require(`../
25aa0 24 7b 6d 6f 64 75 6c 65 2e 66 69 6c 65 7d 60 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 ${module.file}`).....}...}...ret
25ac0 75 72 6e 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 69 65 73 28 65 78 70 6f urn.Object.defineProperties(expo
25ae0 72 74 73 2c 20 64 65 73 63 72 69 70 74 6f 72 73 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 rts,.descriptors).}.'use.strict'
25b00 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 69 73 50 72 ..module.exports.=.function.isPr
25b20 6f 6d 69 73 65 20 28 76 61 6c 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 28 0a 20 20 20 20 76 61 6c omise.(val).{...return.(.....val
25b40 20 26 26 0a 20 20 20 20 76 61 6c 2e 74 68 65 6e 20 26 26 0a 20 20 20 20 76 61 6c 2e 74 68 65 6e .&&.....val.then.&&.....val.then
25b60 20 69 6e 73 74 61 6e 63 65 6f 66 20 46 75 6e 63 74 69 6f 6e 20 26 26 0a 20 20 20 20 76 61 6c 2e .instanceof.Function.&&.....val.
25b80 63 6f 6e 73 74 72 75 63 74 6f 72 20 26 26 0a 20 20 20 20 76 61 6c 2e 63 6f 6e 73 74 72 75 63 74 constructor.&&.....val.construct
25ba0 6f 72 2e 72 65 6a 65 63 74 20 26 26 0a 20 20 20 20 76 61 6c 2e 63 6f 6e 73 74 72 75 63 74 6f 72 or.reject.&&.....val.constructor
25bc0 2e 72 65 6a 65 63 74 20 69 6e 73 74 61 6e 63 65 6f 66 20 46 75 6e 63 74 69 6f 6e 20 26 26 0a 20 .reject.instanceof.Function.&&..
25be0 20 20 20 76 61 6c 2e 63 6f 6e 73 74 72 75 63 74 6f 72 2e 72 65 73 6f 6c 76 65 20 26 26 0a 20 20 ...val.constructor.resolve.&&...
25c00 20 20 76 61 6c 2e 63 6f 6e 73 74 72 75 63 74 6f 72 2e 72 65 73 6f 6c 76 65 20 69 6e 73 74 61 6e ..val.constructor.resolve.instan
25c20 63 65 6f 66 20 46 75 6e 63 74 69 6f 6e 0a 20 20 29 0a 7d 0a 2f 2f 20 43 6f 6d 6d 6f 6e 20 6d 6f ceof.Function...).}.//.Common.mo
25c40 64 75 6c 65 73 2c 20 70 6c 65 61 73 65 20 73 6f 72 74 20 61 6c 70 68 61 62 65 74 69 63 61 6c 6c dules,.please.sort.alphabeticall
25c60 79 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 5b 0a 20 20 7b 6e 61 6d 65 3a 20 27 63 y.module.exports.=.[...{name:.'c
25c80 6c 69 70 62 6f 61 72 64 27 2c 20 66 69 6c 65 3a 20 27 63 6c 69 70 62 6f 61 72 64 27 7d 2c 0a 20 lipboard',.file:.'clipboard'},..
25ca0 20 7b 6e 61 6d 65 3a 20 27 63 72 61 73 68 52 65 70 6f 72 74 65 72 27 2c 20 66 69 6c 65 3a 20 27 .{name:.'crashReporter',.file:.'
25cc0 63 72 61 73 68 2d 72 65 70 6f 72 74 65 72 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 6e 61 74 69 crash-reporter'},...{name:.'nati
25ce0 76 65 49 6d 61 67 65 27 2c 20 66 69 6c 65 3a 20 27 6e 61 74 69 76 65 2d 69 6d 61 67 65 27 7d 2c veImage',.file:.'native-image'},
25d00 0a 20 20 7b 6e 61 6d 65 3a 20 27 73 68 65 6c 6c 27 2c 20 66 69 6c 65 3a 20 27 73 68 65 6c 6c 27 ...{name:.'shell',.file:.'shell'
25d20 7d 2c 0a 20 20 2f 2f 20 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 6d 6f 64 75 6c 65 73 2c 20 69 6e },...//.The.internal.modules,.in
25d40 76 69 73 69 62 6c 65 20 75 6e 6c 65 73 73 20 79 6f 75 20 6b 6e 6f 77 20 74 68 65 69 72 20 6e 61 visible.unless.you.know.their.na
25d60 6d 65 73 2e 0a 20 20 7b 6e 61 6d 65 3a 20 27 43 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 mes....{name:.'CallbacksRegistry
25d80 27 2c 20 66 69 6c 65 3a 20 27 63 61 6c 6c 62 61 63 6b 73 2d 72 65 67 69 73 74 72 79 27 2c 20 70 ',.file:.'callbacks-registry',.p
25da0 72 69 76 61 74 65 3a 20 74 72 75 65 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 64 65 70 72 65 63 61 rivate:.true},...{name:.'depreca
25dc0 74 65 27 2c 20 66 69 6c 65 3a 20 27 64 65 70 72 65 63 61 74 65 27 2c 20 70 72 69 76 61 74 65 3a te',.file:.'deprecate',.private:
25de0 20 74 72 75 65 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 64 65 70 72 65 63 61 74 69 6f 6e 73 27 2c .true},...{name:.'deprecations',
25e00 20 66 69 6c 65 3a 20 27 64 65 70 72 65 63 61 74 69 6f 6e 73 27 2c 20 70 72 69 76 61 74 65 3a 20 .file:.'deprecations',.private:.
25e20 74 72 75 65 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 69 73 50 72 6f 6d 69 73 65 27 2c 20 66 69 6c true},...{name:.'isPromise',.fil
25e40 65 3a 20 27 69 73 2d 70 72 6f 6d 69 73 65 27 2c 20 70 72 69 76 61 74 65 3a 20 74 72 75 65 7d 0a e:.'is-promise',.private:.true}.
25e60 5d 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 ].module.exports.=.process.atomB
25e80 69 6e 64 69 6e 67 28 27 6e 61 74 69 76 65 5f 69 6d 61 67 65 27 29 0a 6d 6f 64 75 6c 65 2e 65 78 inding('native_image').module.ex
25ea0 70 6f 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 73 68 65 ports.=.process.atomBinding('she
25ec0 6c 6c 27 29 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 61 ll').module.exports.=.function.a
25ee0 74 6f 6d 42 69 6e 64 69 6e 67 53 65 74 75 70 20 28 62 69 6e 64 69 6e 67 2c 20 70 72 6f 63 65 73 tomBindingSetup.(binding,.proces
25f00 73 54 79 70 65 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e 20 61 74 6f 6d 42 sType).{...return.function.atomB
25f20 69 6e 64 69 6e 67 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 74 72 79 20 7b 0a 20 20 20 20 20 20 inding.(name).{.....try.{.......
25f40 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 28 60 61 74 6f 6d 5f 24 7b 70 72 6f 63 65 73 73 54 79 return.binding(`atom_${processTy
25f60 70 65 7d 5f 24 7b 6e 61 6d 65 7d 60 29 0a 20 20 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 pe}_${name}`).....}.catch.(error
25f80 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 2f 4e 6f 20 73 75 63 68 20 6d 6f 64 75 6c 65 2f 2e 74 ).{.......if.(/No.such.module/.t
25fa0 65 73 74 28 65 72 72 6f 72 2e 6d 65 73 73 61 67 65 29 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 est(error.message)).{.........re
25fc0 74 75 72 6e 20 62 69 6e 64 69 6e 67 28 60 61 74 6f 6d 5f 63 6f 6d 6d 6f 6e 5f 24 7b 6e 61 6d 65 turn.binding(`atom_common_${name
25fe0 7d 60 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 }`).......}.else.{.........throw
26000 20 65 72 72 6f 72 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 63 6f 6e 73 74 .error.......}.....}...}.}.const
26020 20 74 69 6d 65 72 73 20 3d 20 72 65 71 75 69 72 65 28 27 74 69 6d 65 72 73 27 29 0a 0a 70 72 6f .timers.=.require('timers')..pro
26040 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2f 61 74 cess.atomBinding.=.require('./at
26060 6f 6d 2d 62 69 6e 64 69 6e 67 2d 73 65 74 75 70 27 29 28 70 72 6f 63 65 73 73 2e 62 69 6e 64 69 om-binding-setup')(process.bindi
26080 6e 67 2c 20 70 72 6f 63 65 73 73 2e 74 79 70 65 29 0a 0a 2f 2f 20 73 65 74 49 6d 6d 65 64 69 61 ng,.process.type)..//.setImmedia
260a0 74 65 20 61 6e 64 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 20 6d 61 6b 65 73 20 75 73 te.and.process.nextTick.makes.us
260c0 65 20 6f 66 20 75 76 5f 63 68 65 63 6b 20 61 6e 64 20 75 76 5f 70 72 65 70 61 72 65 20 74 6f 0a e.of.uv_check.and.uv_prepare.to.
260e0 2f 2f 20 72 75 6e 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 73 2c 20 68 6f 77 65 76 65 72 20 73 69 //.run.the.callbacks,.however.si
26100 6e 63 65 20 77 65 20 6f 6e 6c 79 20 72 75 6e 20 75 76 20 6c 6f 6f 70 20 6f 6e 20 72 65 71 75 65 nce.we.only.run.uv.loop.on.reque
26120 73 74 73 2c 20 74 68 65 0a 2f 2f 20 63 61 6c 6c 62 61 63 6b 73 20 77 6f 75 6c 64 6e 27 74 20 62 sts,.the.//.callbacks.wouldn't.b
26140 65 20 63 61 6c 6c 65 64 20 75 6e 74 69 6c 20 73 6f 6d 65 74 68 69 6e 67 20 65 6c 73 65 20 61 63 e.called.until.something.else.ac
26160 74 69 76 61 74 65 64 20 74 68 65 20 75 76 20 6c 6f 6f 70 2c 0a 2f 2f 20 77 68 69 63 68 20 77 6f tivated.the.uv.loop,.//.which.wo
26180 75 6c 64 20 64 65 6c 61 79 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 73 20 66 6f 72 20 61 72 62 69 uld.delay.the.callbacks.for.arbi
261a0 74 72 61 72 79 20 6c 6f 6e 67 20 74 69 6d 65 2e 20 53 6f 20 77 65 20 73 68 6f 75 6c 64 0a 2f 2f trary.long.time..So.we.should.//
261c0 20 69 6e 69 74 69 61 74 69 76 65 6c 79 20 61 63 74 69 76 61 74 65 20 74 68 65 20 75 76 20 6c 6f .initiatively.activate.the.uv.lo
261e0 6f 70 20 6f 6e 63 65 20 73 65 74 49 6d 6d 65 64 69 61 74 65 20 61 6e 64 20 70 72 6f 63 65 73 73 op.once.setImmediate.and.process
26200 2e 6e 65 78 74 54 69 63 6b 20 69 73 0a 2f 2f 20 63 61 6c 6c 65 64 2e 0a 76 61 72 20 77 72 61 70 .nextTick.is.//.called..var.wrap
26220 57 69 74 68 41 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 66 WithActivateUvLoop.=.function.(f
26240 75 6e 63 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 unc).{...return.function.().{...
26260 20 20 70 72 6f 63 65 73 73 2e 61 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 29 0a 20 20 20 20 72 ..process.activateUvLoop().....r
26280 65 74 75 72 6e 20 66 75 6e 63 2e 61 70 70 6c 79 28 74 68 69 73 2c 20 61 72 67 75 6d 65 6e 74 73 eturn.func.apply(this,.arguments
262a0 29 0a 20 20 7d 0a 7d 0a 0a 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 20 3d 20 77 72 61 70 )...}.}..process.nextTick.=.wrap
262c0 57 69 74 68 41 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 WithActivateUvLoop(process.nextT
262e0 69 63 6b 29 0a 0a 67 6c 6f 62 61 6c 2e 73 65 74 49 6d 6d 65 64 69 61 74 65 20 3d 20 77 72 61 70 ick)..global.setImmediate.=.wrap
26300 57 69 74 68 41 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 74 69 6d 65 72 73 2e 73 65 74 49 6d 6d WithActivateUvLoop(timers.setImm
26320 65 64 69 61 74 65 29 0a 0a 67 6c 6f 62 61 6c 2e 63 6c 65 61 72 49 6d 6d 65 64 69 61 74 65 20 3d ediate)..global.clearImmediate.=
26340 20 74 69 6d 65 72 73 2e 63 6c 65 61 72 49 6d 6d 65 64 69 61 74 65 0a 0a 69 66 20 28 70 72 6f 63 .timers.clearImmediate..if.(proc
26360 65 73 73 2e 74 79 70 65 20 3d 3d 3d 20 27 62 72 6f 77 73 65 72 27 29 20 7b 0a 20 20 2f 2f 20 73 ess.type.===.'browser').{...//.s
26380 65 74 54 69 6d 65 6f 75 74 20 6e 65 65 64 73 20 74 6f 20 75 70 64 61 74 65 20 74 68 65 20 70 6f etTimeout.needs.to.update.the.po
263a0 6c 6c 69 6e 67 20 74 69 6d 65 6f 75 74 20 6f 66 20 74 68 65 20 65 76 65 6e 74 20 6c 6f 6f 70 2c lling.timeout.of.the.event.loop,
263c0 20 77 68 65 6e 0a 20 20 2f 2f 20 63 61 6c 6c 65 64 20 75 6e 64 65 72 20 43 68 72 6f 6d 69 75 6d .when...//.called.under.Chromium
263e0 27 73 20 65 76 65 6e 74 20 6c 6f 6f 70 20 74 68 65 20 6e 6f 64 65 27 73 20 65 76 65 6e 74 20 6c 's.event.loop.the.node's.event.l
26400 6f 6f 70 20 77 6f 6e 27 74 20 67 65 74 20 61 20 63 68 61 6e 63 65 0a 20 20 2f 2f 20 74 6f 20 75 oop.won't.get.a.chance...//.to.u
26420 70 64 61 74 65 20 74 68 65 20 74 69 6d 65 6f 75 74 2c 20 73 6f 20 77 65 20 68 61 76 65 20 74 6f pdate.the.timeout,.so.we.have.to
26440 20 66 6f 72 63 65 20 74 68 65 20 6e 6f 64 65 27 73 20 65 76 65 6e 74 20 6c 6f 6f 70 20 74 6f 0a .force.the.node's.event.loop.to.
26460 20 20 2f 2f 20 72 65 63 61 6c 63 75 6c 61 74 65 20 74 68 65 20 74 69 6d 65 6f 75 74 20 69 6e 20 ..//.recalculate.the.timeout.in.
26480 62 72 6f 77 73 65 72 20 70 72 6f 63 65 73 73 2e 0a 20 20 67 6c 6f 62 61 6c 2e 73 65 74 54 69 6d browser.process....global.setTim
264a0 65 6f 75 74 20 3d 20 77 72 61 70 57 69 74 68 41 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 74 69 eout.=.wrapWithActivateUvLoop(ti
264c0 6d 65 72 73 2e 73 65 74 54 69 6d 65 6f 75 74 29 0a 20 20 67 6c 6f 62 61 6c 2e 73 65 74 49 6e 74 mers.setTimeout)...global.setInt
264e0 65 72 76 61 6c 20 3d 20 77 72 61 70 57 69 74 68 41 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 74 erval.=.wrapWithActivateUvLoop(t
26500 69 6d 65 72 73 2e 73 65 74 49 6e 74 65 72 76 61 6c 29 0a 7d 0a 0a 69 66 20 28 70 72 6f 63 65 73 imers.setInterval).}..if.(proces
26520 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 29 20 7b 0a 20 20 2f 2f 20 41 s.platform.===.'win32').{...//.A
26540 6c 77 61 79 73 20 72 65 74 75 72 6e 73 20 45 4f 46 20 66 6f 72 20 73 74 64 69 6e 20 73 74 72 65 lways.returns.EOF.for.stdin.stre
26560 61 6d 2e 0a 20 20 63 6f 6e 73 74 20 7b 52 65 61 64 61 62 6c 65 7d 20 3d 20 72 65 71 75 69 72 65 am....const.{Readable}.=.require
26580 28 27 73 74 72 65 61 6d 27 29 0a 20 20 63 6f 6e 73 74 20 73 74 64 69 6e 20 3d 20 6e 65 77 20 52 ('stream')...const.stdin.=.new.R
265a0 65 61 64 61 62 6c 65 28 29 0a 20 20 73 74 64 69 6e 2e 70 75 73 68 28 6e 75 6c 6c 29 0a 20 20 70 eadable()...stdin.push(null)...p
265c0 72 6f 63 65 73 73 2e 5f 5f 64 65 66 69 6e 65 47 65 74 74 65 72 5f 5f 28 27 73 74 64 69 6e 27 2c rocess.__defineGetter__('stdin',
265e0 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 73 74 64 69 6e 0a .function.().{.....return.stdin.
26600 20 20 7d 29 0a 0a 20 20 2f 2f 20 49 66 20 77 65 27 72 65 20 72 75 6e 6e 69 6e 67 20 61 73 20 61 ..})....//.If.we're.running.as.a
26620 20 57 69 6e 64 6f 77 73 20 53 74 6f 72 65 20 61 70 70 2c 20 5f 5f 64 69 72 6e 61 6d 65 20 77 69 .Windows.Store.app,.__dirname.wi
26640 6c 6c 20 62 65 20 73 65 74 0a 20 20 2f 2f 20 74 6f 20 43 3a 2f 50 72 6f 67 72 61 6d 20 46 69 6c ll.be.set...//.to.C:/Program.Fil
26660 65 73 2f 57 69 6e 64 6f 77 73 41 70 70 73 2e 0a 20 20 2f 2f 0a 20 20 2f 2f 20 4e 6f 62 6f 64 79 es/WindowsApps....//...//.Nobody
26680 20 65 6c 73 65 20 67 65 74 27 73 20 74 6f 20 69 6e 73 74 61 6c 6c 20 74 68 65 72 65 2c 20 63 68 .else.get's.to.install.there,.ch
266a0 61 6e 67 69 6e 67 20 74 68 65 20 70 61 74 68 20 69 73 20 66 6f 72 62 69 64 64 65 6e 0a 20 20 2f anging.the.path.is.forbidden.../
266c0 2f 20 57 65 20 63 61 6e 20 74 68 65 72 65 66 6f 72 65 20 73 61 79 20 74 68 61 74 20 77 65 27 72 /.We.can.therefore.say.that.we'r
266e0 65 20 72 75 6e 6e 69 6e 67 20 61 73 20 61 70 70 78 0a 20 20 69 66 20 28 5f 5f 64 69 72 6e 61 6d e.running.as.appx...if.(__dirnam
26700 65 2e 69 6e 63 6c 75 64 65 73 28 27 5c 5c 57 69 6e 64 6f 77 73 41 70 70 73 5c 5c 27 29 29 20 7b e.includes('\\WindowsApps\\')).{
26720 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 77 69 6e 64 6f 77 73 53 74 6f 72 65 20 3d 20 74 72 75 65 .....process.windowsStore.=.true
26740 0a 20 20 7d 0a 7d 0a 2f 2f 20 70 61 72 73 65 73 20 61 20 66 65 61 74 75 72 65 20 73 74 72 69 6e ...}.}.//.parses.a.feature.strin
26760 67 20 74 68 61 74 20 68 61 73 20 74 68 65 20 66 6f 72 6d 61 74 20 75 73 65 64 20 69 6e 20 77 69 g.that.has.the.format.used.in.wi
26780 6e 64 6f 77 2e 6f 70 65 6e 28 29 0a 2f 2f 20 2d 20 60 66 65 61 74 75 72 65 73 60 20 69 6e 70 75 ndow.open().//.-.`features`.inpu
267a0 74 20 73 74 72 69 6e 67 0a 2f 2f 20 2d 20 60 65 6d 69 74 60 20 66 75 6e 63 74 69 6f 6e 28 6b 65 t.string.//.-.`emit`.function(ke
267c0 79 2c 20 76 61 6c 75 65 29 20 2d 20 63 61 6c 6c 65 64 20 66 6f 72 20 65 61 63 68 20 70 61 72 73 y,.value).-.called.for.each.pars
267e0 65 64 20 4b 56 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 ed.KV.module.exports.=.function.
26800 70 61 72 73 65 46 65 61 74 75 72 65 73 53 74 72 69 6e 67 20 28 66 65 61 74 75 72 65 73 2c 20 65 parseFeaturesString.(features,.e
26820 6d 69 74 29 20 7b 0a 20 20 66 65 61 74 75 72 65 73 20 3d 20 60 24 7b 66 65 61 74 75 72 65 73 7d mit).{...features.=.`${features}
26840 60 0a 20 20 2f 2f 20 73 70 6c 69 74 20 74 68 65 20 73 74 72 69 6e 67 20 62 79 20 27 2c 27 0a 20 `...//.split.the.string.by.','..
26860 20 66 65 61 74 75 72 65 73 2e 73 70 6c 69 74 28 2f 2c 5c 73 2a 2f 29 2e 66 6f 72 45 61 63 68 28 .features.split(/,\s*/).forEach(
26880 28 66 65 61 74 75 72 65 29 20 3d 3e 20 7b 0a 20 20 20 20 2f 2f 20 65 78 70 65 63 74 65 64 20 66 (feature).=>.{.....//.expected.f
268a0 6f 72 6d 20 69 73 20 65 69 74 68 65 72 20 61 20 6b 65 79 20 62 79 20 69 74 73 65 6c 66 20 6f 72 orm.is.either.a.key.by.itself.or
268c0 20 61 20 6b 65 79 2f 76 61 6c 75 65 20 70 61 69 72 20 69 6e 20 74 68 65 20 66 6f 72 6d 20 6f 66 .a.key/value.pair.in.the.form.of
268e0 0a 20 20 20 20 2f 2f 20 27 6b 65 79 3d 76 61 6c 75 65 27 0a 20 20 20 20 6c 65 74 20 5b 6b 65 79 .....//.'key=value'.....let.[key
26900 2c 20 76 61 6c 75 65 5d 20 3d 20 66 65 61 74 75 72 65 2e 73 70 6c 69 74 28 2f 5c 73 2a 3d 2f 29 ,.value].=.feature.split(/\s*=/)
26920 0a 20 20 20 20 69 66 20 28 21 6b 65 79 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 2f 2f 20 69 6e .....if.(!key).return......//.in
26940 74 65 72 70 72 65 74 20 74 68 65 20 76 61 6c 75 65 20 61 73 20 61 20 62 6f 6f 6c 65 61 6e 2c 20 terpret.the.value.as.a.boolean,.
26960 69 66 20 70 6f 73 73 69 62 6c 65 0a 20 20 20 20 76 61 6c 75 65 20 3d 20 28 76 61 6c 75 65 20 3d if.possible.....value.=.(value.=
26980 3d 3d 20 27 79 65 73 27 20 7c 7c 20 76 61 6c 75 65 20 3d 3d 3d 20 27 31 27 29 20 3f 20 74 72 75 ==.'yes'.||.value.===.'1').?.tru
269a0 65 20 3a 20 28 76 61 6c 75 65 20 3d 3d 3d 20 27 6e 6f 27 20 7c 7c 20 76 61 6c 75 65 20 3d 3d 3d e.:.(value.===.'no'.||.value.===
269c0 20 27 30 27 29 20 3f 20 66 61 6c 73 65 20 3a 20 76 61 6c 75 65 0a 0a 20 20 20 20 2f 2f 20 65 6d .'0').?.false.:.value......//.em
269e0 69 74 20 74 68 65 20 70 61 72 73 65 64 20 70 61 69 72 0a 20 20 20 20 65 6d 69 74 28 6b 65 79 2c it.the.parsed.pair.....emit(key,
26a00 20 76 61 6c 75 65 29 0a 20 20 7d 29 0a 7d 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 .value)...}).}.const.path.=.requ
26a20 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 4d 6f 64 75 6c 65 20 3d 20 72 65 71 75 69 ire('path').const.Module.=.requi
26a40 72 65 28 27 6d 6f 64 75 6c 65 27 29 0a 0a 2f 2f 20 43 6c 65 61 72 20 4e 6f 64 65 27 73 20 67 6c re('module')..//.Clear.Node's.gl
26a60 6f 62 61 6c 20 73 65 61 72 63 68 20 70 61 74 68 73 2e 0a 4d 6f 64 75 6c 65 2e 67 6c 6f 62 61 6c obal.search.paths..Module.global
26a80 50 61 74 68 73 2e 6c 65 6e 67 74 68 20 3d 20 30 0a 0a 2f 2f 20 43 6c 65 61 72 20 63 75 72 72 65 Paths.length.=.0..//.Clear.curre
26aa0 6e 74 20 61 6e 64 20 70 61 72 65 6e 74 28 69 6e 69 74 2e 6a 73 29 27 73 20 73 65 61 72 63 68 20 nt.and.parent(init.js)'s.search.
26ac0 70 61 74 68 73 2e 0a 6d 6f 64 75 6c 65 2e 70 61 74 68 73 20 3d 20 5b 5d 0a 6d 6f 64 75 6c 65 2e paths..module.paths.=.[].module.
26ae0 70 61 72 65 6e 74 2e 70 61 74 68 73 20 3d 20 5b 5d 0a 0a 2f 2f 20 50 72 65 76 65 6e 74 20 4e 6f parent.paths.=.[]..//.Prevent.No
26b00 64 65 20 66 72 6f 6d 20 61 64 64 69 6e 67 20 70 61 74 68 73 20 6f 75 74 73 69 64 65 20 74 68 69 de.from.adding.paths.outside.thi
26b20 73 20 61 70 70 20 74 6f 20 73 65 61 72 63 68 20 70 61 74 68 73 2e 0a 63 6f 6e 73 74 20 72 65 73 s.app.to.search.paths..const.res
26b40 6f 75 72 63 65 73 50 61 74 68 57 69 74 68 54 72 61 69 6c 69 6e 67 53 6c 61 73 68 20 3d 20 70 72 ourcesPathWithTrailingSlash.=.pr
26b60 6f 63 65 73 73 2e 72 65 73 6f 75 72 63 65 73 50 61 74 68 20 2b 20 70 61 74 68 2e 73 65 70 0a 63 ocess.resourcesPath.+.path.sep.c
26b80 6f 6e 73 74 20 6f 72 69 67 69 6e 61 6c 4e 6f 64 65 4d 6f 64 75 6c 65 50 61 74 68 73 20 3d 20 4d onst.originalNodeModulePaths.=.M
26ba0 6f 64 75 6c 65 2e 5f 6e 6f 64 65 4d 6f 64 75 6c 65 50 61 74 68 73 0a 4d 6f 64 75 6c 65 2e 5f 6e odule._nodeModulePaths.Module._n
26bc0 6f 64 65 4d 6f 64 75 6c 65 50 61 74 68 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 66 72 6f 6d 29 odeModulePaths.=.function.(from)
26be0 20 7b 0a 20 20 63 6f 6e 73 74 20 70 61 74 68 73 20 3d 20 6f 72 69 67 69 6e 61 6c 4e 6f 64 65 4d .{...const.paths.=.originalNodeM
26c00 6f 64 75 6c 65 50 61 74 68 73 28 66 72 6f 6d 29 0a 20 20 63 6f 6e 73 74 20 66 72 6f 6d 50 61 74 odulePaths(from)...const.fromPat
26c20 68 20 3d 20 70 61 74 68 2e 72 65 73 6f 6c 76 65 28 66 72 6f 6d 29 20 2b 20 70 61 74 68 2e 73 65 h.=.path.resolve(from).+.path.se
26c40 70 0a 20 20 2f 2f 20 49 66 20 22 66 72 6f 6d 22 20 69 73 20 6f 75 74 73 69 64 65 20 74 68 65 20 p...//.If."from".is.outside.the.
26c60 61 70 70 20 74 68 65 6e 20 77 65 20 64 6f 20 6e 6f 74 68 69 6e 67 2e 0a 20 20 69 66 20 28 66 72 app.then.we.do.nothing....if.(fr
26c80 6f 6d 50 61 74 68 2e 73 74 61 72 74 73 57 69 74 68 28 72 65 73 6f 75 72 63 65 73 50 61 74 68 57 omPath.startsWith(resourcesPathW
26ca0 69 74 68 54 72 61 69 6c 69 6e 67 53 6c 61 73 68 29 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 ithTrailingSlash)).{.....return.
26cc0 70 61 74 68 73 2e 66 69 6c 74 65 72 28 66 75 6e 63 74 69 6f 6e 20 28 63 61 6e 64 69 64 61 74 65 paths.filter(function.(candidate
26ce0 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6e 64 69 64 61 74 65 2e 73 74 61 72 74 ).{.......return.candidate.start
26d00 73 57 69 74 68 28 72 65 73 6f 75 72 63 65 73 50 61 74 68 57 69 74 68 54 72 61 69 6c 69 6e 67 53 sWith(resourcesPathWithTrailingS
26d20 6c 61 73 68 29 0a 20 20 20 20 7d 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 72 65 74 75 lash).....})...}.else.{.....retu
26d40 72 6e 20 70 61 74 68 73 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 50 61 74 63 68 20 4d 6f 64 75 6c 65 2e rn.paths...}.}..//.Patch.Module.
26d60 5f 72 65 73 6f 6c 76 65 46 69 6c 65 6e 61 6d 65 20 74 6f 20 61 6c 77 61 79 73 20 72 65 71 75 69 _resolveFilename.to.always.requi
26d80 72 65 20 74 68 65 20 45 6c 65 63 74 72 6f 6e 20 41 50 49 20 77 68 65 6e 0a 2f 2f 20 72 65 71 75 re.the.Electron.API.when.//.requ
26da0 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 20 69 73 20 64 6f 6e 65 2e 0a 63 6f 6e 73 74 20 65 ire('electron').is.done..const.e
26dc0 6c 65 63 74 72 6f 6e 50 61 74 68 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 5f 5f 64 69 72 6e 61 6d lectronPath.=.path.join(__dirnam
26de0 65 2c 20 27 2e 2e 27 2c 20 70 72 6f 63 65 73 73 2e 74 79 70 65 2c 20 27 61 70 69 27 2c 20 27 65 e,.'..',.process.type,.'api',.'e
26e00 78 70 6f 72 74 73 27 2c 20 27 65 6c 65 63 74 72 6f 6e 2e 6a 73 27 29 0a 63 6f 6e 73 74 20 6f 72 xports',.'electron.js').const.or
26e20 69 67 69 6e 61 6c 52 65 73 6f 6c 76 65 46 69 6c 65 6e 61 6d 65 20 3d 20 4d 6f 64 75 6c 65 2e 5f iginalResolveFilename.=.Module._
26e40 72 65 73 6f 6c 76 65 46 69 6c 65 6e 61 6d 65 0a 4d 6f 64 75 6c 65 2e 5f 72 65 73 6f 6c 76 65 46 resolveFilename.Module._resolveF
26e60 69 6c 65 6e 61 6d 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 72 65 71 75 65 73 74 2c 20 70 61 72 ilename.=.function.(request,.par
26e80 65 6e 74 2c 20 69 73 4d 61 69 6e 29 20 7b 0a 20 20 69 66 20 28 72 65 71 75 65 73 74 20 3d 3d 3d ent,.isMain).{...if.(request.===
26ea0 20 27 65 6c 65 63 74 72 6f 6e 27 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 65 6c 65 63 74 72 .'electron').{.....return.electr
26ec0 6f 6e 50 61 74 68 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 6f 72 69 onPath...}.else.{.....return.ori
26ee0 67 69 6e 61 6c 52 65 73 6f 6c 76 65 46 69 6c 65 6e 61 6d 65 28 72 65 71 75 65 73 74 2c 20 70 61 ginalResolveFilename(request,.pa
26f00 72 65 6e 74 2c 20 69 73 4d 61 69 6e 29 0a 20 20 7d 0a 7d 0a 63 6f 6e 73 74 20 7b 69 70 63 52 65 rent,.isMain)...}.}.const.{ipcRe
26f20 6e 64 65 72 65 72 2c 20 6e 61 74 69 76 65 49 6d 61 67 65 7d 20 3d 20 72 65 71 75 69 72 65 28 27 nderer,.nativeImage}.=.require('
26f40 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 63 6f 6e 73 74 20 69 6e 63 6c 75 64 65 73 20 3d 20 5b 5d 2e electron')..const.includes.=.[].
26f60 69 6e 63 6c 75 64 65 73 0a 6c 65 74 20 63 75 72 72 65 6e 74 49 64 20 3d 20 30 0a 0a 63 6f 6e 73 includes.let.currentId.=.0..cons
26f80 74 20 69 6e 63 72 65 6d 65 6e 74 49 64 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 63 75 72 72 65 6e t.incrementId.=.().=>.{...curren
26fa0 74 49 64 20 2b 3d 20 31 0a 20 20 72 65 74 75 72 6e 20 63 75 72 72 65 6e 74 49 64 0a 7d 0a 0a 2f tId.+=.1...return.currentId.}../
26fc0 2f 20 7c 6f 70 74 69 6f 6e 73 2e 74 79 70 65 73 7c 20 63 61 6e 27 74 20 62 65 20 65 6d 70 74 79 /.|options.types|.can't.be.empty
26fe0 20 61 6e 64 20 6d 75 73 74 20 62 65 20 61 6e 20 61 72 72 61 79 0a 66 75 6e 63 74 69 6f 6e 20 69 .and.must.be.an.array.function.i
27000 73 56 61 6c 69 64 20 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 74 79 70 65 73 sValid.(options).{...const.types
27020 20 3d 20 6f 70 74 69 6f 6e 73 20 3f 20 6f 70 74 69 6f 6e 73 2e 74 79 70 65 73 20 3a 20 75 6e 64 .=.options.?.options.types.:.und
27040 65 66 69 6e 65 64 0a 20 20 72 65 74 75 72 6e 20 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 74 79 efined...return.Array.isArray(ty
27060 70 65 73 29 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 67 65 74 53 6f 75 72 63 65 73 20 3d 20 66 75 6e pes).}..exports.getSources.=.fun
27080 63 74 69 6f 6e 20 28 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 69 66 ction.(options,.callback).{...if
270a0 20 28 21 69 73 56 61 6c 69 64 28 6f 70 74 69 6f 6e 73 29 29 20 72 65 74 75 72 6e 20 63 61 6c 6c .(!isValid(options)).return.call
270c0 62 61 63 6b 28 6e 65 77 20 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 20 6f 70 74 69 6f 6e 73 27 back(new.Error('Invalid.options'
270e0 29 29 0a 20 20 63 6f 6e 73 74 20 63 61 70 74 75 72 65 57 69 6e 64 6f 77 20 3d 20 69 6e 63 6c 75 ))...const.captureWindow.=.inclu
27100 64 65 73 2e 63 61 6c 6c 28 6f 70 74 69 6f 6e 73 2e 74 79 70 65 73 2c 20 27 77 69 6e 64 6f 77 27 des.call(options.types,.'window'
27120 29 0a 20 20 63 6f 6e 73 74 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 20 3d 20 69 6e 63 6c 75 64 )...const.captureScreen.=.includ
27140 65 73 2e 63 61 6c 6c 28 6f 70 74 69 6f 6e 73 2e 74 79 70 65 73 2c 20 27 73 63 72 65 65 6e 27 29 es.call(options.types,.'screen')
27160 0a 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 20 3d 3d ....if.(options.thumbnailSize.==
27180 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 74 68 75 6d 62 6e 61 69 6c 53 69 .null).{.....options.thumbnailSi
271a0 7a 65 20 3d 20 7b 0a 20 20 20 20 20 20 77 69 64 74 68 3a 20 31 35 30 2c 0a 20 20 20 20 20 20 68 ze.=.{.......width:.150,.......h
271c0 65 69 67 68 74 3a 20 31 35 30 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 69 64 eight:.150.....}...}....const.id
271e0 20 3d 20 69 6e 63 72 65 6d 65 6e 74 49 64 28 29 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 .=.incrementId()...ipcRenderer.s
27200 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 44 45 53 4b 54 4f 50 5f 43 41 end('ELECTRON_BROWSER_DESKTOP_CA
27220 50 54 55 52 45 52 5f 47 45 54 5f 53 4f 55 52 43 45 53 27 2c 20 63 61 70 74 75 72 65 57 69 6e 64 PTURER_GET_SOURCES',.captureWind
27240 6f 77 2c 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c 20 6f 70 74 69 6f 6e 73 2e 74 68 75 6d 62 ow,.captureScreen,.options.thumb
27260 6e 61 69 6c 53 69 7a 65 2c 20 69 64 29 0a 20 20 72 65 74 75 72 6e 20 69 70 63 52 65 6e 64 65 72 nailSize,.id)...return.ipcRender
27280 65 72 2e 6f 6e 63 65 28 60 45 4c 45 43 54 52 4f 4e 5f 52 45 4e 44 45 52 45 52 5f 44 45 53 4b 54 er.once(`ELECTRON_RENDERER_DESKT
272a0 4f 50 5f 43 41 50 54 55 52 45 52 5f 52 45 53 55 4c 54 5f 24 7b 69 64 7d 60 2c 20 28 65 76 65 6e OP_CAPTURER_RESULT_${id}`,.(even
272c0 74 2c 20 73 6f 75 72 63 65 73 29 20 3d 3e 20 7b 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 6e 75 t,.sources).=>.{.....callback(nu
272e0 6c 6c 2c 20 28 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 73 75 6c 74 73 ll,.(().=>.{.......const.results
27300 20 3d 20 5b 5d 0a 20 20 20 20 20 20 73 6f 75 72 63 65 73 2e 66 6f 72 45 61 63 68 28 73 6f 75 72 .=.[].......sources.forEach(sour
27320 63 65 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 72 65 73 75 6c 74 73 2e 70 75 73 68 28 7b 0a 20 ce.=>.{.........results.push({..
27340 20 20 20 20 20 20 20 20 20 69 64 3a 20 73 6f 75 72 63 65 2e 69 64 2c 0a 20 20 20 20 20 20 20 20 .........id:.source.id,.........
27360 20 20 6e 61 6d 65 3a 20 73 6f 75 72 63 65 2e 6e 61 6d 65 2c 0a 20 20 20 20 20 20 20 20 20 20 74 ..name:.source.name,...........t
27380 68 75 6d 62 6e 61 69 6c 3a 20 6e 61 74 69 76 65 49 6d 61 67 65 2e 63 72 65 61 74 65 46 72 6f 6d humbnail:.nativeImage.createFrom
273a0 44 61 74 61 55 52 4c 28 73 6f 75 72 63 65 2e 74 68 75 6d 62 6e 61 69 6c 29 0a 20 20 20 20 20 20 DataURL(source.thumbnail).......
273c0 20 20 7d 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 72 65 73 75 6c ..}).......}).......return.resul
273e0 74 73 0a 20 20 20 20 7d 29 28 29 29 0a 20 20 7d 29 0a 7d 0a 63 6f 6e 73 74 20 63 6f 6d 6d 6f 6e ts.....})())...}).}.const.common
27400 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2e 2f 2e 2e 2f 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 61 70 69 2f .=.require('../../../common/api/
27420 65 78 70 6f 72 74 73 2f 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 4c exports/electron').const.moduleL
27440 69 73 74 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2e 2f 6d 6f 64 75 6c 65 2d 6c 69 73 74 27 29 0a ist.=.require('../module-list').
27460 0a 2f 2f 20 49 6d 70 6f 72 74 20 63 6f 6d 6d 6f 6e 20 6d 6f 64 75 6c 65 73 2e 0a 63 6f 6d 6d 6f .//.Import.common.modules..commo
27480 6e 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 69 65 73 28 65 78 70 6f 72 74 73 29 0a 0a 66 6f 72 n.defineProperties(exports)..for
274a0 20 28 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 20 6f 66 20 6d 6f 64 75 6c 65 4c 69 73 74 29 20 7b 0a .(const.module.of.moduleList).{.
274c0 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 65 78 70 6f 72 74 73 2c ..Object.defineProperty(exports,
274e0 20 6d 6f 64 75 6c 65 2e 6e 61 6d 65 2c 20 7b 0a 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 .module.name,.{.....enumerable:.
27500 21 6d 6f 64 75 6c 65 2e 70 72 69 76 61 74 65 2c 0a 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 !module.private,.....get:.().=>.
27520 72 65 71 75 69 72 65 28 60 2e 2e 2f 24 7b 6d 6f 64 75 6c 65 2e 66 69 6c 65 7d 60 29 0a 20 20 7d require(`../${module.file}`)...}
27540 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 62 69 6e 64 69 6e 67 20 ).}.'use.strict'..const.binding.
27560 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 69 70 63 27 29 0a 63 6f 6e =.process.atomBinding('ipc').con
27580 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 st.v8Util.=.process.atomBinding(
275a0 27 76 38 5f 75 74 69 6c 27 29 0a 0a 2f 2f 20 43 72 65 61 74 65 64 20 62 79 20 69 6e 69 74 2e 6a 'v8_util')..//.Created.by.init.j
275c0 73 2e 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 76 38 55 74 69 6c 2e 67 65 s..const.ipcRenderer.=.v8Util.ge
275e0 74 48 69 64 64 65 6e 56 61 6c 75 65 28 67 6c 6f 62 61 6c 2c 20 27 69 70 63 27 29 0a 0a 69 70 63 tHiddenValue(global,.'ipc')..ipc
27600 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 Renderer.send.=.function.(...arg
27620 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 65 6e 64 28 27 69 70 63 2d s).{...return.binding.send('ipc-
27640 6d 65 73 73 61 67 65 27 2c 20 61 72 67 73 29 0a 7d 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 message',.args).}..ipcRenderer.s
27660 65 6e 64 53 79 6e 63 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 endSync.=.function.(...args).{..
27680 20 72 65 74 75 72 6e 20 4a 53 4f 4e 2e 70 61 72 73 65 28 62 69 6e 64 69 6e 67 2e 73 65 6e 64 53 .return.JSON.parse(binding.sendS
276a0 79 6e 63 28 27 69 70 63 2d 6d 65 73 73 61 67 65 2d 73 79 6e 63 27 2c 20 61 72 67 73 29 29 0a 7d ync('ipc-message-sync',.args)).}
276c0 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 54 6f 48 6f 73 74 20 3d 20 66 75 6e 63 74 ..ipcRenderer.sendToHost.=.funct
276e0 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 ion.(...args).{...return.binding
27700 2e 73 65 6e 64 28 27 69 70 63 2d 6d 65 73 73 61 67 65 2d 68 6f 73 74 27 2c 20 61 72 67 73 29 0a .send('ipc-message-host',.args).
27720 7d 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 54 6f 20 3d 20 66 75 6e 63 74 69 6f 6e }..ipcRenderer.sendTo.=.function
27740 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c 20 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 .(webContentsId,.channel,....arg
27760 73 29 20 7b 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 20 s).{...if.(typeof.webContentsId.
27780 21 3d 3d 20 27 6e 75 6d 62 65 72 27 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 !==.'number').{.....throw.new.Ty
277a0 70 65 45 72 72 6f 72 28 27 46 69 72 73 74 20 61 72 67 75 6d 65 6e 74 20 68 61 73 20 74 6f 20 62 peError('First.argument.has.to.b
277c0 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 27 29 0a 20 20 7d 0a 0a 20 20 69 70 63 52 65 6e 64 e.webContentsId')...}....ipcRend
277e0 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 53 45 4e 44 erer.send('ELECTRON_BROWSER_SEND
27800 5f 54 4f 27 2c 20 66 61 6c 73 65 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c 20 63 68 61 6e _TO',.false,.webContentsId,.chan
27820 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 0a 7d 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e nel,....args).}..ipcRenderer.sen
27840 64 54 6f 41 6c 6c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 dToAll.=.function.(webContentsId
27860 2c 20 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 66 20 28 74 79 70 65 ,.channel,....args).{...if.(type
27880 6f 66 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 20 21 3d 3d 20 27 6e 75 6d 62 65 72 27 29 20 7b of.webContentsId.!==.'number').{
278a0 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 46 69 72 73 74 20 .....throw.new.TypeError('First.
278c0 61 72 67 75 6d 65 6e 74 20 68 61 73 20 74 6f 20 62 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 argument.has.to.be.webContentsId
278e0 27 29 0a 20 20 7d 0a 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 ')...}....ipcRenderer.send('ELEC
27900 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 53 45 4e 44 5f 54 4f 27 2c 20 74 72 75 65 2c 20 77 65 62 TRON_BROWSER_SEND_TO',.true,.web
27920 43 6f 6e 74 65 6e 74 73 49 64 2c 20 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 0a 7d 0a ContentsId,.channel,....args).}.
27940 0a 63 6f 6e 73 74 20 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 20 3d 20 69 70 63 52 .const.removeAllListeners.=.ipcR
27960 65 6e 64 65 72 65 72 2e 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 2e 62 69 6e 64 28 enderer.removeAllListeners.bind(
27980 69 70 63 52 65 6e 64 65 72 65 72 29 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 72 65 6d 6f 76 65 41 ipcRenderer).ipcRenderer.removeA
279a0 6c 6c 4c 69 73 74 65 6e 65 72 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 llListeners.=.function.(...args)
279c0 20 7b 0a 20 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 .{...if.(args.length.===.0).{...
279e0 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 52 65 6d 6f 76 69 6e 67 20 61 6c 6c 20 ..throw.new.Error('Removing.all.
27a00 6c 69 73 74 65 6e 65 72 73 20 66 72 6f 6d 20 69 70 63 52 65 6e 64 65 72 65 72 20 77 69 6c 6c 20 listeners.from.ipcRenderer.will.
27a20 6d 61 6b 65 20 45 6c 65 63 74 72 6f 6e 20 69 6e 74 65 72 6e 61 6c 73 20 73 74 6f 70 20 77 6f 72 make.Electron.internals.stop.wor
27a40 6b 69 6e 67 2e 20 20 50 6c 65 61 73 65 20 73 70 65 63 69 66 79 20 61 20 65 76 65 6e 74 20 6e 61 king...Please.specify.a.event.na
27a60 6d 65 27 29 0a 20 20 7d 0a 20 20 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 28 2e 2e me')...}...removeAllListeners(..
27a80 2e 61 72 67 73 29 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 69 70 63 52 65 .args).}..module.exports.=.ipcRe
27aa0 6e 64 65 72 65 72 0a 2f 2f 20 52 65 6e 64 65 72 65 72 20 73 69 64 65 20 6d 6f 64 75 6c 65 73 2c nderer.//.Renderer.side.modules,
27ac0 20 70 6c 65 61 73 65 20 73 6f 72 74 20 61 6c 70 68 61 62 65 74 69 63 61 6c 6c 79 2e 0a 6d 6f 64 .please.sort.alphabetically..mod
27ae0 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 5b 0a 20 20 7b 6e 61 6d 65 3a 20 27 64 65 73 6b 74 6f ule.exports.=.[...{name:.'deskto
27b00 70 43 61 70 74 75 72 65 72 27 2c 20 66 69 6c 65 3a 20 27 64 65 73 6b 74 6f 70 2d 63 61 70 74 75 pCapturer',.file:.'desktop-captu
27b20 72 65 72 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 69 70 63 52 65 6e 64 65 72 65 72 27 2c 20 66 rer'},...{name:.'ipcRenderer',.f
27b40 69 6c 65 3a 20 27 69 70 63 2d 72 65 6e 64 65 72 65 72 27 7d 2c 0a 20 20 7b 6e 61 6d 65 3a 20 27 ile:.'ipc-renderer'},...{name:.'
27b60 72 65 6d 6f 74 65 27 2c 20 66 69 6c 65 3a 20 27 72 65 6d 6f 74 65 27 7d 2c 0a 20 20 7b 6e 61 6d remote',.file:.'remote'},...{nam
27b80 65 3a 20 27 73 63 72 65 65 6e 27 2c 20 66 69 6c 65 3a 20 27 73 63 72 65 65 6e 27 7d 2c 0a 20 20 e:.'screen',.file:.'screen'},...
27ba0 7b 6e 61 6d 65 3a 20 27 77 65 62 46 72 61 6d 65 27 2c 20 66 69 6c 65 3a 20 27 77 65 62 2d 66 72 {name:.'webFrame',.file:.'web-fr
27bc0 61 6d 65 27 7d 0a 5d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 2f 2f 20 4e 6f 74 65 3a 20 44 ame'}.].'use.strict'..//.Note:.D
27be0 6f 6e 27 74 20 75 73 65 20 64 65 73 74 72 75 63 74 75 72 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e on't.use.destructuring.assignmen
27c00 74 20 66 6f 72 20 60 42 75 66 66 65 72 60 2c 20 6f 72 20 77 65 27 6c 6c 20 68 69 74 20 61 0a 2f t.for.`Buffer`,.or.we'll.hit.a./
27c20 2f 20 62 72 6f 77 73 65 72 69 66 79 20 62 75 67 20 74 68 61 74 20 6d 61 6b 65 73 20 74 68 65 20 /.browserify.bug.that.makes.the.
27c40 73 74 61 74 65 6d 65 6e 74 20 69 6e 76 61 6c 69 64 2c 20 74 68 72 6f 77 69 6e 67 20 61 6e 20 65 statement.invalid,.throwing.an.e
27c60 72 72 6f 72 20 69 6e 0a 2f 2f 20 73 61 6e 64 62 6f 78 65 64 20 72 65 6e 64 65 72 65 72 2e 0a 63 rror.in.//.sandboxed.renderer..c
27c80 6f 6e 73 74 20 42 75 66 66 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 62 75 66 66 65 72 27 29 2e onst.Buffer.=.require('buffer').
27ca0 42 75 66 66 65 72 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 Buffer.const.v8Util.=.process.at
27cc0 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 63 6f 6e 73 74 20 7b 69 70 63 52 omBinding('v8_util').const.{ipcR
27ce0 65 6e 64 65 72 65 72 2c 20 69 73 50 72 6f 6d 69 73 65 2c 20 43 61 6c 6c 62 61 63 6b 73 52 65 67 enderer,.isPromise,.CallbacksReg
27d00 69 73 74 72 79 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e istry}.=.require('electron').con
27d20 73 74 20 72 65 73 6f 6c 76 65 50 72 6f 6d 69 73 65 20 3d 20 50 72 6f 6d 69 73 65 2e 72 65 73 6f st.resolvePromise.=.Promise.reso
27d40 6c 76 65 2e 62 69 6e 64 28 50 72 6f 6d 69 73 65 29 0a 0a 63 6f 6e 73 74 20 63 61 6c 6c 62 61 63 lve.bind(Promise)..const.callbac
27d60 6b 73 52 65 67 69 73 74 72 79 20 3d 20 6e 65 77 20 43 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 ksRegistry.=.new.CallbacksRegist
27d80 72 79 28 29 0a 63 6f 6e 73 74 20 72 65 6d 6f 74 65 4f 62 6a 65 63 74 43 61 63 68 65 20 3d 20 76 ry().const.remoteObjectCache.=.v
27da0 38 55 74 69 6c 2e 63 72 65 61 74 65 49 44 57 65 61 6b 4d 61 70 28 29 0a 0a 2f 2f 20 43 6f 6e 76 8Util.createIDWeakMap()..//.Conv
27dc0 65 72 74 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 6f 62 6a 65 63 74 20 69 6e 74 6f 20 61 6e ert.the.arguments.object.into.an
27de0 20 61 72 72 61 79 20 6f 66 20 6d 65 74 61 20 64 61 74 61 2e 0a 66 75 6e 63 74 69 6f 6e 20 77 72 .array.of.meta.data..function.wr
27e00 61 70 41 72 67 73 20 28 61 72 67 73 2c 20 76 69 73 69 74 65 64 20 3d 20 6e 65 77 20 53 65 74 28 apArgs.(args,.visited.=.new.Set(
27e20 29 29 20 7b 0a 20 20 63 6f 6e 73 74 20 76 61 6c 75 65 54 6f 4d 65 74 61 20 3d 20 28 76 61 6c 75 )).{...const.valueToMeta.=.(valu
27e40 65 29 20 3d 3e 20 7b 0a 20 20 20 20 2f 2f 20 43 68 65 63 6b 20 66 6f 72 20 63 69 72 63 75 6c 61 e).=>.{.....//.Check.for.circula
27e60 72 20 72 65 66 65 72 65 6e 63 65 2e 0a 20 20 20 20 69 66 20 28 76 69 73 69 74 65 64 2e 68 61 73 r.reference......if.(visited.has
27e80 28 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 (value)).{.......return.{.......
27ea0 20 20 74 79 70 65 3a 20 27 76 61 6c 75 65 27 2c 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 ..type:.'value',.........value:.
27ec0 6e 75 6c 6c 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 41 72 72 61 null.......}.....}......if.(Arra
27ee0 79 2e 69 73 41 72 72 61 79 28 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 76 69 73 69 74 65 y.isArray(value)).{.......visite
27f00 64 2e 61 64 64 28 76 61 6c 75 65 29 0a 20 20 20 20 20 20 6c 65 74 20 6d 65 74 61 20 3d 20 7b 0a d.add(value).......let.meta.=.{.
27f20 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 61 72 72 61 79 27 2c 0a 20 20 20 20 20 20 20 20 76 ........type:.'array',.........v
27f40 61 6c 75 65 3a 20 77 72 61 70 41 72 67 73 28 76 61 6c 75 65 2c 20 76 69 73 69 74 65 64 29 0a 20 alue:.wrapArgs(value,.visited)..
27f60 20 20 20 20 20 7d 0a 20 20 20 20 20 20 76 69 73 69 74 65 64 2e 64 65 6c 65 74 65 28 76 61 6c 75 .....}.......visited.delete(valu
27f80 65 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 6d 65 74 61 0a 20 20 20 20 7d 20 65 6c 73 65 20 e).......return.meta.....}.else.
27fa0 69 66 20 28 41 72 72 61 79 42 75 66 66 65 72 2e 69 73 56 69 65 77 28 76 61 6c 75 65 29 29 20 7b if.(ArrayBuffer.isView(value)).{
27fc0 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 62 .......return.{.........type:.'b
27fe0 75 66 66 65 72 27 2c 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 42 75 66 66 65 72 2e 66 72 uffer',.........value:.Buffer.fr
28000 6f 6d 28 76 61 6c 75 65 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 om(value).......}.....}.else.if.
28020 28 76 61 6c 75 65 20 69 6e 73 74 61 6e 63 65 6f 66 20 44 61 74 65 29 20 7b 0a 20 20 20 20 20 20 (value.instanceof.Date).{.......
28040 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 64 61 74 65 27 2c 0a 20 return.{.........type:.'date',..
28060 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 2e 67 65 74 54 69 6d 65 28 29 0a 20 20 .......value:.value.getTime()...
28080 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 28 76 61 6c 75 65 20 21 3d 20 6e ....}.....}.else.if.((value.!=.n
280a0 75 6c 6c 29 20 26 26 20 74 79 70 65 6f 66 20 76 61 6c 75 65 20 3d 3d 3d 20 27 6f 62 6a 65 63 74 ull).&&.typeof.value.===.'object
280c0 27 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 69 73 50 72 6f 6d 69 73 65 28 76 61 6c 75 65 29 29 ').{.......if.(isPromise(value))
280e0 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 79 .{.........return.{...........ty
28100 70 65 3a 20 27 70 72 6f 6d 69 73 65 27 2c 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 6e 3a 20 76 pe:.'promise',...........then:.v
28120 61 6c 75 65 54 6f 4d 65 74 61 28 66 75 6e 63 74 69 6f 6e 20 28 6f 6e 46 75 6c 66 69 6c 6c 65 64 alueToMeta(function.(onFulfilled
28140 2c 20 6f 6e 52 65 6a 65 63 74 65 64 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 76 61 6c 75 ,.onRejected).{.............valu
28160 65 2e 74 68 65 6e 28 6f 6e 46 75 6c 66 69 6c 6c 65 64 2c 20 6f 6e 52 65 6a 65 63 74 65 64 29 0a e.then(onFulfilled,.onRejected).
28180 20 20 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 20 65 ..........}).........}.......}.e
281a0 6c 73 65 20 69 66 20 28 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 76 61 lse.if.(v8Util.getHiddenValue(va
281c0 6c 75 65 2c 20 27 61 74 6f 6d 49 64 27 29 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e lue,.'atomId')).{.........return
281e0 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 72 65 6d 6f 74 65 2d 6f 62 6a 65 63 .{...........type:.'remote-objec
28200 74 27 2c 0a 20 20 20 20 20 20 20 20 20 20 69 64 3a 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 t',...........id:.v8Util.getHidd
28220 65 6e 56 61 6c 75 65 28 76 61 6c 75 65 2c 20 27 61 74 6f 6d 49 64 27 29 0a 20 20 20 20 20 20 20 enValue(value,.'atomId')........
28240 20 7d 0a 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 6c 65 74 20 6d 65 74 61 20 3d 20 7b 0a 20 .}.......}........let.meta.=.{..
28260 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 6f 62 6a 65 63 74 27 2c 0a 20 20 20 20 20 20 20 20 6e .......type:.'object',.........n
28280 61 6d 65 3a 20 76 61 6c 75 65 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 3f 20 76 61 6c 75 65 2e 63 ame:.value.constructor.?.value.c
282a0 6f 6e 73 74 72 75 63 74 6f 72 2e 6e 61 6d 65 20 3a 20 27 27 2c 0a 20 20 20 20 20 20 20 20 6d 65 onstructor.name.:.'',.........me
282c0 6d 62 65 72 73 3a 20 5b 5d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 76 69 73 69 74 65 64 2e mbers:.[].......}.......visited.
282e0 61 64 64 28 76 61 6c 75 65 29 0a 20 20 20 20 20 20 66 6f 72 20 28 6c 65 74 20 70 72 6f 70 20 69 add(value).......for.(let.prop.i
28300 6e 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 20 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 2e n.value).{.........meta.members.
28320 70 75 73 68 28 7b 0a 20 20 20 20 20 20 20 20 20 20 6e 61 6d 65 3a 20 70 72 6f 70 2c 0a 20 20 20 push({...........name:.prop,....
28340 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 76 61 6c 75 65 5b .......value:.valueToMeta(value[
28360 70 72 6f 70 5d 29 0a 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 prop]).........}).......}.......
28380 76 69 73 69 74 65 64 2e 64 65 6c 65 74 65 28 76 61 6c 75 65 29 0a 20 20 20 20 20 20 72 65 74 75 visited.delete(value).......retu
283a0 72 6e 20 6d 65 74 61 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 76 61 rn.meta.....}.else.if.(typeof.va
283c0 6c 75 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 26 26 20 76 38 55 74 69 6c 2e 67 65 74 lue.===.'function'.&&.v8Util.get
283e0 48 69 64 64 65 6e 56 61 6c 75 65 28 76 61 6c 75 65 2c 20 27 72 65 74 75 72 6e 56 61 6c 75 65 27 HiddenValue(value,.'returnValue'
28400 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 )).{.......return.{.........type
28420 3a 20 27 66 75 6e 63 74 69 6f 6e 2d 77 69 74 68 2d 72 65 74 75 72 6e 2d 76 61 6c 75 65 27 2c 0a :.'function-with-return-value',.
28440 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 76 61 6c 75 65 ........value:.valueToMeta(value
28460 28 29 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f ()).......}.....}.else.if.(typeo
28480 66 20 76 61 6c 75 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 f.value.===.'function').{.......
284a0 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 66 75 6e 63 74 69 6f 6e return.{.........type:.'function
284c0 27 2c 0a 20 20 20 20 20 20 20 20 69 64 3a 20 63 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 ',.........id:.callbacksRegistry
284e0 2e 61 64 64 28 76 61 6c 75 65 29 2c 0a 20 20 20 20 20 20 20 20 6c 6f 63 61 74 69 6f 6e 3a 20 76 .add(value),.........location:.v
28500 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 76 61 6c 75 65 2c 20 27 6c 6f 63 8Util.getHiddenValue(value,.'loc
28520 61 74 69 6f 6e 27 29 2c 0a 20 20 20 20 20 20 20 20 6c 65 6e 67 74 68 3a 20 76 61 6c 75 65 2e 6c ation'),.........length:.value.l
28540 65 6e 67 74 68 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 ength.......}.....}.else.{......
28560 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 76 61 6c 75 65 27 2c .return.{.........type:.'value',
28580 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 0a 20 20 20 20 20 20 7d 0a 20 20 .........value:.value.......}...
285a0 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 61 72 67 73 2e 6d 61 70 28 76 61 6c 75 65 54 ..}...}...return.args.map(valueT
285c0 6f 4d 65 74 61 29 0a 7d 0a 0a 2f 2f 20 50 6f 70 75 6c 61 74 65 20 6f 62 6a 65 63 74 27 73 20 6d oMeta).}..//.Populate.object's.m
285e0 65 6d 62 65 72 73 20 66 72 6f 6d 20 64 65 73 63 72 69 70 74 6f 72 73 2e 0a 2f 2f 20 54 68 65 20 embers.from.descriptors..//.The.
28600 7c 72 65 66 7c 20 77 69 6c 6c 20 62 65 20 6b 65 70 74 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 |ref|.will.be.kept.referenced.by
28620 20 7c 6d 65 6d 62 65 72 73 7c 2e 0a 2f 2f 20 54 68 69 73 20 6d 61 74 63 68 65 73 20 7c 67 65 74 .|members|..//.This.matches.|get
28640 4f 62 6a 65 63 74 4d 65 6d 65 62 65 72 73 7c 20 69 6e 20 72 70 63 2d 73 65 72 76 65 72 2e 0a 66 ObjectMemebers|.in.rpc-server..f
28660 75 6e 63 74 69 6f 6e 20 73 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 73 20 28 72 65 66 2c 20 6f unction.setObjectMembers.(ref,.o
28680 62 6a 65 63 74 2c 20 6d 65 74 61 49 64 2c 20 6d 65 6d 62 65 72 73 29 20 7b 0a 20 20 69 66 20 28 bject,.metaId,.members).{...if.(
286a0 21 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 6d 65 6d 62 65 72 73 29 29 20 72 65 74 75 72 6e 0a !Array.isArray(members)).return.
286c0 0a 20 20 66 6f 72 20 28 6c 65 74 20 6d 65 6d 62 65 72 20 6f 66 20 6d 65 6d 62 65 72 73 29 20 7b ...for.(let.member.of.members).{
286e0 0a 20 20 20 20 69 66 20 28 6f 62 6a 65 63 74 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 6d .....if.(object.hasOwnProperty(m
28700 65 6d 62 65 72 2e 6e 61 6d 65 29 29 20 63 6f 6e 74 69 6e 75 65 0a 0a 20 20 20 20 6c 65 74 20 64 ember.name)).continue......let.d
28720 65 73 63 72 69 70 74 6f 72 20 3d 20 7b 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 6d 65 6d 62 65 72 escriptor.=.{.enumerable:.member
28740 2e 65 6e 75 6d 65 72 61 62 6c 65 20 7d 0a 20 20 20 20 69 66 20 28 6d 65 6d 62 65 72 2e 74 79 70 .enumerable.}.....if.(member.typ
28760 65 20 3d 3d 3d 20 27 6d 65 74 68 6f 64 27 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 e.===.'method').{.......const.re
28780 6d 6f 74 65 4d 65 6d 62 65 72 46 75 6e 63 74 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e moteMemberFunction.=.function.(.
287a0 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 20 20 6c 65 74 20 63 6f 6d 6d 61 6e 64 0a 20 20 ..args).{.........let.command...
287c0 20 20 20 20 20 20 69 66 20 28 74 68 69 73 20 26 26 20 74 68 69 73 2e 63 6f 6e 73 74 72 75 63 74 ......if.(this.&&.this.construct
287e0 6f 72 20 3d 3d 3d 20 72 65 6d 6f 74 65 4d 65 6d 62 65 72 46 75 6e 63 74 69 6f 6e 29 20 7b 0a 20 or.===.remoteMemberFunction).{..
28800 20 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f .........command.=.'ELECTRON_BRO
28820 57 53 45 52 5f 4d 45 4d 42 45 52 5f 43 4f 4e 53 54 52 55 43 54 4f 52 27 0a 20 20 20 20 20 20 20 WSER_MEMBER_CONSTRUCTOR'........
28840 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 .}.else.{...........command.=.'E
28860 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 45 52 5f 43 41 4c 4c 27 0a 20 20 20 LECTRON_BROWSER_MEMBER_CALL'....
28880 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 74 20 3d 20 69 70 63 52 65 .....}.........const.ret.=.ipcRe
288a0 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 6d 65 74 61 49 64 2c nderer.sendSync(command,.metaId,
288c0 20 6d 65 6d 62 65 72 2e 6e 61 6d 65 2c 20 77 72 61 70 41 72 67 73 28 61 72 67 73 29 29 0a 20 20 .member.name,.wrapArgs(args))...
288e0 20 20 20 20 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 72 65 74 29 0a 20 20 ......return.metaToValue(ret)...
28900 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 6c 65 74 20 64 65 73 63 72 69 70 74 6f 72 46 75 6e 63 74 ....}........let.descriptorFunct
28920 69 6f 6e 20 3d 20 70 72 6f 78 79 46 75 6e 63 74 69 6f 6e 50 72 6f 70 65 72 74 69 65 73 28 72 65 ion.=.proxyFunctionProperties(re
28940 6d 6f 74 65 4d 65 6d 62 65 72 46 75 6e 63 74 69 6f 6e 2c 20 6d 65 74 61 49 64 2c 20 6d 65 6d 62 moteMemberFunction,.metaId,.memb
28960 65 72 2e 6e 61 6d 65 29 0a 0a 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 2e 67 65 74 20 3d er.name)........descriptor.get.=
28980 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 46 75 6e 63 74 .().=>.{.........descriptorFunct
289a0 69 6f 6e 2e 72 65 66 20 3d 20 72 65 66 20 20 2f 2f 20 54 68 65 20 6d 65 6d 62 65 72 20 73 68 6f ion.ref.=.ref..//.The.member.sho
289c0 75 6c 64 20 72 65 66 65 72 65 6e 63 65 20 69 74 73 20 6f 62 6a 65 63 74 2e 0a 20 20 20 20 20 20 uld.reference.its.object........
289e0 20 20 72 65 74 75 72 6e 20 64 65 73 63 72 69 70 74 6f 72 46 75 6e 63 74 69 6f 6e 0a 20 20 20 20 ..return.descriptorFunction.....
28a00 20 20 7d 0a 20 20 20 20 20 20 2f 2f 20 45 6e 61 62 6c 65 20 6d 6f 6e 6b 65 79 2d 70 61 74 63 68 ..}.......//.Enable.monkey-patch
28a20 20 74 68 65 20 6d 65 74 68 6f 64 0a 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 2e 73 65 74 .the.method.......descriptor.set
28a40 20 3d 20 28 76 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 64 65 73 63 72 69 70 74 .=.(value).=>.{.........descript
28a60 6f 72 46 75 6e 63 74 69 6f 6e 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 orFunction.=.value.........retur
28a80 6e 20 76 61 6c 75 65 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 n.value.......}.......descriptor
28aa0 2e 63 6f 6e 66 69 67 75 72 61 62 6c 65 20 3d 20 74 72 75 65 0a 20 20 20 20 7d 20 65 6c 73 65 20 .configurable.=.true.....}.else.
28ac0 69 66 20 28 6d 65 6d 62 65 72 2e 74 79 70 65 20 3d 3d 3d 20 27 67 65 74 27 29 20 7b 0a 20 20 20 if.(member.type.===.'get').{....
28ae0 20 20 20 64 65 73 63 72 69 70 74 6f 72 2e 67 65 74 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 ...descriptor.get.=.().=>.{.....
28b00 20 20 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 ....const.command.=.'ELECTRON_BR
28b20 4f 57 53 45 52 5f 4d 45 4d 42 45 52 5f 47 45 54 27 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 OWSER_MEMBER_GET'.........const.
28b40 6d 65 74 61 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d meta.=.ipcRenderer.sendSync(comm
28b60 61 6e 64 2c 20 6d 65 74 61 49 64 2c 20 6d 65 6d 62 65 72 2e 6e 61 6d 65 29 0a 20 20 20 20 20 20 and,.metaId,.member.name).......
28b80 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 29 0a 20 20 20 20 20 ..return.metaToValue(meta)......
28ba0 20 7d 0a 0a 20 20 20 20 20 20 69 66 20 28 6d 65 6d 62 65 72 2e 77 72 69 74 61 62 6c 65 29 20 7b .}........if.(member.writable).{
28bc0 0a 20 20 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 2e 73 65 74 20 3d 20 28 76 61 6c 75 65 .........descriptor.set.=.(value
28be0 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 61 72 67 73 20 3d 20 77 72 ).=>.{...........const.args.=.wr
28c00 61 70 41 72 67 73 28 5b 76 61 6c 75 65 5d 29 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 apArgs([value])...........const.
28c20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 command.=.'ELECTRON_BROWSER_MEMB
28c40 45 52 5f 53 45 54 27 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 ER_SET'...........const.meta.=.i
28c60 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 6d 65 74 pcRenderer.sendSync(command,.met
28c80 61 49 64 2c 20 6d 65 6d 62 65 72 2e 6e 61 6d 65 2c 20 61 72 67 73 29 0a 20 20 20 20 20 20 20 20 aId,.member.name,.args).........
28ca0 20 20 69 66 20 28 6d 65 74 61 20 21 3d 20 6e 75 6c 6c 29 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 ..if.(meta.!=.null).metaToValue(
28cc0 6d 65 74 61 29 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 0a 20 20 20 meta)...........return.value....
28ce0 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 4f 62 6a 65 63 74 .....}.......}.....}......Object
28d00 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 6f 62 6a 65 63 74 2c 20 6d 65 6d 62 65 72 2e 6e .defineProperty(object,.member.n
28d20 61 6d 65 2c 20 64 65 73 63 72 69 70 74 6f 72 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 50 6f 70 75 6c ame,.descriptor)...}.}..//.Popul
28d40 61 74 65 20 6f 62 6a 65 63 74 27 73 20 70 72 6f 74 6f 74 79 70 65 20 66 72 6f 6d 20 64 65 73 63 ate.object's.prototype.from.desc
28d60 72 69 70 74 6f 72 2e 0a 2f 2f 20 54 68 69 73 20 6d 61 74 63 68 65 73 20 7c 67 65 74 4f 62 6a 65 riptor..//.This.matches.|getObje
28d80 63 74 50 72 6f 74 6f 74 79 70 65 7c 20 69 6e 20 72 70 63 2d 73 65 72 76 65 72 2e 0a 66 75 6e 63 ctPrototype|.in.rpc-server..func
28da0 74 69 6f 6e 20 73 65 74 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 65 20 28 72 65 66 2c 20 6f 62 tion.setObjectPrototype.(ref,.ob
28dc0 6a 65 63 74 2c 20 6d 65 74 61 49 64 2c 20 64 65 73 63 72 69 70 74 6f 72 29 20 7b 0a 20 20 69 66 ject,.metaId,.descriptor).{...if
28de0 20 28 64 65 73 63 72 69 70 74 6f 72 20 3d 3d 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e 0a 20 20 .(descriptor.===.null).return...
28e00 6c 65 74 20 70 72 6f 74 6f 20 3d 20 7b 7d 0a 20 20 73 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 let.proto.=.{}...setObjectMember
28e20 73 28 72 65 66 2c 20 70 72 6f 74 6f 2c 20 6d 65 74 61 49 64 2c 20 64 65 73 63 72 69 70 74 6f 72 s(ref,.proto,.metaId,.descriptor
28e40 2e 6d 65 6d 62 65 72 73 29 0a 20 20 73 65 74 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 65 28 72 .members)...setObjectPrototype(r
28e60 65 66 2c 20 70 72 6f 74 6f 2c 20 6d 65 74 61 49 64 2c 20 64 65 73 63 72 69 70 74 6f 72 2e 70 72 ef,.proto,.metaId,.descriptor.pr
28e80 6f 74 6f 29 0a 20 20 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 6f 62 6a oto)...Object.setPrototypeOf(obj
28ea0 65 63 74 2c 20 70 72 6f 74 6f 29 0a 7d 0a 0a 2f 2f 20 57 72 61 70 20 66 75 6e 63 74 69 6f 6e 20 ect,.proto).}..//.Wrap.function.
28ec0 69 6e 20 50 72 6f 78 79 20 66 6f 72 20 61 63 63 65 73 73 69 6e 67 20 72 65 6d 6f 74 65 20 70 72 in.Proxy.for.accessing.remote.pr
28ee0 6f 70 65 72 74 69 65 73 0a 66 75 6e 63 74 69 6f 6e 20 70 72 6f 78 79 46 75 6e 63 74 69 6f 6e 50 operties.function.proxyFunctionP
28f00 72 6f 70 65 72 74 69 65 73 20 28 72 65 6d 6f 74 65 4d 65 6d 62 65 72 46 75 6e 63 74 69 6f 6e 2c roperties.(remoteMemberFunction,
28f20 20 6d 65 74 61 49 64 2c 20 6e 61 6d 65 29 20 7b 0a 20 20 6c 65 74 20 6c 6f 61 64 65 64 20 3d 20 .metaId,.name).{...let.loaded.=.
28f40 66 61 6c 73 65 0a 0a 20 20 2f 2f 20 4c 61 7a 69 6c 79 20 6c 6f 61 64 20 66 75 6e 63 74 69 6f 6e false....//.Lazily.load.function
28f60 20 70 72 6f 70 65 72 74 69 65 73 0a 20 20 63 6f 6e 73 74 20 6c 6f 61 64 52 65 6d 6f 74 65 50 72 .properties...const.loadRemotePr
28f80 6f 70 65 72 74 69 65 73 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 6c 6f 61 64 65 operties.=.().=>.{.....if.(loade
28fa0 64 29 20 72 65 74 75 72 6e 0a 20 20 20 20 6c 6f 61 64 65 64 20 3d 20 74 72 75 65 0a 20 20 20 20 d).return.....loaded.=.true.....
28fc0 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 const.command.=.'ELECTRON_BROWSE
28fe0 52 5f 4d 45 4d 42 45 52 5f 47 45 54 27 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 R_MEMBER_GET'.....const.meta.=.i
29000 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 6d 65 74 pcRenderer.sendSync(command,.met
29020 61 49 64 2c 20 6e 61 6d 65 29 0a 20 20 20 20 73 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 73 28 aId,.name).....setObjectMembers(
29040 72 65 6d 6f 74 65 4d 65 6d 62 65 72 46 75 6e 63 74 69 6f 6e 2c 20 72 65 6d 6f 74 65 4d 65 6d 62 remoteMemberFunction,.remoteMemb
29060 65 72 46 75 6e 63 74 69 6f 6e 2c 20 6d 65 74 61 2e 69 64 2c 20 6d 65 74 61 2e 6d 65 6d 62 65 72 erFunction,.meta.id,.meta.member
29080 73 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 6e 65 77 20 50 72 6f 78 79 28 72 65 6d 6f 74 s)...}....return.new.Proxy(remot
290a0 65 4d 65 6d 62 65 72 46 75 6e 63 74 69 6f 6e 2c 20 7b 0a 20 20 20 20 73 65 74 3a 20 28 74 61 72 eMemberFunction,.{.....set:.(tar
290c0 67 65 74 2c 20 70 72 6f 70 65 72 74 79 2c 20 76 61 6c 75 65 2c 20 72 65 63 65 69 76 65 72 29 20 get,.property,.value,.receiver).
290e0 3d 3e 20 7b 0a 20 20 20 20 20 20 69 66 20 28 70 72 6f 70 65 72 74 79 20 21 3d 3d 20 27 72 65 66 =>.{.......if.(property.!==.'ref
29100 27 29 20 6c 6f 61 64 52 65 6d 6f 74 65 50 72 6f 70 65 72 74 69 65 73 28 29 0a 20 20 20 20 20 20 ').loadRemoteProperties().......
29120 74 61 72 67 65 74 5b 70 72 6f 70 65 72 74 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 72 target[property].=.value.......r
29140 65 74 75 72 6e 20 74 72 75 65 0a 20 20 20 20 7d 2c 0a 20 20 20 20 67 65 74 3a 20 28 74 61 72 67 eturn.true.....},.....get:.(targ
29160 65 74 2c 20 70 72 6f 70 65 72 74 79 2c 20 72 65 63 65 69 76 65 72 29 20 3d 3e 20 7b 0a 20 20 20 et,.property,.receiver).=>.{....
29180 20 20 20 69 66 20 28 21 74 61 72 67 65 74 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 70 72 ...if.(!target.hasOwnProperty(pr
291a0 6f 70 65 72 74 79 29 29 20 6c 6f 61 64 52 65 6d 6f 74 65 50 72 6f 70 65 72 74 69 65 73 28 29 0a operty)).loadRemoteProperties().
291c0 20 20 20 20 20 20 63 6f 6e 73 74 20 76 61 6c 75 65 20 3d 20 74 61 72 67 65 74 5b 70 72 6f 70 65 ......const.value.=.target[prope
291e0 72 74 79 5d 0a 20 20 20 20 20 20 69 66 20 28 70 72 6f 70 65 72 74 79 20 3d 3d 3d 20 27 74 6f 53 rty].......if.(property.===.'toS
29200 74 72 69 6e 67 27 20 26 26 20 74 79 70 65 6f 66 20 76 61 6c 75 65 20 3d 3d 3d 20 27 66 75 6e 63 tring'.&&.typeof.value.===.'func
29220 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 2e 62 69 tion').{.........return.value.bi
29240 6e 64 28 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 nd(target).......}.......return.
29260 76 61 6c 75 65 0a 20 20 20 20 7d 2c 0a 20 20 20 20 6f 77 6e 4b 65 79 73 3a 20 28 74 61 72 67 65 value.....},.....ownKeys:.(targe
29280 74 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 6c 6f 61 64 52 65 6d 6f 74 65 50 72 6f 70 65 72 74 69 t).=>.{.......loadRemoteProperti
292a0 65 73 28 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 es().......return.Object.getOwnP
292c0 72 6f 70 65 72 74 79 4e 61 6d 65 73 28 74 61 72 67 65 74 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 ropertyNames(target).....},.....
292e0 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 72 69 70 74 6f 72 3a 20 28 74 61 72 67 65 getOwnPropertyDescriptor:.(targe
29300 74 2c 20 70 72 6f 70 65 72 74 79 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 6c 65 74 20 64 65 73 63 t,.property).=>.{.......let.desc
29320 72 69 70 74 6f 72 20 3d 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 44 65 riptor.=.Object.getOwnPropertyDe
29340 73 63 72 69 70 74 6f 72 28 74 61 72 67 65 74 2c 20 70 72 6f 70 65 72 74 79 29 0a 20 20 20 20 20 scriptor(target,.property)......
29360 20 69 66 20 28 64 65 73 63 72 69 70 74 6f 72 29 20 72 65 74 75 72 6e 20 64 65 73 63 72 69 70 74 .if.(descriptor).return.descript
29380 6f 72 0a 20 20 20 20 20 20 6c 6f 61 64 52 65 6d 6f 74 65 50 72 6f 70 65 72 74 69 65 73 28 29 0a or.......loadRemoteProperties().
293a0 20 20 20 20 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 ......return.Object.getOwnProper
293c0 74 79 44 65 73 63 72 69 70 74 6f 72 28 74 61 72 67 65 74 2c 20 70 72 6f 70 65 72 74 79 29 0a 20 tyDescriptor(target,.property)..
293e0 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 43 6f 6e 76 65 72 74 20 6d 65 74 61 20 64 61 74 ...}...}).}..//.Convert.meta.dat
29400 61 20 66 72 6f 6d 20 62 72 6f 77 73 65 72 20 69 6e 74 6f 20 72 65 61 6c 20 76 61 6c 75 65 2e 0a a.from.browser.into.real.value..
29420 66 75 6e 63 74 69 6f 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 20 28 6d 65 74 61 29 20 7b 0a 20 20 function.metaToValue.(meta).{...
29440 63 6f 6e 73 74 20 74 79 70 65 73 20 3d 20 7b 0a 20 20 20 20 76 61 6c 75 65 3a 20 28 29 20 3d 3e const.types.=.{.....value:.().=>
29460 20 6d 65 74 61 2e 76 61 6c 75 65 2c 0a 20 20 20 20 61 72 72 61 79 3a 20 28 29 20 3d 3e 20 6d 65 .meta.value,.....array:.().=>.me
29480 74 61 2e 6d 65 6d 62 65 72 73 2e 6d 61 70 28 28 6d 65 6d 62 65 72 29 20 3d 3e 20 6d 65 74 61 54 ta.members.map((member).=>.metaT
294a0 6f 56 61 6c 75 65 28 6d 65 6d 62 65 72 29 29 2c 0a 20 20 20 20 62 75 66 66 65 72 3a 20 28 29 20 oValue(member)),.....buffer:.().
294c0 3d 3e 20 42 75 66 66 65 72 2e 66 72 6f 6d 28 6d 65 74 61 2e 76 61 6c 75 65 29 2c 0a 20 20 20 20 =>.Buffer.from(meta.value),.....
294e0 70 72 6f 6d 69 73 65 3a 20 28 29 20 3d 3e 20 72 65 73 6f 6c 76 65 50 72 6f 6d 69 73 65 28 7b 74 promise:.().=>.resolvePromise({t
29500 68 65 6e 3a 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 2e 74 68 65 6e 29 7d 29 2c 0a 20 hen:.metaToValue(meta.then)}),..
29520 20 20 20 65 72 72 6f 72 3a 20 28 29 20 3d 3e 20 6d 65 74 61 54 6f 50 6c 61 69 6e 4f 62 6a 65 63 ...error:.().=>.metaToPlainObjec
29540 74 28 6d 65 74 61 29 2c 0a 20 20 20 20 64 61 74 65 3a 20 28 29 20 3d 3e 20 6e 65 77 20 44 61 74 t(meta),.....date:.().=>.new.Dat
29560 65 28 6d 65 74 61 2e 76 61 6c 75 65 29 2c 0a 20 20 20 20 65 78 63 65 70 74 69 6f 6e 3a 20 28 29 e(meta.value),.....exception:.()
29580 20 3d 3e 20 7b 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 24 7b 6d 65 74 61 2e 6d 65 .=>.{.throw.new.Error(`${meta.me
295a0 73 73 61 67 65 7d 5c 6e 24 7b 6d 65 74 61 2e 73 74 61 63 6b 7d 60 29 20 7d 0a 20 20 7d 0a 0a 20 ssage}\n${meta.stack}`).}...}...
295c0 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 69 6e 20 74 79 70 65 73 29 20 7b 0a 20 20 20 20 72 .if.(meta.type.in.types).{.....r
295e0 65 74 75 72 6e 20 74 79 70 65 73 5b 6d 65 74 61 2e 74 79 70 65 5d 28 29 0a 20 20 7d 20 65 6c 73 eturn.types[meta.type]()...}.els
29600 65 20 7b 0a 20 20 20 20 6c 65 74 20 72 65 74 0a 20 20 20 20 69 66 20 28 72 65 6d 6f 74 65 4f 62 e.{.....let.ret.....if.(remoteOb
29620 6a 65 63 74 43 61 63 68 65 2e 68 61 73 28 6d 65 74 61 2e 69 64 29 29 20 7b 0a 20 20 20 20 20 20 jectCache.has(meta.id)).{.......
29640 72 65 74 75 72 6e 20 72 65 6d 6f 74 65 4f 62 6a 65 63 74 43 61 63 68 65 2e 67 65 74 28 6d 65 74 return.remoteObjectCache.get(met
29660 61 2e 69 64 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 41 20 73 68 61 64 6f 77 20 63 6c 61 a.id).....}......//.A.shadow.cla
29680 73 73 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 72 65 6d 6f 74 65 20 66 75 6e 63 74 ss.to.represent.the.remote.funct
296a0 69 6f 6e 20 6f 62 6a 65 63 74 2e 0a 20 20 20 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d ion.object......if.(meta.type.==
296c0 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 6c 65 74 20 72 65 6d 6f 74 65 =.'function').{.......let.remote
296e0 46 75 6e 63 74 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a Function.=.function.(...args).{.
29700 20 20 20 20 20 20 20 20 6c 65 74 20 63 6f 6d 6d 61 6e 64 0a 20 20 20 20 20 20 20 20 69 66 20 28 ........let.command.........if.(
29720 74 68 69 73 20 26 26 20 74 68 69 73 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 3d 3d 3d 20 72 65 6d this.&&.this.constructor.===.rem
29740 6f 74 65 46 75 6e 63 74 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 oteFunction).{...........command
29760 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 4f 4e 53 54 52 55 43 54 4f 52 .=.'ELECTRON_BROWSER_CONSTRUCTOR
29780 27 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d '.........}.else.{...........com
297a0 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 46 55 4e 43 54 49 4f mand.=.'ELECTRON_BROWSER_FUNCTIO
297c0 4e 5f 43 41 4c 4c 27 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 N_CALL'.........}.........const.
297e0 6f 62 6a 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 obj.=.ipcRenderer.sendSync(comma
29800 6e 64 2c 20 6d 65 74 61 2e 69 64 2c 20 77 72 61 70 41 72 67 73 28 61 72 67 73 29 29 0a 20 20 20 nd,.meta.id,.wrapArgs(args))....
29820 20 20 20 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6f 62 6a 29 0a 20 20 20 .....return.metaToValue(obj)....
29840 20 20 20 7d 0a 20 20 20 20 20 20 72 65 74 20 3d 20 72 65 6d 6f 74 65 46 75 6e 63 74 69 6f 6e 0a ...}.......ret.=.remoteFunction.
29860 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 20 3d 20 7b 7d 0a 20 20 20 20 ....}.else.{.......ret.=.{}.....
29880 7d 0a 0a 20 20 20 20 73 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 73 28 72 65 74 2c 20 72 65 74 }......setObjectMembers(ret,.ret
298a0 2c 20 6d 65 74 61 2e 69 64 2c 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 29 0a 20 20 20 20 73 65 74 ,.meta.id,.meta.members).....set
298c0 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 65 28 72 65 74 2c 20 72 65 74 2c 20 6d 65 74 61 2e 69 ObjectPrototype(ret,.ret,.meta.i
298e0 64 2c 20 6d 65 74 61 2e 70 72 6f 74 6f 29 0a 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 d,.meta.proto).....Object.define
29900 50 72 6f 70 65 72 74 79 28 72 65 74 2e 63 6f 6e 73 74 72 75 63 74 6f 72 2c 20 27 6e 61 6d 65 27 Property(ret.constructor,.'name'
29920 2c 20 7b 20 76 61 6c 75 65 3a 20 6d 65 74 61 2e 6e 61 6d 65 20 7d 29 0a 0a 20 20 20 20 2f 2f 20 ,.{.value:.meta.name.})......//.
29940 54 72 61 63 6b 20 64 65 6c 65 67 61 74 65 20 6f 62 6a 27 73 20 6c 69 66 65 74 69 6d 65 20 26 20 Track.delegate.obj's.lifetime.&.
29960 74 65 6c 6c 20 62 72 6f 77 73 65 72 20 74 6f 20 63 6c 65 61 6e 20 75 70 20 77 68 65 6e 20 6f 62 tell.browser.to.clean.up.when.ob
29980 6a 65 63 74 20 69 73 20 47 43 65 64 2e 0a 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 52 65 6d 6f ject.is.GCed......v8Util.setRemo
299a0 74 65 4f 62 6a 65 63 74 46 72 65 65 72 28 72 65 74 2c 20 6d 65 74 61 2e 69 64 29 0a 20 20 20 20 teObjectFreer(ret,.meta.id).....
299c0 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 72 65 74 2c 20 27 61 74 6f 6d v8Util.setHiddenValue(ret,.'atom
299e0 49 64 27 2c 20 6d 65 74 61 2e 69 64 29 0a 20 20 20 20 72 65 6d 6f 74 65 4f 62 6a 65 63 74 43 61 Id',.meta.id).....remoteObjectCa
29a00 63 68 65 2e 73 65 74 28 6d 65 74 61 2e 69 64 2c 20 72 65 74 29 0a 20 20 20 20 72 65 74 75 72 6e che.set(meta.id,.ret).....return
29a20 20 72 65 74 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 43 6f 6e 73 74 72 75 63 74 20 61 20 70 6c 61 69 6e .ret...}.}..//.Construct.a.plain
29a40 20 6f 62 6a 65 63 74 20 66 72 6f 6d 20 74 68 65 20 6d 65 74 61 2e 0a 66 75 6e 63 74 69 6f 6e 20 .object.from.the.meta..function.
29a60 6d 65 74 61 54 6f 50 6c 61 69 6e 4f 62 6a 65 63 74 20 28 6d 65 74 61 29 20 7b 0a 20 20 63 6f 6e metaToPlainObject.(meta).{...con
29a80 73 74 20 6f 62 6a 20 3d 20 28 28 29 20 3d 3e 20 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 65 st.obj.=.(().=>.meta.type.===.'e
29aa0 72 72 6f 72 27 20 3f 20 6e 65 77 20 45 72 72 6f 72 28 29 20 3a 20 7b 7d 29 28 29 0a 20 20 66 6f rror'.?.new.Error().:.{})()...fo
29ac0 72 20 28 6c 65 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 2e 6c r.(let.i.=.0;.i.<.meta.members.l
29ae0 65 6e 67 74 68 3b 20 69 2b 2b 29 20 7b 0a 20 20 20 20 6c 65 74 20 7b 6e 61 6d 65 2c 20 76 61 6c ength;.i++).{.....let.{name,.val
29b00 75 65 7d 20 3d 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 5b 69 5d 0a 20 20 20 20 6f 62 6a 5b 6e 61 ue}.=.meta.members[i].....obj[na
29b20 6d 65 5d 20 3d 20 76 61 6c 75 65 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 6f 62 6a 0a 7d 0a 0a me].=.value...}...return.obj.}..
29b40 2f 2f 20 42 72 6f 77 73 65 72 20 63 61 6c 6c 73 20 61 20 63 61 6c 6c 62 61 63 6b 20 69 6e 20 72 //.Browser.calls.a.callback.in.r
29b60 65 6e 64 65 72 65 72 2e 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 43 54 52 4f enderer..ipcRenderer.on('ELECTRO
29b80 4e 5f 52 45 4e 44 45 52 45 52 5f 43 41 4c 4c 42 41 43 4b 27 2c 20 28 65 76 65 6e 74 2c 20 69 64 N_RENDERER_CALLBACK',.(event,.id
29ba0 2c 20 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 63 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 ,.args).=>.{...callbacksRegistry
29bc0 2e 61 70 70 6c 79 28 69 64 2c 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 61 72 67 73 29 29 0a 7d 29 .apply(id,.metaToValue(args)).})
29be0 0a 0a 2f 2f 20 41 20 63 61 6c 6c 62 61 63 6b 20 69 6e 20 62 72 6f 77 73 65 72 20 69 73 20 72 65 ..//.A.callback.in.browser.is.re
29c00 6c 65 61 73 65 64 2e 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e leased..ipcRenderer.on('ELECTRON
29c20 5f 52 45 4e 44 45 52 45 52 5f 52 45 4c 45 41 53 45 5f 43 41 4c 4c 42 41 43 4b 27 2c 20 28 65 76 _RENDERER_RELEASE_CALLBACK',.(ev
29c40 65 6e 74 2c 20 69 64 29 20 3d 3e 20 7b 0a 20 20 63 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 ent,.id).=>.{...callbacksRegistr
29c60 79 2e 72 65 6d 6f 76 65 28 69 64 29 0a 7d 29 0a 0a 70 72 6f 63 65 73 73 2e 6f 6e 28 27 65 78 69 y.remove(id).})..process.on('exi
29c80 74 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 t',.().=>.{...const.command.=.'E
29ca0 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 4f 4e 54 45 58 54 5f 52 45 4c 45 41 53 45 27 LECTRON_BROWSER_CONTEXT_RELEASE'
29cc0 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 29 ...ipcRenderer.sendSync(command)
29ce0 0a 7d 29 0a 0a 65 78 70 6f 72 74 73 2e 72 65 71 75 69 72 65 20 3d 20 28 6d 6f 64 75 6c 65 29 20 .})..exports.require.=.(module).
29d00 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e =>.{...const.command.=.'ELECTRON
29d20 5f 42 52 4f 57 53 45 52 5f 52 45 51 55 49 52 45 27 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d _BROWSER_REQUIRE'...const.meta.=
29d40 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 6d .ipcRenderer.sendSync(command,.m
29d60 6f 64 75 6c 65 29 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 odule)...return.metaToValue(meta
29d80 29 0a 7d 0a 0a 2f 2f 20 41 6c 69 61 73 20 74 6f 20 72 65 6d 6f 74 65 2e 72 65 71 75 69 72 65 28 ).}..//.Alias.to.remote.require(
29da0 27 65 6c 65 63 74 72 6f 6e 27 29 2e 78 78 78 2e 0a 65 78 70 6f 72 74 73 2e 67 65 74 42 75 69 6c 'electron').xxx..exports.getBuil
29dc0 74 69 6e 20 3d 20 28 6d 6f 64 75 6c 65 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6d 6d tin.=.(module).=>.{...const.comm
29de0 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 47 45 54 5f 42 55 49 4c and.=.'ELECTRON_BROWSER_GET_BUIL
29e00 54 49 4e 27 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e TIN'...const.meta.=.ipcRenderer.
29e20 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 6d 6f 64 75 6c 65 29 0a 20 20 72 65 74 75 sendSync(command,.module)...retu
29e40 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 29 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e rn.metaToValue(meta).}..exports.
29e60 67 65 74 43 75 72 72 65 6e 74 57 69 6e 64 6f 77 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e getCurrentWindow.=.().=>.{...con
29e80 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 st.command.=.'ELECTRON_BROWSER_C
29ea0 55 52 52 45 4e 54 5f 57 49 4e 44 4f 57 27 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 70 URRENT_WINDOW'...const.meta.=.ip
29ec0 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 29 0a 20 20 72 65 cRenderer.sendSync(command)...re
29ee0 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 29 0a 7d 0a 0a 2f 2f 20 47 65 74 turn.metaToValue(meta).}..//.Get
29f00 20 63 75 72 72 65 6e 74 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 6f 62 6a 65 63 74 2e 0a 65 78 70 .current.WebContents.object..exp
29f20 6f 72 74 73 2e 67 65 74 43 75 72 72 65 6e 74 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 28 29 20 orts.getCurrentWebContents.=.().
29f40 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 69 70 63 52 65 6e =>.{...return.metaToValue(ipcRen
29f60 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 derer.sendSync('ELECTRON_BROWSER
29f80 5f 43 55 52 52 45 4e 54 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 27 29 29 0a 7d 0a 0a 2f 2f 20 47 _CURRENT_WEB_CONTENTS')).}..//.G
29fa0 65 74 20 61 20 67 6c 6f 62 61 6c 20 6f 62 6a 65 63 74 20 69 6e 20 62 72 6f 77 73 65 72 2e 0a 65 et.a.global.object.in.browser..e
29fc0 78 70 6f 72 74 73 2e 67 65 74 47 6c 6f 62 61 6c 20 3d 20 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 xports.getGlobal.=.(name).=>.{..
29fe0 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 .const.command.=.'ELECTRON_BROWS
2a000 45 52 5f 47 4c 4f 42 41 4c 27 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 70 63 52 65 6e ER_GLOBAL'...const.meta.=.ipcRen
2a020 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 6e 61 6d 65 29 0a 20 20 derer.sendSync(command,.name)...
2a040 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 29 0a 7d 0a 0a 2f 2f 20 47 return.metaToValue(meta).}..//.G
2a060 65 74 20 74 68 65 20 70 72 6f 63 65 73 73 20 6f 62 6a 65 63 74 20 69 6e 20 62 72 6f 77 73 65 72 et.the.process.object.in.browser
2a080 2e 0a 65 78 70 6f 72 74 73 2e 5f 5f 64 65 66 69 6e 65 47 65 74 74 65 72 5f 5f 28 27 70 72 6f 63 ..exports.__defineGetter__('proc
2a0a0 65 73 73 27 2c 20 28 29 20 3d 3e 20 65 78 70 6f 72 74 73 2e 67 65 74 47 6c 6f 62 61 6c 28 27 70 ess',.().=>.exports.getGlobal('p
2a0c0 72 6f 63 65 73 73 27 29 29 0a 0a 2f 2f 20 43 72 65 61 74 65 20 61 20 66 75 6e 63 74 69 6f 6e 20 rocess'))..//.Create.a.function.
2a0e0 74 68 61 74 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 76 that.will.return.the.specified.v
2a100 61 6c 75 65 20 77 68 65 6e 20 63 61 6c 6c 65 64 20 69 6e 20 62 72 6f 77 73 65 72 2e 0a 65 78 70 alue.when.called.in.browser..exp
2a120 6f 72 74 73 2e 63 72 65 61 74 65 46 75 6e 63 74 69 6f 6e 57 69 74 68 52 65 74 75 72 6e 56 61 6c orts.createFunctionWithReturnVal
2a140 75 65 20 3d 20 28 72 65 74 75 72 6e 56 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 ue.=.(returnValue).=>.{...const.
2a160 66 75 6e 63 20 3d 20 28 29 20 3d 3e 20 72 65 74 75 72 6e 56 61 6c 75 65 0a 20 20 76 38 55 74 69 func.=.().=>.returnValue...v8Uti
2a180 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 66 75 6e 63 2c 20 27 72 65 74 75 72 6e 56 61 l.setHiddenValue(func,.'returnVa
2a1a0 6c 75 65 27 2c 20 74 72 75 65 29 0a 20 20 72 65 74 75 72 6e 20 66 75 6e 63 0a 7d 0a 0a 2f 2f 20 lue',.true)...return.func.}..//.
2a1c0 47 65 74 20 74 68 65 20 67 75 65 73 74 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 66 72 6f 6d 20 67 Get.the.guest.WebContents.from.g
2a1e0 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2e 0a 65 78 70 6f 72 74 73 2e 67 65 74 47 75 65 73 74 uestInstanceId..exports.getGuest
2a200 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 WebContents.=.(guestInstanceId).
2a220 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e =>.{...const.command.=.'ELECTRON
2a240 5f 42 52 4f 57 53 45 52 5f 47 55 45 53 54 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 27 0a 20 20 63 _BROWSER_GUEST_WEB_CONTENTS'...c
2a260 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 onst.meta.=.ipcRenderer.sendSync
2a280 28 63 6f 6d 6d 61 6e 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 72 65 74 (command,.guestInstanceId)...ret
2a2a0 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 29 0a 7d 0a 0a 63 6f 6e 73 74 20 61 urn.metaToValue(meta).}..const.a
2a2c0 64 64 42 75 69 6c 74 69 6e 50 72 6f 70 65 72 74 79 20 3d 20 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a ddBuiltinProperty.=.(name).=>.{.
2a2e0 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 65 78 70 6f 72 74 73 2c ..Object.defineProperty(exports,
2a300 20 6e 61 6d 65 2c 20 7b 0a 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 65 78 70 6f 72 74 73 2e .name,.{.....get:.().=>.exports.
2a320 67 65 74 42 75 69 6c 74 69 6e 28 6e 61 6d 65 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 62 getBuiltin(name)...}).}..const.b
2a340 72 6f 77 73 65 72 4d 6f 64 75 6c 65 73 20 3d 0a 20 20 72 65 71 75 69 72 65 28 27 2e 2e 2f 2e 2e rowserModules.=...require('../..
2a360 2f 63 6f 6d 6d 6f 6e 2f 61 70 69 2f 6d 6f 64 75 6c 65 2d 6c 69 73 74 27 29 2e 63 6f 6e 63 61 74 /common/api/module-list').concat
2a380 28 0a 20 20 72 65 71 75 69 72 65 28 27 2e 2e 2f 2e 2e 2f 62 72 6f 77 73 65 72 2f 61 70 69 2f 6d (...require('../../browser/api/m
2a3a0 6f 64 75 6c 65 2d 6c 69 73 74 27 29 29 0a 0a 2f 2f 20 41 6e 64 20 61 64 64 20 61 20 68 65 6c 70 odule-list'))..//.And.add.a.help
2a3c0 65 72 20 72 65 63 65 69 76 65 72 20 66 6f 72 20 65 61 63 68 20 6f 6e 65 2e 0a 62 72 6f 77 73 65 er.receiver.for.each.one..browse
2a3e0 72 4d 6f 64 75 6c 65 73 0a 20 20 2e 66 69 6c 74 65 72 28 28 6d 29 20 3d 3e 20 21 6d 2e 70 72 69 rModules....filter((m).=>.!m.pri
2a400 76 61 74 65 29 0a 20 20 2e 6d 61 70 28 28 6d 29 20 3d 3e 20 6d 2e 6e 61 6d 65 29 0a 20 20 2e 66 vate)....map((m).=>.m.name)....f
2a420 6f 72 45 61 63 68 28 61 64 64 42 75 69 6c 74 69 6e 50 72 6f 70 65 72 74 79 29 0a 6d 6f 64 75 6c orEach(addBuiltinProperty).modul
2a440 65 2e 65 78 70 6f 72 74 73 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 2e e.exports.=.require('electron').
2a460 72 65 6d 6f 74 65 2e 73 63 72 65 65 6e 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 remote.screen.'use.strict'..cons
2a480 74 20 7b 45 76 65 6e 74 45 6d 69 74 74 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e t.{EventEmitter}.=.require('even
2a4a0 74 73 27 29 0a 63 6f 6e 73 74 20 7b 77 65 62 46 72 61 6d 65 2c 20 57 65 62 46 72 61 6d 65 7d 20 ts').const.{webFrame,.WebFrame}.
2a4c0 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 77 65 62 5f 66 72 61 6d 65 =.process.atomBinding('web_frame
2a4e0 27 29 0a 0a 2f 2f 20 57 65 62 46 72 61 6d 65 20 69 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 ')..//.WebFrame.is.an.EventEmitt
2a500 65 72 2e 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 57 65 62 46 72 61 er..Object.setPrototypeOf(WebFra
2a520 6d 65 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f me.prototype,.EventEmitter.proto
2a540 74 79 70 65 29 0a 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 77 65 62 46 72 61 6d 65 type).EventEmitter.call(webFrame
2a560 29 0a 0a 2f 2f 20 4c 6f 74 73 20 6f 66 20 77 65 62 76 69 65 77 20 77 6f 75 6c 64 20 73 75 62 73 )..//.Lots.of.webview.would.subs
2a580 63 72 69 62 65 20 74 6f 20 77 65 62 46 72 61 6d 65 27 73 20 65 76 65 6e 74 73 2e 0a 77 65 62 46 cribe.to.webFrame's.events..webF
2a5a0 72 61 6d 65 2e 73 65 74 4d 61 78 4c 69 73 74 65 6e 65 72 73 28 30 29 0a 0a 6d 6f 64 75 6c 65 2e rame.setMaxListeners(0)..module.
2a5c0 65 78 70 6f 72 74 73 20 3d 20 77 65 62 46 72 61 6d 65 0a 63 6f 6e 73 74 20 7b 69 70 63 52 65 6e exports.=.webFrame.const.{ipcRen
2a5e0 64 65 72 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e derer}.=.require('electron').con
2a600 73 74 20 45 76 65 6e 74 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2f 65 78 74 65 6e 73 69 6f 6e 73 st.Event.=.require('./extensions
2a620 2f 65 76 65 6e 74 27 29 0a 63 6f 6e 73 74 20 75 72 6c 20 3d 20 72 65 71 75 69 72 65 28 27 75 72 /event').const.url.=.require('ur
2a640 6c 27 29 0a 0a 6c 65 74 20 6e 65 78 74 49 64 20 3d 20 30 0a 0a 63 6c 61 73 73 20 54 61 62 20 7b l')..let.nextId.=.0..class.Tab.{
2a660 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 74 61 62 49 64 29 20 7b 0a 20 20 20 20 74 68 69 ...constructor.(tabId).{.....thi
2a680 73 2e 69 64 20 3d 20 74 61 62 49 64 0a 20 20 7d 0a 7d 0a 0a 63 6c 61 73 73 20 4d 65 73 73 61 67 s.id.=.tabId...}.}..class.Messag
2a6a0 65 53 65 6e 64 65 72 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 74 61 62 49 64 2c 20 eSender.{...constructor.(tabId,.
2a6c0 65 78 74 65 6e 73 69 6f 6e 49 64 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 74 61 62 20 3d 20 74 61 extensionId).{.....this.tab.=.ta
2a6e0 62 49 64 20 3f 20 6e 65 77 20 54 61 62 28 74 61 62 49 64 29 20 3a 20 6e 75 6c 6c 0a 20 20 20 20 bId.?.new.Tab(tabId).:.null.....
2a700 74 68 69 73 2e 69 64 20 3d 20 65 78 74 65 6e 73 69 6f 6e 49 64 0a 20 20 20 20 74 68 69 73 2e 75 this.id.=.extensionId.....this.u
2a720 72 6c 20 3d 20 60 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 2f 2f 24 7b 65 78 74 65 6e rl.=.`chrome-extension://${exten
2a740 73 69 6f 6e 49 64 7d 60 0a 20 20 7d 0a 7d 0a 0a 63 6c 61 73 73 20 50 6f 72 74 20 7b 0a 20 20 63 sionId}`...}.}..class.Port.{...c
2a760 6f 6e 73 74 72 75 63 74 6f 72 20 28 74 61 62 49 64 2c 20 70 6f 72 74 49 64 2c 20 65 78 74 65 6e onstructor.(tabId,.portId,.exten
2a780 73 69 6f 6e 49 64 2c 20 6e 61 6d 65 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 74 61 62 49 64 20 3d sionId,.name).{.....this.tabId.=
2a7a0 20 74 61 62 49 64 0a 20 20 20 20 74 68 69 73 2e 70 6f 72 74 49 64 20 3d 20 70 6f 72 74 49 64 0a .tabId.....this.portId.=.portId.
2a7c0 20 20 20 20 74 68 69 73 2e 64 69 73 63 6f 6e 6e 65 63 74 65 64 20 3d 20 66 61 6c 73 65 0a 0a 20 ....this.disconnected.=.false...
2a7e0 20 20 20 74 68 69 73 2e 6e 61 6d 65 20 3d 20 6e 61 6d 65 0a 20 20 20 20 74 68 69 73 2e 6f 6e 44 ...this.name.=.name.....this.onD
2a800 69 73 63 6f 6e 6e 65 63 74 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 29 0a 20 20 20 20 74 68 69 73 isconnect.=.new.Event().....this
2a820 2e 6f 6e 4d 65 73 73 61 67 65 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 29 0a 20 20 20 20 74 68 69 .onMessage.=.new.Event().....thi
2a840 73 2e 73 65 6e 64 65 72 20 3d 20 6e 65 77 20 4d 65 73 73 61 67 65 53 65 6e 64 65 72 28 74 61 62 s.sender.=.new.MessageSender(tab
2a860 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 0a 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 Id,.extensionId)......ipcRendere
2a880 72 2e 6f 6e 63 65 28 60 43 48 52 4f 4d 45 5f 50 4f 52 54 5f 44 49 53 43 4f 4e 4e 45 43 54 5f 24 r.once(`CHROME_PORT_DISCONNECT_$
2a8a0 7b 70 6f 72 74 49 64 7d 60 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 6f {portId}`,.().=>.{.......this._o
2a8c0 6e 44 69 73 63 6f 6e 6e 65 63 74 28 29 0a 20 20 20 20 7d 29 0a 20 20 20 20 69 70 63 52 65 6e 64 nDisconnect().....}).....ipcRend
2a8e0 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d 45 5f 50 4f 52 54 5f 50 4f 53 54 4d 45 53 53 41 47 45 erer.on(`CHROME_PORT_POSTMESSAGE
2a900 5f 24 7b 70 6f 72 74 49 64 7d 60 2c 20 28 65 76 65 6e 74 2c 20 6d 65 73 73 61 67 65 29 20 3d 3e _${portId}`,.(event,.message).=>
2a920 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 73 65 6e 64 52 65 73 70 6f 6e 73 65 20 3d 20 66 75 .{.......const.sendResponse.=.fu
2a940 6e 63 74 69 6f 6e 20 28 29 20 7b 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 73 65 6e 64 52 nction.().{.console.error('sendR
2a960 65 73 70 6f 6e 73 65 20 69 73 20 6e 6f 74 20 69 6d 70 6c 65 6d 65 6e 74 65 64 27 29 20 7d 0a 20 esponse.is.not.implemented').}..
2a980 20 20 20 20 20 74 68 69 73 2e 6f 6e 4d 65 73 73 61 67 65 2e 65 6d 69 74 28 6d 65 73 73 61 67 65 .....this.onMessage.emit(message
2a9a0 2c 20 74 68 69 73 2e 73 65 6e 64 65 72 2c 20 73 65 6e 64 52 65 73 70 6f 6e 73 65 29 0a 20 20 20 ,.this.sender,.sendResponse)....
2a9c0 20 7d 29 0a 20 20 7d 0a 0a 20 20 64 69 73 63 6f 6e 6e 65 63 74 20 28 29 20 7b 0a 20 20 20 20 69 .})...}....disconnect.().{.....i
2a9e0 66 20 28 74 68 69 73 2e 64 69 73 63 6f 6e 6e 65 63 74 65 64 29 20 72 65 74 75 72 6e 0a 0a 20 20 f.(this.disconnected).return....
2aa00 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 54 6f 41 6c 6c 28 74 68 69 73 2e 74 61 62 ..ipcRenderer.sendToAll(this.tab
2aa20 49 64 2c 20 60 43 48 52 4f 4d 45 5f 50 4f 52 54 5f 44 49 53 43 4f 4e 4e 45 43 54 5f 24 7b 74 68 Id,.`CHROME_PORT_DISCONNECT_${th
2aa40 69 73 2e 70 6f 72 74 49 64 7d 60 29 0a 20 20 20 20 74 68 69 73 2e 5f 6f 6e 44 69 73 63 6f 6e 6e is.portId}`).....this._onDisconn
2aa60 65 63 74 28 29 0a 20 20 7d 0a 0a 20 20 70 6f 73 74 4d 65 73 73 61 67 65 20 28 6d 65 73 73 61 67 ect()...}....postMessage.(messag
2aa80 65 29 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 54 6f 41 6c 6c 28 74 e).{.....ipcRenderer.sendToAll(t
2aaa0 68 69 73 2e 74 61 62 49 64 2c 20 60 43 48 52 4f 4d 45 5f 50 4f 52 54 5f 50 4f 53 54 4d 45 53 53 his.tabId,.`CHROME_PORT_POSTMESS
2aac0 41 47 45 5f 24 7b 74 68 69 73 2e 70 6f 72 74 49 64 7d 60 2c 20 6d 65 73 73 61 67 65 29 0a 20 20 AGE_${this.portId}`,.message)...
2aae0 7d 0a 0a 20 20 5f 6f 6e 44 69 73 63 6f 6e 6e 65 63 74 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 }...._onDisconnect.().{.....this
2ab00 2e 64 69 73 63 6f 6e 6e 65 63 74 65 64 20 3d 20 74 72 75 65 0a 20 20 20 20 69 70 63 52 65 6e 64 .disconnected.=.true.....ipcRend
2ab20 65 72 65 72 2e 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 28 60 43 48 52 4f 4d 45 5f erer.removeAllListeners(`CHROME_
2ab40 50 4f 52 54 5f 50 4f 53 54 4d 45 53 53 41 47 45 5f 24 7b 74 68 69 73 2e 70 6f 72 74 49 64 7d 60 PORT_POSTMESSAGE_${this.portId}`
2ab60 29 0a 20 20 20 20 74 68 69 73 2e 6f 6e 44 69 73 63 6f 6e 6e 65 63 74 2e 65 6d 69 74 28 29 0a 20 ).....this.onDisconnect.emit()..
2ab80 20 7d 0a 7d 0a 0a 2f 2f 20 49 6e 6a 65 63 74 20 63 68 72 6f 6d 65 20 41 50 49 20 74 6f 20 74 68 .}.}..//.Inject.chrome.API.to.th
2aba0 65 20 7c 63 6f 6e 74 65 78 74 7c 0a 65 78 70 6f 72 74 73 2e 69 6e 6a 65 63 74 54 6f 20 3d 20 66 e.|context|.exports.injectTo.=.f
2abc0 75 6e 63 74 69 6f 6e 20 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 69 73 42 61 63 6b 67 72 6f 75 unction.(extensionId,.isBackgrou
2abe0 6e 64 50 61 67 65 2c 20 63 6f 6e 74 65 78 74 29 20 7b 0a 20 20 63 6f 6e 73 74 20 63 68 72 6f 6d ndPage,.context).{...const.chrom
2ac00 65 20 3d 20 63 6f 6e 74 65 78 74 2e 63 68 72 6f 6d 65 20 3d 20 63 6f 6e 74 65 78 74 2e 63 68 72 e.=.context.chrome.=.context.chr
2ac20 6f 6d 65 20 7c 7c 20 7b 7d 0a 20 20 6c 65 74 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 20 3d ome.||.{}...let.originResultID.=
2ac40 20 31 0a 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d 45 5f 52 55 4e .1....ipcRenderer.on(`CHROME_RUN
2ac60 54 49 4d 45 5f 4f 4e 43 4f 4e 4e 45 43 54 5f 24 7b 65 78 74 65 6e 73 69 6f 6e 49 64 7d 60 2c 20 TIME_ONCONNECT_${extensionId}`,.
2ac80 28 65 76 65 6e 74 2c 20 74 61 62 49 64 2c 20 70 6f 72 74 49 64 2c 20 63 6f 6e 6e 65 63 74 49 6e (event,.tabId,.portId,.connectIn
2aca0 66 6f 29 20 3d 3e 20 7b 0a 20 20 20 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 6f 6e 43 6f fo).=>.{.....chrome.runtime.onCo
2acc0 6e 6e 65 63 74 2e 65 6d 69 74 28 6e 65 77 20 50 6f 72 74 28 74 61 62 49 64 2c 20 70 6f 72 74 49 nnect.emit(new.Port(tabId,.portI
2ace0 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 2e 6e 61 6d 65 d,.extensionId,.connectInfo.name
2ad00 29 29 0a 20 20 7d 29 0a 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d ))...})....ipcRenderer.on(`CHROM
2ad20 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 24 7b 65 78 74 65 6e 73 69 6f 6e 49 E_RUNTIME_ONMESSAGE_${extensionI
2ad40 64 7d 60 2c 20 28 65 76 65 6e 74 2c 20 74 61 62 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 72 65 73 d}`,.(event,.tabId,.message,.res
2ad60 75 6c 74 49 44 29 20 3d 3e 20 7b 0a 20 20 20 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 6f ultID).=>.{.....chrome.runtime.o
2ad80 6e 4d 65 73 73 61 67 65 2e 65 6d 69 74 28 6d 65 73 73 61 67 65 2c 20 6e 65 77 20 4d 65 73 73 61 nMessage.emit(message,.new.Messa
2ada0 67 65 53 65 6e 64 65 72 28 74 61 62 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 2c 20 28 6d geSender(tabId,.extensionId),.(m
2adc0 65 73 73 61 67 65 52 65 73 75 6c 74 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 essageResult).=>.{.......ipcRend
2ade0 65 72 65 72 2e 73 65 6e 64 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 erer.send(`CHROME_RUNTIME_ONMESS
2ae00 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 72 65 73 75 6c 74 49 44 7d 60 2c 20 6d 65 73 73 61 67 65 AGE_RESULT_${resultID}`,.message
2ae20 52 65 73 75 6c 74 29 0a 20 20 20 20 7d 29 0a 20 20 7d 29 0a 0a 20 20 69 70 63 52 65 6e 64 65 72 Result).....})...})....ipcRender
2ae40 65 72 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 4f 4e 43 52 45 41 54 45 44 27 2c 20 28 er.on('CHROME_TABS_ONCREATED',.(
2ae60 65 76 65 6e 74 2c 20 74 61 62 49 64 29 20 3d 3e 20 7b 0a 20 20 20 20 63 68 72 6f 6d 65 2e 74 61 event,.tabId).=>.{.....chrome.ta
2ae80 62 73 2e 6f 6e 43 72 65 61 74 65 64 2e 65 6d 69 74 28 6e 65 77 20 54 61 62 28 74 61 62 49 64 29 bs.onCreated.emit(new.Tab(tabId)
2aea0 29 0a 20 20 7d 29 0a 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 43 48 52 4f 4d 45 )...})....ipcRenderer.on('CHROME
2aec0 5f 54 41 42 53 5f 4f 4e 52 45 4d 4f 56 45 44 27 2c 20 28 65 76 65 6e 74 2c 20 74 61 62 49 64 29 _TABS_ONREMOVED',.(event,.tabId)
2aee0 20 3d 3e 20 7b 0a 20 20 20 20 63 68 72 6f 6d 65 2e 74 61 62 73 2e 6f 6e 52 65 6d 6f 76 65 64 2e .=>.{.....chrome.tabs.onRemoved.
2af00 65 6d 69 74 28 74 61 62 49 64 29 0a 20 20 7d 29 0a 0a 20 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 emit(tabId)...})....chrome.runti
2af20 6d 65 20 3d 20 7b 0a 20 20 20 20 69 64 3a 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 0a 0a 20 20 20 me.=.{.....id:.extensionId,.....
2af40 20 67 65 74 55 52 4c 3a 20 66 75 6e 63 74 69 6f 6e 20 28 70 61 74 68 29 20 7b 0a 20 20 20 20 20 .getURL:.function.(path).{......
2af60 20 72 65 74 75 72 6e 20 75 72 6c 2e 66 6f 72 6d 61 74 28 7b 0a 20 20 20 20 20 20 20 20 70 72 6f .return.url.format({.........pro
2af80 74 6f 63 6f 6c 3a 20 27 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 27 2c 0a 20 20 20 20 20 tocol:.'chrome-extension',......
2afa0 20 20 20 73 6c 61 73 68 65 73 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 20 20 68 6f 73 74 6e 61 ...slashes:.true,.........hostna
2afc0 6d 65 3a 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 0a 20 20 20 20 20 20 20 20 70 61 74 68 6e 61 6d me:.extensionId,.........pathnam
2afe0 65 3a 20 70 61 74 68 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 63 6f 6e e:.path.......}).....},......con
2b000 6e 65 63 74 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 69 73 42 61 63 nect.(...args).{.......if.(isBac
2b020 6b 67 72 6f 75 6e 64 50 61 67 65 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 kgroundPage).{.........console.e
2b040 72 72 6f 72 28 27 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 63 6f 6e 6e 65 63 74 20 69 73 20 rror('chrome.runtime.connect.is.
2b060 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 20 69 6e 20 62 61 63 6b 67 72 6f 75 6e 64 20 70 61 67 65 not.supported.in.background.page
2b080 27 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 ').........return.......}.......
2b0a0 20 2f 2f 20 50 61 72 73 65 20 74 68 65 20 6f 70 74 69 6f 6e 61 6c 20 61 72 67 73 2e 0a 20 20 20 .//.Parse.the.optional.args.....
2b0c0 20 20 20 6c 65 74 20 74 61 72 67 65 74 45 78 74 65 6e 73 69 6f 6e 49 64 20 3d 20 65 78 74 65 6e ...let.targetExtensionId.=.exten
2b0e0 73 69 6f 6e 49 64 0a 20 20 20 20 20 20 6c 65 74 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 20 3d 20 7b sionId.......let.connectInfo.=.{
2b100 6e 61 6d 65 3a 20 27 27 7d 0a 20 20 20 20 20 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 68 20 name:.''}.......if.(args.length.
2b120 3d 3d 3d 20 31 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 20 3d 20 61 ===.1).{.........connectInfo.=.a
2b140 72 67 73 5b 30 5d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 73 2e 6c 65 6e rgs[0].......}.else.if.(args.len
2b160 67 74 68 20 3d 3d 3d 20 32 29 20 7b 0a 20 20 20 20 20 20 20 20 5b 74 61 72 67 65 74 45 78 74 65 gth.===.2).{.........[targetExte
2b180 6e 73 69 6f 6e 49 64 2c 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 5d 20 3d 20 61 72 67 73 0a 20 20 20 nsionId,.connectInfo].=.args....
2b1a0 20 20 20 7d 0a 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 7b 74 61 62 49 64 2c 20 70 6f 72 74 49 64 ...}........const.{tabId,.portId
2b1c0 7d 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 43 48 52 4f 4d 45 }.=.ipcRenderer.sendSync('CHROME
2b1e0 5f 52 55 4e 54 49 4d 45 5f 43 4f 4e 4e 45 43 54 27 2c 20 74 61 72 67 65 74 45 78 74 65 6e 73 69 _RUNTIME_CONNECT',.targetExtensi
2b200 6f 6e 49 64 2c 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 onId,.connectInfo).......return.
2b220 6e 65 77 20 50 6f 72 74 28 74 61 62 49 64 2c 20 70 6f 72 74 49 64 2c 20 65 78 74 65 6e 73 69 6f new.Port(tabId,.portId,.extensio
2b240 6e 49 64 2c 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 2e 6e 61 6d 65 29 0a 20 20 20 20 7d 2c 0a 0a 20 nId,.connectInfo.name).....},...
2b260 20 20 20 73 65 6e 64 4d 65 73 73 61 67 65 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 ...sendMessage.(...args).{......
2b280 20 69 66 20 28 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 29 20 7b 0a 20 20 20 20 20 20 20 .if.(isBackgroundPage).{........
2b2a0 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 73 .console.error('chrome.runtime.s
2b2c0 65 6e 64 4d 65 73 73 61 67 65 20 69 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 20 69 6e 20 62 endMessage.is.not.supported.in.b
2b2e0 61 63 6b 67 72 6f 75 6e 64 20 70 61 67 65 27 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0a ackground.page').........return.
2b300 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 2f 2f 20 50 61 72 73 65 20 74 68 65 20 6f 70 74 69 ......}........//.Parse.the.opti
2b320 6f 6e 61 6c 20 61 72 67 73 2e 0a 20 20 20 20 20 20 6c 65 74 20 74 61 72 67 65 74 45 78 74 65 6e onal.args........let.targetExten
2b340 73 69 6f 6e 49 64 20 3d 20 65 78 74 65 6e 73 69 6f 6e 49 64 0a 20 20 20 20 20 20 6c 65 74 20 6d sionId.=.extensionId.......let.m
2b360 65 73 73 61 67 65 0a 20 20 20 20 20 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d essage.......if.(args.length.===
2b380 20 31 29 20 7b 0a 20 20 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 3d 20 61 72 67 73 5b 30 5d 0a .1).{.........message.=.args[0].
2b3a0 20 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d ......}.else.if.(args.length.===
2b3c0 20 32 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 41 20 63 61 73 65 20 6f 66 20 6e 6f 74 20 70 .2).{.........//.A.case.of.not.p
2b3e0 72 6f 76 69 64 65 20 65 78 74 65 6e 73 69 6f 6e 2d 69 64 3a 20 28 6d 65 73 73 61 67 65 2c 20 72 rovide.extension-id:.(message,.r
2b400 65 73 70 6f 6e 73 65 43 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 79 70 esponseCallback).........if.(typ
2b420 65 6f 66 20 61 72 67 73 5b 31 5d 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 eof.args[1].===.'function').{...
2b440 20 20 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d 45 5f 52 ........ipcRenderer.on(`CHROME_R
2b460 55 4e 54 49 4d 45 5f 53 45 4e 44 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 6f 72 69 67 UNTIME_SENDMESSAGE_RESULT_${orig
2b480 69 6e 52 65 73 75 6c 74 49 44 7d 60 2c 20 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 29 20 3d 3e inResultID}`,.(event,.result).=>
2b4a0 20 61 72 67 73 5b 31 5d 28 72 65 73 75 6c 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 6d 65 73 73 .args[1](result))...........mess
2b4c0 61 67 65 20 3d 20 61 72 67 73 5b 30 5d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 age.=.args[0].........}.else.{..
2b4e0 20 20 20 20 20 20 20 20 20 5b 74 61 72 67 65 74 45 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6d 65 73 .........[targetExtensionId,.mes
2b500 73 61 67 65 5d 20 3d 20 61 72 67 73 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 20 65 sage].=.args.........}.......}.e
2b520 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 6f 70 74 lse.{.........console.error('opt
2b540 69 6f 6e 73 20 69 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 27 29 0a 20 20 20 20 20 20 20 20 ions.is.not.supported').........
2b560 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 53 ipcRenderer.on(`CHROME_RUNTIME_S
2b580 45 4e 44 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 6f 72 69 67 69 6e 52 65 73 75 6c 74 ENDMESSAGE_RESULT_${originResult
2b5a0 49 44 7d 60 2c 20 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 29 20 3d 3e 20 61 72 67 73 5b 32 5d ID}`,.(event,.result).=>.args[2]
2b5c0 28 72 65 73 75 6c 74 29 29 0a 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 (result)).......}........ipcRend
2b5e0 65 72 65 72 2e 73 65 6e 64 28 27 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 53 45 4e 44 4d 45 erer.send('CHROME_RUNTIME_SENDME
2b600 53 53 41 47 45 27 2c 20 74 61 72 67 65 74 45 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6d 65 73 73 61 SSAGE',.targetExtensionId,.messa
2b620 67 65 2c 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 29 0a 20 20 20 20 20 20 6f 72 69 67 69 6e ge,.originResultID).......origin
2b640 52 65 73 75 6c 74 49 44 2b 2b 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 6f 6e 43 6f 6e 6e 65 63 74 ResultID++.....},......onConnect
2b660 3a 20 6e 65 77 20 45 76 65 6e 74 28 29 2c 0a 20 20 20 20 6f 6e 4d 65 73 73 61 67 65 3a 20 6e 65 :.new.Event(),.....onMessage:.ne
2b680 77 20 45 76 65 6e 74 28 29 2c 0a 20 20 20 20 6f 6e 49 6e 73 74 61 6c 6c 65 64 3a 20 6e 65 77 20 w.Event(),.....onInstalled:.new.
2b6a0 45 76 65 6e 74 28 29 0a 20 20 7d 0a 0a 20 20 63 68 72 6f 6d 65 2e 74 61 62 73 20 3d 20 7b 0a 20 Event()...}....chrome.tabs.=.{..
2b6c0 20 20 20 65 78 65 63 75 74 65 53 63 72 69 70 74 20 28 74 61 62 49 64 2c 20 64 65 74 61 69 6c 73 ...executeScript.(tabId,.details
2b6e0 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 71 75 65 73 ,.callback).{.......const.reques
2b700 74 49 64 20 3d 20 2b 2b 6e 65 78 74 49 64 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 tId.=.++nextId.......ipcRenderer
2b720 2e 6f 6e 63 65 28 60 43 48 52 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 45 53 43 52 49 50 54 .once(`CHROME_TABS_EXECUTESCRIPT
2b740 5f 52 45 53 55 4c 54 5f 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 28 65 76 65 6e 74 2c 20 72 _RESULT_${requestId}`,.(event,.r
2b760 65 73 75 6c 74 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 5b 65 76 esult).=>.{.........callback([ev
2b780 65 6e 74 2e 72 65 73 75 6c 74 5d 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 69 70 63 52 ent.result]).......}).......ipcR
2b7a0 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 enderer.send('CHROME_TABS_EXECUT
2b7c0 45 53 43 52 49 50 54 27 2c 20 72 65 71 75 65 73 74 49 64 2c 20 74 61 62 49 64 2c 20 65 78 74 65 ESCRIPT',.requestId,.tabId,.exte
2b7e0 6e 73 69 6f 6e 49 64 2c 20 64 65 74 61 69 6c 73 29 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 73 65 nsionId,.details).....},......se
2b800 6e 64 4d 65 73 73 61 67 65 20 28 74 61 62 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 6f 70 74 69 6f ndMessage.(tabId,.message,.optio
2b820 6e 73 2c 20 72 65 73 70 6f 6e 73 65 43 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 69 66 ns,.responseCallback).{.......if
2b840 20 28 72 65 73 70 6f 6e 73 65 43 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 20 20 69 70 .(responseCallback).{.........ip
2b860 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d 45 5f 54 41 42 53 5f 53 45 4e 44 5f 4d cRenderer.on(`CHROME_TABS_SEND_M
2b880 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 7d 60 ESSAGE_RESULT_${originResultID}`
2b8a0 2c 20 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 29 20 3d 3e 20 72 65 73 70 6f 6e 73 65 43 61 6c ,.(event,.result).=>.responseCal
2b8c0 6c 62 61 63 6b 28 72 65 73 75 6c 74 29 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 69 70 63 lback(result)).......}.......ipc
2b8e0 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 53 45 4e 44 5f Renderer.send('CHROME_TABS_SEND_
2b900 4d 45 53 53 41 47 45 27 2c 20 74 61 62 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 69 73 MESSAGE',.tabId,.extensionId,.is
2b920 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 2c 20 6d 65 73 73 61 67 65 2c 20 6f 72 69 67 69 6e 52 BackgroundPage,.message,.originR
2b940 65 73 75 6c 74 49 44 29 0a 20 20 20 20 20 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 2b 2b 0a esultID).......originResultID++.
2b960 20 20 20 20 7d 2c 0a 0a 20 20 20 20 6f 6e 55 70 64 61 74 65 64 3a 20 6e 65 77 20 45 76 65 6e 74 ....},......onUpdated:.new.Event
2b980 28 29 2c 0a 20 20 20 20 6f 6e 43 72 65 61 74 65 64 3a 20 6e 65 77 20 45 76 65 6e 74 28 29 2c 0a (),.....onCreated:.new.Event(),.
2b9a0 20 20 20 20 6f 6e 52 65 6d 6f 76 65 64 3a 20 6e 65 77 20 45 76 65 6e 74 28 29 0a 20 20 7d 0a 0a ....onRemoved:.new.Event()...}..
2b9c0 20 20 63 68 72 6f 6d 65 2e 65 78 74 65 6e 73 69 6f 6e 20 3d 20 7b 0a 20 20 20 20 67 65 74 55 52 ..chrome.extension.=.{.....getUR
2b9e0 4c 3a 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 67 65 74 55 52 4c 2c 0a 20 20 20 20 63 6f L:.chrome.runtime.getURL,.....co
2ba00 6e 6e 65 63 74 3a 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 63 6f 6e 6e 65 63 74 2c 0a 20 nnect:.chrome.runtime.connect,..
2ba20 20 20 20 6f 6e 43 6f 6e 6e 65 63 74 3a 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 6f 6e 43 ...onConnect:.chrome.runtime.onC
2ba40 6f 6e 6e 65 63 74 2c 0a 20 20 20 20 73 65 6e 64 4d 65 73 73 61 67 65 3a 20 63 68 72 6f 6d 65 2e onnect,.....sendMessage:.chrome.
2ba60 72 75 6e 74 69 6d 65 2e 73 65 6e 64 4d 65 73 73 61 67 65 2c 0a 20 20 20 20 6f 6e 4d 65 73 73 61 runtime.sendMessage,.....onMessa
2ba80 67 65 3a 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 6f 6e 4d 65 73 73 61 67 65 0a 20 20 7d ge:.chrome.runtime.onMessage...}
2baa0 0a 0a 20 20 63 68 72 6f 6d 65 2e 73 74 6f 72 61 67 65 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2f ....chrome.storage.=.require('./
2bac0 65 78 74 65 6e 73 69 6f 6e 73 2f 73 74 6f 72 61 67 65 27 29 2e 73 65 74 75 70 28 65 78 74 65 6e extensions/storage').setup(exten
2bae0 73 69 6f 6e 49 64 29 0a 0a 20 20 63 68 72 6f 6d 65 2e 70 61 67 65 41 63 74 69 6f 6e 20 3d 20 7b sionId)....chrome.pageAction.=.{
2bb00 0a 20 20 20 20 73 68 6f 77 20 28 29 20 7b 7d 2c 0a 20 20 20 20 68 69 64 65 20 28 29 20 7b 7d 2c .....show.().{},.....hide.().{},
2bb20 0a 20 20 20 20 73 65 74 54 69 74 6c 65 20 28 29 20 7b 7d 2c 0a 20 20 20 20 67 65 74 54 69 74 6c .....setTitle.().{},.....getTitl
2bb40 65 20 28 29 20 7b 7d 2c 0a 20 20 20 20 73 65 74 49 63 6f 6e 20 28 29 20 7b 7d 2c 0a 20 20 20 20 e.().{},.....setIcon.().{},.....
2bb60 73 65 74 50 6f 70 75 70 20 28 29 20 7b 7d 2c 0a 20 20 20 20 67 65 74 50 6f 70 75 70 20 28 29 20 setPopup.().{},.....getPopup.().
2bb80 7b 7d 0a 20 20 7d 0a 0a 20 20 63 68 72 6f 6d 65 2e 69 31 38 6e 20 3d 20 72 65 71 75 69 72 65 28 {}...}....chrome.i18n.=.require(
2bba0 27 2e 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 69 31 38 6e 27 29 2e 73 65 74 75 70 28 65 78 74 65 6e './extensions/i18n').setup(exten
2bbc0 73 69 6f 6e 49 64 29 0a 20 20 63 68 72 6f 6d 65 2e 77 65 62 4e 61 76 69 67 61 74 69 6f 6e 20 3d sionId)...chrome.webNavigation.=
2bbe0 20 72 65 71 75 69 72 65 28 27 2e 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 77 65 62 2d 6e 61 76 69 67 .require('./extensions/web-navig
2bc00 61 74 69 6f 6e 27 29 2e 73 65 74 75 70 28 29 0a 7d 0a 63 6f 6e 73 74 20 7b 69 70 63 52 65 6e 64 ation').setup().}.const.{ipcRend
2bc20 65 72 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 erer}.=.require('electron').cons
2bc40 74 20 7b 72 75 6e 49 6e 54 68 69 73 43 6f 6e 74 65 78 74 7d 20 3d 20 72 65 71 75 69 72 65 28 27 t.{runInThisContext}.=.require('
2bc60 76 6d 27 29 0a 0a 2f 2f 20 43 68 65 63 6b 20 77 68 65 74 68 65 72 20 70 61 74 74 65 72 6e 20 6d vm')..//.Check.whether.pattern.m
2bc80 61 74 63 68 65 73 2e 0a 2f 2f 20 68 74 74 70 73 3a 2f 2f 64 65 76 65 6c 6f 70 65 72 2e 63 68 72 atches..//.https://developer.chr
2bca0 6f 6d 65 2e 63 6f 6d 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 6d 61 74 63 68 5f 70 61 74 74 65 72 6e ome.com/extensions/match_pattern
2bcc0 73 0a 63 6f 6e 73 74 20 6d 61 74 63 68 65 73 50 61 74 74 65 72 6e 20 3d 20 66 75 6e 63 74 69 6f s.const.matchesPattern.=.functio
2bce0 6e 20 28 70 61 74 74 65 72 6e 29 20 7b 0a 20 20 69 66 20 28 70 61 74 74 65 72 6e 20 3d 3d 3d 20 n.(pattern).{...if.(pattern.===.
2bd00 27 3c 61 6c 6c 5f 75 72 6c 73 3e 27 29 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 63 6f 6e 73 '<all_urls>').return.true...cons
2bd20 74 20 72 65 67 65 78 70 20 3d 20 6e 65 77 20 52 65 67 45 78 70 28 60 5e 24 7b 70 61 74 74 65 72 t.regexp.=.new.RegExp(`^${patter
2bd40 6e 2e 72 65 70 6c 61 63 65 28 2f 5c 2a 2f 67 2c 20 27 2e 2a 27 29 7d 24 60 29 0a 20 20 63 6f 6e n.replace(/\*/g,.'.*')}$`)...con
2bd60 73 74 20 75 72 6c 20 3d 20 60 24 7b 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 7d 2f 2f st.url.=.`${location.protocol}//
2bd80 24 7b 6c 6f 63 61 74 69 6f 6e 2e 68 6f 73 74 7d 24 7b 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e ${location.host}${location.pathn
2bda0 61 6d 65 7d 60 0a 20 20 72 65 74 75 72 6e 20 75 72 6c 2e 6d 61 74 63 68 28 72 65 67 65 78 70 29 ame}`...return.url.match(regexp)
2bdc0 0a 7d 0a 0a 2f 2f 20 52 75 6e 20 74 68 65 20 63 6f 64 65 20 77 69 74 68 20 63 68 72 6f 6d 65 20 .}..//.Run.the.code.with.chrome.
2bde0 41 50 49 20 69 6e 74 65 67 72 61 74 65 64 2e 0a 63 6f 6e 73 74 20 72 75 6e 43 6f 6e 74 65 6e 74 API.integrated..const.runContent
2be00 53 63 72 69 70 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 Script.=.function.(extensionId,.
2be20 75 72 6c 2c 20 63 6f 64 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6e 74 65 78 74 20 3d 20 7b url,.code).{...const.context.=.{
2be40 7d 0a 20 20 72 65 71 75 69 72 65 28 27 2e 2f 63 68 72 6f 6d 65 2d 61 70 69 27 29 2e 69 6e 6a 65 }...require('./chrome-api').inje
2be60 63 74 54 6f 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 66 61 6c 73 65 2c 20 63 6f 6e 74 65 78 74 ctTo(extensionId,.false,.context
2be80 29 0a 20 20 63 6f 6e 73 74 20 77 72 61 70 70 65 72 20 3d 20 60 28 28 63 68 72 6f 6d 65 29 20 3d )...const.wrapper.=.`((chrome).=
2bea0 3e 20 7b 5c 6e 20 20 24 7b 63 6f 64 65 7d 5c 6e 20 20 7d 29 60 0a 20 20 63 6f 6e 73 74 20 63 6f >.{\n..${code}\n..})`...const.co
2bec0 6d 70 69 6c 65 64 57 72 61 70 70 65 72 20 3d 20 72 75 6e 49 6e 54 68 69 73 43 6f 6e 74 65 78 74 mpiledWrapper.=.runInThisContext
2bee0 28 77 72 61 70 70 65 72 2c 20 7b 0a 20 20 20 20 66 69 6c 65 6e 61 6d 65 3a 20 75 72 6c 2c 0a 20 (wrapper,.{.....filename:.url,..
2bf00 20 20 20 6c 69 6e 65 4f 66 66 73 65 74 3a 20 31 2c 0a 20 20 20 20 64 69 73 70 6c 61 79 45 72 72 ...lineOffset:.1,.....displayErr
2bf20 6f 72 73 3a 20 74 72 75 65 0a 20 20 7d 29 0a 20 20 72 65 74 75 72 6e 20 63 6f 6d 70 69 6c 65 64 ors:.true...})...return.compiled
2bf40 57 72 61 70 70 65 72 2e 63 61 6c 6c 28 74 68 69 73 2c 20 63 6f 6e 74 65 78 74 2e 63 68 72 6f 6d Wrapper.call(this,.context.chrom
2bf60 65 29 0a 7d 0a 0a 63 6f 6e 73 74 20 72 75 6e 53 74 79 6c 65 73 68 65 65 74 20 3d 20 66 75 6e 63 e).}..const.runStylesheet.=.func
2bf80 74 69 6f 6e 20 28 75 72 6c 2c 20 63 6f 64 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 77 72 61 70 70 tion.(url,.code).{...const.wrapp
2bfa0 65 72 20 3d 20 60 28 28 63 6f 64 65 29 20 3d 3e 20 7b 0a 20 20 20 20 66 75 6e 63 74 69 6f 6e 20 er.=.`((code).=>.{.....function.
2bfc0 69 6e 69 74 28 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 73 74 79 6c 65 45 6c 65 6d 65 6e init().{.......const.styleElemen
2bfe0 74 20 3d 20 64 6f 63 75 6d 65 6e 74 2e 63 72 65 61 74 65 45 6c 65 6d 65 6e 74 28 27 73 74 79 6c t.=.document.createElement('styl
2c000 65 27 29 3b 0a 20 20 20 20 20 20 73 74 79 6c 65 45 6c 65 6d 65 6e 74 2e 74 65 78 74 43 6f 6e 74 e');.......styleElement.textCont
2c020 65 6e 74 20 3d 20 63 6f 64 65 3b 0a 20 20 20 20 20 20 64 6f 63 75 6d 65 6e 74 2e 68 65 61 64 2e ent.=.code;.......document.head.
2c040 61 70 70 65 6e 64 28 73 74 79 6c 65 45 6c 65 6d 65 6e 74 29 3b 0a 20 20 20 20 7d 0a 20 20 20 20 append(styleElement);.....}.....
2c060 64 6f 63 75 6d 65 6e 74 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 27 44 4f 4d 43 6f document.addEventListener('DOMCo
2c080 6e 74 65 6e 74 4c 6f 61 64 65 64 27 2c 20 69 6e 69 74 29 3b 0a 20 20 7d 29 60 0a 20 20 63 6f 6e ntentLoaded',.init);...})`...con
2c0a0 73 74 20 63 6f 6d 70 69 6c 65 64 57 72 61 70 70 65 72 20 3d 20 72 75 6e 49 6e 54 68 69 73 43 6f st.compiledWrapper.=.runInThisCo
2c0c0 6e 74 65 78 74 28 77 72 61 70 70 65 72 2c 20 7b 0a 20 20 20 20 66 69 6c 65 6e 61 6d 65 3a 20 75 ntext(wrapper,.{.....filename:.u
2c0e0 72 6c 2c 0a 20 20 20 20 6c 69 6e 65 4f 66 66 73 65 74 3a 20 31 2c 0a 20 20 20 20 64 69 73 70 6c rl,.....lineOffset:.1,.....displ
2c100 61 79 45 72 72 6f 72 73 3a 20 74 72 75 65 0a 20 20 7d 29 0a 20 20 72 65 74 75 72 6e 20 63 6f 6d ayErrors:.true...})...return.com
2c120 70 69 6c 65 64 57 72 61 70 70 65 72 2e 63 61 6c 6c 28 74 68 69 73 2c 20 63 6f 64 65 29 0a 7d 0a piledWrapper.call(this,.code).}.
2c140 0a 2f 2f 20 52 75 6e 20 69 6e 6a 65 63 74 65 64 20 73 63 72 69 70 74 73 2e 0a 2f 2f 20 68 74 74 .//.Run.injected.scripts..//.htt
2c160 70 73 3a 2f 2f 64 65 76 65 6c 6f 70 65 72 2e 63 68 72 6f 6d 65 2e 63 6f 6d 2f 65 78 74 65 6e 73 ps://developer.chrome.com/extens
2c180 69 6f 6e 73 2f 63 6f 6e 74 65 6e 74 5f 73 63 72 69 70 74 73 0a 63 6f 6e 73 74 20 69 6e 6a 65 63 ions/content_scripts.const.injec
2c1a0 74 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 78 74 65 6e tContentScript.=.function.(exten
2c1c0 73 69 6f 6e 49 64 2c 20 73 63 72 69 70 74 29 20 7b 0a 20 20 69 66 20 28 21 73 63 72 69 70 74 2e sionId,.script).{...if.(!script.
2c1e0 6d 61 74 63 68 65 73 2e 73 6f 6d 65 28 6d 61 74 63 68 65 73 50 61 74 74 65 72 6e 29 29 20 72 65 matches.some(matchesPattern)).re
2c200 74 75 72 6e 0a 0a 20 20 69 66 20 28 73 63 72 69 70 74 2e 6a 73 29 20 7b 0a 20 20 20 20 66 6f 72 turn....if.(script.js).{.....for
2c220 20 28 63 6f 6e 73 74 20 7b 75 72 6c 2c 20 63 6f 64 65 7d 20 6f 66 20 73 63 72 69 70 74 2e 6a 73 .(const.{url,.code}.of.script.js
2c240 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 66 69 72 65 20 3d 20 72 75 6e 43 6f 6e 74 65 6e ).{.......const.fire.=.runConten
2c260 74 53 63 72 69 70 74 2e 62 69 6e 64 28 77 69 6e 64 6f 77 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 tScript.bind(window,.extensionId
2c280 2c 20 75 72 6c 2c 20 63 6f 64 65 29 0a 20 20 20 20 20 20 69 66 20 28 73 63 72 69 70 74 2e 72 75 ,.url,.code).......if.(script.ru
2c2a0 6e 41 74 20 3d 3d 3d 20 27 64 6f 63 75 6d 65 6e 74 5f 73 74 61 72 74 27 29 20 7b 0a 20 20 20 20 nAt.===.'document_start').{.....
2c2c0 20 20 20 20 70 72 6f 63 65 73 73 2e 6f 6e 63 65 28 27 64 6f 63 75 6d 65 6e 74 2d 73 74 61 72 74 ....process.once('document-start
2c2e0 27 2c 20 66 69 72 65 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 73 63 72 69 70 74 ',.fire).......}.else.if.(script
2c300 2e 72 75 6e 41 74 20 3d 3d 3d 20 27 64 6f 63 75 6d 65 6e 74 5f 65 6e 64 27 29 20 7b 0a 20 20 20 .runAt.===.'document_end').{....
2c320 20 20 20 20 20 70 72 6f 63 65 73 73 2e 6f 6e 63 65 28 27 64 6f 63 75 6d 65 6e 74 2d 65 6e 64 27 .....process.once('document-end'
2c340 2c 20 66 69 72 65 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 64 ,.fire).......}.else.{.........d
2c360 6f 63 75 6d 65 6e 74 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 27 44 4f 4d 43 6f 6e ocument.addEventListener('DOMCon
2c380 74 65 6e 74 4c 6f 61 64 65 64 27 2c 20 66 69 72 65 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d tentLoaded',.fire).......}.....}
2c3a0 0a 20 20 7d 0a 0a 20 20 69 66 20 28 73 63 72 69 70 74 2e 63 73 73 29 20 7b 0a 20 20 20 20 66 6f ...}....if.(script.css).{.....fo
2c3c0 72 20 28 63 6f 6e 73 74 20 7b 75 72 6c 2c 20 63 6f 64 65 7d 20 6f 66 20 73 63 72 69 70 74 2e 63 r.(const.{url,.code}.of.script.c
2c3e0 73 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 66 69 72 65 20 3d 20 72 75 6e 53 74 79 6c ss).{.......const.fire.=.runStyl
2c400 65 73 68 65 65 74 2e 62 69 6e 64 28 77 69 6e 64 6f 77 2c 20 75 72 6c 2c 20 63 6f 64 65 29 0a 20 esheet.bind(window,.url,.code)..
2c420 20 20 20 20 20 69 66 20 28 73 63 72 69 70 74 2e 72 75 6e 41 74 20 3d 3d 3d 20 27 64 6f 63 75 6d .....if.(script.runAt.===.'docum
2c440 65 6e 74 5f 73 74 61 72 74 27 29 20 7b 0a 20 20 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 6f 6e ent_start').{.........process.on
2c460 63 65 28 27 64 6f 63 75 6d 65 6e 74 2d 73 74 61 72 74 27 2c 20 66 69 72 65 29 0a 20 20 20 20 20 ce('document-start',.fire)......
2c480 20 7d 20 65 6c 73 65 20 69 66 20 28 73 63 72 69 70 74 2e 72 75 6e 41 74 20 3d 3d 3d 20 27 64 6f .}.else.if.(script.runAt.===.'do
2c4a0 63 75 6d 65 6e 74 5f 65 6e 64 27 29 20 7b 0a 20 20 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 6f cument_end').{.........process.o
2c4c0 6e 63 65 28 27 64 6f 63 75 6d 65 6e 74 2d 65 6e 64 27 2c 20 66 69 72 65 29 0a 20 20 20 20 20 20 nce('document-end',.fire).......
2c4e0 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 64 6f 63 75 6d 65 6e 74 2e 61 64 64 45 76 65 }.else.{.........document.addEve
2c500 6e 74 4c 69 73 74 65 6e 65 72 28 27 44 4f 4d 43 6f 6e 74 65 6e 74 4c 6f 61 64 65 64 27 2c 20 66 ntListener('DOMContentLoaded',.f
2c520 69 72 65 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 48 61 6e ire).......}.....}...}.}..//.Han
2c540 64 6c 65 20 74 68 65 20 72 65 71 75 65 73 74 20 6f 66 20 63 68 72 6f 6d 65 2e 74 61 62 73 2e 65 dle.the.request.of.chrome.tabs.e
2c560 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 2e 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e xecuteJavaScript..ipcRenderer.on
2c580 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 45 53 43 52 49 50 54 27 2c 20 66 75 ('CHROME_TABS_EXECUTESCRIPT',.fu
2c5a0 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 73 65 6e 64 65 72 57 65 62 43 6f 6e 74 65 6e 74 73 nction.(event,.senderWebContents
2c5c0 49 64 2c 20 72 65 71 75 65 73 74 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 75 72 6c 2c Id,.requestId,.extensionId,.url,
2c5e0 20 63 6f 64 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 72 65 73 75 6c 74 20 3d 20 72 75 6e 43 6f 6e .code).{...const.result.=.runCon
2c600 74 65 6e 74 53 63 72 69 70 74 2e 63 61 6c 6c 28 77 69 6e 64 6f 77 2c 20 65 78 74 65 6e 73 69 6f tentScript.call(window,.extensio
2c620 6e 49 64 2c 20 75 72 6c 2c 20 63 6f 64 65 29 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 nId,.url,.code)...ipcRenderer.se
2c640 6e 64 54 6f 41 6c 6c 28 73 65 6e 64 65 72 57 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c 20 60 43 48 ndToAll(senderWebContentsId,.`CH
2c660 52 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 45 53 43 52 49 50 54 5f 52 45 53 55 4c 54 5f 24 ROME_TABS_EXECUTESCRIPT_RESULT_$
2c680 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 72 65 73 75 6c 74 29 0a 7d 29 0a 0a 2f 2f 20 52 65 61 {requestId}`,.result).})..//.Rea
2c6a0 64 20 74 68 65 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 20 70 72 65 66 65 72 65 6e 63 d.the.renderer.process.preferenc
2c6c0 65 73 2e 0a 63 6f 6e 73 74 20 70 72 65 66 65 72 65 6e 63 65 73 20 3d 20 70 72 6f 63 65 73 73 2e es..const.preferences.=.process.
2c6e0 67 65 74 52 65 6e 64 65 72 50 72 6f 63 65 73 73 50 72 65 66 65 72 65 6e 63 65 73 28 29 0a 69 66 getRenderProcessPreferences().if
2c700 20 28 70 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 70 72 .(preferences).{...for.(const.pr
2c720 65 66 20 6f 66 20 70 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 20 20 69 66 20 28 70 72 65 ef.of.preferences).{.....if.(pre
2c740 66 2e 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 29 20 7b 0a 20 20 20 20 20 20 66 6f 72 20 28 63 f.contentScripts).{.......for.(c
2c760 6f 6e 73 74 20 73 63 72 69 70 74 20 6f 66 20 70 72 65 66 2e 63 6f 6e 74 65 6e 74 53 63 72 69 70 onst.script.of.pref.contentScrip
2c780 74 73 29 20 7b 0a 20 20 20 20 20 20 20 20 69 6e 6a 65 63 74 43 6f 6e 74 65 6e 74 53 63 72 69 70 ts).{.........injectContentScrip
2c7a0 74 28 70 72 65 66 2e 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 73 63 72 69 70 74 29 0a 20 20 20 20 t(pref.extensionId,.script).....
2c7c0 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 63 6c 61 73 73 20 45 76 65 6e 74 20 7b 0a 20 20 ..}.....}...}.}.class.Event.{...
2c7e0 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 6c 69 73 74 65 6e constructor.().{.....this.listen
2c800 65 72 73 20 3d 20 5b 5d 0a 20 20 7d 0a 0a 20 20 61 64 64 4c 69 73 74 65 6e 65 72 20 28 63 61 6c ers.=.[]...}....addListener.(cal
2c820 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 6c 69 73 74 65 6e 65 72 73 2e 70 75 73 68 lback).{.....this.listeners.push
2c840 28 63 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 0a 0a 20 20 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 (callback)...}....removeListener
2c860 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 64 65 78 20 3d 20 .(callback).{.....const.index.=.
2c880 74 68 69 73 2e 6c 69 73 74 65 6e 65 72 73 2e 69 6e 64 65 78 4f 66 28 63 61 6c 6c 62 61 63 6b 29 this.listeners.indexOf(callback)
2c8a0 0a 20 20 20 20 69 66 20 28 69 6e 64 65 78 20 21 3d 3d 20 2d 31 29 20 7b 0a 20 20 20 20 20 20 74 .....if.(index.!==.-1).{.......t
2c8c0 68 69 73 2e 6c 69 73 74 65 6e 65 72 73 2e 73 70 6c 69 63 65 28 69 6e 64 65 78 2c 20 31 29 0a 20 his.listeners.splice(index,.1)..
2c8e0 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 65 6d 69 74 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 ...}...}....emit.(...args).{....
2c900 20 66 6f 72 20 28 63 6f 6e 73 74 20 6c 69 73 74 65 6e 65 72 20 6f 66 20 74 68 69 73 2e 6c 69 73 .for.(const.listener.of.this.lis
2c920 74 65 6e 65 72 73 29 20 7b 0a 20 20 20 20 20 20 6c 69 73 74 65 6e 65 72 28 2e 2e 2e 61 72 67 73 teners).{.......listener(...args
2c940 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 ).....}...}.}..module.exports.=.
2c960 45 76 65 6e 74 0a 2f 2f 20 49 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 63 68 72 6f 6d Event.//.Implementation.of.chrom
2c980 65 2e 69 31 38 6e 2e 67 65 74 4d 65 73 73 61 67 65 0a 2f 2f 20 68 74 74 70 73 3a 2f 2f 64 65 76 e.i18n.getMessage.//.https://dev
2c9a0 65 6c 6f 70 65 72 2e 63 68 72 6f 6d 65 2e 63 6f 6d 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 69 31 38 eloper.chrome.com/extensions/i18
2c9c0 6e 23 6d 65 74 68 6f 64 2d 67 65 74 4d 65 73 73 61 67 65 0a 2f 2f 0a 2f 2f 20 44 6f 65 73 20 6e n#method-getMessage.//.//.Does.n
2c9e0 6f 74 20 69 6d 70 6c 65 6d 65 6e 74 20 70 72 65 64 65 66 69 6e 65 64 20 6d 65 73 73 61 67 65 73 ot.implement.predefined.messages
2ca00 3a 0a 2f 2f 20 68 74 74 70 73 3a 2f 2f 64 65 76 65 6c 6f 70 65 72 2e 63 68 72 6f 6d 65 2e 63 6f :.//.https://developer.chrome.co
2ca20 6d 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 69 31 38 6e 23 6f 76 65 72 76 69 65 77 2d 70 72 65 64 65 m/extensions/i18n#overview-prede
2ca40 66 69 6e 65 64 0a 0a 63 6f 6e 73 74 20 7b 69 70 63 52 65 6e 64 65 72 65 72 7d 20 3d 20 72 65 71 fined..const.{ipcRenderer}.=.req
2ca60 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 71 75 uire('electron').const.fs.=.requ
2ca80 69 72 65 28 27 66 73 27 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 ire('fs').const.path.=.require('
2caa0 70 61 74 68 27 29 0a 0a 6c 65 74 20 6d 65 74 61 64 61 74 61 0a 0a 63 6f 6e 73 74 20 67 65 74 45 path')..let.metadata..const.getE
2cac0 78 74 65 6e 73 69 6f 6e 4d 65 74 61 64 61 74 61 20 3d 20 28 65 78 74 65 6e 73 69 6f 6e 49 64 29 xtensionMetadata.=.(extensionId)
2cae0 20 3d 3e 20 7b 0a 20 20 69 66 20 28 21 6d 65 74 61 64 61 74 61 29 20 7b 0a 20 20 20 20 6d 65 74 .=>.{...if.(!metadata).{.....met
2cb00 61 64 61 74 61 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 43 48 adata.=.ipcRenderer.sendSync('CH
2cb20 52 4f 4d 45 5f 49 31 38 4e 5f 4d 41 4e 49 46 45 53 54 27 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 ROME_I18N_MANIFEST',.extensionId
2cb40 29 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 64 61 74 61 0a 7d 0a 0a 63 6f 6e 73 74 )...}...return.metadata.}..const
2cb60 20 67 65 74 4d 65 73 73 61 67 65 73 50 61 74 68 20 3d 20 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c .getMessagesPath.=.(extensionId,
2cb80 20 6c 61 6e 67 75 61 67 65 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 64 61 74 61 .language).=>.{...const.metadata
2cba0 20 3d 20 67 65 74 45 78 74 65 6e 73 69 6f 6e 4d 65 74 61 64 61 74 61 28 65 78 74 65 6e 73 69 6f .=.getExtensionMetadata(extensio
2cbc0 6e 49 64 29 0a 20 20 63 6f 6e 73 74 20 64 65 66 61 75 6c 74 4c 6f 63 61 6c 65 20 3d 20 6d 65 74 nId)...const.defaultLocale.=.met
2cbe0 61 64 61 74 61 2e 64 65 66 61 75 6c 74 5f 6c 6f 63 61 6c 65 20 7c 7c 20 27 65 6e 27 0a 20 20 63 adata.default_locale.||.'en'...c
2cc00 6f 6e 73 74 20 6c 6f 63 61 6c 65 73 44 69 72 65 63 74 6f 72 79 20 3d 20 70 61 74 68 2e 6a 6f 69 onst.localesDirectory.=.path.joi
2cc20 6e 28 6d 65 74 61 64 61 74 61 2e 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 27 5f 6c 6f 63 61 6c n(metadata.srcDirectory,.'_local
2cc40 65 73 27 29 0a 20 20 6c 65 74 20 6d 65 73 73 61 67 65 73 50 61 74 68 20 3d 20 70 61 74 68 2e 6a es')...let.messagesPath.=.path.j
2cc60 6f 69 6e 28 6c 6f 63 61 6c 65 73 44 69 72 65 63 74 6f 72 79 2c 20 6c 61 6e 67 75 61 67 65 2c 20 oin(localesDirectory,.language,.
2cc80 27 6d 65 73 73 61 67 65 73 2e 6a 73 6f 6e 27 29 0a 20 20 69 66 20 28 21 66 73 2e 73 74 61 74 53 'messages.json')...if.(!fs.statS
2cca0 79 6e 63 4e 6f 45 78 63 65 70 74 69 6f 6e 28 6d 65 73 73 61 67 65 73 50 61 74 68 29 29 20 7b 0a yncNoException(messagesPath)).{.
2ccc0 20 20 20 20 6d 65 73 73 61 67 65 73 50 61 74 68 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 6c 6f 63 ....messagesPath.=.path.join(loc
2cce0 61 6c 65 73 44 69 72 65 63 74 6f 72 79 2c 20 64 65 66 61 75 6c 74 4c 6f 63 61 6c 65 2c 20 27 6d alesDirectory,.defaultLocale,.'m
2cd00 65 73 73 61 67 65 73 2e 6a 73 6f 6e 27 29 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 6d 65 73 73 essages.json')...}...return.mess
2cd20 61 67 65 73 50 61 74 68 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 4d 65 73 73 61 67 65 73 20 3d 20 agesPath.}..const.getMessages.=.
2cd40 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6c 61 6e 67 75 61 67 65 29 20 3d 3e 20 7b 0a 20 20 74 (extensionId,.language).=>.{...t
2cd60 72 79 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 73 73 61 67 65 73 50 61 74 68 20 3d 20 67 65 ry.{.....const.messagesPath.=.ge
2cd80 74 4d 65 73 73 61 67 65 73 50 61 74 68 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6c 61 6e 67 75 tMessagesPath(extensionId,.langu
2cda0 61 67 65 29 0a 20 20 20 20 72 65 74 75 72 6e 20 4a 53 4f 4e 2e 70 61 72 73 65 28 66 73 2e 72 65 age).....return.JSON.parse(fs.re
2cdc0 61 64 46 69 6c 65 53 79 6e 63 28 6d 65 73 73 61 67 65 73 50 61 74 68 29 29 20 7c 7c 20 7b 7d 0a adFileSync(messagesPath)).||.{}.
2cde0 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 7b ..}.catch.(error).{.....return.{
2ce00 7d 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 4c 61 6e 67 75 61 67 65 20 3d 20 28 29 20 }...}.}..const.getLanguage.=.().
2ce20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 6e 61 76 69 67 61 74 6f 72 2e 6c 61 6e 67 75 61 67 65 =>.{...return.navigator.language
2ce40 2e 72 65 70 6c 61 63 65 28 2f 2d 2e 2a 24 2f 2c 20 27 27 29 2e 74 6f 4c 6f 77 65 72 43 61 73 65 .replace(/-.*$/,.'').toLowerCase
2ce60 28 29 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 70 6c 61 63 65 4e 75 6d 62 65 72 65 64 53 75 62 73 74 ().}..const.replaceNumberedSubst
2ce80 69 74 75 74 69 6f 6e 73 20 3d 20 28 6d 65 73 73 61 67 65 2c 20 73 75 62 73 74 69 74 75 74 69 6f itutions.=.(message,.substitutio
2cea0 6e 73 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 6d 65 73 73 61 67 65 2e 72 65 70 6c 61 63 ns).=>.{...return.message.replac
2cec0 65 28 2f 5c 24 28 5c 64 2b 29 2f 2c 20 28 5f 2c 20 6e 75 6d 62 65 72 29 20 3d 3e 20 7b 0a 20 20 e(/\$(\d+)/,.(_,.number).=>.{...
2cee0 20 20 63 6f 6e 73 74 20 69 6e 64 65 78 20 3d 20 70 61 72 73 65 49 6e 74 28 6e 75 6d 62 65 72 2c ..const.index.=.parseInt(number,
2cf00 20 31 30 29 20 2d 20 31 0a 20 20 20 20 72 65 74 75 72 6e 20 73 75 62 73 74 69 74 75 74 69 6f 6e .10).-.1.....return.substitution
2cf20 73 5b 69 6e 64 65 78 5d 20 7c 7c 20 27 27 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 70 s[index].||.''...}).}..const.rep
2cf40 6c 61 63 65 50 6c 61 63 65 68 6f 6c 64 65 72 73 20 3d 20 28 6d 65 73 73 61 67 65 2c 20 70 6c 61 lacePlaceholders.=.(message,.pla
2cf60 63 65 68 6f 6c 64 65 72 73 2c 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 20 3d 3e 20 7b 0a 20 ceholders,.substitutions).=>.{..
2cf80 20 69 66 20 28 74 79 70 65 6f 66 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 20 3d 3d 3d 20 27 73 .if.(typeof.substitutions.===.'s
2cfa0 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 20 3d 20 5b 73 tring').{.....substitutions.=.[s
2cfc0 75 62 73 74 69 74 75 74 69 6f 6e 73 5d 0a 20 20 7d 0a 20 20 69 66 20 28 21 41 72 72 61 79 2e 69 ubstitutions]...}...if.(!Array.i
2cfe0 73 41 72 72 61 79 28 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 29 20 7b 0a 20 20 20 20 73 75 62 sArray(substitutions)).{.....sub
2d000 73 74 69 74 75 74 69 6f 6e 73 20 3d 20 5b 5d 0a 20 20 7d 0a 0a 20 20 69 66 20 28 70 6c 61 63 65 stitutions.=.[]...}....if.(place
2d020 68 6f 6c 64 65 72 73 29 20 7b 0a 20 20 20 20 4f 62 6a 65 63 74 2e 6b 65 79 73 28 70 6c 61 63 65 holders).{.....Object.keys(place
2d040 68 6f 6c 64 65 72 73 29 2e 66 6f 72 45 61 63 68 28 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 holders).forEach((name).=>.{....
2d060 20 20 20 6c 65 74 20 7b 63 6f 6e 74 65 6e 74 7d 20 3d 20 70 6c 61 63 65 68 6f 6c 64 65 72 73 5b ...let.{content}.=.placeholders[
2d080 6e 61 6d 65 5d 0a 20 20 20 20 20 20 63 6f 6e 74 65 6e 74 20 3d 20 72 65 70 6c 61 63 65 4e 75 6d name].......content.=.replaceNum
2d0a0 62 65 72 65 64 53 75 62 73 74 69 74 75 74 69 6f 6e 73 28 63 6f 6e 74 65 6e 74 2c 20 73 75 62 73 beredSubstitutions(content,.subs
2d0c0 74 69 74 75 74 69 6f 6e 73 29 0a 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 3d 20 6d 65 73 73 61 titutions).......message.=.messa
2d0e0 67 65 2e 72 65 70 6c 61 63 65 28 6e 65 77 20 52 65 67 45 78 70 28 60 5c 5c 24 24 7b 6e 61 6d 65 ge.replace(new.RegExp(`\\$${name
2d100 7d 5c 5c 24 60 2c 20 27 67 69 27 29 2c 20 63 6f 6e 74 65 6e 74 29 0a 20 20 20 20 7d 29 0a 20 20 }\\$`,.'gi'),.content).....})...
2d120 7d 0a 0a 20 20 72 65 74 75 72 6e 20 72 65 70 6c 61 63 65 4e 75 6d 62 65 72 65 64 53 75 62 73 74 }....return.replaceNumberedSubst
2d140 69 74 75 74 69 6f 6e 73 28 6d 65 73 73 61 67 65 2c 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 itutions(message,.substitutions)
2d160 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 4d 65 73 73 61 67 65 20 3d 20 28 65 78 74 65 6e 73 69 6f .}..const.getMessage.=.(extensio
2d180 6e 49 64 2c 20 6d 65 73 73 61 67 65 4e 61 6d 65 2c 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 nId,.messageName,.substitutions)
2d1a0 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 6d 65 73 73 61 67 65 73 20 3d 20 67 65 74 4d 65 73 73 .=>.{...const.messages.=.getMess
2d1c0 61 67 65 73 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 67 65 74 4c 61 6e 67 75 61 67 65 28 29 29 ages(extensionId,.getLanguage())
2d1e0 0a 20 20 69 66 20 28 6d 65 73 73 61 67 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 6d ...if.(messages.hasOwnProperty(m
2d200 65 73 73 61 67 65 4e 61 6d 65 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 7b 6d 65 73 73 61 67 essageName)).{.....const.{messag
2d220 65 2c 20 70 6c 61 63 65 68 6f 6c 64 65 72 73 7d 20 3d 20 6d 65 73 73 61 67 65 73 5b 6d 65 73 73 e,.placeholders}.=.messages[mess
2d240 61 67 65 4e 61 6d 65 5d 0a 20 20 20 20 72 65 74 75 72 6e 20 72 65 70 6c 61 63 65 50 6c 61 63 65 ageName].....return.replacePlace
2d260 68 6f 6c 64 65 72 73 28 6d 65 73 73 61 67 65 2c 20 70 6c 61 63 65 68 6f 6c 64 65 72 73 2c 20 73 holders(message,.placeholders,.s
2d280 75 62 73 74 69 74 75 74 69 6f 6e 73 29 0a 20 20 7d 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 73 65 74 ubstitutions)...}.}..exports.set
2d2a0 75 70 20 3d 20 28 65 78 74 65 6e 73 69 6f 6e 49 64 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e up.=.(extensionId).=>.{...return
2d2c0 20 7b 0a 20 20 20 20 67 65 74 4d 65 73 73 61 67 65 20 28 6d 65 73 73 61 67 65 4e 61 6d 65 2c 20 .{.....getMessage.(messageName,.
2d2e0 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 67 65 substitutions).{.......return.ge
2d300 74 4d 65 73 73 61 67 65 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6d 65 73 73 61 67 65 4e 61 6d tMessage(extensionId,.messageNam
2d320 65 2c 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 63 6f e,.substitutions).....}...}.}.co
2d340 6e 73 74 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 0a 63 6f 6e 73 74 20 70 61 74 nst.fs.=.require('fs').const.pat
2d360 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 7b 20 72 65 6d 6f h.=.require('path').const.{.remo
2d380 74 65 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 te.}.=.require('electron').const
2d3a0 20 7b 20 61 70 70 20 7d 20 3d 20 72 65 6d 6f 74 65 0a 0a 63 6f 6e 73 74 20 67 65 74 43 68 72 6f .{.app.}.=.remote..const.getChro
2d3c0 6d 65 53 74 6f 72 61 67 65 50 61 74 68 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 meStoragePath.=.(storageType,.ex
2d3e0 74 65 6e 73 69 6f 6e 49 64 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 70 61 74 68 2e 6a 6f tensionId).=>.{...return.path.jo
2d400 69 6e 28 0a 20 20 20 20 61 70 70 2e 67 65 74 50 61 74 68 28 27 75 73 65 72 44 61 74 61 27 29 2c in(.....app.getPath('userData'),
2d420 20 60 2f 43 68 72 6f 6d 65 20 53 74 6f 72 61 67 65 2f 24 7b 65 78 74 65 6e 73 69 6f 6e 49 64 7d .`/Chrome.Storage/${extensionId}
2d440 2d 24 7b 73 74 6f 72 61 67 65 54 79 70 65 7d 2e 6a 73 6f 6e 60 29 0a 7d 0a 0a 63 6f 6e 73 74 20 -${storageType}.json`).}..const.
2d460 6d 6b 64 69 72 70 20 3d 20 28 64 69 72 2c 20 63 61 6c 6c 62 61 63 6b 29 20 3d 3e 20 7b 0a 20 20 mkdirp.=.(dir,.callback).=>.{...
2d480 66 73 2e 6d 6b 64 69 72 28 64 69 72 2c 20 28 65 72 72 6f 72 29 20 3d 3e 20 7b 0a 20 20 20 20 69 fs.mkdir(dir,.(error).=>.{.....i
2d4a0 66 20 28 65 72 72 6f 72 20 26 26 20 65 72 72 6f 72 2e 63 6f 64 65 20 3d 3d 3d 20 27 45 4e 4f 45 f.(error.&&.error.code.===.'ENOE
2d4c0 4e 54 27 29 20 7b 0a 20 20 20 20 20 20 6d 6b 64 69 72 70 28 70 61 74 68 2e 64 69 72 6e 61 6d 65 NT').{.......mkdirp(path.dirname
2d4e0 28 64 69 72 29 2c 20 28 65 72 72 6f 72 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 (dir),.(error).=>.{.........if.(
2d500 21 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 6d 6b 64 69 72 70 28 64 69 72 2c 20 !error).{...........mkdirp(dir,.
2d520 63 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 callback).........}.......})....
2d540 20 7d 20 65 6c 73 65 20 69 66 20 28 65 72 72 6f 72 20 26 26 20 65 72 72 6f 72 2e 63 6f 64 65 20 .}.else.if.(error.&&.error.code.
2d560 3d 3d 3d 20 27 45 45 58 49 53 54 27 29 20 7b 0a 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 6e ===.'EEXIST').{.......callback(n
2d580 75 6c 6c 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b ull).....}.else.{.......callback
2d5a0 28 65 72 72 6f 72 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 61 64 (error).....}...}).}..const.read
2d5c0 43 68 72 6f 6d 65 53 74 6f 72 61 67 65 46 69 6c 65 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 ChromeStorageFile.=.(storageType
2d5e0 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 63 62 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 ,.extensionId,.cb).=>.{...const.
2d600 66 69 6c 65 50 61 74 68 20 3d 20 67 65 74 43 68 72 6f 6d 65 53 74 6f 72 61 67 65 50 61 74 68 28 filePath.=.getChromeStoragePath(
2d620 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 0a 20 20 66 73 2e 72 storageType,.extensionId)...fs.r
2d640 65 61 64 46 69 6c 65 28 66 69 6c 65 50 61 74 68 2c 20 27 75 74 66 38 27 2c 20 28 65 72 72 2c 20 eadFile(filePath,.'utf8',.(err,.
2d660 64 61 74 61 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 72 72 20 26 26 20 65 72 72 2e 63 6f data).=>.{.....if.(err.&&.err.co
2d680 64 65 20 3d 3d 3d 20 27 45 4e 4f 45 4e 54 27 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 de.===.'ENOENT').{.......return.
2d6a0 63 62 28 6e 75 6c 6c 2c 20 6e 75 6c 6c 29 0a 20 20 20 20 7d 0a 20 20 20 20 63 62 28 65 72 72 2c cb(null,.null).....}.....cb(err,
2d6c0 20 64 61 74 61 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 77 72 69 74 65 43 68 72 6f 6d 65 .data)...}).}..const.writeChrome
2d6e0 53 74 6f 72 61 67 65 46 69 6c 65 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 StorageFile.=.(storageType,.exte
2d700 6e 73 69 6f 6e 49 64 2c 20 64 61 74 61 2c 20 63 62 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 nsionId,.data,.cb).=>.{...const.
2d720 66 69 6c 65 50 61 74 68 20 3d 20 67 65 74 43 68 72 6f 6d 65 53 74 6f 72 61 67 65 50 61 74 68 28 filePath.=.getChromeStoragePath(
2d740 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 0a 0a 20 20 6d 6b 64 storageType,.extensionId)....mkd
2d760 69 72 70 28 70 61 74 68 2e 64 69 72 6e 61 6d 65 28 66 69 6c 65 50 61 74 68 29 2c 20 65 72 72 20 irp(path.dirname(filePath),.err.
2d780 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 72 72 29 20 7b 20 2f 2a 20 77 65 20 6a 75 73 74 20 69 =>.{.....if.(err).{./*.we.just.i
2d7a0 67 6e 6f 72 65 20 74 68 65 20 65 72 72 6f 72 73 20 6f 66 20 6d 6b 64 69 72 20 6f 72 20 6d 6b 64 gnore.the.errors.of.mkdir.or.mkd
2d7c0 69 72 70 20 2a 2f 20 7d 0a 20 20 20 20 66 73 2e 77 72 69 74 65 46 69 6c 65 28 66 69 6c 65 50 61 irp.*/.}.....fs.writeFile(filePa
2d7e0 74 68 2c 20 64 61 74 61 2c 20 63 62 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 53 th,.data,.cb)...}).}..const.getS
2d800 74 6f 72 61 67 65 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e torage.=.(storageType,.extension
2d820 49 64 2c 20 63 62 29 20 3d 3e 20 7b 0a 20 20 72 65 61 64 43 68 72 6f 6d 65 53 74 6f 72 61 67 65 Id,.cb).=>.{...readChromeStorage
2d840 46 69 6c 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 28 File(storageType,.extensionId,.(
2d860 65 72 72 2c 20 64 61 74 61 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 72 72 29 20 74 68 72 err,.data).=>.{.....if.(err).thr
2d880 6f 77 20 65 72 72 0a 20 20 20 20 69 66 20 28 21 63 62 29 20 74 68 72 6f 77 20 6e 65 77 20 54 79 ow.err.....if.(!cb).throw.new.Ty
2d8a0 70 65 45 72 72 6f 72 28 27 4e 6f 20 63 61 6c 6c 62 61 63 6b 20 70 72 6f 76 69 64 65 64 27 29 0a peError('No.callback.provided').
2d8c0 0a 20 20 20 20 69 66 20 28 64 61 74 61 20 21 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 .....if.(data.!==.null).{.......
2d8e0 63 62 28 4a 53 4f 4e 2e 70 61 72 73 65 28 64 61 74 61 29 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 cb(JSON.parse(data)).....}.else.
2d900 7b 0a 20 20 20 20 20 20 63 62 28 7b 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e {.......cb({}).....}...}).}..con
2d920 73 74 20 73 65 74 53 74 6f 72 61 67 65 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 st.setStorage.=.(storageType,.ex
2d940 74 65 6e 73 69 6f 6e 49 64 2c 20 73 74 6f 72 61 67 65 2c 20 63 62 29 20 3d 3e 20 7b 0a 20 20 63 tensionId,.storage,.cb).=>.{...c
2d960 6f 6e 73 74 20 6a 73 6f 6e 20 3d 20 4a 53 4f 4e 2e 73 74 72 69 6e 67 69 66 79 28 73 74 6f 72 61 onst.json.=.JSON.stringify(stora
2d980 67 65 29 0a 20 20 77 72 69 74 65 43 68 72 6f 6d 65 53 74 6f 72 61 67 65 46 69 6c 65 28 73 74 6f ge)...writeChromeStorageFile(sto
2d9a0 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6a 73 6f 6e 2c 20 65 72 72 rageType,.extensionId,.json,.err
2d9c0 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 72 72 29 20 74 68 72 6f 77 20 65 72 72 0a 20 20 20 .=>.{.....if.(err).throw.err....
2d9e0 20 69 66 20 28 63 62 29 20 63 62 28 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 53 .if.(cb).cb()...}).}..const.getS
2da00 74 6f 72 61 67 65 4d 61 6e 61 67 65 72 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 torageManager.=.(storageType,.ex
2da20 74 65 6e 73 69 6f 6e 49 64 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 67 tensionId).=>.{...return.{.....g
2da40 65 74 20 28 6b 65 79 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 67 65 74 53 et.(keys,.callback).{.......getS
2da60 74 6f 72 61 67 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c torage(storageType,.extensionId,
2da80 20 73 74 6f 72 61 67 65 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 6b 65 79 73 20 3d .storage.=>.{.........if.(keys.=
2daa0 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 73 74 6f 72 61 67 65 29 =.null).return.callback(storage)
2dac0 0a 0a 20 20 20 20 20 20 20 20 6c 65 74 20 64 65 66 61 75 6c 74 73 20 3d 20 7b 7d 0a 20 20 20 20 ..........let.defaults.=.{}.....
2dae0 20 20 20 20 73 77 69 74 63 68 20 28 74 79 70 65 6f 66 20 6b 65 79 73 29 20 7b 0a 20 20 20 20 20 ....switch.(typeof.keys).{......
2db00 20 20 20 20 20 63 61 73 65 20 27 73 74 72 69 6e 67 27 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 .....case.'string':.............
2db20 6b 65 79 73 20 3d 20 5b 6b 65 79 73 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 0a keys.=.[keys].............break.
2db40 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 6f 62 6a 65 63 74 27 3a 0a 20 20 20 20 20 20 20 ..........case.'object':........
2db60 20 20 20 20 20 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 6b 65 79 73 29 29 20 7b .....if.(!Array.isArray(keys)).{
2db80 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 73 20 3d 20 6b 65 79 73 0a 20 ...............defaults.=.keys..
2dba0 20 20 20 20 20 20 20 20 20 20 20 20 20 6b 65 79 73 20 3d 20 4f 62 6a 65 63 74 2e 6b 65 79 73 28 .............keys.=.Object.keys(
2dbc0 6b 65 79 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 keys).............}.............
2dbe0 62 72 65 61 6b 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 69 66 20 28 6b 65 79 73 break.........}.........if.(keys
2dc00 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 30 29 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 7b .length.===.0).return.callback({
2dc20 7d 29 0a 0a 20 20 20 20 20 20 20 20 6c 65 74 20 69 74 65 6d 73 20 3d 20 7b 7d 0a 20 20 20 20 20 })..........let.items.=.{}......
2dc40 20 20 20 6b 65 79 73 2e 66 6f 72 45 61 63 68 28 66 75 6e 63 74 69 6f 6e 20 28 6b 65 79 29 20 7b ...keys.forEach(function.(key).{
2dc60 0a 20 20 20 20 20 20 20 20 20 20 76 61 72 20 76 61 6c 75 65 20 3d 20 73 74 6f 72 61 67 65 5b 6b ...........var.value.=.storage[k
2dc80 65 79 5d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 28 76 61 6c 75 65 20 3d 3d 20 6e 75 6c 6c 29 ey]...........if.(value.==.null)
2dca0 20 76 61 6c 75 65 20 3d 20 64 65 66 61 75 6c 74 73 5b 6b 65 79 5d 0a 20 20 20 20 20 20 20 20 20 .value.=.defaults[key]..........
2dcc0 20 69 74 65 6d 73 5b 6b 65 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 7d 29 0a 20 .items[key].=.value.........})..
2dce0 20 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 69 74 65 6d 73 29 0a 20 20 20 20 20 20 7d 29 0a .......callback(items).......}).
2dd00 20 20 20 20 7d 2c 0a 0a 20 20 20 20 73 65 74 20 28 69 74 65 6d 73 2c 20 63 61 6c 6c 62 61 63 6b ....},......set.(items,.callback
2dd20 29 20 7b 0a 20 20 20 20 20 20 67 65 74 53 74 6f 72 61 67 65 28 73 74 6f 72 61 67 65 54 79 70 65 ).{.......getStorage(storageType
2dd40 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 73 74 6f 72 61 67 65 20 3d 3e 20 7b 0a 20 20 20 20 ,.extensionId,.storage.=>.{.....
2dd60 20 20 20 20 4f 62 6a 65 63 74 2e 6b 65 79 73 28 69 74 65 6d 73 29 2e 66 6f 72 45 61 63 68 28 66 ....Object.keys(items).forEach(f
2dd80 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 73 74 6f 72 61 unction.(name).{...........stora
2dda0 67 65 5b 6e 61 6d 65 5d 20 3d 20 69 74 65 6d 73 5b 6e 61 6d 65 5d 0a 20 20 20 20 20 20 20 20 7d ge[name].=.items[name].........}
2ddc0 29 0a 0a 20 20 20 20 20 20 20 20 73 65 74 53 74 6f 72 61 67 65 28 73 74 6f 72 61 67 65 54 79 70 )..........setStorage(storageTyp
2dde0 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 73 74 6f 72 61 67 65 2c 20 63 61 6c 6c 62 61 63 e,.extensionId,.storage,.callbac
2de00 6b 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 72 65 6d 6f 76 65 20 28 k).......}).....},......remove.(
2de20 6b 65 79 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 67 65 74 53 74 6f 72 61 keys,.callback).{.......getStora
2de40 67 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 73 74 6f ge(storageType,.extensionId,.sto
2de60 72 61 67 65 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 rage.=>.{.........if.(!Array.isA
2de80 72 72 61 79 28 6b 65 79 73 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 6b 65 79 73 20 3d 20 5b rray(keys)).{...........keys.=.[
2dea0 6b 65 79 73 5d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 6b 65 79 73 2e 66 6f 72 keys].........}.........keys.for
2dec0 45 61 63 68 28 66 75 6e 63 74 69 6f 6e 20 28 6b 65 79 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 Each(function.(key).{...........
2dee0 64 65 6c 65 74 65 20 73 74 6f 72 61 67 65 5b 6b 65 79 5d 0a 20 20 20 20 20 20 20 20 7d 29 0a 0a delete.storage[key].........})..
2df00 20 20 20 20 20 20 20 20 73 65 74 53 74 6f 72 61 67 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 ........setStorage(storageType,.
2df20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 73 74 6f 72 61 67 65 2c 20 63 61 6c 6c 62 61 63 6b 29 0a extensionId,.storage,.callback).
2df40 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 63 6c 65 61 72 20 28 63 61 6c 6c ......}).....},......clear.(call
2df60 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 73 65 74 53 74 6f 72 61 67 65 28 73 74 6f 72 61 67 65 back).{.......setStorage(storage
2df80 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 7b 7d 2c 20 63 61 6c 6c 62 61 63 6b 29 Type,.extensionId,.{},.callback)
2dfa0 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 7b .....}...}.}..module.exports.=.{
2dfc0 0a 20 20 73 65 74 75 70 3a 20 65 78 74 65 6e 73 69 6f 6e 49 64 20 3d 3e 20 28 7b 0a 20 20 20 20 ...setup:.extensionId.=>.({.....
2dfe0 73 79 6e 63 3a 20 67 65 74 53 74 6f 72 61 67 65 4d 61 6e 61 67 65 72 28 27 73 79 6e 63 27 2c 20 sync:.getStorageManager('sync',.
2e000 65 78 74 65 6e 73 69 6f 6e 49 64 29 2c 0a 20 20 20 20 6c 6f 63 61 6c 3a 20 67 65 74 53 74 6f 72 extensionId),.....local:.getStor
2e020 61 67 65 4d 61 6e 61 67 65 72 28 27 6c 6f 63 61 6c 27 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 ageManager('local',.extensionId)
2e040 0a 20 20 7d 29 0a 7d 0a 63 6f 6e 73 74 20 45 76 65 6e 74 20 3d 20 72 65 71 75 69 72 65 28 27 2e ...}).}.const.Event.=.require('.
2e060 2f 65 76 65 6e 74 27 29 0a 63 6f 6e 73 74 20 7b 69 70 63 52 65 6e 64 65 72 65 72 7d 20 3d 20 72 /event').const.{ipcRenderer}.=.r
2e080 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 63 6c 61 73 73 20 57 65 62 4e 61 76 equire('electron')..class.WebNav
2e0a0 69 67 61 74 69 6f 6e 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 29 20 7b 0a 20 20 20 igation.{...constructor.().{....
2e0c0 20 74 68 69 73 2e 6f 6e 42 65 66 6f 72 65 4e 61 76 69 67 61 74 65 20 3d 20 6e 65 77 20 45 76 65 .this.onBeforeNavigate.=.new.Eve
2e0e0 6e 74 28 29 0a 20 20 20 20 74 68 69 73 2e 6f 6e 43 6f 6d 70 6c 65 74 65 64 20 3d 20 6e 65 77 20 nt().....this.onCompleted.=.new.
2e100 45 76 65 6e 74 28 29 0a 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 43 48 52 Event()......ipcRenderer.on('CHR
2e120 4f 4d 45 5f 57 45 42 4e 41 56 49 47 41 54 49 4f 4e 5f 4f 4e 42 45 46 4f 52 45 4e 41 56 49 47 41 OME_WEBNAVIGATION_ONBEFORENAVIGA
2e140 54 45 27 2c 20 28 65 76 65 6e 74 2c 20 64 65 74 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 TE',.(event,.details).=>.{......
2e160 20 74 68 69 73 2e 6f 6e 42 65 66 6f 72 65 4e 61 76 69 67 61 74 65 2e 65 6d 69 74 28 64 65 74 61 .this.onBeforeNavigate.emit(deta
2e180 69 6c 73 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 ils).....})......ipcRenderer.on(
2e1a0 27 43 48 52 4f 4d 45 5f 57 45 42 4e 41 56 49 47 41 54 49 4f 4e 5f 4f 4e 43 4f 4d 50 4c 45 54 45 'CHROME_WEBNAVIGATION_ONCOMPLETE
2e1c0 44 27 2c 20 28 65 76 65 6e 74 2c 20 64 65 74 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 D',.(event,.details).=>.{.......
2e1e0 74 68 69 73 2e 6f 6e 43 6f 6d 70 6c 65 74 65 64 2e 65 6d 69 74 28 64 65 74 61 69 6c 73 29 0a 20 this.onCompleted.emit(details)..
2e200 20 20 20 7d 29 0a 20 20 7d 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 73 65 74 75 70 20 3d 20 28 29 20 ...})...}.}..exports.setup.=.().
2e220 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 6e 65 77 20 57 65 62 4e 61 76 69 67 61 74 69 6f 6e 28 =>.{...return.new.WebNavigation(
2e240 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 65 76 65 6e 74 73 20 3d ).}.'use.strict'..const.events.=
2e260 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 .require('events').const.path.=.
2e280 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 4d 6f 64 75 6c 65 20 3d 20 72 require('path').const.Module.=.r
2e2a0 65 71 75 69 72 65 28 27 6d 6f 64 75 6c 65 27 29 0a 63 6f 6e 73 74 20 72 65 73 6f 6c 76 65 50 72 equire('module').const.resolvePr
2e2c0 6f 6d 69 73 65 20 3d 20 50 72 6f 6d 69 73 65 2e 72 65 73 6f 6c 76 65 2e 62 69 6e 64 28 50 72 6f omise.=.Promise.resolve.bind(Pro
2e2e0 6d 69 73 65 29 0a 0a 2f 2f 20 57 65 20 6d 6f 64 69 66 69 65 64 20 74 68 65 20 6f 72 69 67 69 6e mise)..//.We.modified.the.origin
2e300 61 6c 20 70 72 6f 63 65 73 73 2e 61 72 67 76 20 74 6f 20 6c 65 74 20 6e 6f 64 65 2e 6a 73 20 6c al.process.argv.to.let.node.js.l
2e320 6f 61 64 20 74 68 65 0a 2f 2f 20 69 6e 69 74 2e 6a 73 2c 20 77 65 20 6e 65 65 64 20 74 6f 20 72 oad.the.//.init.js,.we.need.to.r
2e340 65 73 74 6f 72 65 20 69 74 20 68 65 72 65 2e 0a 70 72 6f 63 65 73 73 2e 61 72 67 76 2e 73 70 6c estore.it.here..process.argv.spl
2e360 69 63 65 28 31 2c 20 31 29 0a 0a 2f 2f 20 43 6c 65 61 72 20 73 65 61 72 63 68 20 70 61 74 68 73 ice(1,.1)..//.Clear.search.paths
2e380 2e 0a 72 65 71 75 69 72 65 28 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 72 65 73 65 74 2d 73 65 61 72 63 ..require('../common/reset-searc
2e3a0 68 2d 70 61 74 68 73 27 29 0a 0a 2f 2f 20 49 6d 70 6f 72 74 20 63 6f 6d 6d 6f 6e 20 73 65 74 74 h-paths')..//.Import.common.sett
2e3c0 69 6e 67 73 2e 0a 72 65 71 75 69 72 65 28 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 69 6e 69 74 27 29 0a ings..require('../common/init').
2e3e0 0a 76 61 72 20 67 6c 6f 62 61 6c 50 61 74 68 73 20 3d 20 4d 6f 64 75 6c 65 2e 67 6c 6f 62 61 6c .var.globalPaths.=.Module.global
2e400 50 61 74 68 73 0a 0a 2f 2f 20 45 78 70 6f 73 65 20 70 75 62 6c 69 63 20 41 50 49 73 2e 0a 67 6c Paths..//.Expose.public.APIs..gl
2e420 6f 62 61 6c 50 61 74 68 73 2e 70 75 73 68 28 70 61 74 68 2e 6a 6f 69 6e 28 5f 5f 64 69 72 6e 61 obalPaths.push(path.join(__dirna
2e440 6d 65 2c 20 27 61 70 69 27 2c 20 27 65 78 70 6f 72 74 73 27 29 29 0a 0a 2f 2f 20 54 68 65 20 67 me,.'api',.'exports'))..//.The.g
2e460 6c 6f 62 61 6c 20 76 61 72 69 61 62 6c 65 20 77 69 6c 6c 20 62 65 20 75 73 65 64 20 62 79 20 69 lobal.variable.will.be.used.by.i
2e480 70 63 20 66 6f 72 20 65 76 65 6e 74 20 64 69 73 70 61 74 63 68 69 6e 67 0a 76 61 72 20 76 38 55 pc.for.event.dispatching.var.v8U
2e4a0 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 til.=.process.atomBinding('v8_ut
2e4c0 69 6c 27 29 0a 0a 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 67 6c 6f 62 il')..v8Util.setHiddenValue(glob
2e4e0 61 6c 2c 20 27 69 70 63 27 2c 20 6e 65 77 20 65 76 65 6e 74 73 2e 45 76 65 6e 74 45 6d 69 74 74 al,.'ipc',.new.events.EventEmitt
2e500 65 72 28 29 29 0a 0a 2f 2f 20 55 73 65 20 65 6c 65 63 74 72 6f 6e 20 6d 6f 64 75 6c 65 20 61 66 er())..//.Use.electron.module.af
2e520 74 65 72 20 65 76 65 72 79 74 68 69 6e 67 20 69 73 20 72 65 61 64 79 2e 0a 63 6f 6e 73 74 20 65 ter.everything.is.ready..const.e
2e540 6c 65 63 74 72 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 2f lectron.=.require('electron')../
2e560 2f 20 43 61 6c 6c 20 77 65 62 46 72 61 6d 65 20 6d 65 74 68 6f 64 2e 0a 65 6c 65 63 74 72 6f 6e /.Call.webFrame.method..electron
2e580 2e 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e .ipcRenderer.on('ELECTRON_INTERN
2e5a0 41 4c 5f 52 45 4e 44 45 52 45 52 5f 57 45 42 5f 46 52 41 4d 45 5f 4d 45 54 48 4f 44 27 2c 20 28 AL_RENDERER_WEB_FRAME_METHOD',.(
2e5c0 65 76 65 6e 74 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 65 6c 65 63 event,.method,.args).=>.{...elec
2e5e0 74 72 6f 6e 2e 77 65 62 46 72 61 6d 65 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 29 0a 7d tron.webFrame[method](...args).}
2e600 29 0a 0a 65 6c 65 63 74 72 6f 6e 2e 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 43 )..electron.ipcRenderer.on('ELEC
2e620 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 52 45 4e 44 45 52 45 52 5f 53 59 4e 43 5f 57 45 42 5f TRON_INTERNAL_RENDERER_SYNC_WEB_
2e640 46 52 41 4d 45 5f 4d 45 54 48 4f 44 27 2c 20 28 65 76 65 6e 74 2c 20 72 65 71 75 65 73 74 49 64 FRAME_METHOD',.(event,.requestId
2e660 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 72 65 73 ,.method,.args).=>.{...const.res
2e680 75 6c 74 20 3d 20 65 6c 65 63 74 72 6f 6e 2e 77 65 62 46 72 61 6d 65 5b 6d 65 74 68 6f 64 5d 28 ult.=.electron.webFrame[method](
2e6a0 2e 2e 2e 61 72 67 73 29 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 73 65 6e 64 28 60 45 4c ...args)...event.sender.send(`EL
2e6c0 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 42 52 4f 57 53 45 52 5f 53 59 4e 43 5f 57 45 42 ECTRON_INTERNAL_BROWSER_SYNC_WEB
2e6e0 5f 46 52 41 4d 45 5f 52 45 53 50 4f 4e 53 45 5f 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 72 _FRAME_RESPONSE_${requestId}`,.r
2e700 65 73 75 6c 74 29 0a 7d 29 0a 0a 65 6c 65 63 74 72 6f 6e 2e 69 70 63 52 65 6e 64 65 72 65 72 2e esult).})..electron.ipcRenderer.
2e720 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 52 45 4e 44 45 52 45 52 5f 41 on('ELECTRON_INTERNAL_RENDERER_A
2e740 53 59 4e 43 5f 57 45 42 5f 46 52 41 4d 45 5f 4d 45 54 48 4f 44 27 2c 20 28 65 76 65 6e 74 2c 20 SYNC_WEB_FRAME_METHOD',.(event,.
2e760 72 65 71 75 65 73 74 49 64 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 requestId,.method,.args).=>.{...
2e780 63 6f 6e 73 74 20 72 65 73 70 6f 6e 73 65 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f const.responseCallback.=.functio
2e7a0 6e 20 28 72 65 73 75 6c 74 29 20 7b 0a 20 20 20 20 72 65 73 6f 6c 76 65 50 72 6f 6d 69 73 65 28 n.(result).{.....resolvePromise(
2e7c0 72 65 73 75 6c 74 29 0a 20 20 20 20 20 20 2e 74 68 65 6e 28 28 72 65 73 6f 6c 76 65 64 52 65 73 result)........then((resolvedRes
2e7e0 75 6c 74 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 73 ult).=>.{.........event.sender.s
2e800 65 6e 64 28 60 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 42 52 4f 57 53 45 52 5f 41 end(`ELECTRON_INTERNAL_BROWSER_A
2e820 53 59 4e 43 5f 57 45 42 5f 46 52 41 4d 45 5f 52 45 53 50 4f 4e 53 45 5f 24 7b 72 65 71 75 65 73 SYNC_WEB_FRAME_RESPONSE_${reques
2e840 74 49 64 7d 60 2c 20 6e 75 6c 6c 2c 20 72 65 73 6f 6c 76 65 64 52 65 73 75 6c 74 29 0a 20 20 20 tId}`,.null,.resolvedResult)....
2e860 20 20 20 7d 29 0a 20 20 20 20 20 20 2e 63 61 74 63 68 28 28 72 65 73 6f 6c 76 65 64 45 72 72 6f ...})........catch((resolvedErro
2e880 72 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 72 65 73 6f 6c 76 65 64 45 72 72 6f r).=>.{.........if.(resolvedErro
2e8a0 72 20 69 6e 73 74 61 6e 63 65 6f 66 20 45 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 r.instanceof.Error).{...........
2e8c0 2f 2f 20 45 72 72 6f 72 73 20 67 65 74 20 6c 6f 73 74 2c 20 62 65 63 61 75 73 65 3a 20 4a 53 4f //.Errors.get.lost,.because:.JSO
2e8e0 4e 2e 73 74 72 69 6e 67 69 66 79 28 6e 65 77 20 45 72 72 6f 72 28 27 4d 65 73 73 61 67 65 27 29 N.stringify(new.Error('Message')
2e900 29 20 3d 3d 3d 20 7b 7d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 54 61 6b 65 20 74 68 65 20 73 ).===.{}...........//.Take.the.s
2e920 65 72 69 61 6c 69 7a 61 62 6c 65 20 70 72 6f 70 65 72 74 69 65 73 20 61 6e 64 20 63 6f 6e 73 74 erializable.properties.and.const
2e940 72 75 63 74 20 61 20 67 65 6e 65 72 69 63 20 6f 62 6a 65 63 74 0a 20 20 20 20 20 20 20 20 20 20 ruct.a.generic.object...........
2e960 72 65 73 6f 6c 76 65 64 45 72 72 6f 72 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 6d 65 resolvedError.=.{.............me
2e980 73 73 61 67 65 3a 20 72 65 73 6f 6c 76 65 64 45 72 72 6f 72 2e 6d 65 73 73 61 67 65 2c 0a 20 20 ssage:.resolvedError.message,...
2e9a0 20 20 20 20 20 20 20 20 20 20 73 74 61 63 6b 3a 20 72 65 73 6f 6c 76 65 64 45 72 72 6f 72 2e 73 ..........stack:.resolvedError.s
2e9c0 74 61 63 6b 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 6e 61 6d 65 3a 20 72 65 73 6f 6c 76 65 64 tack,.............name:.resolved
2e9e0 45 72 72 6f 72 2e 6e 61 6d 65 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 45 4c 45 43 54 52 Error.name,.............__ELECTR
2ea00 4f 4e 5f 53 45 52 49 41 4c 49 5a 45 44 5f 45 52 52 4f 52 5f 5f 3a 20 74 72 75 65 0a 20 20 20 20 ON_SERIALIZED_ERROR__:.true.....
2ea20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 20 20 65 76 65 6e 74 ......}.........}..........event
2ea40 2e 73 65 6e 64 65 72 2e 73 65 6e 64 28 60 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f .sender.send(`ELECTRON_INTERNAL_
2ea60 42 52 4f 57 53 45 52 5f 41 53 59 4e 43 5f 57 45 42 5f 46 52 41 4d 45 5f 52 45 53 50 4f 4e 53 45 BROWSER_ASYNC_WEB_FRAME_RESPONSE
2ea80 5f 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 72 65 73 6f 6c 76 65 64 45 72 72 6f 72 29 0a 20 _${requestId}`,.resolvedError)..
2eaa0 20 20 20 20 20 7d 29 0a 20 20 7d 0a 20 20 61 72 67 73 2e 70 75 73 68 28 72 65 73 70 6f 6e 73 65 .....})...}...args.push(response
2eac0 43 61 6c 6c 62 61 63 6b 29 0a 20 20 65 6c 65 63 74 72 6f 6e 2e 77 65 62 46 72 61 6d 65 5b 6d 65 Callback)...electron.webFrame[me
2eae0 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 29 0a 7d 29 0a 0a 2f 2f 20 50 72 6f 63 65 73 73 20 63 6f thod](...args).})..//.Process.co
2eb00 6d 6d 61 6e 64 20 6c 69 6e 65 20 61 72 67 75 6d 65 6e 74 73 2e 0a 6c 65 74 20 6e 6f 64 65 49 6e mmand.line.arguments..let.nodeIn
2eb20 74 65 67 72 61 74 69 6f 6e 20 3d 20 27 66 61 6c 73 65 27 0a 6c 65 74 20 77 65 62 76 69 65 77 54 tegration.=.'false'.let.webviewT
2eb40 61 67 20 3d 20 27 66 61 6c 73 65 27 0a 6c 65 74 20 70 72 65 6c 6f 61 64 53 63 72 69 70 74 20 3d ag.=.'false'.let.preloadScript.=
2eb60 20 6e 75 6c 6c 0a 6c 65 74 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 20 3d 20 66 61 6c .null.let.isBackgroundPage.=.fal
2eb80 73 65 0a 6c 65 74 20 61 70 70 50 61 74 68 20 3d 20 6e 75 6c 6c 0a 66 6f 72 20 28 6c 65 74 20 61 se.let.appPath.=.null.for.(let.a
2eba0 72 67 20 6f 66 20 70 72 6f 63 65 73 73 2e 61 72 67 76 29 20 7b 0a 20 20 69 66 20 28 61 72 67 2e rg.of.process.argv).{...if.(arg.
2ebc0 69 6e 64 65 78 4f 66 28 27 2d 2d 67 75 65 73 74 2d 69 6e 73 74 61 6e 63 65 2d 69 64 3d 27 29 20 indexOf('--guest-instance-id=').
2ebe0 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 2f 2f 20 54 68 69 73 20 69 73 20 61 20 67 75 65 73 74 20 ===.0).{.....//.This.is.a.guest.
2ec00 77 65 62 20 76 69 65 77 2e 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 67 75 65 73 74 49 6e 73 74 61 web.view......process.guestInsta
2ec20 6e 63 65 49 64 20 3d 20 70 61 72 73 65 49 6e 74 28 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e nceId.=.parseInt(arg.substr(arg.
2ec40 69 6e 64 65 78 4f 66 28 27 3d 27 29 20 2b 20 31 29 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 indexOf('=').+.1))...}.else.if.(
2ec60 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 2d 2d 6f 70 65 6e 65 72 2d 69 64 3d 27 29 20 3d 3d 3d 20 arg.indexOf('--opener-id=').===.
2ec80 30 29 20 7b 0a 20 20 20 20 2f 2f 20 54 68 69 73 20 69 73 20 61 20 67 75 65 73 74 20 42 72 6f 77 0).{.....//.This.is.a.guest.Brow
2eca0 73 65 72 57 69 6e 64 6f 77 2e 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 6f 70 65 6e 65 72 49 64 20 serWindow......process.openerId.
2ecc0 3d 20 70 61 72 73 65 49 6e 74 28 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e 69 6e 64 65 78 4f =.parseInt(arg.substr(arg.indexO
2ece0 66 28 27 3d 27 29 20 2b 20 31 29 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 2e 69 6e f('=').+.1))...}.else.if.(arg.in
2ed00 64 65 78 4f 66 28 27 2d 2d 6e 6f 64 65 2d 69 6e 74 65 67 72 61 74 69 6f 6e 3d 27 29 20 3d 3d 3d dexOf('--node-integration=').===
2ed20 20 30 29 20 7b 0a 20 20 20 20 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 20 61 72 67 2e .0).{.....nodeIntegration.=.arg.
2ed40 73 75 62 73 74 72 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 3d 27 29 20 2b 20 31 29 0a 20 20 7d substr(arg.indexOf('=').+.1)...}
2ed60 20 65 6c 73 65 20 69 66 20 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 2d 2d 70 72 65 6c 6f 61 64 .else.if.(arg.indexOf('--preload
2ed80 3d 27 29 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 70 72 65 6c 6f 61 64 53 63 72 69 70 74 20 3d =').===.0).{.....preloadScript.=
2eda0 20 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 3d 27 29 20 2b 20 31 .arg.substr(arg.indexOf('=').+.1
2edc0 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 20 3d 3d 3d 20 27 2d 2d 62 61 63 6b 67 72 )...}.else.if.(arg.===.'--backgr
2ede0 6f 75 6e 64 2d 70 61 67 65 27 29 20 7b 0a 20 20 20 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 ound-page').{.....isBackgroundPa
2ee00 67 65 20 3d 20 74 72 75 65 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 2e 69 6e 64 65 78 ge.=.true...}.else.if.(arg.index
2ee20 4f 66 28 27 2d 2d 61 70 70 2d 70 61 74 68 3d 27 29 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 61 Of('--app-path=').===.0).{.....a
2ee40 70 70 50 61 74 68 20 3d 20 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 ppPath.=.arg.substr(arg.indexOf(
2ee60 27 3d 27 29 20 2b 20 31 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 2e 69 6e 64 65 78 '=').+.1)...}.else.if.(arg.index
2ee80 4f 66 28 27 2d 2d 77 65 62 76 69 65 77 2d 74 61 67 3d 27 29 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 Of('--webview-tag=').===.0).{...
2eea0 20 20 77 65 62 76 69 65 77 54 61 67 20 3d 20 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e 69 6e ..webviewTag.=.arg.substr(arg.in
2eec0 64 65 78 4f 66 28 27 3d 27 29 20 2b 20 31 29 0a 20 20 7d 0a 7d 0a 0a 69 66 20 28 77 69 6e 64 6f dexOf('=').+.1)...}.}..if.(windo
2eee0 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 63 68 72 6f 6d 65 2d w.location.protocol.===.'chrome-
2ef00 64 65 76 74 6f 6f 6c 73 3a 27 29 20 7b 0a 20 20 2f 2f 20 4f 76 65 72 72 69 64 65 20 73 6f 6d 65 devtools:').{...//.Override.some
2ef20 20 69 6e 73 70 65 63 74 6f 72 20 41 50 49 73 2e 0a 20 20 72 65 71 75 69 72 65 28 27 2e 2f 69 6e .inspector.APIs....require('./in
2ef40 73 70 65 63 74 6f 72 27 29 0a 20 20 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 20 27 66 spector')...nodeIntegration.=.'f
2ef60 61 6c 73 65 27 0a 7d 20 65 6c 73 65 20 69 66 20 28 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e alse'.}.else.if.(window.location
2ef80 2e 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a .protocol.===.'chrome-extension:
2efa0 27 29 20 7b 0a 20 20 2f 2f 20 41 64 64 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 ').{...//.Add.implementations.of
2efc0 20 63 68 72 6f 6d 65 20 41 50 49 2e 0a 20 20 72 65 71 75 69 72 65 28 27 2e 2f 63 68 72 6f 6d 65 .chrome.API....require('./chrome
2efe0 2d 61 70 69 27 29 2e 69 6e 6a 65 63 74 54 6f 28 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e -api').injectTo(window.location.
2f000 68 6f 73 74 6e 61 6d 65 2c 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 2c 20 77 69 6e 64 hostname,.isBackgroundPage,.wind
2f020 6f 77 29 0a 20 20 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 20 27 66 61 6c 73 65 27 0a ow)...nodeIntegration.=.'false'.
2f040 7d 20 65 6c 73 65 20 69 66 20 28 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f }.else.if.(window.location.proto
2f060 63 6f 6c 20 3d 3d 3d 20 27 63 68 72 6f 6d 65 3a 27 29 20 7b 0a 20 20 2f 2f 20 44 69 73 61 62 6c col.===.'chrome:').{...//.Disabl
2f080 65 20 6e 6f 64 65 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 66 6f 72 20 63 68 72 6f 6d 65 20 55 49 e.node.integration.for.chrome.UI
2f0a0 20 73 63 68 65 6d 65 2e 0a 20 20 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 20 27 66 61 .scheme....nodeIntegration.=.'fa
2f0c0 6c 73 65 27 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 2f 2f 20 4f 76 65 72 72 69 64 65 20 64 65 66 61 lse'.}.else.{...//.Override.defa
2f0e0 75 6c 74 20 77 65 62 20 66 75 6e 63 74 69 6f 6e 73 2e 0a 20 20 72 65 71 75 69 72 65 28 27 2e 2f ult.web.functions....require('./
2f100 6f 76 65 72 72 69 64 65 27 29 0a 0a 20 20 2f 2f 20 49 6e 6a 65 63 74 20 63 6f 6e 74 65 6e 74 20 override')....//.Inject.content.
2f120 73 63 72 69 70 74 73 2e 0a 20 20 72 65 71 75 69 72 65 28 27 2e 2f 63 6f 6e 74 65 6e 74 2d 73 63 scripts....require('./content-sc
2f140 72 69 70 74 73 2d 69 6e 6a 65 63 74 6f 72 27 29 0a 0a 20 20 2f 2f 20 4c 6f 61 64 20 77 65 62 76 ripts-injector')....//.Load.webv
2f160 69 65 77 20 74 61 67 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a 20 20 69 66 20 28 77 65 iew.tag.implementation....if.(we
2f180 62 76 69 65 77 54 61 67 20 3d 3d 3d 20 27 74 72 75 65 27 20 26 26 20 70 72 6f 63 65 73 73 2e 67 bviewTag.===.'true'.&&.process.g
2f1a0 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 72 65 uestInstanceId.==.null).{.....re
2f1c0 71 75 69 72 65 28 27 2e 2f 77 65 62 2d 76 69 65 77 2f 77 65 62 2d 76 69 65 77 27 29 0a 20 20 20 quire('./web-view/web-view')....
2f1e0 20 72 65 71 75 69 72 65 28 27 2e 2f 77 65 62 2d 76 69 65 77 2f 77 65 62 2d 76 69 65 77 2d 61 74 .require('./web-view/web-view-at
2f200 74 72 69 62 75 74 65 73 27 29 0a 20 20 7d 0a 7d 0a 0a 69 66 20 28 6e 6f 64 65 49 6e 74 65 67 72 tributes')...}.}..if.(nodeIntegr
2f220 61 74 69 6f 6e 20 3d 3d 3d 20 27 74 72 75 65 27 29 20 7b 0a 20 20 2f 2f 20 45 78 70 6f 72 74 20 ation.===.'true').{...//.Export.
2f240 6e 6f 64 65 20 62 69 6e 64 69 6e 67 73 20 74 6f 20 67 6c 6f 62 61 6c 2e 0a 20 20 67 6c 6f 62 61 node.bindings.to.global....globa
2f260 6c 2e 72 65 71 75 69 72 65 20 3d 20 72 65 71 75 69 72 65 0a 20 20 67 6c 6f 62 61 6c 2e 6d 6f 64 l.require.=.require...global.mod
2f280 75 6c 65 20 3d 20 6d 6f 64 75 6c 65 0a 0a 20 20 2f 2f 20 53 65 74 20 74 68 65 20 5f 5f 66 69 6c ule.=.module....//.Set.the.__fil
2f2a0 65 6e 61 6d 65 20 74 6f 20 74 68 65 20 70 61 74 68 20 6f 66 20 68 74 6d 6c 20 66 69 6c 65 20 69 ename.to.the.path.of.html.file.i
2f2c0 66 20 69 74 20 69 73 20 66 69 6c 65 3a 20 70 72 6f 74 6f 63 6f 6c 2e 0a 20 20 69 66 20 28 77 69 f.it.is.file:.protocol....if.(wi
2f2e0 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 66 69 6c 65 ndow.location.protocol.===.'file
2f300 3a 27 29 20 7b 0a 20 20 20 20 76 61 72 20 70 61 74 68 6e 61 6d 65 20 3d 20 70 72 6f 63 65 73 73 :').{.....var.pathname.=.process
2f320 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 20 26 26 20 77 69 6e 64 6f 77 2e .platform.===.'win32'.&&.window.
2f340 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e 61 6d 65 5b 30 5d 20 3d 3d 3d 20 27 2f 27 20 3f 20 77 location.pathname[0].===.'/'.?.w
2f360 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e 61 6d 65 2e 73 75 62 73 74 72 28 31 indow.location.pathname.substr(1
2f380 29 20 3a 20 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e 61 6d 65 0a 20 20 20 ).:.window.location.pathname....
2f3a0 20 67 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 20 3d 20 70 61 74 68 2e 6e 6f 72 6d 61 6c .global.__filename.=.path.normal
2f3c0 69 7a 65 28 64 65 63 6f 64 65 55 52 49 43 6f 6d 70 6f 6e 65 6e 74 28 70 61 74 68 6e 61 6d 65 29 ize(decodeURIComponent(pathname)
2f3e0 29 0a 20 20 20 20 67 6c 6f 62 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 20 3d 20 70 61 74 68 2e 64 69 ).....global.__dirname.=.path.di
2f400 72 6e 61 6d 65 28 67 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 29 0a 0a 20 20 20 20 2f 2f rname(global.__filename)......//
2f420 20 53 65 74 20 6d 6f 64 75 6c 65 27 73 20 66 69 6c 65 6e 61 6d 65 20 73 6f 20 72 65 6c 61 74 69 .Set.module's.filename.so.relati
2f440 76 65 20 72 65 71 75 69 72 65 20 63 61 6e 20 77 6f 72 6b 20 61 73 20 65 78 70 65 63 74 65 64 2e ve.require.can.work.as.expected.
2f460 0a 20 20 20 20 6d 6f 64 75 6c 65 2e 66 69 6c 65 6e 61 6d 65 20 3d 20 67 6c 6f 62 61 6c 2e 5f 5f .....module.filename.=.global.__
2f480 66 69 6c 65 6e 61 6d 65 0a 0a 20 20 20 20 2f 2f 20 41 6c 73 6f 20 73 65 61 72 63 68 20 66 6f 72 filename......//.Also.search.for
2f4a0 20 6d 6f 64 75 6c 65 20 75 6e 64 65 72 20 74 68 65 20 68 74 6d 6c 20 66 69 6c 65 2e 0a 20 20 20 .module.under.the.html.file.....
2f4c0 20 6d 6f 64 75 6c 65 2e 70 61 74 68 73 20 3d 20 6d 6f 64 75 6c 65 2e 70 61 74 68 73 2e 63 6f 6e .module.paths.=.module.paths.con
2f4e0 63 61 74 28 4d 6f 64 75 6c 65 2e 5f 6e 6f 64 65 4d 6f 64 75 6c 65 50 61 74 68 73 28 67 6c 6f 62 cat(Module._nodeModulePaths(glob
2f500 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 29 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 67 6c al.__dirname))...}.else.{.....gl
2f520 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 20 3d 20 5f 5f 66 69 6c 65 6e 61 6d 65 0a 20 20 20 obal.__filename.=.__filename....
2f540 20 67 6c 6f 62 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 20 3d 20 5f 5f 64 69 72 6e 61 6d 65 0a 0a 20 .global.__dirname.=.__dirname...
2f560 20 20 20 69 66 20 28 61 70 70 50 61 74 68 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 53 65 61 72 63 ...if.(appPath).{.......//.Searc
2f580 68 20 66 6f 72 20 6d 6f 64 75 6c 65 20 75 6e 64 65 72 20 74 68 65 20 61 70 70 20 64 69 72 65 63 h.for.module.under.the.app.direc
2f5a0 74 6f 72 79 0a 20 20 20 20 20 20 6d 6f 64 75 6c 65 2e 70 61 74 68 73 20 3d 20 6d 6f 64 75 6c 65 tory.......module.paths.=.module
2f5c0 2e 70 61 74 68 73 2e 63 6f 6e 63 61 74 28 4d 6f 64 75 6c 65 2e 5f 6e 6f 64 65 4d 6f 64 75 6c 65 .paths.concat(Module._nodeModule
2f5e0 50 61 74 68 73 28 61 70 70 50 61 74 68 29 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 69 66 20 Paths(appPath)).....}...}....if.
2f600 28 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 68 (window.location.protocol.===.'h
2f620 74 74 70 73 3a 27 20 7c 7c 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e ttps:'.||.......window.location.
2f640 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 68 74 74 70 3a 27 20 7c 7c 0a 20 20 20 20 20 20 77 69 protocol.===.'http:'.||.......wi
2f660 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 66 74 70 3a ndow.location.protocol.===.'ftp:
2f680 27 29 20 7b 0a 20 20 20 20 6c 65 74 20 77 61 72 6e 69 6e 67 20 3d 20 27 54 68 69 73 20 72 65 6e ').{.....let.warning.=.'This.ren
2f6a0 64 65 72 65 72 20 70 72 6f 63 65 73 73 20 68 61 73 20 4e 6f 64 65 2e 6a 73 20 69 6e 74 65 67 72 derer.process.has.Node.js.integr
2f6c0 61 74 69 6f 6e 20 65 6e 61 62 6c 65 64 20 27 0a 20 20 20 20 77 61 72 6e 69 6e 67 20 2b 3d 20 27 ation.enabled.'.....warning.+=.'
2f6e0 61 6e 64 20 61 74 74 65 6d 70 74 65 64 20 74 6f 20 6c 6f 61 64 20 72 65 6d 6f 74 65 20 63 6f 6e and.attempted.to.load.remote.con
2f700 74 65 6e 74 2e 20 54 68 69 73 20 65 78 70 6f 73 65 73 20 75 73 65 72 73 20 6f 66 20 74 68 69 73 tent..This.exposes.users.of.this
2f720 20 61 70 70 20 74 6f 20 73 65 76 65 72 65 20 27 0a 20 20 20 20 77 61 72 6e 69 6e 67 20 2b 3d 20 .app.to.severe.'.....warning.+=.
2f740 27 73 65 63 75 72 69 74 79 20 72 69 73 6b 73 2e 5c 6e 27 0a 20 20 20 20 77 61 72 6e 69 6e 67 20 'security.risks.\n'.....warning.
2f760 2b 3d 20 27 46 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 6e 64 20 68 65 6c +=.'For.more.information.and.hel
2f780 70 2c 20 63 6f 6e 73 75 6c 74 20 68 74 74 70 73 3a 2f 2f 65 6c 65 63 74 72 6f 6e 6a 73 2e 6f 72 p,.consult.https://electronjs.or
2f7a0 67 2f 64 6f 63 73 2f 74 75 74 6f 72 69 61 6c 2f 73 65 63 75 72 69 74 79 27 0a 0a 20 20 20 20 63 g/docs/tutorial/security'......c
2f7c0 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 53 65 63 75 72 69 74 79 onsole.warn('%cElectron.Security
2f7e0 20 57 61 72 6e 69 6e 67 27 2c 20 27 66 6f 6e 74 2d 77 65 69 67 68 74 3a 20 62 6f 6c 64 3b 27 2c .Warning',.'font-weight:.bold;',
2f800 20 77 61 72 6e 69 6e 67 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 52 65 64 69 72 65 63 74 20 77 69 6e .warning)...}....//.Redirect.win
2f820 64 6f 77 2e 6f 6e 65 72 72 6f 72 20 74 6f 20 75 6e 63 61 75 67 68 74 45 78 63 65 70 74 69 6f 6e dow.onerror.to.uncaughtException
2f840 2e 0a 20 20 77 69 6e 64 6f 77 2e 6f 6e 65 72 72 6f 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d ....window.onerror.=.function.(m
2f860 65 73 73 61 67 65 2c 20 66 69 6c 65 6e 61 6d 65 2c 20 6c 69 6e 65 6e 6f 2c 20 63 6f 6c 6e 6f 2c essage,.filename,.lineno,.colno,
2f880 20 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 69 66 20 28 67 6c 6f 62 61 6c 2e 70 72 6f 63 65 73 73 .error).{.....if.(global.process
2f8a0 2e 6c 69 73 74 65 6e 65 72 73 28 27 75 6e 63 61 75 67 68 74 45 78 63 65 70 74 69 6f 6e 27 29 2e .listeners('uncaughtException').
2f8c0 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 20 20 67 6c 6f 62 61 6c 2e 70 72 6f 63 65 length.>.0).{.......global.proce
2f8e0 73 73 2e 65 6d 69 74 28 27 75 6e 63 61 75 67 68 74 45 78 63 65 70 74 69 6f 6e 27 2c 20 65 72 72 ss.emit('uncaughtException',.err
2f900 6f 72 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 20 20 7d 20 65 6c 73 65 or).......return.true.....}.else
2f920 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0a 20 20 20 20 7d 0a 20 20 7d 0a .{.......return.false.....}...}.
2f940 7d 20 65 6c 73 65 20 7b 0a 20 20 2f 2f 20 44 65 6c 65 74 65 20 4e 6f 64 65 27 73 20 73 79 6d 62 }.else.{...//.Delete.Node's.symb
2f960 6f 6c 73 20 61 66 74 65 72 20 74 68 65 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 68 61 73 20 62 65 ols.after.the.Environment.has.be
2f980 65 6e 20 6c 6f 61 64 65 64 2e 0a 20 20 70 72 6f 63 65 73 73 2e 6f 6e 63 65 28 27 6c 6f 61 64 65 en.loaded....process.once('loade
2f9a0 64 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 64 65 6c 65 74 65 20 67 6c 6f d',.function.().{.....delete.glo
2f9c0 62 61 6c 2e 70 72 6f 63 65 73 73 0a 20 20 20 20 64 65 6c 65 74 65 20 67 6c 6f 62 61 6c 2e 42 75 bal.process.....delete.global.Bu
2f9e0 66 66 65 72 0a 20 20 20 20 64 65 6c 65 74 65 20 67 6c 6f 62 61 6c 2e 73 65 74 49 6d 6d 65 64 69 ffer.....delete.global.setImmedi
2fa00 61 74 65 0a 20 20 20 20 64 65 6c 65 74 65 20 67 6c 6f 62 61 6c 2e 63 6c 65 61 72 49 6d 6d 65 64 ate.....delete.global.clearImmed
2fa20 69 61 74 65 0a 20 20 20 20 64 65 6c 65 74 65 20 67 6c 6f 62 61 6c 2e 67 6c 6f 62 61 6c 0a 20 20 iate.....delete.global.global...
2fa40 7d 29 0a 7d 0a 0a 2f 2f 20 4c 6f 61 64 20 74 68 65 20 73 63 72 69 70 74 20 73 70 65 63 66 69 65 }).}..//.Load.the.script.specfie
2fa60 64 20 62 79 20 74 68 65 20 22 70 72 65 6c 6f 61 64 22 20 61 74 74 72 69 62 75 74 65 2e 0a 69 66 d.by.the."preload".attribute..if
2fa80 20 28 70 72 65 6c 6f 61 64 53 63 72 69 70 74 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 72 .(preloadScript).{...try.{.....r
2faa0 65 71 75 69 72 65 28 70 72 65 6c 6f 61 64 53 63 72 69 70 74 29 0a 20 20 7d 20 63 61 74 63 68 20 equire(preloadScript)...}.catch.
2fac0 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 55 6e 61 (error).{.....console.error('Una
2fae0 62 6c 65 20 74 6f 20 6c 6f 61 64 20 70 72 65 6c 6f 61 64 20 73 63 72 69 70 74 3a 20 27 20 2b 20 ble.to.load.preload.script:.'.+.
2fb00 70 72 65 6c 6f 61 64 53 63 72 69 70 74 29 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 preloadScript).....console.error
2fb20 28 65 72 72 6f 72 2e 73 74 61 63 6b 20 7c 7c 20 65 72 72 6f 72 2e 6d 65 73 73 61 67 65 29 0a 20 (error.stack.||.error.message)..
2fb40 20 7d 0a 7d 0a 77 69 6e 64 6f 77 2e 6f 6e 6c 6f 61 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 .}.}.window.onload.=.function.()
2fb60 20 7b 0a 20 20 2f 2f 20 55 73 65 20 6d 65 6e 75 20 41 50 49 20 74 6f 20 73 68 6f 77 20 63 6f 6e .{...//.Use.menu.API.to.show.con
2fb80 74 65 78 74 20 6d 65 6e 75 2e 0a 20 20 77 69 6e 64 6f 77 2e 49 6e 73 70 65 63 74 6f 72 46 72 6f text.menu....window.InspectorFro
2fba0 6e 74 65 6e 64 48 6f 73 74 2e 73 68 6f 77 43 6f 6e 74 65 78 74 4d 65 6e 75 41 74 50 6f 69 6e 74 ntendHost.showContextMenuAtPoint
2fbc0 20 3d 20 63 72 65 61 74 65 4d 65 6e 75 0a 0a 20 20 2f 2f 20 55 73 65 20 64 69 61 6c 6f 67 20 41 .=.createMenu....//.Use.dialog.A
2fbe0 50 49 20 74 6f 20 6f 76 65 72 72 69 64 65 20 66 69 6c 65 20 63 68 6f 6f 73 65 72 20 64 69 61 6c PI.to.override.file.chooser.dial
2fc00 6f 67 2e 0a 20 20 2f 2f 20 4e 6f 74 65 3a 20 49 74 20 77 69 6c 6c 20 62 65 20 6d 6f 76 65 64 20 og....//.Note:.It.will.be.moved.
2fc20 74 6f 20 55 49 20 61 66 74 65 72 20 43 68 72 6f 6d 65 20 35 37 2e 0a 20 20 77 69 6e 64 6f 77 2e to.UI.after.Chrome.57....window.
2fc40 42 69 6e 64 69 6e 67 73 2e 63 72 65 61 74 65 46 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 6d 65 Bindings.createFileSelectorEleme
2fc60 6e 74 20 3d 20 63 72 65 61 74 65 46 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 6d 65 6e 74 0a 7d nt.=.createFileSelectorElement.}
2fc80 0a 0a 77 69 6e 64 6f 77 2e 63 6f 6e 66 69 72 6d 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 65 73 ..window.confirm.=.function.(mes
2fca0 73 61 67 65 2c 20 74 69 74 6c 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 7b 64 69 61 6c 6f 67 7d 20 sage,.title).{...const.{dialog}.
2fcc0 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 2e 72 65 6d 6f 74 65 0a 20 20 69 =.require('electron').remote...i
2fce0 66 20 28 74 69 74 6c 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 69 74 6c 65 20 3d 20 f.(title.==.null).{.....title.=.
2fd00 27 27 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 21 64 69 61 6c 6f 67 2e 73 68 6f 77 4d 65 73 73 ''...}...return.!dialog.showMess
2fd20 61 67 65 42 6f 78 28 7b 0a 20 20 20 20 6d 65 73 73 61 67 65 3a 20 6d 65 73 73 61 67 65 2c 0a 20 ageBox({.....message:.message,..
2fd40 20 20 20 74 69 74 6c 65 3a 20 74 69 74 6c 65 2c 0a 20 20 20 20 62 75 74 74 6f 6e 73 3a 20 5b 27 ...title:.title,.....buttons:.['
2fd60 4f 4b 27 2c 20 27 43 61 6e 63 65 6c 27 5d 2c 0a 20 20 20 20 63 61 6e 63 65 6c 49 64 3a 20 31 0a OK',.'Cancel'],.....cancelId:.1.
2fd80 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 63 6f 6e 76 65 72 74 54 6f 4d 65 6e 75 54 65 6d 70 6c ..}).}..const.convertToMenuTempl
2fda0 61 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 74 65 6d 73 29 20 7b 0a 20 20 72 65 74 75 72 ate.=.function.(items).{...retur
2fdc0 6e 20 69 74 65 6d 73 2e 6d 61 70 28 66 75 6e 63 74 69 6f 6e 20 28 69 74 65 6d 29 20 7b 0a 20 20 n.items.map(function.(item).{...
2fde0 20 20 63 6f 6e 73 74 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 3d 20 69 74 65 6d 2e 74 79 70 65 20 ..const.transformed.=.item.type.
2fe00 3d 3d 3d 20 27 73 75 62 4d 65 6e 75 27 20 3f 20 7b 0a 20 20 20 20 20 20 74 79 70 65 3a 20 27 73 ===.'subMenu'.?.{.......type:.'s
2fe20 75 62 6d 65 6e 75 27 2c 0a 20 20 20 20 20 20 6c 61 62 65 6c 3a 20 69 74 65 6d 2e 6c 61 62 65 6c ubmenu',.......label:.item.label
2fe40 2c 0a 20 20 20 20 20 20 65 6e 61 62 6c 65 64 3a 20 69 74 65 6d 2e 65 6e 61 62 6c 65 64 2c 0a 20 ,.......enabled:.item.enabled,..
2fe60 20 20 20 20 20 73 75 62 6d 65 6e 75 3a 20 63 6f 6e 76 65 72 74 54 6f 4d 65 6e 75 54 65 6d 70 6c .....submenu:.convertToMenuTempl
2fe80 61 74 65 28 69 74 65 6d 2e 73 75 62 49 74 65 6d 73 29 0a 20 20 20 20 7d 20 3a 20 69 74 65 6d 2e ate(item.subItems).....}.:.item.
2fea0 74 79 70 65 20 3d 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 20 3f 20 7b 0a 20 20 20 20 20 20 74 type.===.'separator'.?.{.......t
2fec0 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 20 20 7d 20 3a 20 69 74 65 6d 2e 74 79 ype:.'separator'.....}.:.item.ty
2fee0 70 65 20 3d 3d 3d 20 27 63 68 65 63 6b 62 6f 78 27 20 3f 20 7b 0a 20 20 20 20 20 20 74 79 70 65 pe.===.'checkbox'.?.{.......type
2ff00 3a 20 27 63 68 65 63 6b 62 6f 78 27 2c 0a 20 20 20 20 20 20 6c 61 62 65 6c 3a 20 69 74 65 6d 2e :.'checkbox',.......label:.item.
2ff20 6c 61 62 65 6c 2c 0a 20 20 20 20 20 20 65 6e 61 62 6c 65 64 3a 20 69 74 65 6d 2e 65 6e 61 62 6c label,.......enabled:.item.enabl
2ff40 65 64 2c 0a 20 20 20 20 20 20 63 68 65 63 6b 65 64 3a 20 69 74 65 6d 2e 63 68 65 63 6b 65 64 0a ed,.......checked:.item.checked.
2ff60 20 20 20 20 7d 20 3a 20 7b 0a 20 20 20 20 20 20 74 79 70 65 3a 20 27 6e 6f 72 6d 61 6c 27 2c 0a ....}.:.{.......type:.'normal',.
2ff80 20 20 20 20 20 20 6c 61 62 65 6c 3a 20 69 74 65 6d 2e 6c 61 62 65 6c 2c 0a 20 20 20 20 20 20 65 ......label:.item.label,.......e
2ffa0 6e 61 62 6c 65 64 3a 20 69 74 65 6d 2e 65 6e 61 62 6c 65 64 0a 20 20 20 20 7d 0a 0a 20 20 20 20 nabled:.item.enabled.....}......
2ffc0 69 66 20 28 69 74 65 6d 2e 69 64 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 72 61 if.(item.id.!=.null).{.......tra
2ffe0 6e 73 66 6f 72 6d 65 64 2e 63 6c 69 63 6b 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 nsformed.click.=.function.().{..
30000 20 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 44 65 76 54 6f 6f 6c 73 41 50 49 2e 63 6f 6e 74 65 78 .......window.DevToolsAPI.contex
30020 74 4d 65 6e 75 49 74 65 6d 53 65 6c 65 63 74 65 64 28 69 74 65 6d 2e 69 64 29 0a 20 20 20 20 20 tMenuItemSelected(item.id)......
30040 20 20 20 72 65 74 75 72 6e 20 77 69 6e 64 6f 77 2e 44 65 76 54 6f 6f 6c 73 41 50 49 2e 63 6f 6e ...return.window.DevToolsAPI.con
30060 74 65 78 74 4d 65 6e 75 43 6c 65 61 72 65 64 28 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a textMenuCleared().......}.....}.
30080 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 61 6e 73 66 6f 72 6d 65 64 0a 20 20 7d 29 0a 7d 0a 0a .....return.transformed...}).}..
300a0 63 6f 6e 73 74 20 63 72 65 61 74 65 4d 65 6e 75 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 78 2c 20 const.createMenu.=.function.(x,.
300c0 79 2c 20 69 74 65 6d 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 7b 72 65 6d 6f 74 65 7d 20 3d 20 72 y,.items).{...const.{remote}.=.r
300e0 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 20 20 63 6f 6e 73 74 20 7b 4d 65 6e 75 equire('electron')...const.{Menu
30100 7d 20 3d 20 72 65 6d 6f 74 65 0a 0a 20 20 6c 65 74 20 74 65 6d 70 6c 61 74 65 20 3d 20 63 6f 6e }.=.remote....let.template.=.con
30120 76 65 72 74 54 6f 4d 65 6e 75 54 65 6d 70 6c 61 74 65 28 69 74 65 6d 73 29 0a 20 20 69 66 20 28 vertToMenuTemplate(items)...if.(
30140 75 73 65 45 64 69 74 4d 65 6e 75 49 74 65 6d 73 28 78 2c 20 79 2c 20 74 65 6d 70 6c 61 74 65 29 useEditMenuItems(x,.y,.template)
30160 29 20 7b 0a 20 20 20 20 74 65 6d 70 6c 61 74 65 20 3d 20 67 65 74 45 64 69 74 4d 65 6e 75 49 74 ).{.....template.=.getEditMenuIt
30180 65 6d 73 28 29 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 6d 65 6e 75 20 3d 20 4d 65 6e 75 2e 62 75 ems()...}...const.menu.=.Menu.bu
301a0 69 6c 64 46 72 6f 6d 54 65 6d 70 6c 61 74 65 28 74 65 6d 70 6c 61 74 65 29 0a 0a 20 20 2f 2f 20 ildFromTemplate(template)....//.
301c0 54 68 65 20 6d 65 6e 75 20 69 73 20 65 78 70 65 63 74 65 64 20 74 6f 20 73 68 6f 77 20 61 73 79 The.menu.is.expected.to.show.asy
301e0 6e 63 68 72 6f 6e 6f 75 73 6c 79 2e 0a 20 20 73 65 74 54 69 6d 65 6f 75 74 28 66 75 6e 63 74 69 nchronously....setTimeout(functi
30200 6f 6e 20 28 29 20 7b 0a 20 20 20 20 6d 65 6e 75 2e 70 6f 70 75 70 28 72 65 6d 6f 74 65 2e 67 65 on.().{.....menu.popup(remote.ge
30220 74 43 75 72 72 65 6e 74 57 69 6e 64 6f 77 28 29 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 tCurrentWindow())...}).}..const.
30240 75 73 65 45 64 69 74 4d 65 6e 75 49 74 65 6d 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 78 2c 20 useEditMenuItems.=.function.(x,.
30260 79 2c 20 69 74 65 6d 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 69 74 65 6d 73 2e 6c 65 6e 67 74 y,.items).{...return.items.lengt
30280 68 20 3d 3d 3d 20 30 20 26 26 20 64 6f 63 75 6d 65 6e 74 2e 65 6c 65 6d 65 6e 74 73 46 72 6f 6d h.===.0.&&.document.elementsFrom
302a0 50 6f 69 6e 74 28 78 2c 20 79 29 2e 73 6f 6d 65 28 66 75 6e 63 74 69 6f 6e 20 28 65 6c 65 6d 65 Point(x,.y).some(function.(eleme
302c0 6e 74 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 65 6c 65 6d 65 6e 74 2e 6e 6f 64 65 4e 61 6d nt).{.....return.element.nodeNam
302e0 65 20 3d 3d 3d 20 27 49 4e 50 55 54 27 20 7c 7c 20 65 6c 65 6d 65 6e 74 2e 6e 6f 64 65 4e 61 6d e.===.'INPUT'.||.element.nodeNam
30300 65 20 3d 3d 3d 20 27 54 45 58 54 41 52 45 41 27 20 7c 7c 20 65 6c 65 6d 65 6e 74 2e 69 73 43 6f e.===.'TEXTAREA'.||.element.isCo
30320 6e 74 65 6e 74 45 64 69 74 61 62 6c 65 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 45 ntentEditable...}).}..const.getE
30340 64 69 74 4d 65 6e 75 49 74 65 6d 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 ditMenuItems.=.function.().{...r
30360 65 74 75 72 6e 20 5b 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 75 6e 64 6f 27 eturn.[.....{.......role:.'undo'
30380 0a 20 20 20 20 7d 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 72 65 64 6f 27 .....},.....{.......role:.'redo'
303a0 0a 20 20 20 20 7d 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 74 79 70 65 3a 20 27 73 65 70 61 72 .....},.....{.......type:.'separ
303c0 61 74 6f 72 27 0a 20 20 20 20 7d 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 ator'.....},.....{.......role:.'
303e0 63 75 74 27 0a 20 20 20 20 7d 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 63 cut'.....},.....{.......role:.'c
30400 6f 70 79 27 0a 20 20 20 20 7d 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 70 opy'.....},.....{.......role:.'p
30420 61 73 74 65 27 0a 20 20 20 20 7d 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 aste'.....},.....{.......role:.'
30440 70 61 73 74 65 61 6e 64 6d 61 74 63 68 73 74 79 6c 65 27 0a 20 20 20 20 7d 2c 0a 20 20 20 20 7b pasteandmatchstyle'.....},.....{
30460 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 64 65 6c 65 74 65 27 0a 20 20 20 20 7d 2c 0a 20 20 20 .......role:.'delete'.....},....
30480 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 73 65 6c 65 63 74 61 6c 6c 27 0a 20 20 20 20 7d .{.......role:.'selectall'.....}
304a0 0a 20 20 5d 0a 7d 0a 0a 63 6f 6e 73 74 20 73 68 6f 77 46 69 6c 65 43 68 6f 6f 73 65 72 44 69 61 ...].}..const.showFileChooserDia
304c0 6c 6f 67 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 63 6f log.=.function.(callback).{...co
304e0 6e 73 74 20 7b 64 69 61 6c 6f 67 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e nst.{dialog}.=.require('electron
30500 27 29 2e 72 65 6d 6f 74 65 0a 20 20 63 6f 6e 73 74 20 66 69 6c 65 73 20 3d 20 64 69 61 6c 6f 67 ').remote...const.files.=.dialog
30520 2e 73 68 6f 77 4f 70 65 6e 44 69 61 6c 6f 67 28 7b 7d 29 0a 20 20 69 66 20 28 66 69 6c 65 73 20 .showOpenDialog({})...if.(files.
30540 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 70 61 74 68 54 6f 48 74 !=.null).{.....callback(pathToHt
30560 6d 6c 35 46 69 6c 65 4f 62 6a 65 63 74 28 66 69 6c 65 73 5b 30 5d 29 29 0a 20 20 7d 0a 7d 0a 0a ml5FileObject(files[0]))...}.}..
30580 63 6f 6e 73 74 20 70 61 74 68 54 6f 48 74 6d 6c 35 46 69 6c 65 4f 62 6a 65 63 74 20 3d 20 66 75 const.pathToHtml5FileObject.=.fu
305a0 6e 63 74 69 6f 6e 20 28 70 61 74 68 29 20 7b 0a 20 20 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 71 nction.(path).{...const.fs.=.req
305c0 75 69 72 65 28 27 66 73 27 29 0a 20 20 63 6f 6e 73 74 20 62 6c 6f 62 20 3d 20 6e 65 77 20 42 6c uire('fs')...const.blob.=.new.Bl
305e0 6f 62 28 5b 66 73 2e 72 65 61 64 46 69 6c 65 53 79 6e 63 28 70 61 74 68 29 5d 29 0a 20 20 62 6c ob([fs.readFileSync(path)])...bl
30600 6f 62 2e 6e 61 6d 65 20 3d 20 70 61 74 68 0a 20 20 72 65 74 75 72 6e 20 62 6c 6f 62 0a 7d 0a 0a ob.name.=.path...return.blob.}..
30620 63 6f 6e 73 74 20 63 72 65 61 74 65 46 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 6d 65 6e 74 20 const.createFileSelectorElement.
30640 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 63 6f 6e 73 74 20 =.function.(callback).{...const.
30660 66 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 6d 65 6e 74 20 3d 20 64 6f 63 75 6d 65 6e 74 2e 63 fileSelectorElement.=.document.c
30680 72 65 61 74 65 45 6c 65 6d 65 6e 74 28 27 73 70 61 6e 27 29 0a 20 20 66 69 6c 65 53 65 6c 65 63 reateElement('span')...fileSelec
306a0 74 6f 72 45 6c 65 6d 65 6e 74 2e 73 74 79 6c 65 2e 64 69 73 70 6c 61 79 20 3d 20 27 6e 6f 6e 65 torElement.style.display.=.'none
306c0 27 0a 20 20 66 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 6d 65 6e 74 2e 63 6c 69 63 6b 20 3d 20 '...fileSelectorElement.click.=.
306e0 73 68 6f 77 46 69 6c 65 43 68 6f 6f 73 65 72 44 69 61 6c 6f 67 2e 62 69 6e 64 28 74 68 69 73 2c showFileChooserDialog.bind(this,
30700 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 72 65 74 75 72 6e 20 66 69 6c 65 53 65 6c 65 63 74 6f 72 .callback)...return.fileSelector
30720 45 6c 65 6d 65 6e 74 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 69 Element.}.'use.strict'..const.{i
30740 70 63 52 65 6e 64 65 72 65 72 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 pcRenderer}.=.require('electron'
30760 29 0a 0a 63 6f 6e 73 74 20 7b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 6f 70 65 6e 65 )..const.{guestInstanceId,.opene
30780 72 49 64 7d 20 3d 20 70 72 6f 63 65 73 73 0a 63 6f 6e 73 74 20 68 69 64 64 65 6e 50 61 67 65 20 rId}.=.process.const.hiddenPage.
307a0 3d 20 70 72 6f 63 65 73 73 2e 61 72 67 76 2e 69 6e 63 6c 75 64 65 73 28 27 2d 2d 68 69 64 64 65 =.process.argv.includes('--hidde
307c0 6e 2d 70 61 67 65 27 29 0a 63 6f 6e 73 74 20 75 73 65 73 4e 61 74 69 76 65 57 69 6e 64 6f 77 4f n-page').const.usesNativeWindowO
307e0 70 65 6e 20 3d 20 70 72 6f 63 65 73 73 2e 61 72 67 76 2e 69 6e 63 6c 75 64 65 73 28 27 2d 2d 6e pen.=.process.argv.includes('--n
30800 61 74 69 76 65 2d 77 69 6e 64 6f 77 2d 6f 70 65 6e 27 29 0a 0a 72 65 71 75 69 72 65 28 27 2e 2f ative-window-open')..require('./
30820 77 69 6e 64 6f 77 2d 73 65 74 75 70 27 29 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 67 75 65 73 window-setup')(ipcRenderer,.gues
30840 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 6f 70 65 6e 65 72 49 64 2c 20 68 69 64 64 65 6e 50 61 67 tInstanceId,.openerId,.hiddenPag
30860 65 2c 20 75 73 65 73 4e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 29 0a 27 75 73 65 20 73 74 e,.usesNativeWindowOpen).'use.st
30880 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 69 70 63 52 65 6e 64 65 72 65 72 2c 20 77 65 62 46 72 rict'..const.{ipcRenderer,.webFr
308a0 61 6d 65 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 6c 65 74 20 ame}.=.require('electron')..let.
308c0 72 65 71 75 65 73 74 49 64 20 3d 20 30 0a 0a 63 6f 6e 73 74 20 57 45 42 5f 56 49 45 57 5f 45 56 requestId.=.0..const.WEB_VIEW_EV
308e0 45 4e 54 53 20 3d 20 7b 0a 20 20 27 6c 6f 61 64 2d 63 6f 6d 6d 69 74 27 3a 20 5b 27 75 72 6c 27 ENTS.=.{...'load-commit':.['url'
30900 2c 20 27 69 73 4d 61 69 6e 46 72 61 6d 65 27 5d 2c 0a 20 20 27 64 69 64 2d 61 74 74 61 63 68 27 ,.'isMainFrame'],...'did-attach'
30920 3a 20 5b 5d 2c 0a 20 20 27 64 69 64 2d 66 69 6e 69 73 68 2d 6c 6f 61 64 27 3a 20 5b 5d 2c 0a 20 :.[],...'did-finish-load':.[],..
30940 20 27 64 69 64 2d 66 61 69 6c 2d 6c 6f 61 64 27 3a 20 5b 27 65 72 72 6f 72 43 6f 64 65 27 2c 20 .'did-fail-load':.['errorCode',.
30960 27 65 72 72 6f 72 44 65 73 63 72 69 70 74 69 6f 6e 27 2c 20 27 76 61 6c 69 64 61 74 65 64 55 52 'errorDescription',.'validatedUR
30980 4c 27 2c 20 27 69 73 4d 61 69 6e 46 72 61 6d 65 27 5d 2c 0a 20 20 27 64 69 64 2d 66 72 61 6d 65 L',.'isMainFrame'],...'did-frame
309a0 2d 66 69 6e 69 73 68 2d 6c 6f 61 64 27 3a 20 5b 27 69 73 4d 61 69 6e 46 72 61 6d 65 27 5d 2c 0a -finish-load':.['isMainFrame'],.
309c0 20 20 27 64 69 64 2d 73 74 61 72 74 2d 6c 6f 61 64 69 6e 67 27 3a 20 5b 5d 2c 0a 20 20 27 64 69 ..'did-start-loading':.[],...'di
309e0 64 2d 73 74 6f 70 2d 6c 6f 61 64 69 6e 67 27 3a 20 5b 5d 2c 0a 20 20 27 64 69 64 2d 67 65 74 2d d-stop-loading':.[],...'did-get-
30a00 72 65 73 70 6f 6e 73 65 2d 64 65 74 61 69 6c 73 27 3a 20 5b 27 73 74 61 74 75 73 27 2c 20 27 6e response-details':.['status',.'n
30a20 65 77 55 52 4c 27 2c 20 27 6f 72 69 67 69 6e 61 6c 55 52 4c 27 2c 20 27 68 74 74 70 52 65 73 70 ewURL',.'originalURL',.'httpResp
30a40 6f 6e 73 65 43 6f 64 65 27 2c 20 27 72 65 71 75 65 73 74 4d 65 74 68 6f 64 27 2c 20 27 72 65 66 onseCode',.'requestMethod',.'ref
30a60 65 72 72 65 72 27 2c 20 27 68 65 61 64 65 72 73 27 2c 20 27 72 65 73 6f 75 72 63 65 54 79 70 65 errer',.'headers',.'resourceType
30a80 27 5d 2c 0a 20 20 27 64 69 64 2d 67 65 74 2d 72 65 64 69 72 65 63 74 2d 72 65 71 75 65 73 74 27 '],...'did-get-redirect-request'
30aa0 3a 20 5b 27 6f 6c 64 55 52 4c 27 2c 20 27 6e 65 77 55 52 4c 27 2c 20 27 69 73 4d 61 69 6e 46 72 :.['oldURL',.'newURL',.'isMainFr
30ac0 61 6d 65 27 5d 2c 0a 20 20 27 64 6f 6d 2d 72 65 61 64 79 27 3a 20 5b 5d 2c 0a 20 20 27 63 6f 6e ame'],...'dom-ready':.[],...'con
30ae0 73 6f 6c 65 2d 6d 65 73 73 61 67 65 27 3a 20 5b 27 6c 65 76 65 6c 27 2c 20 27 6d 65 73 73 61 67 sole-message':.['level',.'messag
30b00 65 27 2c 20 27 6c 69 6e 65 27 2c 20 27 73 6f 75 72 63 65 49 64 27 5d 2c 0a 20 20 27 63 6f 6e 74 e',.'line',.'sourceId'],...'cont
30b20 65 78 74 2d 6d 65 6e 75 27 3a 20 5b 27 70 61 72 61 6d 73 27 5d 2c 0a 20 20 27 64 65 76 74 6f 6f ext-menu':.['params'],...'devtoo
30b40 6c 73 2d 6f 70 65 6e 65 64 27 3a 20 5b 5d 2c 0a 20 20 27 64 65 76 74 6f 6f 6c 73 2d 63 6c 6f 73 ls-opened':.[],...'devtools-clos
30b60 65 64 27 3a 20 5b 5d 2c 0a 20 20 27 64 65 76 74 6f 6f 6c 73 2d 66 6f 63 75 73 65 64 27 3a 20 5b ed':.[],...'devtools-focused':.[
30b80 5d 2c 0a 20 20 27 6e 65 77 2d 77 69 6e 64 6f 77 27 3a 20 5b 27 75 72 6c 27 2c 20 27 66 72 61 6d ],...'new-window':.['url',.'fram
30ba0 65 4e 61 6d 65 27 2c 20 27 64 69 73 70 6f 73 69 74 69 6f 6e 27 2c 20 27 6f 70 74 69 6f 6e 73 27 eName',.'disposition',.'options'
30bc0 5d 2c 0a 20 20 27 77 69 6c 6c 2d 6e 61 76 69 67 61 74 65 27 3a 20 5b 27 75 72 6c 27 5d 2c 0a 20 ],...'will-navigate':.['url'],..
30be0 20 27 64 69 64 2d 6e 61 76 69 67 61 74 65 27 3a 20 5b 27 75 72 6c 27 5d 2c 0a 20 20 27 64 69 64 .'did-navigate':.['url'],...'did
30c00 2d 6e 61 76 69 67 61 74 65 2d 69 6e 2d 70 61 67 65 27 3a 20 5b 27 75 72 6c 27 2c 20 27 69 73 4d -navigate-in-page':.['url',.'isM
30c20 61 69 6e 46 72 61 6d 65 27 5d 2c 0a 20 20 27 63 6c 6f 73 65 27 3a 20 5b 5d 2c 0a 20 20 27 63 72 ainFrame'],...'close':.[],...'cr
30c40 61 73 68 65 64 27 3a 20 5b 5d 2c 0a 20 20 27 67 70 75 2d 63 72 61 73 68 65 64 27 3a 20 5b 5d 2c ashed':.[],...'gpu-crashed':.[],
30c60 0a 20 20 27 70 6c 75 67 69 6e 2d 63 72 61 73 68 65 64 27 3a 20 5b 27 6e 61 6d 65 27 2c 20 27 76 ...'plugin-crashed':.['name',.'v
30c80 65 72 73 69 6f 6e 27 5d 2c 0a 20 20 27 64 65 73 74 72 6f 79 65 64 27 3a 20 5b 5d 2c 0a 20 20 27 ersion'],...'destroyed':.[],...'
30ca0 70 61 67 65 2d 74 69 74 6c 65 2d 75 70 64 61 74 65 64 27 3a 20 5b 27 74 69 74 6c 65 27 2c 20 27 page-title-updated':.['title',.'
30cc0 65 78 70 6c 69 63 69 74 53 65 74 27 5d 2c 0a 20 20 27 70 61 67 65 2d 66 61 76 69 63 6f 6e 2d 75 explicitSet'],...'page-favicon-u
30ce0 70 64 61 74 65 64 27 3a 20 5b 27 66 61 76 69 63 6f 6e 73 27 5d 2c 0a 20 20 27 65 6e 74 65 72 2d pdated':.['favicons'],...'enter-
30d00 68 74 6d 6c 2d 66 75 6c 6c 2d 73 63 72 65 65 6e 27 3a 20 5b 5d 2c 0a 20 20 27 6c 65 61 76 65 2d html-full-screen':.[],...'leave-
30d20 68 74 6d 6c 2d 66 75 6c 6c 2d 73 63 72 65 65 6e 27 3a 20 5b 5d 2c 0a 20 20 27 6d 65 64 69 61 2d html-full-screen':.[],...'media-
30d40 73 74 61 72 74 65 64 2d 70 6c 61 79 69 6e 67 27 3a 20 5b 5d 2c 0a 20 20 27 6d 65 64 69 61 2d 70 started-playing':.[],...'media-p
30d60 61 75 73 65 64 27 3a 20 5b 5d 2c 0a 20 20 27 66 6f 75 6e 64 2d 69 6e 2d 70 61 67 65 27 3a 20 5b aused':.[],...'found-in-page':.[
30d80 27 72 65 73 75 6c 74 27 5d 2c 0a 20 20 27 64 69 64 2d 63 68 61 6e 67 65 2d 74 68 65 6d 65 2d 63 'result'],...'did-change-theme-c
30da0 6f 6c 6f 72 27 3a 20 5b 27 74 68 65 6d 65 43 6f 6c 6f 72 27 5d 2c 0a 20 20 27 75 70 64 61 74 65 olor':.['themeColor'],...'update
30dc0 2d 74 61 72 67 65 74 2d 75 72 6c 27 3a 20 5b 27 75 72 6c 27 5d 0a 7d 0a 0a 63 6f 6e 73 74 20 44 -target-url':.['url'].}..const.D
30de0 45 50 52 45 43 41 54 45 44 5f 45 56 45 4e 54 53 20 3d 20 7b 0a 20 20 27 70 61 67 65 2d 74 69 74 EPRECATED_EVENTS.=.{...'page-tit
30e00 6c 65 2d 75 70 64 61 74 65 64 27 3a 20 27 70 61 67 65 2d 74 69 74 6c 65 2d 73 65 74 27 0a 7d 0a le-updated':.'page-title-set'.}.
30e20 0a 63 6f 6e 73 74 20 64 69 73 70 61 74 63 68 45 76 65 6e 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 .const.dispatchEvent.=.function.
30e40 28 77 65 62 56 69 65 77 2c 20 65 76 65 6e 74 4e 61 6d 65 2c 20 65 76 65 6e 74 4b 65 79 2c 20 2e (webView,.eventName,.eventKey,..
30e60 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 66 20 28 44 45 50 52 45 43 41 54 45 44 5f 45 56 45 4e 54 ..args).{...if.(DEPRECATED_EVENT
30e80 53 5b 65 76 65 6e 74 4e 61 6d 65 5d 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 64 69 73 70 S[eventName].!=.null).{.....disp
30ea0 61 74 63 68 45 76 65 6e 74 28 77 65 62 56 69 65 77 2c 20 44 45 50 52 45 43 41 54 45 44 5f 45 56 atchEvent(webView,.DEPRECATED_EV
30ec0 45 4e 54 53 5b 65 76 65 6e 74 4e 61 6d 65 5d 2c 20 65 76 65 6e 74 4b 65 79 2c 20 2e 2e 2e 61 72 ENTS[eventName],.eventKey,....ar
30ee0 67 73 29 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 64 6f 6d 45 76 65 6e 74 20 3d 20 6e 65 77 20 45 gs)...}...const.domEvent.=.new.E
30f00 76 65 6e 74 28 65 76 65 6e 74 4e 61 6d 65 29 0a 20 20 57 45 42 5f 56 49 45 57 5f 45 56 45 4e 54 vent(eventName)...WEB_VIEW_EVENT
30f20 53 5b 65 76 65 6e 74 4b 65 79 5d 2e 66 6f 72 45 61 63 68 28 28 70 72 6f 70 2c 20 69 6e 64 65 78 S[eventKey].forEach((prop,.index
30f40 29 20 3d 3e 20 7b 0a 20 20 20 20 64 6f 6d 45 76 65 6e 74 5b 70 72 6f 70 5d 20 3d 20 61 72 67 73 ).=>.{.....domEvent[prop].=.args
30f60 5b 69 6e 64 65 78 5d 0a 20 20 7d 29 0a 20 20 77 65 62 56 69 65 77 2e 64 69 73 70 61 74 63 68 45 [index]...})...webView.dispatchE
30f80 76 65 6e 74 28 64 6f 6d 45 76 65 6e 74 29 0a 20 20 69 66 20 28 65 76 65 6e 74 4e 61 6d 65 20 3d vent(domEvent)...if.(eventName.=
30fa0 3d 3d 20 27 6c 6f 61 64 2d 63 6f 6d 6d 69 74 27 29 20 7b 0a 20 20 20 20 77 65 62 56 69 65 77 2e ==.'load-commit').{.....webView.
30fc0 6f 6e 4c 6f 61 64 43 6f 6d 6d 69 74 28 64 6f 6d 45 76 65 6e 74 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f onLoadCommit(domEvent)...}.}..mo
30fe0 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 7b 0a 20 20 72 65 67 69 73 74 65 72 45 76 65 6e 74 dule.exports.=.{...registerEvent
31000 73 3a 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 56 69 65 77 2c 20 76 69 65 77 49 6e 73 74 61 6e s:.function.(webView,.viewInstan
31020 63 65 49 64 29 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 45 4c 45 43 ceId).{.....ipcRenderer.on(`ELEC
31040 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 44 45 53 54 52 4f 59 TRON_GUEST_VIEW_INTERNAL_DESTROY
31060 5f 47 55 45 53 54 2d 24 7b 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 2c 20 66 75 6e 63 74 _GUEST-${viewInstanceId}`,.funct
31080 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 77 65 62 46 72 61 6d 65 2e 64 65 74 61 63 68 47 75 ion.().{.......webFrame.detachGu
310a0 65 73 74 28 77 65 62 56 69 65 77 2e 69 6e 74 65 72 6e 61 6c 49 6e 73 74 61 6e 63 65 49 64 29 0a est(webView.internalInstanceId).
310c0 20 20 20 20 20 20 77 65 62 56 69 65 77 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 ......webView.guestInstanceId.=.
310e0 75 6e 64 65 66 69 6e 65 64 0a 20 20 20 20 20 20 77 65 62 56 69 65 77 2e 72 65 73 65 74 28 29 0a undefined.......webView.reset().
31100 20 20 20 20 20 20 63 6f 6e 73 74 20 64 6f 6d 45 76 65 6e 74 20 3d 20 6e 65 77 20 45 76 65 6e 74 ......const.domEvent.=.new.Event
31120 28 27 64 65 73 74 72 6f 79 65 64 27 29 0a 20 20 20 20 20 20 77 65 62 56 69 65 77 2e 64 69 73 70 ('destroyed').......webView.disp
31140 61 74 63 68 45 76 65 6e 74 28 64 6f 6d 45 76 65 6e 74 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 atchEvent(domEvent).....})......
31160 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 ipcRenderer.on(`ELECTRON_GUEST_V
31180 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 44 49 53 50 41 54 43 48 5f 45 56 45 4e 54 2d 24 7b 76 69 IEW_INTERNAL_DISPATCH_EVENT-${vi
311a0 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c ewInstanceId}`,.function.(event,
311c0 20 65 76 65 6e 74 4e 61 6d 65 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 64 69 73 .eventName,....args).{.......dis
311e0 70 61 74 63 68 45 76 65 6e 74 28 77 65 62 56 69 65 77 2c 20 65 76 65 6e 74 4e 61 6d 65 2c 20 65 patchEvent(webView,.eventName,.e
31200 76 65 6e 74 4e 61 6d 65 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 69 ventName,....args).....})......i
31220 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 pcRenderer.on(`ELECTRON_GUEST_VI
31240 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 49 50 43 5f 4d 45 53 53 41 47 45 2d 24 7b 76 69 65 77 49 6e EW_INTERNAL_IPC_MESSAGE-${viewIn
31260 73 74 61 6e 63 65 49 64 7d 60 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 63 68 61 stanceId}`,.function.(event,.cha
31280 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 64 6f 6d nnel,....args).{.......const.dom
312a0 45 76 65 6e 74 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 27 69 70 63 2d 6d 65 73 73 61 67 65 27 29 Event.=.new.Event('ipc-message')
312c0 0a 20 20 20 20 20 20 64 6f 6d 45 76 65 6e 74 2e 63 68 61 6e 6e 65 6c 20 3d 20 63 68 61 6e 6e 65 .......domEvent.channel.=.channe
312e0 6c 0a 20 20 20 20 20 20 64 6f 6d 45 76 65 6e 74 2e 61 72 67 73 20 3d 20 61 72 67 73 0a 20 20 20 l.......domEvent.args.=.args....
31300 20 20 20 77 65 62 56 69 65 77 2e 64 69 73 70 61 74 63 68 45 76 65 6e 74 28 64 6f 6d 45 76 65 6e ...webView.dispatchEvent(domEven
31320 74 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 45 t).....})......ipcRenderer.on(`E
31340 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 53 49 5a 45 LECTRON_GUEST_VIEW_INTERNAL_SIZE
31360 5f 43 48 41 4e 47 45 44 2d 24 7b 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 2c 20 66 75 6e _CHANGED-${viewInstanceId}`,.fun
31380 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 ction.(event,....args).{.......c
313a0 6f 6e 73 74 20 64 6f 6d 45 76 65 6e 74 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 27 73 69 7a 65 2d onst.domEvent.=.new.Event('size-
313c0 63 68 61 6e 67 65 64 27 29 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 70 72 6f 70 73 20 3d 20 5b 27 changed').......const.props.=.['
313e0 6f 6c 64 57 69 64 74 68 27 2c 20 27 6f 6c 64 48 65 69 67 68 74 27 2c 20 27 6e 65 77 57 69 64 74 oldWidth',.'oldHeight',.'newWidt
31400 68 27 2c 20 27 6e 65 77 48 65 69 67 68 74 27 5d 0a 20 20 20 20 20 20 66 6f 72 20 28 6c 65 74 20 h',.'newHeight'].......for.(let.
31420 69 20 3d 20 30 3b 20 69 20 3c 20 70 72 6f 70 73 2e 6c 65 6e 67 74 68 3b 20 69 2b 2b 29 20 7b 0a i.=.0;.i.<.props.length;.i++).{.
31440 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 70 72 6f 70 20 3d 20 70 72 6f 70 73 5b 69 5d 0a 20 20 ........const.prop.=.props[i]...
31460 20 20 20 20 20 20 64 6f 6d 45 76 65 6e 74 5b 70 72 6f 70 5d 20 3d 20 61 72 67 73 5b 69 5d 0a 20 ......domEvent[prop].=.args[i]..
31480 20 20 20 20 20 7d 0a 20 20 20 20 20 20 77 65 62 56 69 65 77 2e 6f 6e 53 69 7a 65 43 68 61 6e 67 .....}.......webView.onSizeChang
314a0 65 64 28 64 6f 6d 45 76 65 6e 74 29 0a 20 20 20 20 7d 29 0a 20 20 7d 2c 0a 20 20 64 65 72 65 67 ed(domEvent).....})...},...dereg
314c0 69 73 74 65 72 45 76 65 6e 74 73 3a 20 66 75 6e 63 74 69 6f 6e 20 28 76 69 65 77 49 6e 73 74 61 isterEvents:.function.(viewInsta
314e0 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 72 65 6d 6f 76 65 41 nceId).{.....ipcRenderer.removeA
31500 6c 6c 4c 69 73 74 65 6e 65 72 73 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 llListeners(`ELECTRON_GUEST_VIEW
31520 5f 49 4e 54 45 52 4e 41 4c 5f 44 45 53 54 52 4f 59 5f 47 55 45 53 54 2d 24 7b 76 69 65 77 49 6e _INTERNAL_DESTROY_GUEST-${viewIn
31540 73 74 61 6e 63 65 49 64 7d 60 29 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 72 65 6d 6f stanceId}`).....ipcRenderer.remo
31560 76 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 veAllListeners(`ELECTRON_GUEST_V
31580 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 44 49 53 50 41 54 43 48 5f 45 56 45 4e 54 2d 24 7b 76 69 IEW_INTERNAL_DISPATCH_EVENT-${vi
315a0 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 29 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e ewInstanceId}`).....ipcRenderer.
315c0 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 removeAllListeners(`ELECTRON_GUE
315e0 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 49 50 43 5f 4d 45 53 53 41 47 45 2d 24 7b 76 ST_VIEW_INTERNAL_IPC_MESSAGE-${v
31600 69 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 29 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 iewInstanceId}`).....ipcRenderer
31620 2e 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 .removeAllListeners(`ELECTRON_GU
31640 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 53 49 5a 45 5f 43 48 41 4e 47 45 44 2d 24 EST_VIEW_INTERNAL_SIZE_CHANGED-$
31660 7b 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 29 0a 20 20 7d 2c 0a 20 20 63 72 65 61 74 65 {viewInstanceId}`)...},...create
31680 47 75 65 73 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 70 61 72 61 6d 73 2c 20 63 61 6c 6c 62 61 63 Guest:.function.(params,.callbac
316a0 6b 29 20 7b 0a 20 20 20 20 72 65 71 75 65 73 74 49 64 2b 2b 0a 20 20 20 20 69 70 63 52 65 6e 64 k).{.....requestId++.....ipcRend
316c0 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d erer.send('ELECTRON_GUEST_VIEW_M
316e0 41 4e 41 47 45 52 5f 43 52 45 41 54 45 5f 47 55 45 53 54 27 2c 20 70 61 72 61 6d 73 2c 20 72 65 ANAGER_CREATE_GUEST',.params,.re
31700 71 75 65 73 74 49 64 29 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 63 65 28 60 45 questId).....ipcRenderer.once(`E
31720 4c 45 43 54 52 4f 4e 5f 52 45 53 50 4f 4e 53 45 5f 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 LECTRON_RESPONSE_${requestId}`,.
31740 63 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 2c 0a 20 20 61 74 74 61 63 68 47 75 65 73 74 3a 20 66 75 callback)...},...attachGuest:.fu
31760 6e 63 74 69 6f 6e 20 28 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 67 75 65 73 74 nction.(elementInstanceId,.guest
31780 49 6e 73 74 61 6e 63 65 49 64 2c 20 70 61 72 61 6d 73 29 20 7b 0a 20 20 20 20 69 70 63 52 65 6e InstanceId,.params).{.....ipcRen
317a0 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f derer.send('ELECTRON_GUEST_VIEW_
317c0 4d 41 4e 41 47 45 52 5f 41 54 54 41 43 48 5f 47 55 45 53 54 27 2c 20 65 6c 65 6d 65 6e 74 49 6e MANAGER_ATTACH_GUEST',.elementIn
317e0 73 74 61 6e 63 65 49 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 70 61 72 61 6d stanceId,.guestInstanceId,.param
31800 73 29 0a 20 20 20 20 77 65 62 46 72 61 6d 65 2e 61 74 74 61 63 68 47 75 65 73 74 28 65 6c 65 6d s).....webFrame.attachGuest(elem
31820 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 7d 2c 0a 20 20 64 65 73 74 72 6f 79 47 75 65 entInstanceId)...},...destroyGue
31840 73 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b st:.function.(guestInstanceId).{
31860 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f .....ipcRenderer.send('ELECTRON_
31880 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 44 45 53 54 52 4f 59 5f 47 55 45 53 54 GUEST_VIEW_MANAGER_DESTROY_GUEST
318a0 27 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 7d 2c 0a 20 20 73 65 74 53 69 ',.guestInstanceId)...},...setSi
318c0 7a 65 3a 20 66 75 6e 63 74 69 6f 6e 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 70 ze:.function.(guestInstanceId,.p
318e0 61 72 61 6d 73 29 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 arams).{.....ipcRenderer.send('E
31900 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 53 45 54 5f 53 LECTRON_GUEST_VIEW_MANAGER_SET_S
31920 49 5a 45 27 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 70 61 72 61 6d 73 29 0a 20 IZE',.guestInstanceId,.params)..
31940 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 57 65 62 56 69 65 77 .}.}.'use.strict'..const.WebView
31960 49 6d 70 6c 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2f 77 65 62 2d 76 69 65 77 27 29 0a 63 6f 6e Impl.=.require('./web-view').con
31980 73 74 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 20 3d 20 72 65 71 75 69 72 65 28 27 st.guestViewInternal.=.require('
319a0 2e 2f 67 75 65 73 74 2d 76 69 65 77 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 77 65 ./guest-view-internal').const.we
319c0 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2f 77 65 62 2d bViewConstants.=.require('./web-
319e0 76 69 65 77 2d 63 6f 6e 73 74 61 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 72 65 6d 6f 74 65 7d 20 view-constants').const.{remote}.
31a00 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 2f 2f 20 48 65 6c 70 65 72 =.require('electron')..//.Helper
31a20 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 72 65 73 6f 6c 76 65 20 75 72 6c 20 73 65 74 20 69 6e 20 .function.to.resolve.url.set.in.
31a40 61 74 74 72 69 62 75 74 65 2e 0a 63 6f 6e 73 74 20 61 20 3d 20 64 6f 63 75 6d 65 6e 74 2e 63 72 attribute..const.a.=.document.cr
31a60 65 61 74 65 45 6c 65 6d 65 6e 74 28 27 61 27 29 0a 0a 63 6f 6e 73 74 20 72 65 73 6f 6c 76 65 55 eateElement('a')..const.resolveU
31a80 52 4c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 72 6c 29 20 7b 0a 20 20 69 66 20 28 75 72 6c 20 RL.=.function.(url).{...if.(url.
31aa0 3d 3d 3d 20 27 27 29 20 72 65 74 75 72 6e 20 27 27 0a 20 20 61 2e 68 72 65 66 20 3d 20 75 72 6c ===.'').return.''...a.href.=.url
31ac0 0a 20 20 72 65 74 75 72 6e 20 61 2e 68 72 65 66 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 ...return.a.href.}..//.Attribute
31ae0 20 6f 62 6a 65 63 74 73 2e 0a 2f 2f 20 44 65 66 61 75 6c 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 .objects..//.Default.implementat
31b00 69 6f 6e 20 6f 66 20 61 20 57 65 62 56 69 65 77 20 61 74 74 72 69 62 75 74 65 2e 0a 63 6c 61 73 ion.of.a.WebView.attribute..clas
31b20 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 s.WebViewAttribute.{...construct
31b40 6f 72 20 28 6e 61 6d 65 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 74 68 69 or.(name,.webViewImpl).{.....thi
31b60 73 2e 6e 61 6d 65 20 3d 20 6e 61 6d 65 0a 20 20 20 20 74 68 69 73 2e 76 61 6c 75 65 20 3d 20 77 s.name.=.name.....this.value.=.w
31b80 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 5b 6e 61 6d 65 5d 20 7c 7c 20 ebViewImpl.webviewNode[name].||.
31ba0 27 27 0a 20 20 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 20 3d 20 77 65 62 56 69 65 ''.....this.webViewImpl.=.webVie
31bc0 77 49 6d 70 6c 0a 20 20 20 20 74 68 69 73 2e 69 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 20 3d 20 wImpl.....this.ignoreMutation.=.
31be0 66 61 6c 73 65 0a 20 20 20 20 74 68 69 73 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 29 0a false.....this.defineProperty().
31c00 20 20 7d 0a 0a 20 20 2f 2f 20 52 65 74 72 69 65 76 65 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 ..}....//.Retrieves.and.returns.
31c20 74 68 65 20 61 74 74 72 69 62 75 74 65 27 73 20 76 61 6c 75 65 2e 0a 20 20 67 65 74 56 61 6c 75 the.attribute's.value....getValu
31c40 65 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d e.().{.....return.this.webViewIm
31c60 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 pl.webviewNode.getAttribute(this
31c80 2e 6e 61 6d 65 29 20 7c 7c 20 74 68 69 73 2e 76 61 6c 75 65 0a 20 20 7d 0a 0a 20 20 2f 2f 20 53 .name).||.this.value...}....//.S
31ca0 65 74 73 20 74 68 65 20 61 74 74 72 69 62 75 74 65 27 73 20 76 61 6c 75 65 2e 0a 20 20 73 65 74 ets.the.attribute's.value....set
31cc0 56 61 6c 75 65 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 Value.(value).{.....this.webView
31ce0 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 73 65 74 41 74 74 72 69 62 75 74 65 28 74 68 Impl.webviewNode.setAttribute(th
31d00 69 73 2e 6e 61 6d 65 2c 20 76 61 6c 75 65 20 7c 7c 20 27 27 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 is.name,.value.||.'')...}....//.
31d20 43 68 61 6e 67 65 73 20 74 68 65 20 61 74 74 72 69 62 75 74 65 27 73 20 76 61 6c 75 65 20 77 69 Changes.the.attribute's.value.wi
31d40 74 68 6f 75 74 20 74 72 69 67 67 65 72 69 6e 67 20 69 74 73 20 6d 75 74 61 74 69 6f 6e 20 68 61 thout.triggering.its.mutation.ha
31d60 6e 64 6c 65 72 2e 0a 20 20 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 20 ndler....setValueIgnoreMutation.
31d80 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 69 67 6e 6f 72 65 4d 75 74 61 74 69 6f (value).{.....this.ignoreMutatio
31da0 6e 20 3d 20 74 72 75 65 0a 20 20 20 20 74 68 69 73 2e 73 65 74 56 61 6c 75 65 28 76 61 6c 75 65 n.=.true.....this.setValue(value
31dc0 29 0a 20 20 20 20 74 68 69 73 2e 69 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 20 3d 20 66 61 6c 73 ).....this.ignoreMutation.=.fals
31de0 65 0a 20 20 7d 0a 0a 20 20 2f 2f 20 44 65 66 69 6e 65 73 20 74 68 69 73 20 61 74 74 72 69 62 75 e...}....//.Defines.this.attribu
31e00 74 65 20 61 73 20 61 20 70 72 6f 70 65 72 74 79 20 6f 6e 20 74 68 65 20 77 65 62 76 69 65 77 20 te.as.a.property.on.the.webview.
31e20 6e 6f 64 65 2e 0a 20 20 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 20 28 29 20 7b 0a 20 20 20 20 node....defineProperty.().{.....
31e40 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 return.Object.defineProperty(thi
31e60 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2c 20 74 68 69 73 2e s.webViewImpl.webviewNode,.this.
31e80 6e 61 6d 65 2c 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 name,.{.......get:.().=>.{......
31ea0 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 56 61 6c 75 65 28 29 0a 20 20 20 20 20 20 ...return.this.getValue().......
31ec0 7d 2c 0a 20 20 20 20 20 20 73 65 74 3a 20 28 76 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 },.......set:.(value).=>.{......
31ee0 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 73 65 74 56 61 6c 75 65 28 76 61 6c 75 65 29 0a 20 ...return.this.setValue(value)..
31f00 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 0a 20 .....},.......enumerable:.true..
31f20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 43 61 6c 6c 65 64 20 77 68 65 6e 20 74 68 65 20 ...})...}....//.Called.when.the.
31f40 61 74 74 72 69 62 75 74 65 27 73 20 76 61 6c 75 65 20 63 68 61 6e 67 65 73 2e 0a 20 20 68 61 6e attribute's.value.changes....han
31f60 64 6c 65 4d 75 74 61 74 69 6f 6e 20 28 29 20 7b 7d 0a 7d 0a 0a 2f 2f 20 41 6e 20 61 74 74 72 69 dleMutation.().{}.}..//.An.attri
31f80 62 75 74 65 20 74 68 61 74 20 69 73 20 74 72 65 61 74 65 64 20 61 73 20 61 20 42 6f 6f 6c 65 61 bute.that.is.treated.as.a.Boolea
31fa0 6e 2e 0a 63 6c 61 73 73 20 42 6f 6f 6c 65 61 6e 41 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 n..class.BooleanAttribute.extend
31fc0 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 67 65 74 56 61 6c 75 65 20 s.WebViewAttribute.{...getValue.
31fe0 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c ().{.....return.this.webViewImpl
32000 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 68 61 73 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e .webviewNode.hasAttribute(this.n
32020 61 6d 65 29 0a 20 20 7d 0a 0a 20 20 73 65 74 56 61 6c 75 65 20 28 76 61 6c 75 65 29 20 7b 0a 20 ame)...}....setValue.(value).{..
32040 20 20 20 69 66 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 77 65 62 56 69 ...if.(value).{.......this.webVi
32060 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 73 65 74 41 74 74 72 69 62 75 74 65 28 ewImpl.webviewNode.setAttribute(
32080 74 68 69 73 2e 6e 61 6d 65 2c 20 27 27 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 this.name,.'').....}.else.{.....
320a0 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 72 ..this.webViewImpl.webviewNode.r
320c0 65 6d 6f 76 65 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 0a 20 20 20 20 7d 0a emoveAttribute(this.name).....}.
320e0 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 75 73 65 64 20 74 6f 20 64 65 66 69 ..}.}..//.Attribute.used.to.defi
32100 6e 65 20 74 68 65 20 64 65 6d 65 6e 73 69 6f 6e 20 6c 69 6d 69 74 73 20 6f 66 20 61 75 74 6f 73 ne.the.demension.limits.of.autos
32120 69 7a 69 6e 67 2e 0a 63 6c 61 73 73 20 41 75 74 6f 73 69 7a 65 44 69 6d 65 6e 73 69 6f 6e 41 74 izing..class.AutosizeDimensionAt
32140 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 tribute.extends.WebViewAttribute
32160 20 7b 0a 20 20 67 65 74 56 61 6c 75 65 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 70 61 .{...getValue.().{.....return.pa
32180 72 73 65 49 6e 74 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e rseInt(this.webViewImpl.webviewN
321a0 6f 64 65 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 29 20 7c 7c 20 ode.getAttribute(this.name)).||.
321c0 30 0a 20 20 7d 0a 0a 20 20 68 61 6e 64 6c 65 4d 75 74 61 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 0...}....handleMutation.().{....
321e0 20 69 66 20 28 21 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 67 75 65 73 74 49 6e 73 74 .if.(!this.webViewImpl.guestInst
32200 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 anceId).{.......return.....}....
32220 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 2e 73 65 74 53 69 7a 65 28 74 68 69 73 2e .guestViewInternal.setSize(this.
32240 77 65 62 56 69 65 77 49 6d 70 6c 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 7b 0a 20 webViewImpl.guestInstanceId,.{..
32260 20 20 20 20 20 65 6e 61 62 6c 65 41 75 74 6f 53 69 7a 65 3a 20 74 68 69 73 2e 77 65 62 56 69 65 .....enableAutoSize:.this.webVie
32280 77 49 6d 70 6c 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 wImpl.attributes[webViewConstant
322a0 73 2e 41 54 54 52 49 42 55 54 45 5f 41 55 54 4f 53 49 5a 45 5d 2e 67 65 74 56 61 6c 75 65 28 29 s.ATTRIBUTE_AUTOSIZE].getValue()
322c0 2c 0a 20 20 20 20 20 20 6d 69 6e 3a 20 7b 0a 20 20 20 20 20 20 20 20 77 69 64 74 68 3a 20 70 61 ,.......min:.{.........width:.pa
322e0 72 73 65 49 6e 74 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 61 74 74 72 69 62 75 74 rseInt(this.webViewImpl.attribut
32300 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 4d 49 es[webViewConstants.ATTRIBUTE_MI
32320 4e 57 49 44 54 48 5d 2e 67 65 74 56 61 6c 75 65 28 29 20 7c 7c 20 30 29 2c 0a 20 20 20 20 20 20 NWIDTH].getValue().||.0),.......
32340 20 20 68 65 69 67 68 74 3a 20 70 61 72 73 65 49 6e 74 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 ..height:.parseInt(this.webViewI
32360 6d 70 6c 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e mpl.attributes[webViewConstants.
32380 41 54 54 52 49 42 55 54 45 5f 4d 49 4e 48 45 49 47 48 54 5d 2e 67 65 74 56 61 6c 75 65 28 29 20 ATTRIBUTE_MINHEIGHT].getValue().
323a0 7c 7c 20 30 29 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 6d 61 78 3a 20 7b 0a 20 20 20 20 ||.0).......},.......max:.{.....
323c0 20 20 20 20 77 69 64 74 68 3a 20 70 61 72 73 65 49 6e 74 28 74 68 69 73 2e 77 65 62 56 69 65 77 ....width:.parseInt(this.webView
323e0 49 6d 70 6c 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 Impl.attributes[webViewConstants
32400 2e 41 54 54 52 49 42 55 54 45 5f 4d 41 58 57 49 44 54 48 5d 2e 67 65 74 56 61 6c 75 65 28 29 20 .ATTRIBUTE_MAXWIDTH].getValue().
32420 7c 7c 20 30 29 2c 0a 20 20 20 20 20 20 20 20 68 65 69 67 68 74 3a 20 70 61 72 73 65 49 6e 74 28 ||.0),.........height:.parseInt(
32440 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 this.webViewImpl.attributes[webV
32460 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 4d 41 58 48 45 49 47 48 54 iewConstants.ATTRIBUTE_MAXHEIGHT
32480 5d 2e 67 65 74 56 61 6c 75 65 28 29 20 7c 7c 20 30 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d ].getValue().||.0).......}.....}
324a0 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 74 68 61 74 20 73 70 65 63 69 )...}.}..//.Attribute.that.speci
324c0 66 69 65 73 20 77 68 65 74 68 65 72 20 74 68 65 20 77 65 62 76 69 65 77 20 73 68 6f 75 6c 64 20 fies.whether.the.webview.should.
324e0 62 65 20 61 75 74 6f 73 69 7a 65 64 2e 0a 63 6c 61 73 73 20 41 75 74 6f 73 69 7a 65 41 74 74 72 be.autosized..class.AutosizeAttr
32500 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 42 6f 6f 6c 65 61 6e 41 74 74 72 69 62 75 74 65 20 7b ibute.extends.BooleanAttribute.{
32520 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 ...constructor.(webViewImpl).{..
32540 20 20 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 ...super(webViewConstants.ATTRIB
32560 55 54 45 5f 41 55 54 4f 53 49 5a 45 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 7d 0a 7d UTE_AUTOSIZE,.webViewImpl)...}.}
32580 0a 0a 41 75 74 6f 73 69 7a 65 41 74 74 72 69 62 75 74 65 2e 70 72 6f 74 6f 74 79 70 65 2e 68 61 ..AutosizeAttribute.prototype.ha
325a0 6e 64 6c 65 4d 75 74 61 74 69 6f 6e 20 3d 20 41 75 74 6f 73 69 7a 65 44 69 6d 65 6e 73 69 6f 6e ndleMutation.=.AutosizeDimension
325c0 41 74 74 72 69 62 75 74 65 2e 70 72 6f 74 6f 74 79 70 65 2e 68 61 6e 64 6c 65 4d 75 74 61 74 69 Attribute.prototype.handleMutati
325e0 6f 6e 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 on..//.Attribute.representing.th
32600 65 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 73 74 6f 72 61 67 65 20 70 61 72 74 69 74 69 6f 6e e.state.of.the.storage.partition
32620 2e 0a 63 6c 61 73 73 20 50 61 72 74 69 74 69 6f 6e 41 74 74 72 69 62 75 74 65 20 65 78 74 65 6e ..class.PartitionAttribute.exten
32640 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 ds.WebViewAttribute.{...construc
32660 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 77 65 tor.(webViewImpl).{.....super(we
32680 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 41 52 54 49 54 49 bViewConstants.ATTRIBUTE_PARTITI
326a0 4f 4e 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 20 20 74 68 69 73 2e 76 61 6c 69 64 50 ON,.webViewImpl).....this.validP
326c0 61 72 74 69 74 69 6f 6e 49 64 20 3d 20 74 72 75 65 0a 20 20 7d 0a 0a 20 20 68 61 6e 64 6c 65 4d artitionId.=.true...}....handleM
326e0 75 74 61 74 69 6f 6e 20 28 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 utation.(oldValue,.newValue).{..
32700 20 20 20 6e 65 77 56 61 6c 75 65 20 3d 20 6e 65 77 56 61 6c 75 65 20 7c 7c 20 27 27 0a 0a 20 20 ...newValue.=.newValue.||.''....
32720 20 20 2f 2f 20 54 68 65 20 70 61 72 74 69 74 69 6f 6e 20 63 61 6e 6e 6f 74 20 63 68 61 6e 67 65 ..//.The.partition.cannot.change
32740 20 69 66 20 74 68 65 20 77 65 62 76 69 65 77 20 68 61 73 20 61 6c 72 65 61 64 79 20 6e 61 76 69 .if.the.webview.has.already.navi
32760 67 61 74 65 64 2e 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c gated......if.(!this.webViewImpl
32780 2e 62 65 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 .beforeFirstNavigation).{.......
327a0 77 69 6e 64 6f 77 2e 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 77 65 62 56 69 65 77 43 6f 6e 73 window.console.error(webViewCons
327c0 74 61 6e 74 73 2e 45 52 52 4f 52 5f 4d 53 47 5f 41 4c 52 45 41 44 59 5f 4e 41 56 49 47 41 54 45 tants.ERROR_MSG_ALREADY_NAVIGATE
327e0 44 29 0a 20 20 20 20 20 20 74 68 69 73 2e 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 D).......this.setValueIgnoreMuta
32800 74 69 6f 6e 28 6f 6c 64 56 61 6c 75 65 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 tion(oldValue).......return.....
32820 7d 0a 20 20 20 20 69 66 20 28 6e 65 77 56 61 6c 75 65 20 3d 3d 3d 20 27 70 65 72 73 69 73 74 3a }.....if.(newValue.===.'persist:
32840 27 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 76 61 6c 69 64 50 61 72 74 69 74 69 6f 6e 49 64 ').{.......this.validPartitionId
32860 20 3d 20 66 61 6c 73 65 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 63 6f 6e 73 6f 6c 65 2e 65 72 .=.false.......window.console.er
32880 72 6f 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 45 52 52 4f 52 5f 4d 53 47 5f 49 ror(webViewConstants.ERROR_MSG_I
328a0 4e 56 41 4c 49 44 5f 50 41 52 54 49 54 49 4f 4e 5f 41 54 54 52 49 42 55 54 45 29 0a 20 20 20 20 NVALID_PARTITION_ATTRIBUTE).....
328c0 7d 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 6e 20 61 74 74 72 69 62 75 74 65 20 74 68 61 74 20 63 6f }...}.}..//.An.attribute.that.co
328e0 6e 74 72 6f 6c 73 20 74 68 65 20 67 75 65 73 74 20 69 6e 73 74 61 6e 63 65 20 74 68 69 73 20 77 ntrols.the.guest.instance.this.w
32900 65 62 76 69 65 77 20 69 73 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f 0a 63 6c 61 73 73 20 47 75 65 ebview.is.connected.to.class.Gue
32920 73 74 49 6e 73 74 61 6e 63 65 41 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 stInstanceAttribute.extends.WebV
32940 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 iewAttribute.{...constructor.(we
32960 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f bViewImpl).{.....super(webViewCo
32980 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 47 55 45 53 54 49 4e 53 54 41 4e 43 45 2c nstants.ATTRIBUTE_GUESTINSTANCE,
329a0 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 52 65 74 72 69 65 76 65 .webViewImpl)...}....//.Retrieve
329c0 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 61 74 74 72 69 62 75 74 65 27 73 20 76 61 s.and.returns.the.attribute's.va
329e0 6c 75 65 2e 0a 20 20 67 65 74 56 61 6c 75 65 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 69 lue....getValue.().{.....if.(thi
32a00 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 68 61 73 41 74 74 s.webViewImpl.webviewNode.hasAtt
32a20 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 ribute(this.name)).{.......retur
32a40 6e 20 70 61 72 73 65 49 6e 74 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 n.parseInt(this.webViewImpl.webv
32a60 69 65 77 4e 6f 64 65 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 29 iewNode.getAttribute(this.name))
32a80 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 53 65 74 73 20 74 68 65 20 61 74 74 72 69 62 .....}...}....//.Sets.the.attrib
32aa0 75 74 65 27 73 20 76 61 6c 75 65 2e 0a 20 20 73 65 74 56 61 6c 75 65 20 28 76 61 6c 75 65 29 20 ute's.value....setValue.(value).
32ac0 7b 0a 20 20 20 20 69 66 20 28 21 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 77 {.....if.(!value).{.......this.w
32ae0 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 72 65 6d 6f 76 65 41 74 74 ebViewImpl.webviewNode.removeAtt
32b00 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 ribute(this.name).....}.else.if.
32b20 28 21 69 73 4e 61 4e 28 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 77 65 62 (!isNaN(value)).{.......this.web
32b40 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 73 65 74 41 74 74 72 69 62 75 74 ViewImpl.webviewNode.setAttribut
32b60 65 28 74 68 69 73 2e 6e 61 6d 65 2c 20 76 61 6c 75 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 e(this.name,.value).....}...}...
32b80 20 68 61 6e 64 6c 65 4d 75 74 61 74 69 6f 6e 20 28 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 .handleMutation.(oldValue,.newVa
32ba0 6c 75 65 29 20 7b 0a 20 20 20 20 69 66 20 28 21 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 lue).{.....if.(!newValue).{.....
32bc0 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 72 65 73 65 74 28 29 0a 20 20 20 20 20 ..this.webViewImpl.reset()......
32be0 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 56 61 6c 20 .return.....}......const.intVal.
32c00 3d 20 70 61 72 73 65 49 6e 74 28 6e 65 77 56 61 6c 75 65 29 0a 20 20 20 20 69 66 20 28 21 69 73 =.parseInt(newValue).....if.(!is
32c20 4e 61 4e 28 6e 65 77 56 61 6c 75 65 29 20 26 26 20 72 65 6d 6f 74 65 2e 67 65 74 47 75 65 73 74 NaN(newValue).&&.remote.getGuest
32c40 57 65 62 43 6f 6e 74 65 6e 74 73 28 69 6e 74 56 61 6c 29 29 20 7b 0a 20 20 20 20 20 20 74 68 69 WebContents(intVal)).{.......thi
32c60 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 61 74 74 61 63 68 47 75 65 73 74 49 6e 73 74 61 6e 63 s.webViewImpl.attachGuestInstanc
32c80 65 28 69 6e 74 56 61 6c 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 74 68 69 e(intVal).....}.else.{.......thi
32ca0 73 2e 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 28 6f 6c 64 56 61 6c 75 s.setValueIgnoreMutation(oldValu
32cc0 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 74 68 61 e).....}...}.}..//.Attribute.tha
32ce0 74 20 68 61 6e 64 6c 65 73 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 20 61 6e 64 20 6e 61 76 69 67 t.handles.the.location.and.navig
32d00 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 77 65 62 76 69 65 77 2e 0a 63 6c 61 73 73 20 53 72 63 41 ation.of.the.webview..class.SrcA
32d20 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 ttribute.extends.WebViewAttribut
32d40 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 e.{...constructor.(webViewImpl).
32d60 7b 0a 20 20 20 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 {.....super(webViewConstants.ATT
32d80 52 49 42 55 54 45 5f 53 52 43 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 20 20 74 68 69 RIBUTE_SRC,.webViewImpl).....thi
32da0 73 2e 73 65 74 75 70 4d 75 74 61 74 69 6f 6e 4f 62 73 65 72 76 65 72 28 29 0a 20 20 7d 0a 0a 20 s.setupMutationObserver()...}...
32dc0 20 67 65 74 56 61 6c 75 65 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 77 65 62 56 .getValue.().{.....if.(this.webV
32de0 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 68 61 73 41 74 74 72 69 62 75 74 65 iewImpl.webviewNode.hasAttribute
32e00 28 74 68 69 73 2e 6e 61 6d 65 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 72 65 73 6f (this.name)).{.......return.reso
32e20 6c 76 65 55 52 4c 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e lveURL(this.webViewImpl.webviewN
32e40 6f 64 65 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 29 0a 20 20 20 ode.getAttribute(this.name))....
32e60 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 76 61 6c 75 .}.else.{.......return.this.valu
32e80 65 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 e.....}...}....setValueIgnoreMut
32ea0 61 74 69 6f 6e 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 73 75 70 65 72 2e 73 65 74 56 61 6c ation.(value).{.....super.setVal
32ec0 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 28 76 61 6c 75 65 29 0a 0a 20 20 20 20 2f 2f 20 ueIgnoreMutation(value)......//.
32ee0 74 61 6b 65 52 65 63 6f 72 64 73 28 29 20 69 73 20 6e 65 65 64 65 64 20 74 6f 20 63 6c 65 61 72 takeRecords().is.needed.to.clear
32f00 20 71 75 65 75 65 64 20 75 70 20 73 72 63 20 6d 75 74 61 74 69 6f 6e 73 2e 20 57 69 74 68 6f 75 .queued.up.src.mutations..Withou
32f20 74 20 69 74 2c 20 69 74 0a 20 20 20 20 2f 2f 20 69 73 20 70 6f 73 73 69 62 6c 65 20 66 6f 72 20 t.it,.it.....//.is.possible.for.
32f40 74 68 69 73 20 63 68 61 6e 67 65 20 74 6f 20 67 65 74 20 70 69 63 6b 65 64 20 75 70 20 61 73 79 this.change.to.get.picked.up.asy
32f60 6e 63 72 6f 6e 6f 75 73 6c 79 20 62 79 20 73 72 63 27 73 0a 20 20 20 20 2f 2f 20 6d 75 74 61 74 ncronously.by.src's.....//.mutat
32f80 69 6f 6e 20 6f 62 73 65 72 76 65 72 20 7c 6f 62 73 65 72 76 65 72 7c 2c 20 61 6e 64 20 74 68 65 ion.observer.|observer|,.and.the
32fa0 6e 20 67 65 74 20 68 61 6e 64 6c 65 64 20 65 76 65 6e 20 74 68 6f 75 67 68 20 77 65 20 64 6f 20 n.get.handled.even.though.we.do.
32fc0 6e 6f 74 0a 20 20 20 20 2f 2f 20 77 61 6e 74 20 74 6f 20 68 61 6e 64 6c 65 20 74 68 69 73 20 6d not.....//.want.to.handle.this.m
32fe0 75 74 61 74 69 6f 6e 2e 0a 20 20 20 20 74 68 69 73 2e 6f 62 73 65 72 76 65 72 2e 74 61 6b 65 52 utation......this.observer.takeR
33000 65 63 6f 72 64 73 28 29 0a 20 20 7d 0a 0a 20 20 68 61 6e 64 6c 65 4d 75 74 61 74 69 6f 6e 20 28 ecords()...}....handleMutation.(
33020 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 2f 2f 20 4f 6e 63 oldValue,.newValue).{.....//.Onc
33040 65 20 77 65 20 68 61 76 65 20 6e 61 76 69 67 61 74 65 64 2c 20 77 65 20 64 6f 6e 27 74 20 61 6c e.we.have.navigated,.we.don't.al
33060 6c 6f 77 20 63 6c 65 61 72 69 6e 67 20 74 68 65 20 73 72 63 20 61 74 74 72 69 62 75 74 65 2e 0a low.clearing.the.src.attribute..
33080 20 20 20 20 2f 2f 20 4f 6e 63 65 20 3c 77 65 62 76 69 65 77 3e 20 65 6e 74 65 72 73 20 61 20 6e ....//.Once.<webview>.enters.a.n
330a0 61 76 69 67 61 74 65 64 20 73 74 61 74 65 2c 20 69 74 20 63 61 6e 6e 6f 74 20 72 65 74 75 72 6e avigated.state,.it.cannot.return
330c0 20 74 6f 20 61 0a 20 20 20 20 2f 2f 20 70 6c 61 63 65 68 6f 6c 64 65 72 20 73 74 61 74 65 2e 0a .to.a.....//.placeholder.state..
330e0 20 20 20 20 69 66 20 28 21 6e 65 77 56 61 6c 75 65 20 26 26 20 6f 6c 64 56 61 6c 75 65 29 20 7b ....if.(!newValue.&&.oldValue).{
33100 0a 20 20 20 20 20 20 2f 2f 20 73 72 63 20 61 74 74 72 69 62 75 74 65 20 63 68 61 6e 67 65 73 20 .......//.src.attribute.changes.
33120 6e 6f 72 6d 61 6c 6c 79 20 69 6e 69 74 69 61 74 65 20 61 20 6e 61 76 69 67 61 74 69 6f 6e 2e 20 normally.initiate.a.navigation..
33140 57 65 20 73 75 70 70 72 65 73 73 0a 20 20 20 20 20 20 2f 2f 20 74 68 65 20 6e 65 78 74 20 73 72 We.suppress.......//.the.next.sr
33160 63 20 61 74 74 72 69 62 75 74 65 20 68 61 6e 64 6c 65 72 20 63 61 6c 6c 20 74 6f 20 61 76 6f 69 c.attribute.handler.call.to.avoi
33180 64 20 72 65 6c 6f 61 64 69 6e 67 20 74 68 65 20 70 61 67 65 0a 20 20 20 20 20 20 2f 2f 20 6f 6e d.reloading.the.page.......//.on
331a0 20 65 76 65 72 79 20 67 75 65 73 74 2d 69 6e 69 74 69 61 74 65 64 20 6e 61 76 69 67 61 74 69 6f .every.guest-initiated.navigatio
331c0 6e 2e 0a 20 20 20 20 20 20 74 68 69 73 2e 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 n........this.setValueIgnoreMuta
331e0 74 69 6f 6e 28 6f 6c 64 56 61 6c 75 65 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 tion(oldValue).......return.....
33200 7d 0a 20 20 20 20 74 68 69 73 2e 70 61 72 73 65 28 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 54 68 65 }.....this.parse()...}....//.The
33220 20 70 75 72 70 6f 73 65 20 6f 66 20 74 68 69 73 20 6d 75 74 61 74 69 6f 6e 20 6f 62 73 65 72 76 .purpose.of.this.mutation.observ
33240 65 72 20 69 73 20 74 6f 20 63 61 74 63 68 20 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 20 74 68 65 er.is.to.catch.assignment.to.the
33260 20 73 72 63 0a 20 20 2f 2f 20 61 74 74 72 69 62 75 74 65 20 77 69 74 68 6f 75 74 20 61 6e 79 20 .src...//.attribute.without.any.
33280 63 68 61 6e 67 65 73 20 74 6f 20 69 74 73 20 76 61 6c 75 65 2e 20 54 68 69 73 20 69 73 20 75 73 changes.to.its.value..This.is.us
332a0 65 66 75 6c 20 69 6e 20 74 68 65 20 63 61 73 65 0a 20 20 2f 2f 20 77 68 65 72 65 20 74 68 65 20 eful.in.the.case...//.where.the.
332c0 77 65 62 76 69 65 77 20 67 75 65 73 74 20 68 61 73 20 63 72 61 73 68 65 64 20 61 6e 64 20 6e 61 webview.guest.has.crashed.and.na
332e0 76 69 67 61 74 69 6e 67 20 74 6f 20 74 68 65 20 73 61 6d 65 20 61 64 64 72 65 73 73 0a 20 20 2f vigating.to.the.same.address.../
33300 2f 20 73 70 61 77 6e 73 20 6f 66 66 20 61 20 6e 65 77 20 70 72 6f 63 65 73 73 2e 0a 20 20 73 65 /.spawns.off.a.new.process....se
33320 74 75 70 4d 75 74 61 74 69 6f 6e 4f 62 73 65 72 76 65 72 20 28 29 20 7b 0a 20 20 20 20 74 68 69 tupMutationObserver.().{.....thi
33340 73 2e 6f 62 73 65 72 76 65 72 20 3d 20 6e 65 77 20 4d 75 74 61 74 69 6f 6e 4f 62 73 65 72 76 65 s.observer.=.new.MutationObserve
33360 72 28 28 6d 75 74 61 74 69 6f 6e 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 66 6f 72 20 28 63 6f r((mutations).=>.{.......for.(co
33380 6e 73 74 20 6d 75 74 61 74 69 6f 6e 20 6f 66 20 6d 75 74 61 74 69 6f 6e 73 29 20 7b 0a 20 20 20 nst.mutation.of.mutations).{....
333a0 20 20 20 20 20 63 6f 6e 73 74 20 7b 6f 6c 64 56 61 6c 75 65 7d 20 3d 20 6d 75 74 61 74 69 6f 6e .....const.{oldValue}.=.mutation
333c0 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 6e 65 77 56 61 6c 75 65 20 3d 20 74 68 69 73 2e 67 .........const.newValue.=.this.g
333e0 65 74 56 61 6c 75 65 28 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 6f 6c 64 56 61 6c 75 65 20 21 etValue().........if.(oldValue.!
33400 3d 3d 20 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0a ==.newValue).{...........return.
33420 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 68 61 6e 64 6c 65 4d 75 74 ........}.........this.handleMut
33440 61 74 69 6f 6e 28 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 0a 20 20 20 20 20 20 ation(oldValue,.newValue).......
33460 7d 0a 20 20 20 20 7d 29 0a 20 20 20 20 63 6f 6e 73 74 20 70 61 72 61 6d 73 20 3d 20 7b 0a 20 20 }.....}).....const.params.=.{...
33480 20 20 20 20 61 74 74 72 69 62 75 74 65 73 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 61 74 74 72 ....attributes:.true,.......attr
334a0 69 62 75 74 65 4f 6c 64 56 61 6c 75 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 61 74 74 72 69 ibuteOldValue:.true,.......attri
334c0 62 75 74 65 46 69 6c 74 65 72 3a 20 5b 74 68 69 73 2e 6e 61 6d 65 5d 0a 20 20 20 20 7d 0a 20 20 buteFilter:.[this.name].....}...
334e0 20 20 74 68 69 73 2e 6f 62 73 65 72 76 65 72 2e 6f 62 73 65 72 76 65 28 74 68 69 73 2e 77 65 62 ..this.observer.observe(this.web
33500 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2c 20 70 61 72 61 6d 73 29 0a 20 20 ViewImpl.webviewNode,.params)...
33520 7d 0a 0a 20 20 70 61 72 73 65 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 77 65 }....parse.().{.....if.(!this.we
33540 62 56 69 65 77 49 6d 70 6c 2e 65 6c 65 6d 65 6e 74 41 74 74 61 63 68 65 64 20 7c 7c 20 21 74 68 bViewImpl.elementAttached.||.!th
33560 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 is.webViewImpl.attributes[webVie
33580 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 41 52 54 49 54 49 4f 4e 5d 2e wConstants.ATTRIBUTE_PARTITION].
335a0 76 61 6c 69 64 50 61 72 74 69 74 69 6f 6e 49 64 20 7c 7c 20 21 74 68 69 73 2e 67 65 74 56 61 6c validPartitionId.||.!this.getVal
335c0 75 65 28 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 69 ue()).{.......return.....}.....i
335e0 66 20 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 f.(this.webViewImpl.guestInstanc
33600 65 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 74 68 69 73 2e 77 65 eId.==.null).{.......if.(this.we
33620 62 56 69 65 77 49 6d 70 6c 2e 62 65 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 29 bViewImpl.beforeFirstNavigation)
33640 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 62 65 66 6f .{.........this.webViewImpl.befo
33660 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 20 3d 20 66 61 6c 73 65 0a 20 20 20 20 20 20 reFirstNavigation.=.false.......
33680 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 63 72 65 61 74 65 47 75 65 73 74 28 29 ..this.webViewImpl.createGuest()
336a0 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 .......}.......return.....}.....
336c0 20 2f 2f 20 4e 61 76 69 67 61 74 65 20 74 6f 20 7c 74 68 69 73 2e 73 72 63 7c 2e 0a 20 20 20 20 .//.Navigate.to.|this.src|......
336e0 63 6f 6e 73 74 20 6f 70 74 73 20 3d 20 7b 7d 0a 20 20 20 20 63 6f 6e 73 74 20 68 74 74 70 72 65 const.opts.=.{}.....const.httpre
33700 66 65 72 72 65 72 20 3d 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 61 74 74 72 69 62 ferrer.=.this.webViewImpl.attrib
33720 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f utes[webViewConstants.ATTRIBUTE_
33740 48 54 54 50 52 45 46 45 52 52 45 52 5d 2e 67 65 74 56 61 6c 75 65 28 29 0a 20 20 20 20 69 66 20 HTTPREFERRER].getValue().....if.
33760 28 68 74 74 70 72 65 66 65 72 72 65 72 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 73 2e 68 74 74 70 (httpreferrer).{.......opts.http
33780 52 65 66 65 72 72 65 72 20 3d 20 68 74 74 70 72 65 66 65 72 72 65 72 0a 20 20 20 20 7d 0a 20 20 Referrer.=.httpreferrer.....}...
337a0 20 20 63 6f 6e 73 74 20 75 73 65 72 61 67 65 6e 74 20 3d 20 74 68 69 73 2e 77 65 62 56 69 65 77 ..const.useragent.=.this.webView
337c0 49 6d 70 6c 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 Impl.attributes[webViewConstants
337e0 2e 41 54 54 52 49 42 55 54 45 5f 55 53 45 52 41 47 45 4e 54 5d 2e 67 65 74 56 61 6c 75 65 28 29 .ATTRIBUTE_USERAGENT].getValue()
33800 0a 20 20 20 20 69 66 20 28 75 73 65 72 61 67 65 6e 74 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 73 .....if.(useragent).{.......opts
33820 2e 75 73 65 72 41 67 65 6e 74 20 3d 20 75 73 65 72 61 67 65 6e 74 0a 20 20 20 20 7d 0a 20 20 20 .userAgent.=.useragent.....}....
33840 20 63 6f 6e 73 74 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 72 65 6d 6f 74 65 2e 67 65 .const.guestContents.=.remote.ge
33860 74 47 75 65 73 74 57 65 62 43 6f 6e 74 65 6e 74 73 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d tGuestWebContents(this.webViewIm
33880 70 6c 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 67 75 65 73 74 43 6f 6e pl.guestInstanceId).....guestCon
338a0 74 65 6e 74 73 2e 6c 6f 61 64 55 52 4c 28 74 68 69 73 2e 67 65 74 56 61 6c 75 65 28 29 2c 20 6f tents.loadURL(this.getValue(),.o
338c0 70 74 73 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 73 70 65 63 69 66 69 pts)...}.}..//.Attribute.specifi
338e0 65 73 20 48 54 54 50 20 72 65 66 65 72 72 65 72 2e 0a 63 6c 61 73 73 20 48 74 74 70 52 65 66 65 es.HTTP.referrer..class.HttpRefe
33900 72 72 65 72 41 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 rrerAttribute.extends.WebViewAtt
33920 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 ribute.{...constructor.(webViewI
33940 6d 70 6c 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 mpl).{.....super(webViewConstant
33960 73 2e 41 54 54 52 49 42 55 54 45 5f 48 54 54 50 52 45 46 45 52 52 45 52 2c 20 77 65 62 56 69 65 s.ATTRIBUTE_HTTPREFERRER,.webVie
33980 77 49 6d 70 6c 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 73 70 65 63 69 wImpl)...}.}..//.Attribute.speci
339a0 66 69 65 73 20 75 73 65 72 20 61 67 65 6e 74 0a 63 6c 61 73 73 20 55 73 65 72 41 67 65 6e 74 41 fies.user.agent.class.UserAgentA
339c0 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 ttribute.extends.WebViewAttribut
339e0 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 e.{...constructor.(webViewImpl).
33a00 7b 0a 20 20 20 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 {.....super(webViewConstants.ATT
33a20 52 49 42 55 54 45 5f 55 53 45 52 41 47 45 4e 54 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 RIBUTE_USERAGENT,.webViewImpl)..
33a40 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 74 68 61 74 20 73 65 74 20 70 72 65 6c .}.}..//.Attribute.that.set.prel
33a60 6f 61 64 20 73 63 72 69 70 74 2e 0a 63 6c 61 73 73 20 50 72 65 6c 6f 61 64 41 74 74 72 69 62 75 oad.script..class.PreloadAttribu
33a80 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 te.extends.WebViewAttribute.{...
33aa0 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 constructor.(webViewImpl).{.....
33ac0 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 super(webViewConstants.ATTRIBUTE
33ae0 5f 50 52 45 4c 4f 41 44 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 7d 0a 0a 20 20 67 65 _PRELOAD,.webViewImpl)...}....ge
33b00 74 56 61 6c 75 65 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 77 65 62 56 69 65 tValue.().{.....if.(!this.webVie
33b20 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 68 61 73 41 74 74 72 69 62 75 74 65 28 74 wImpl.webviewNode.hasAttribute(t
33b40 68 69 73 2e 6e 61 6d 65 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 76 his.name)).{.......return.this.v
33b60 61 6c 75 65 0a 20 20 20 20 7d 0a 20 20 20 20 6c 65 74 20 70 72 65 6c 6f 61 64 20 3d 20 72 65 73 alue.....}.....let.preload.=.res
33b80 6f 6c 76 65 55 52 4c 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 olveURL(this.webViewImpl.webview
33ba0 4e 6f 64 65 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 29 0a 20 20 Node.getAttribute(this.name))...
33bc0 20 20 63 6f 6e 73 74 20 70 72 6f 74 6f 63 6f 6c 20 3d 20 70 72 65 6c 6f 61 64 2e 73 75 62 73 74 ..const.protocol.=.preload.subst
33be0 72 28 30 2c 20 35 29 0a 20 20 20 20 69 66 20 28 70 72 6f 74 6f 63 6f 6c 20 21 3d 3d 20 27 66 69 r(0,.5).....if.(protocol.!==.'fi
33c00 6c 65 3a 27 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 77 65 62 56 le:').{.......console.error(webV
33c20 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 45 52 52 4f 52 5f 4d 53 47 5f 49 4e 56 41 4c 49 44 5f 50 iewConstants.ERROR_MSG_INVALID_P
33c40 52 45 4c 4f 41 44 5f 41 54 54 52 49 42 55 54 45 29 0a 20 20 20 20 20 20 70 72 65 6c 6f 61 64 20 RELOAD_ATTRIBUTE).......preload.
33c60 3d 20 27 27 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 70 72 65 6c 6f 61 64 0a 20 20 =.''.....}.....return.preload...
33c80 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 }.}..//.Attribute.that.specifies
33ca0 20 74 68 65 20 62 6c 69 6e 6b 20 66 65 61 74 75 72 65 73 20 74 6f 20 62 65 20 65 6e 61 62 6c 65 .the.blink.features.to.be.enable
33cc0 64 2e 0a 63 6c 61 73 73 20 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 41 74 74 72 69 62 75 74 65 20 d..class.BlinkFeaturesAttribute.
33ce0 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e extends.WebViewAttribute.{...con
33d00 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 75 70 structor.(webViewImpl).{.....sup
33d20 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 42 4c er(webViewConstants.ATTRIBUTE_BL
33d40 49 4e 4b 46 45 41 54 55 52 45 53 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 7d 0a 7d 0a INKFEATURES,.webViewImpl)...}.}.
33d60 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 74 68 65 .//.Attribute.that.specifies.the
33d80 20 62 6c 69 6e 6b 20 66 65 61 74 75 72 65 73 20 74 6f 20 62 65 20 64 69 73 61 62 6c 65 64 2e 0a .blink.features.to.be.disabled..
33da0 63 6c 61 73 73 20 44 69 73 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 41 74 74 72 69 62 class.DisableBlinkFeaturesAttrib
33dc0 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 ute.extends.WebViewAttribute.{..
33de0 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 .constructor.(webViewImpl).{....
33e00 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 .super(webViewConstants.ATTRIBUT
33e20 45 5f 44 49 53 41 42 4c 45 42 4c 49 4e 4b 46 45 41 54 55 52 45 53 2c 20 77 65 62 56 69 65 77 49 E_DISABLEBLINKFEATURES,.webViewI
33e40 6d 70 6c 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 74 68 61 74 20 73 70 mpl)...}.}..//.Attribute.that.sp
33e60 65 63 69 66 69 65 73 20 74 68 65 20 77 65 62 20 70 72 65 66 65 72 65 6e 63 65 73 20 74 6f 20 62 ecifies.the.web.preferences.to.b
33e80 65 20 65 6e 61 62 6c 65 64 2e 0a 63 6c 61 73 73 20 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 41 e.enabled..class.WebPreferencesA
33ea0 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 ttribute.extends.WebViewAttribut
33ec0 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 e.{...constructor.(webViewImpl).
33ee0 7b 0a 20 20 20 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 {.....super(webViewConstants.ATT
33f00 52 49 42 55 54 45 5f 57 45 42 50 52 45 46 45 52 45 4e 43 45 53 2c 20 77 65 62 56 69 65 77 49 6d RIBUTE_WEBPREFERENCES,.webViewIm
33f20 70 6c 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 53 65 74 73 20 75 70 20 61 6c 6c 20 6f 66 20 74 68 65 pl)...}.}..//.Sets.up.all.of.the
33f40 20 77 65 62 76 69 65 77 20 61 74 74 72 69 62 75 74 65 73 2e 0a 57 65 62 56 69 65 77 49 6d 70 6c .webview.attributes..WebViewImpl
33f60 2e 70 72 6f 74 6f 74 79 70 65 2e 73 65 74 75 70 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 .prototype.setupWebViewAttribute
33f80 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 s.=.function.().{...this.attribu
33fa0 74 65 73 20 3d 20 7b 7d 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 tes.=.{}...this.attributes[webVi
33fc0 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 41 55 54 4f 53 49 5a 45 5d 20 ewConstants.ATTRIBUTE_AUTOSIZE].
33fe0 3d 20 6e 65 77 20 41 75 74 6f 73 69 7a 65 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 =.new.AutosizeAttribute(this)...
34000 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 this.attributes[webViewConstants
34020 2e 41 54 54 52 49 42 55 54 45 5f 50 41 52 54 49 54 49 4f 4e 5d 20 3d 20 6e 65 77 20 50 61 72 74 .ATTRIBUTE_PARTITION].=.new.Part
34040 69 74 69 6f 6e 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 itionAttribute(this)...this.attr
34060 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 ibutes[webViewConstants.ATTRIBUT
34080 45 5f 53 52 43 5d 20 3d 20 6e 65 77 20 53 72 63 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a E_SRC].=.new.SrcAttribute(this).
340a0 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e ..this.attributes[webViewConstan
340c0 74 73 2e 41 54 54 52 49 42 55 54 45 5f 48 54 54 50 52 45 46 45 52 52 45 52 5d 20 3d 20 6e 65 77 ts.ATTRIBUTE_HTTPREFERRER].=.new
340e0 20 48 74 74 70 52 65 66 65 72 72 65 72 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 .HttpReferrerAttribute(this)...t
34100 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e his.attributes[webViewConstants.
34120 41 54 54 52 49 42 55 54 45 5f 55 53 45 52 41 47 45 4e 54 5d 20 3d 20 6e 65 77 20 55 73 65 72 41 ATTRIBUTE_USERAGENT].=.new.UserA
34140 67 65 6e 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 gentAttribute(this)...this.attri
34160 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 butes[webViewConstants.ATTRIBUTE
34180 5f 4e 4f 44 45 49 4e 54 45 47 52 41 54 49 4f 4e 5d 20 3d 20 6e 65 77 20 42 6f 6f 6c 65 61 6e 41 _NODEINTEGRATION].=.new.BooleanA
341a0 74 74 72 69 62 75 74 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 ttribute(webViewConstants.ATTRIB
341c0 55 54 45 5f 4e 4f 44 45 49 4e 54 45 47 52 41 54 49 4f 4e 2c 20 74 68 69 73 29 0a 20 20 74 68 69 UTE_NODEINTEGRATION,.this)...thi
341e0 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 s.attributes[webViewConstants.AT
34200 54 52 49 42 55 54 45 5f 50 4c 55 47 49 4e 53 5d 20 3d 20 6e 65 77 20 42 6f 6f 6c 65 61 6e 41 74 TRIBUTE_PLUGINS].=.new.BooleanAt
34220 74 72 69 62 75 74 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 tribute(webViewConstants.ATTRIBU
34240 54 45 5f 50 4c 55 47 49 4e 53 2c 20 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 TE_PLUGINS,.this)...this.attribu
34260 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 44 tes[webViewConstants.ATTRIBUTE_D
34280 49 53 41 42 4c 45 57 45 42 53 45 43 55 52 49 54 59 5d 20 3d 20 6e 65 77 20 42 6f 6f 6c 65 61 6e ISABLEWEBSECURITY].=.new.Boolean
342a0 41 74 74 72 69 62 75 74 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 Attribute(webViewConstants.ATTRI
342c0 42 55 54 45 5f 44 49 53 41 42 4c 45 57 45 42 53 45 43 55 52 49 54 59 2c 20 74 68 69 73 29 0a 20 BUTE_DISABLEWEBSECURITY,.this)..
342e0 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 .this.attributes[webViewConstant
34300 73 2e 41 54 54 52 49 42 55 54 45 5f 41 4c 4c 4f 57 50 4f 50 55 50 53 5d 20 3d 20 6e 65 77 20 42 s.ATTRIBUTE_ALLOWPOPUPS].=.new.B
34320 6f 6f 6c 65 61 6e 41 74 74 72 69 62 75 74 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 ooleanAttribute(webViewConstants
34340 2e 41 54 54 52 49 42 55 54 45 5f 41 4c 4c 4f 57 50 4f 50 55 50 53 2c 20 74 68 69 73 29 0a 20 20 .ATTRIBUTE_ALLOWPOPUPS,.this)...
34360 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 this.attributes[webViewConstants
34380 2e 41 54 54 52 49 42 55 54 45 5f 50 52 45 4c 4f 41 44 5d 20 3d 20 6e 65 77 20 50 72 65 6c 6f 61 .ATTRIBUTE_PRELOAD].=.new.Preloa
343a0 64 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 dAttribute(this)...this.attribut
343c0 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 42 4c es[webViewConstants.ATTRIBUTE_BL
343e0 49 4e 4b 46 45 41 54 55 52 45 53 5d 20 3d 20 6e 65 77 20 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 INKFEATURES].=.new.BlinkFeatures
34400 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 Attribute(this)...this.attribute
34420 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 44 49 53 s[webViewConstants.ATTRIBUTE_DIS
34440 41 42 4c 45 42 4c 49 4e 4b 46 45 41 54 55 52 45 53 5d 20 3d 20 6e 65 77 20 44 69 73 61 62 6c 65 ABLEBLINKFEATURES].=.new.Disable
34460 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 BlinkFeaturesAttribute(this)...t
34480 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e his.attributes[webViewConstants.
344a0 41 54 54 52 49 42 55 54 45 5f 47 55 45 53 54 49 4e 53 54 41 4e 43 45 5d 20 3d 20 6e 65 77 20 47 ATTRIBUTE_GUESTINSTANCE].=.new.G
344c0 75 65 73 74 49 6e 73 74 61 6e 63 65 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 uestInstanceAttribute(this)...th
344e0 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 is.attributes[webViewConstants.A
34500 54 54 52 49 42 55 54 45 5f 44 49 53 41 42 4c 45 47 55 45 53 54 52 45 53 49 5a 45 5d 20 3d 20 6e TTRIBUTE_DISABLEGUESTRESIZE].=.n
34520 65 77 20 42 6f 6f 6c 65 61 6e 41 74 74 72 69 62 75 74 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 ew.BooleanAttribute(webViewConst
34540 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 44 49 53 41 42 4c 45 47 55 45 53 54 52 45 53 49 5a ants.ATTRIBUTE_DISABLEGUESTRESIZ
34560 45 2c 20 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 E,.this)...this.attributes[webVi
34580 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 57 45 42 50 52 45 46 45 52 45 ewConstants.ATTRIBUTE_WEBPREFERE
345a0 4e 43 45 53 5d 20 3d 20 6e 65 77 20 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 41 74 74 72 69 62 NCES].=.new.WebPreferencesAttrib
345c0 75 74 65 28 74 68 69 73 29 0a 0a 20 20 63 6f 6e 73 74 20 61 75 74 6f 73 69 7a 65 41 74 74 72 69 ute(this)....const.autosizeAttri
345e0 62 75 74 65 73 20 3d 20 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 butes.=.[webViewConstants.ATTRIB
34600 55 54 45 5f 4d 41 58 48 45 49 47 48 54 2c 20 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e UTE_MAXHEIGHT,.webViewConstants.
34620 41 54 54 52 49 42 55 54 45 5f 4d 41 58 57 49 44 54 48 2c 20 77 65 62 56 69 65 77 43 6f 6e 73 74 ATTRIBUTE_MAXWIDTH,.webViewConst
34640 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 4d 49 4e 48 45 49 47 48 54 2c 20 77 65 62 56 69 65 ants.ATTRIBUTE_MINHEIGHT,.webVie
34660 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 4d 49 4e 57 49 44 54 48 5d 0a 20 wConstants.ATTRIBUTE_MINWIDTH]..
34680 20 61 75 74 6f 73 69 7a 65 41 74 74 72 69 62 75 74 65 73 2e 66 6f 72 45 61 63 68 28 28 61 74 74 .autosizeAttributes.forEach((att
346a0 72 69 62 75 74 65 29 20 3d 3e 20 7b 0a 20 20 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 ribute).=>.{.....this.attributes
346c0 5b 61 74 74 72 69 62 75 74 65 5d 20 3d 20 6e 65 77 20 41 75 74 6f 73 69 7a 65 44 69 6d 65 6e 73 [attribute].=.new.AutosizeDimens
346e0 69 6f 6e 41 74 74 72 69 62 75 74 65 28 61 74 74 72 69 62 75 74 65 2c 20 74 68 69 73 29 0a 20 20 ionAttribute(attribute,.this)...
34700 7d 29 0a 7d 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 7b 0a 20 20 2f 2f 20 41 74 74 }).}.module.exports.=.{...//.Att
34720 72 69 62 75 74 65 73 2e 0a 20 20 41 54 54 52 49 42 55 54 45 5f 41 55 54 4f 53 49 5a 45 3a 20 27 ributes....ATTRIBUTE_AUTOSIZE:.'
34740 61 75 74 6f 73 69 7a 65 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 4d 41 58 48 45 49 47 48 54 autosize',...ATTRIBUTE_MAXHEIGHT
34760 3a 20 27 6d 61 78 68 65 69 67 68 74 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 4d 41 58 57 49 :.'maxheight',...ATTRIBUTE_MAXWI
34780 44 54 48 3a 20 27 6d 61 78 77 69 64 74 68 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 4d 49 4e DTH:.'maxwidth',...ATTRIBUTE_MIN
347a0 48 45 49 47 48 54 3a 20 27 6d 69 6e 68 65 69 67 68 74 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 HEIGHT:.'minheight',...ATTRIBUTE
347c0 5f 4d 49 4e 57 49 44 54 48 3a 20 27 6d 69 6e 77 69 64 74 68 27 2c 0a 20 20 41 54 54 52 49 42 55 _MINWIDTH:.'minwidth',...ATTRIBU
347e0 54 45 5f 4e 41 4d 45 3a 20 27 6e 61 6d 65 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 50 41 52 TE_NAME:.'name',...ATTRIBUTE_PAR
34800 54 49 54 49 4f 4e 3a 20 27 70 61 72 74 69 74 69 6f 6e 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 TITION:.'partition',...ATTRIBUTE
34820 5f 53 52 43 3a 20 27 73 72 63 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 48 54 54 50 52 45 46 _SRC:.'src',...ATTRIBUTE_HTTPREF
34840 45 52 52 45 52 3a 20 27 68 74 74 70 72 65 66 65 72 72 65 72 27 2c 0a 20 20 41 54 54 52 49 42 55 ERRER:.'httpreferrer',...ATTRIBU
34860 54 45 5f 4e 4f 44 45 49 4e 54 45 47 52 41 54 49 4f 4e 3a 20 27 6e 6f 64 65 69 6e 74 65 67 72 61 TE_NODEINTEGRATION:.'nodeintegra
34880 74 69 6f 6e 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 50 4c 55 47 49 4e 53 3a 20 27 70 6c 75 tion',...ATTRIBUTE_PLUGINS:.'plu
348a0 67 69 6e 73 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 44 49 53 41 42 4c 45 57 45 42 53 45 43 gins',...ATTRIBUTE_DISABLEWEBSEC
348c0 55 52 49 54 59 3a 20 27 64 69 73 61 62 6c 65 77 65 62 73 65 63 75 72 69 74 79 27 2c 0a 20 20 41 URITY:.'disablewebsecurity',...A
348e0 54 54 52 49 42 55 54 45 5f 41 4c 4c 4f 57 50 4f 50 55 50 53 3a 20 27 61 6c 6c 6f 77 70 6f 70 75 TTRIBUTE_ALLOWPOPUPS:.'allowpopu
34900 70 73 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 50 52 45 4c 4f 41 44 3a 20 27 70 72 65 6c 6f ps',...ATTRIBUTE_PRELOAD:.'prelo
34920 61 64 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 55 53 45 52 41 47 45 4e 54 3a 20 27 75 73 65 ad',...ATTRIBUTE_USERAGENT:.'use
34940 72 61 67 65 6e 74 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 42 4c 49 4e 4b 46 45 41 54 55 52 ragent',...ATTRIBUTE_BLINKFEATUR
34960 45 53 3a 20 27 62 6c 69 6e 6b 66 65 61 74 75 72 65 73 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 ES:.'blinkfeatures',...ATTRIBUTE
34980 5f 44 49 53 41 42 4c 45 42 4c 49 4e 4b 46 45 41 54 55 52 45 53 3a 20 27 64 69 73 61 62 6c 65 62 _DISABLEBLINKFEATURES:.'disableb
349a0 6c 69 6e 6b 66 65 61 74 75 72 65 73 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 47 55 45 53 54 linkfeatures',...ATTRIBUTE_GUEST
349c0 49 4e 53 54 41 4e 43 45 3a 20 27 67 75 65 73 74 69 6e 73 74 61 6e 63 65 27 2c 0a 20 20 41 54 54 INSTANCE:.'guestinstance',...ATT
349e0 52 49 42 55 54 45 5f 44 49 53 41 42 4c 45 47 55 45 53 54 52 45 53 49 5a 45 3a 20 27 64 69 73 61 RIBUTE_DISABLEGUESTRESIZE:.'disa
34a00 62 6c 65 67 75 65 73 74 72 65 73 69 7a 65 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 57 45 42 bleguestresize',...ATTRIBUTE_WEB
34a20 50 52 45 46 45 52 45 4e 43 45 53 3a 20 27 77 65 62 70 72 65 66 65 72 65 6e 63 65 73 27 2c 0a 0a PREFERENCES:.'webpreferences',..
34a40 20 20 2f 2f 20 49 6e 74 65 72 6e 61 6c 20 61 74 74 72 69 62 75 74 65 2e 0a 20 20 41 54 54 52 49 ..//.Internal.attribute....ATTRI
34a60 42 55 54 45 5f 49 4e 54 45 52 4e 41 4c 49 4e 53 54 41 4e 43 45 49 44 3a 20 27 69 6e 74 65 72 6e BUTE_INTERNALINSTANCEID:.'intern
34a80 61 6c 69 6e 73 74 61 6e 63 65 69 64 27 2c 0a 0a 20 20 2f 2f 20 45 72 72 6f 72 20 6d 65 73 73 61 alinstanceid',....//.Error.messa
34aa0 67 65 73 2e 0a 20 20 45 52 52 4f 52 5f 4d 53 47 5f 41 4c 52 45 41 44 59 5f 4e 41 56 49 47 41 54 ges....ERROR_MSG_ALREADY_NAVIGAT
34ac0 45 44 3a 20 27 54 68 65 20 6f 62 6a 65 63 74 20 68 61 73 20 61 6c 72 65 61 64 79 20 6e 61 76 69 ED:.'The.object.has.already.navi
34ae0 67 61 74 65 64 2c 20 73 6f 20 69 74 73 20 70 61 72 74 69 74 69 6f 6e 20 63 61 6e 6e 6f 74 20 62 gated,.so.its.partition.cannot.b
34b00 65 20 63 68 61 6e 67 65 64 2e 27 2c 0a 20 20 45 52 52 4f 52 5f 4d 53 47 5f 43 41 4e 4e 4f 54 5f e.changed.',...ERROR_MSG_CANNOT_
34b20 49 4e 4a 45 43 54 5f 53 43 52 49 50 54 3a 20 27 3c 77 65 62 76 69 65 77 3e 3a 20 27 20 2b 20 27 INJECT_SCRIPT:.'<webview>:.'.+.'
34b40 53 63 72 69 70 74 20 63 61 6e 6e 6f 74 20 62 65 20 69 6e 6a 65 63 74 65 64 20 69 6e 74 6f 20 63 Script.cannot.be.injected.into.c
34b60 6f 6e 74 65 6e 74 20 75 6e 74 69 6c 20 74 68 65 20 70 61 67 65 20 68 61 73 20 6c 6f 61 64 65 64 ontent.until.the.page.has.loaded
34b80 2e 27 2c 0a 20 20 45 52 52 4f 52 5f 4d 53 47 5f 49 4e 56 41 4c 49 44 5f 50 41 52 54 49 54 49 4f .',...ERROR_MSG_INVALID_PARTITIO
34ba0 4e 5f 41 54 54 52 49 42 55 54 45 3a 20 27 49 6e 76 61 6c 69 64 20 70 61 72 74 69 74 69 6f 6e 20 N_ATTRIBUTE:.'Invalid.partition.
34bc0 61 74 74 72 69 62 75 74 65 2e 27 2c 0a 20 20 45 52 52 4f 52 5f 4d 53 47 5f 49 4e 56 41 4c 49 44 attribute.',...ERROR_MSG_INVALID
34be0 5f 50 52 45 4c 4f 41 44 5f 41 54 54 52 49 42 55 54 45 3a 20 27 4f 6e 6c 79 20 22 66 69 6c 65 3a _PRELOAD_ATTRIBUTE:.'Only."file:
34c00 22 20 70 72 6f 74 6f 63 6f 6c 20 69 73 20 73 75 70 70 6f 72 74 65 64 20 69 6e 20 22 70 72 65 6c ".protocol.is.supported.in."prel
34c20 6f 61 64 22 20 61 74 74 72 69 62 75 74 65 2e 27 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a oad".attribute.'.}.'use.strict'.
34c40 0a 63 6f 6e 73 74 20 7b 69 70 63 52 65 6e 64 65 72 65 72 2c 20 72 65 6d 6f 74 65 2c 20 77 65 62 .const.{ipcRenderer,.remote,.web
34c60 46 72 61 6d 65 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 63 6f Frame}.=.require('electron')..co
34c80 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 nst.v8Util.=.process.atomBinding
34ca0 28 27 76 38 5f 75 74 69 6c 27 29 0a 63 6f 6e 73 74 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 ('v8_util').const.guestViewInter
34cc0 6e 61 6c 20 3d 20 72 65 71 75 69 72 65 28 27 2e 2f 67 75 65 73 74 2d 76 69 65 77 2d 69 6e 74 65 nal.=.require('./guest-view-inte
34ce0 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 20 3d 20 rnal').const.webViewConstants.=.
34d00 72 65 71 75 69 72 65 28 27 2e 2f 77 65 62 2d 76 69 65 77 2d 63 6f 6e 73 74 61 6e 74 73 27 29 0a require('./web-view-constants').
34d20 0a 63 6f 6e 73 74 20 68 61 73 50 72 6f 70 20 3d 20 7b 7d 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 .const.hasProp.=.{}.hasOwnProper
34d40 74 79 0a 0a 2f 2f 20 49 44 20 67 65 6e 65 72 61 74 6f 72 2e 0a 6c 65 74 20 6e 65 78 74 49 64 20 ty..//.ID.generator..let.nextId.
34d60 3d 20 30 0a 0a 63 6f 6e 73 74 20 67 65 74 4e 65 78 74 49 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 =.0..const.getNextId.=.function.
34d80 28 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 2b 2b 6e 65 78 74 49 64 0a 7d 0a 0a 2f 2f 20 52 65 70 ().{...return.++nextId.}..//.Rep
34da0 72 65 73 65 6e 74 73 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 65 20 6f 66 20 74 68 resents.the.internal.state.of.th
34dc0 65 20 57 65 62 56 69 65 77 20 6e 6f 64 65 2e 0a 63 6c 61 73 73 20 57 65 62 56 69 65 77 49 6d 70 e.WebView.node..class.WebViewImp
34de0 6c 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 76 69 65 77 4e 6f 64 65 29 20 l.{...constructor.(webviewNode).
34e00 7b 0a 20 20 20 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 20 3d 20 77 65 62 76 69 65 77 {.....this.webviewNode.=.webview
34e20 4e 6f 64 65 0a 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 Node.....v8Util.setHiddenValue(t
34e40 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2c 20 27 69 6e 74 65 72 6e 61 6c 27 2c 20 74 68 69 his.webviewNode,.'internal',.thi
34e60 73 29 0a 20 20 20 20 74 68 69 73 2e 61 74 74 61 63 68 65 64 20 3d 20 66 61 6c 73 65 0a 20 20 20 s).....this.attached.=.false....
34e80 20 74 68 69 73 2e 65 6c 65 6d 65 6e 74 41 74 74 61 63 68 65 64 20 3d 20 66 61 6c 73 65 0a 20 20 .this.elementAttached.=.false...
34ea0 20 20 74 68 69 73 2e 62 65 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 20 3d 20 74 ..this.beforeFirstNavigation.=.t
34ec0 72 75 65 0a 0a 20 20 20 20 2f 2f 20 6f 6e 2a 20 45 76 65 6e 74 20 68 61 6e 64 6c 65 72 73 2e 0a rue......//.on*.Event.handlers..
34ee0 20 20 20 20 74 68 69 73 2e 6f 6e 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 62 72 6f 77 73 65 ....this.on.=.{}.....this.browse
34f00 72 50 6c 75 67 69 6e 4e 6f 64 65 20 3d 20 74 68 69 73 2e 63 72 65 61 74 65 42 72 6f 77 73 65 72 rPluginNode.=.this.createBrowser
34f20 50 6c 75 67 69 6e 4e 6f 64 65 28 29 0a 20 20 20 20 63 6f 6e 73 74 20 73 68 61 64 6f 77 52 6f 6f PluginNode().....const.shadowRoo
34f40 74 20 3d 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 63 72 65 61 74 65 53 68 61 64 6f t.=.this.webviewNode.createShado
34f60 77 52 6f 6f 74 28 29 0a 20 20 20 20 73 68 61 64 6f 77 52 6f 6f 74 2e 69 6e 6e 65 72 48 54 4d 4c wRoot().....shadowRoot.innerHTML
34f80 20 3d 20 27 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 3c 73 74 79 6c 65 20 74 79 70 65 3d 22 .=.'<!DOCTYPE.html><style.type="
34fa0 74 65 78 74 2f 63 73 73 22 3e 3a 68 6f 73 74 20 7b 20 64 69 73 70 6c 61 79 3a 20 66 6c 65 78 3b text/css">:host.{.display:.flex;
34fc0 20 7d 3c 2f 73 74 79 6c 65 3e 27 0a 20 20 20 20 74 68 69 73 2e 73 65 74 75 70 57 65 62 56 69 65 .}</style>'.....this.setupWebVie
34fe0 77 41 74 74 72 69 62 75 74 65 73 28 29 0a 20 20 20 20 74 68 69 73 2e 73 65 74 75 70 46 6f 63 75 wAttributes().....this.setupFocu
35000 73 50 72 6f 70 61 67 61 74 69 6f 6e 28 29 0a 20 20 20 20 74 68 69 73 2e 76 69 65 77 49 6e 73 74 sPropagation().....this.viewInst
35020 61 6e 63 65 49 64 20 3d 20 67 65 74 4e 65 78 74 49 64 28 29 0a 20 20 20 20 73 68 61 64 6f 77 52 anceId.=.getNextId().....shadowR
35040 6f 6f 74 2e 61 70 70 65 6e 64 43 68 69 6c 64 28 74 68 69 73 2e 62 72 6f 77 73 65 72 50 6c 75 67 oot.appendChild(this.browserPlug
35060 69 6e 4e 6f 64 65 29 0a 20 20 7d 0a 0a 20 20 63 72 65 61 74 65 42 72 6f 77 73 65 72 50 6c 75 67 inNode)...}....createBrowserPlug
35080 69 6e 4e 6f 64 65 20 28 29 20 7b 0a 20 20 20 20 2f 2f 20 57 65 20 63 72 65 61 74 65 20 42 72 6f inNode.().{.....//.We.create.Bro
350a0 77 73 65 72 50 6c 75 67 69 6e 20 61 73 20 61 20 63 75 73 74 6f 6d 20 65 6c 65 6d 65 6e 74 20 69 wserPlugin.as.a.custom.element.i
350c0 6e 20 6f 72 64 65 72 20 74 6f 20 6f 62 73 65 72 76 65 20 63 68 61 6e 67 65 73 0a 20 20 20 20 2f n.order.to.observe.changes...../
350e0 2f 20 74 6f 20 61 74 74 72 69 62 75 74 65 73 20 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 2e 0a 20 /.to.attributes.synchronously...
35100 20 20 20 63 6f 6e 73 74 20 62 72 6f 77 73 65 72 50 6c 75 67 69 6e 4e 6f 64 65 20 3d 20 6e 65 77 ...const.browserPluginNode.=.new
35120 20 57 65 62 56 69 65 77 49 6d 70 6c 2e 42 72 6f 77 73 65 72 50 6c 75 67 69 6e 28 29 0a 20 20 20 .WebViewImpl.BrowserPlugin()....
35140 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 62 72 6f 77 73 65 72 50 6c .v8Util.setHiddenValue(browserPl
35160 75 67 69 6e 4e 6f 64 65 2c 20 27 69 6e 74 65 72 6e 61 6c 27 2c 20 74 68 69 73 29 0a 20 20 20 20 uginNode,.'internal',.this).....
35180 72 65 74 75 72 6e 20 62 72 6f 77 73 65 72 50 6c 75 67 69 6e 4e 6f 64 65 0a 20 20 7d 0a 0a 20 20 return.browserPluginNode...}....
351a0 2f 2f 20 52 65 73 65 74 73 20 73 6f 6d 65 20 73 74 61 74 65 20 75 70 6f 6e 20 72 65 61 74 74 61 //.Resets.some.state.upon.reatta
351c0 63 68 69 6e 67 20 3c 77 65 62 76 69 65 77 3e 20 65 6c 65 6d 65 6e 74 20 74 6f 20 74 68 65 20 44 ching.<webview>.element.to.the.D
351e0 4f 4d 2e 0a 20 20 72 65 73 65 74 20 28 29 20 7b 0a 20 20 20 20 2f 2f 20 49 66 20 67 75 65 73 74 OM....reset.().{.....//.If.guest
35200 49 6e 73 74 61 6e 63 65 49 64 20 69 73 20 64 65 66 69 6e 65 64 20 74 68 65 6e 20 74 68 65 20 3c InstanceId.is.defined.then.the.<
35220 77 65 62 76 69 65 77 3e 20 68 61 73 20 6e 61 76 69 67 61 74 65 64 20 61 6e 64 20 68 61 73 0a 20 webview>.has.navigated.and.has..
35240 20 20 20 2f 2f 20 61 6c 72 65 61 64 79 20 70 69 63 6b 65 64 20 75 70 20 61 20 70 61 72 74 69 74 ...//.already.picked.up.a.partit
35260 69 6f 6e 20 49 44 2e 20 54 68 75 73 2c 20 77 65 20 6e 65 65 64 20 74 6f 20 72 65 73 65 74 20 74 ion.ID..Thus,.we.need.to.reset.t
35280 68 65 20 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 0a 20 20 20 20 2f 2f 20 73 74 61 74 65 2e 20 he.initialization.....//.state..
352a0 48 6f 77 65 76 65 72 2c 20 69 74 20 6d 61 79 20 62 65 20 74 68 65 20 63 61 73 65 20 74 68 61 74 However,.it.may.be.the.case.that
352c0 20 62 65 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 20 69 73 20 66 61 6c 73 65 20 .beforeFirstNavigation.is.false.
352e0 42 55 54 0a 20 20 20 20 2f 2f 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 68 61 73 20 79 BUT.....//.guestInstanceId.has.y
35300 65 74 20 74 6f 20 62 65 20 69 6e 69 74 69 61 6c 69 7a 65 64 2e 20 54 68 69 73 20 6d 65 61 6e 73 et.to.be.initialized..This.means
35320 20 74 68 61 74 20 77 65 20 68 61 76 65 20 6e 6f 74 0a 20 20 20 20 2f 2f 20 68 65 61 72 64 20 62 .that.we.have.not.....//.heard.b
35340 61 63 6b 20 66 72 6f 6d 20 63 72 65 61 74 65 47 75 65 73 74 20 79 65 74 2e 20 57 65 20 77 69 6c ack.from.createGuest.yet..We.wil
35360 6c 20 6e 6f 74 20 72 65 73 65 74 20 74 68 65 20 66 6c 61 67 20 69 6e 20 74 68 69 73 20 63 61 73 l.not.reset.the.flag.in.this.cas
35380 65 20 73 6f 0a 20 20 20 20 2f 2f 20 74 68 61 74 20 77 65 20 64 6f 6e 27 74 20 65 6e 64 20 75 70 e.so.....//.that.we.don't.end.up
353a0 20 61 6c 6c 6f 63 61 74 69 6e 67 20 61 20 73 65 63 6f 6e 64 20 67 75 65 73 74 2e 0a 20 20 20 20 .allocating.a.second.guest......
353c0 69 66 20 28 74 68 69 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 if.(this.guestInstanceId).{.....
353e0 20 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 2e 64 65 73 74 72 6f 79 47 75 65 73 74 ..guestViewInternal.destroyGuest
35400 28 74 68 69 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 20 20 74 68 69 (this.guestInstanceId).......thi
35420 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 76 6f 69 64 20 30 0a 20 20 20 20 7d s.guestInstanceId.=.void.0.....}
35440 0a 0a 20 20 20 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 6e 75 6c 6c 0a 20 20 ......this.webContents.=.null...
35460 20 20 74 68 69 73 2e 62 65 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 20 3d 20 74 ..this.beforeFirstNavigation.=.t
35480 72 75 65 0a 20 20 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 rue.....this.attributes[webViewC
354a0 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 41 52 54 49 54 49 4f 4e 5d 2e 76 61 onstants.ATTRIBUTE_PARTITION].va
354c0 6c 69 64 50 61 72 74 69 74 69 6f 6e 49 64 20 3d 20 74 72 75 65 0a 0a 20 20 20 20 2f 2f 20 53 65 lidPartitionId.=.true......//.Se
354e0 74 20 67 75 65 73 74 69 6e 73 74 61 6e 63 65 20 6c 61 73 74 20 73 69 6e 63 65 20 74 68 69 73 20 t.guestinstance.last.since.this.
35500 63 61 6e 20 74 72 69 67 67 65 72 20 74 68 65 20 61 74 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b can.trigger.the.attachedCallback
35520 20 74 6f 20 66 69 72 65 0a 20 20 20 20 2f 2f 20 77 68 65 6e 20 6d 6f 76 69 6e 67 20 74 68 65 20 .to.fire.....//.when.moving.the.
35540 77 65 62 76 69 65 77 20 75 73 69 6e 67 20 65 6c 65 6d 65 6e 74 2e 72 65 70 6c 61 63 65 43 68 69 webview.using.element.replaceChi
35560 6c 64 0a 20 20 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f ld.....this.attributes[webViewCo
35580 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 47 55 45 53 54 49 4e 53 54 41 4e 43 45 5d nstants.ATTRIBUTE_GUESTINSTANCE]
355a0 2e 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 28 75 6e 64 65 66 69 6e 65 .setValueIgnoreMutation(undefine
355c0 64 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 53 65 74 73 20 74 68 65 20 3c 77 65 62 76 69 65 77 3e 2e d)...}....//.Sets.the.<webview>.
355e0 72 65 71 75 65 73 74 20 70 72 6f 70 65 72 74 79 2e 0a 20 20 73 65 74 52 65 71 75 65 73 74 50 72 request.property....setRequestPr
35600 6f 70 65 72 74 79 4f 6e 57 65 62 56 69 65 77 4e 6f 64 65 20 28 72 65 71 75 65 73 74 29 20 7b 0a opertyOnWebViewNode.(request).{.
35620 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 73 2e 77 ....Object.defineProperty(this.w
35640 65 62 76 69 65 77 4e 6f 64 65 2c 20 27 72 65 71 75 65 73 74 27 2c 20 7b 0a 20 20 20 20 20 20 76 ebviewNode,.'request',.{.......v
35660 61 6c 75 65 3a 20 72 65 71 75 65 73 74 2c 0a 20 20 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a alue:.request,.......enumerable:
35680 20 74 72 75 65 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 73 65 74 75 70 46 6f 63 75 73 50 72 .true.....})...}....setupFocusPr
356a0 6f 70 61 67 61 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 77 65 62 opagation.().{.....if.(!this.web
356c0 76 69 65 77 4e 6f 64 65 2e 68 61 73 41 74 74 72 69 62 75 74 65 28 27 74 61 62 49 6e 64 65 78 27 viewNode.hasAttribute('tabIndex'
356e0 29 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 3c 77 65 62 76 69 65 77 3e 20 6e 65 65 64 73 20 61 20 )).{.......//.<webview>.needs.a.
35700 74 61 62 49 6e 64 65 78 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 62 65 20 66 6f 63 75 73 61 62 6c tabIndex.in.order.to.be.focusabl
35720 65 2e 0a 20 20 20 20 20 20 2f 2f 20 54 4f 44 4f 28 66 73 61 6d 75 65 6c 29 3a 20 49 74 20 77 6f e........//.TODO(fsamuel):.It.wo
35740 75 6c 64 20 62 65 20 6e 69 63 65 20 74 6f 20 61 76 6f 69 64 20 65 78 70 6f 73 69 6e 67 20 61 20 uld.be.nice.to.avoid.exposing.a.
35760 74 61 62 49 6e 64 65 78 20 61 74 74 72 69 62 75 74 65 0a 20 20 20 20 20 20 2f 2f 20 74 6f 20 61 tabIndex.attribute.......//.to.a
35780 6c 6c 6f 77 20 3c 77 65 62 76 69 65 77 3e 20 74 6f 20 62 65 20 66 6f 63 75 73 61 62 6c 65 2e 0a llow.<webview>.to.be.focusable..
357a0 20 20 20 20 20 20 2f 2f 20 53 65 65 20 68 74 74 70 3a 2f 2f 63 72 62 75 67 2e 63 6f 6d 2f 32 33 ......//.See.http://crbug.com/23
357c0 31 36 36 34 2e 0a 20 20 20 20 20 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 73 65 74 1664........this.webviewNode.set
357e0 41 74 74 72 69 62 75 74 65 28 27 74 61 62 49 6e 64 65 78 27 2c 20 2d 31 29 0a 20 20 20 20 7d 0a Attribute('tabIndex',.-1).....}.
35800 0a 20 20 20 20 2f 2f 20 46 6f 63 75 73 20 74 68 65 20 42 72 6f 77 73 65 72 50 6c 75 67 69 6e 20 .....//.Focus.the.BrowserPlugin.
35820 77 68 65 6e 20 74 68 65 20 3c 77 65 62 76 69 65 77 3e 20 74 61 6b 65 73 20 66 6f 63 75 73 2e 0a when.the.<webview>.takes.focus..
35840 20 20 20 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 61 64 64 45 76 65 6e 74 4c 69 73 ....this.webviewNode.addEventLis
35860 74 65 6e 65 72 28 27 66 6f 63 75 73 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 tener('focus',.().=>.{.......thi
35880 73 2e 62 72 6f 77 73 65 72 50 6c 75 67 69 6e 4e 6f 64 65 2e 66 6f 63 75 73 28 29 0a 20 20 20 20 s.browserPluginNode.focus().....
358a0 7d 29 0a 0a 20 20 20 20 2f 2f 20 42 6c 75 72 20 74 68 65 20 42 72 6f 77 73 65 72 50 6c 75 67 69 })......//.Blur.the.BrowserPlugi
358c0 6e 20 77 68 65 6e 20 74 68 65 20 3c 77 65 62 76 69 65 77 3e 20 6c 6f 73 65 73 20 66 6f 63 75 73 n.when.the.<webview>.loses.focus
358e0 2e 0a 20 20 20 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 61 64 64 45 76 65 6e 74 4c ......this.webviewNode.addEventL
35900 69 73 74 65 6e 65 72 28 27 62 6c 75 72 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 istener('blur',.().=>.{.......th
35920 69 73 2e 62 72 6f 77 73 65 72 50 6c 75 67 69 6e 4e 6f 64 65 2e 62 6c 75 72 28 29 0a 20 20 20 20 is.browserPluginNode.blur().....
35940 7d 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 54 68 69 73 20 6f 62 73 65 72 76 65 72 20 6d 6f 6e 69 74 })...}....//.This.observer.monit
35960 6f 72 73 20 6d 75 74 61 74 69 6f 6e 73 20 74 6f 20 61 74 74 72 69 62 75 74 65 73 20 6f 66 20 74 ors.mutations.to.attributes.of.t
35980 68 65 20 3c 77 65 62 76 69 65 77 3e 20 61 6e 64 0a 20 20 2f 2f 20 75 70 64 61 74 65 73 20 74 68 he.<webview>.and...//.updates.th
359a0 65 20 42 72 6f 77 73 65 72 50 6c 75 67 69 6e 20 70 72 6f 70 65 72 74 69 65 73 20 61 63 63 6f 72 e.BrowserPlugin.properties.accor
359c0 64 69 6e 67 6c 79 2e 20 49 6e 20 74 75 72 6e 2c 20 75 70 64 61 74 69 6e 67 0a 20 20 2f 2f 20 61 dingly..In.turn,.updating...//.a
359e0 20 42 72 6f 77 73 65 72 50 6c 75 67 69 6e 20 70 72 6f 70 65 72 74 79 20 77 69 6c 6c 20 75 70 64 .BrowserPlugin.property.will.upd
35a00 61 74 65 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 42 72 6f 77 73 65 72 50 6c 75 ate.the.corresponding.BrowserPlu
35a20 67 69 6e 0a 20 20 2f 2f 20 61 74 74 72 69 62 75 74 65 2c 20 69 66 20 6e 65 63 65 73 73 61 72 79 gin...//.attribute,.if.necessary
35a40 2e 20 53 65 65 20 42 72 6f 77 73 65 72 50 6c 75 67 69 6e 3a 3a 55 70 64 61 74 65 44 4f 4d 41 74 ..See.BrowserPlugin::UpdateDOMAt
35a60 74 72 69 62 75 74 65 20 66 6f 72 20 6d 6f 72 65 0a 20 20 2f 2f 20 64 65 74 61 69 6c 73 2e 0a 20 tribute.for.more...//.details...
35a80 20 68 61 6e 64 6c 65 57 65 62 76 69 65 77 41 74 74 72 69 62 75 74 65 4d 75 74 61 74 69 6f 6e 20 .handleWebviewAttributeMutation.
35aa0 28 61 74 74 72 69 62 75 74 65 4e 61 6d 65 2c 20 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c (attributeName,.oldValue,.newVal
35ac0 75 65 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 61 ue).{.....if.(!this.attributes[a
35ae0 74 74 72 69 62 75 74 65 4e 61 6d 65 5d 20 7c 7c 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 ttributeName].||.this.attributes
35b00 5b 61 74 74 72 69 62 75 74 65 4e 61 6d 65 5d 2e 69 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 29 20 [attributeName].ignoreMutation).
35b20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 4c 65 74 {.......return.....}......//.Let
35b40 20 74 68 65 20 63 68 61 6e 67 65 64 20 61 74 74 72 69 62 75 74 65 20 68 61 6e 64 6c 65 20 69 74 .the.changed.attribute.handle.it
35b60 73 20 6f 77 6e 20 6d 75 74 61 74 69 6f 6e 0a 20 20 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 s.own.mutation.....this.attribut
35b80 65 73 5b 61 74 74 72 69 62 75 74 65 4e 61 6d 65 5d 2e 68 61 6e 64 6c 65 4d 75 74 61 74 69 6f 6e es[attributeName].handleMutation
35ba0 28 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 0a 20 20 7d 0a 0a 20 20 68 61 6e 64 (oldValue,.newValue)...}....hand
35bc0 6c 65 42 72 6f 77 73 65 72 50 6c 75 67 69 6e 41 74 74 72 69 62 75 74 65 4d 75 74 61 74 69 6f 6e leBrowserPluginAttributeMutation
35be0 20 28 61 74 74 72 69 62 75 74 65 4e 61 6d 65 2c 20 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 .(attributeName,.oldValue,.newVa
35c00 6c 75 65 29 20 7b 0a 20 20 20 20 69 66 20 28 61 74 74 72 69 62 75 74 65 4e 61 6d 65 20 3d 3d 3d lue).{.....if.(attributeName.===
35c20 20 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 49 4e 54 45 .webViewConstants.ATTRIBUTE_INTE
35c40 52 4e 41 4c 49 4e 53 54 41 4e 43 45 49 44 20 26 26 20 21 6f 6c 64 56 61 6c 75 65 20 26 26 20 21 RNALINSTANCEID.&&.!oldValue.&&.!
35c60 21 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 62 72 6f 77 73 65 72 50 !newValue).{.......this.browserP
35c80 6c 75 67 69 6e 4e 6f 64 65 2e 72 65 6d 6f 76 65 41 74 74 72 69 62 75 74 65 28 77 65 62 56 69 65 luginNode.removeAttribute(webVie
35ca0 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 49 4e 54 45 52 4e 41 4c 49 4e 53 wConstants.ATTRIBUTE_INTERNALINS
35cc0 54 41 4e 43 45 49 44 29 0a 20 20 20 20 20 20 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c 49 6e 73 74 TANCEID).......this.internalInst
35ce0 61 6e 63 65 49 64 20 3d 20 70 61 72 73 65 49 6e 74 28 6e 65 77 56 61 6c 75 65 29 0a 0a 20 20 20 anceId.=.parseInt(newValue).....
35d00 20 20 20 2f 2f 20 54 72 61 63 6b 20 77 68 65 6e 20 74 68 65 20 65 6c 65 6d 65 6e 74 20 72 65 73 ...//.Track.when.the.element.res
35d20 69 7a 65 73 20 75 73 69 6e 67 20 74 68 65 20 65 6c 65 6d 65 6e 74 20 72 65 73 69 7a 65 20 63 61 izes.using.the.element.resize.ca
35d40 6c 6c 62 61 63 6b 2e 0a 20 20 20 20 20 20 77 65 62 46 72 61 6d 65 2e 72 65 67 69 73 74 65 72 45 llback........webFrame.registerE
35d60 6c 65 6d 65 6e 74 52 65 73 69 7a 65 43 61 6c 6c 62 61 63 6b 28 74 68 69 73 2e 69 6e 74 65 72 6e lementResizeCallback(this.intern
35d80 61 6c 49 6e 73 74 61 6e 63 65 49 64 2c 20 74 68 69 73 2e 6f 6e 45 6c 65 6d 65 6e 74 52 65 73 69 alInstanceId,.this.onElementResi
35da0 7a 65 2e 62 69 6e 64 28 74 68 69 73 29 29 0a 20 20 20 20 20 20 69 66 20 28 74 68 69 73 2e 67 75 ze.bind(this)).......if.(this.gu
35dc0 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 20 20 20 20 67 75 65 73 74 56 69 estInstanceId).{.........guestVi
35de0 65 77 49 6e 74 65 72 6e 61 6c 2e 61 74 74 61 63 68 47 75 65 73 74 28 74 68 69 73 2e 69 6e 74 65 ewInternal.attachGuest(this.inte
35e00 72 6e 61 6c 49 6e 73 74 61 6e 63 65 49 64 2c 20 74 68 69 73 2e 67 75 65 73 74 49 6e 73 74 61 6e rnalInstanceId,.this.guestInstan
35e20 63 65 49 64 2c 20 74 68 69 73 2e 62 75 69 6c 64 50 61 72 61 6d 73 28 29 29 0a 20 20 20 20 20 20 ceId,.this.buildParams()).......
35e40 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 6f 6e 53 69 7a 65 43 68 61 6e 67 65 64 20 28 77 65 }.....}...}....onSizeChanged.(we
35e60 62 56 69 65 77 45 76 65 6e 74 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 7b 6e 65 77 48 65 69 67 bViewEvent).{.....const.{newHeig
35e80 68 74 2c 20 6e 65 77 57 69 64 74 68 7d 20 3d 20 77 65 62 56 69 65 77 45 76 65 6e 74 0a 20 20 20 ht,.newWidth}.=.webViewEvent....
35ea0 20 63 6f 6e 73 74 20 6e 6f 64 65 20 3d 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 0a 20 .const.node.=.this.webviewNode..
35ec0 20 20 20 63 6f 6e 73 74 20 77 69 64 74 68 20 3d 20 6e 6f 64 65 2e 6f 66 66 73 65 74 57 69 64 74 ...const.width.=.node.offsetWidt
35ee0 68 0a 0a 20 20 20 20 2f 2f 20 43 68 65 63 6b 20 74 68 65 20 63 75 72 72 65 6e 74 20 62 6f 75 6e h......//.Check.the.current.boun
35f00 64 73 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 20 77 65 20 64 6f 20 6e 6f 74 20 72 65 73 69 7a 65 ds.to.make.sure.we.do.not.resize
35f20 20 3c 77 65 62 76 69 65 77 3e 0a 20 20 20 20 2f 2f 20 6f 75 74 73 69 64 65 20 6f 66 20 63 75 72 .<webview>.....//.outside.of.cur
35f40 72 65 6e 74 20 63 6f 6e 73 74 72 61 69 6e 74 73 2e 0a 20 20 20 20 63 6f 6e 73 74 20 6d 61 78 57 rent.constraints......const.maxW
35f60 69 64 74 68 20 3d 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f idth.=.this.attributes[webViewCo
35f80 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 4d 41 58 57 49 44 54 48 5d 2e 67 65 74 56 nstants.ATTRIBUTE_MAXWIDTH].getV
35fa0 61 6c 75 65 28 29 20 7c 20 77 69 64 74 68 0a 20 20 20 20 63 6f 6e 73 74 20 6d 61 78 48 65 69 67 alue().|.width.....const.maxHeig
35fc0 68 74 20 3d 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 ht.=.this.attributes[webViewCons
35fe0 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 4d 41 58 48 45 49 47 48 54 5d 2e 67 65 74 56 61 tants.ATTRIBUTE_MAXHEIGHT].getVa
36000 6c 75 65 28 29 20 7c 20 77 69 64 74 68 0a 20 20 20 20 6c 65 74 20 6d 69 6e 57 69 64 74 68 20 3d lue().|.width.....let.minWidth.=
36020 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 .this.attributes[webViewConstant
36040 73 2e 41 54 54 52 49 42 55 54 45 5f 4d 49 4e 57 49 44 54 48 5d 2e 67 65 74 56 61 6c 75 65 28 29 s.ATTRIBUTE_MINWIDTH].getValue()
36060 20 7c 20 77 69 64 74 68 0a 20 20 20 20 6c 65 74 20 6d 69 6e 48 65 69 67 68 74 20 3d 20 74 68 69 .|.width.....let.minHeight.=.thi
36080 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 s.attributes[webViewConstants.AT
360a0 54 52 49 42 55 54 45 5f 4d 49 4e 48 45 49 47 48 54 5d 2e 67 65 74 56 61 6c 75 65 28 29 20 7c 20 TRIBUTE_MINHEIGHT].getValue().|.
360c0 77 69 64 74 68 0a 20 20 20 20 6d 69 6e 57 69 64 74 68 20 3d 20 4d 61 74 68 2e 6d 69 6e 28 6d 69 width.....minWidth.=.Math.min(mi
360e0 6e 57 69 64 74 68 2c 20 6d 61 78 57 69 64 74 68 29 0a 20 20 20 20 6d 69 6e 48 65 69 67 68 74 20 nWidth,.maxWidth).....minHeight.
36100 3d 20 4d 61 74 68 2e 6d 69 6e 28 6d 69 6e 48 65 69 67 68 74 2c 20 6d 61 78 48 65 69 67 68 74 29 =.Math.min(minHeight,.maxHeight)
36120 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 .....if.(!this.attributes[webVie
36140 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 41 55 54 4f 53 49 5a 45 5d 2e 67 wConstants.ATTRIBUTE_AUTOSIZE].g
36160 65 74 56 61 6c 75 65 28 29 20 7c 7c 20 28 6e 65 77 57 69 64 74 68 20 3e 3d 20 6d 69 6e 57 69 64 etValue().||.(newWidth.>=.minWid
36180 74 68 20 26 26 20 6e 65 77 57 69 64 74 68 20 3c 3d 20 6d 61 78 57 69 64 74 68 20 26 26 20 6e 65 th.&&.newWidth.<=.maxWidth.&&.ne
361a0 77 48 65 69 67 68 74 20 3e 3d 20 6d 69 6e 48 65 69 67 68 74 20 26 26 20 6e 65 77 48 65 69 67 68 wHeight.>=.minHeight.&&.newHeigh
361c0 74 20 3c 3d 20 6d 61 78 48 65 69 67 68 74 29 29 20 7b 0a 20 20 20 20 20 20 6e 6f 64 65 2e 73 74 t.<=.maxHeight)).{.......node.st
361e0 79 6c 65 2e 77 69 64 74 68 20 3d 20 60 24 7b 6e 65 77 57 69 64 74 68 7d 70 78 60 0a 20 20 20 20 yle.width.=.`${newWidth}px`.....
36200 20 20 6e 6f 64 65 2e 73 74 79 6c 65 2e 68 65 69 67 68 74 20 3d 20 60 24 7b 6e 65 77 48 65 69 67 ..node.style.height.=.`${newHeig
36220 68 74 7d 70 78 60 0a 0a 20 20 20 20 20 20 2f 2f 20 4f 6e 6c 79 20 66 69 72 65 20 74 68 65 20 44 ht}px`........//.Only.fire.the.D
36240 4f 4d 20 65 76 65 6e 74 20 69 66 20 74 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 3c 77 65 62 OM.event.if.the.size.of.the.<web
36260 76 69 65 77 3e 20 68 61 73 20 61 63 74 75 61 6c 6c 79 0a 20 20 20 20 20 20 2f 2f 20 63 68 61 6e view>.has.actually.......//.chan
36280 67 65 64 2e 0a 20 20 20 20 20 20 74 68 69 73 2e 64 69 73 70 61 74 63 68 45 76 65 6e 74 28 77 65 ged........this.dispatchEvent(we
362a0 62 56 69 65 77 45 76 65 6e 74 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 6f 6e 45 6c 65 6d 65 bViewEvent).....}...}....onEleme
362c0 6e 74 52 65 73 69 7a 65 20 28 6e 65 77 53 69 7a 65 29 20 7b 0a 20 20 20 20 2f 2f 20 44 69 73 70 ntResize.(newSize).{.....//.Disp
362e0 61 74 63 68 20 74 68 65 20 27 72 65 73 69 7a 65 27 20 65 76 65 6e 74 2e 0a 20 20 20 20 63 6f 6e atch.the.'resize'.event......con
36300 73 74 20 72 65 73 69 7a 65 45 76 65 6e 74 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 27 72 65 73 69 st.resizeEvent.=.new.Event('resi
36320 7a 65 27 2c 20 7b 0a 20 20 20 20 20 20 62 75 62 62 6c 65 73 3a 20 74 72 75 65 0a 20 20 20 20 7d ze',.{.......bubbles:.true.....}
36340 29 0a 0a 20 20 20 20 2f 2f 20 55 73 69 6e 67 20 63 6c 69 65 6e 74 20 73 69 7a 65 20 76 61 6c 75 )......//.Using.client.size.valu
36360 65 73 2c 20 62 65 63 61 75 73 65 20 77 68 65 6e 20 61 20 77 65 62 76 69 65 77 20 69 73 20 74 72 es,.because.when.a.webview.is.tr
36380 61 6e 73 66 6f 72 6d 65 64 20 60 6e 65 77 53 69 7a 65 60 0a 20 20 20 20 2f 2f 20 69 73 20 69 6e ansformed.`newSize`.....//.is.in
363a0 63 6f 72 72 65 63 74 0a 20 20 20 20 6e 65 77 53 69 7a 65 2e 77 69 64 74 68 20 3d 20 74 68 69 73 correct.....newSize.width.=.this
363c0 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 63 6c 69 65 6e 74 57 69 64 74 68 0a 20 20 20 20 6e 65 77 .webviewNode.clientWidth.....new
363e0 53 69 7a 65 2e 68 65 69 67 68 74 20 3d 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 63 Size.height.=.this.webviewNode.c
36400 6c 69 65 6e 74 48 65 69 67 68 74 0a 0a 20 20 20 20 72 65 73 69 7a 65 45 76 65 6e 74 2e 6e 65 77 lientHeight......resizeEvent.new
36420 57 69 64 74 68 20 3d 20 6e 65 77 53 69 7a 65 2e 77 69 64 74 68 0a 20 20 20 20 72 65 73 69 7a 65 Width.=.newSize.width.....resize
36440 45 76 65 6e 74 2e 6e 65 77 48 65 69 67 68 74 20 3d 20 6e 65 77 53 69 7a 65 2e 68 65 69 67 68 74 Event.newHeight.=.newSize.height
36460 0a 20 20 20 20 74 68 69 73 2e 64 69 73 70 61 74 63 68 45 76 65 6e 74 28 72 65 73 69 7a 65 45 76 .....this.dispatchEvent(resizeEv
36480 65 6e 74 29 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 ent).....if.(this.guestInstanceI
364a0 64 20 26 26 0a 20 20 20 20 20 20 20 20 21 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 d.&&.........!this.attributes[we
364c0 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 44 49 53 41 42 4c 45 bViewConstants.ATTRIBUTE_DISABLE
364e0 47 55 45 53 54 52 45 53 49 5a 45 5d 2e 67 65 74 56 61 6c 75 65 28 29 29 20 7b 0a 20 20 20 20 20 GUESTRESIZE].getValue()).{......
36500 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 2e 73 65 74 53 69 7a 65 28 74 68 69 73 2e .guestViewInternal.setSize(this.
36520 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 7b 0a 20 20 20 20 20 20 20 20 6e 6f 72 6d 61 guestInstanceId,.{.........norma
36540 6c 3a 20 6e 65 77 53 69 7a 65 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 l:.newSize.......}).....}...}...
36560 20 63 72 65 61 74 65 47 75 65 73 74 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 67 75 65 .createGuest.().{.....return.gue
36580 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 2e 63 72 65 61 74 65 47 75 65 73 74 28 74 68 69 73 2e stViewInternal.createGuest(this.
365a0 62 75 69 6c 64 50 61 72 61 6d 73 28 29 2c 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 6e 73 74 buildParams(),.(event,.guestInst
365c0 61 6e 63 65 49 64 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 61 74 74 61 63 68 47 75 anceId).=>.{.......this.attachGu
365e0 65 73 74 49 6e 73 74 61 6e 63 65 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 estInstance(guestInstanceId)....
36600 20 7d 29 0a 20 20 7d 0a 0a 20 20 64 69 73 70 61 74 63 68 45 76 65 6e 74 20 28 77 65 62 56 69 65 .})...}....dispatchEvent.(webVie
36620 77 45 76 65 6e 74 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 64 wEvent).{.....this.webviewNode.d
36640 69 73 70 61 74 63 68 45 76 65 6e 74 28 77 65 62 56 69 65 77 45 76 65 6e 74 29 0a 20 20 7d 0a 0a ispatchEvent(webViewEvent)...}..
36660 20 20 2f 2f 20 41 64 64 73 20 61 6e 20 27 6f 6e 3c 65 76 65 6e 74 3e 27 20 70 72 6f 70 65 72 74 ..//.Adds.an.'on<event>'.propert
36680 79 20 6f 6e 20 74 68 65 20 77 65 62 76 69 65 77 2c 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 75 y.on.the.webview,.which.can.be.u
366a0 73 65 64 20 74 6f 20 73 65 74 2f 75 6e 73 65 74 0a 20 20 2f 2f 20 61 6e 20 65 76 65 6e 74 20 68 sed.to.set/unset...//.an.event.h
366c0 61 6e 64 6c 65 72 2e 0a 20 20 73 65 74 75 70 45 76 65 6e 74 50 72 6f 70 65 72 74 79 20 28 65 76 andler....setupEventProperty.(ev
366e0 65 6e 74 4e 61 6d 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 70 72 6f 70 65 72 74 79 4e 61 6d entName).{.....const.propertyNam
36700 65 20 3d 20 60 6f 6e 24 7b 65 76 65 6e 74 4e 61 6d 65 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 e.=.`on${eventName.toLowerCase()
36720 7d 60 0a 20 20 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 }`.....return.Object.definePrope
36740 72 74 79 28 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2c 20 70 72 6f 70 65 72 74 79 4e 61 rty(this.webviewNode,.propertyNa
36760 6d 65 2c 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 me,.{.......get:.().=>.{........
36780 20 72 65 74 75 72 6e 20 74 68 69 73 2e 6f 6e 5b 70 72 6f 70 65 72 74 79 4e 61 6d 65 5d 0a 20 20 .return.this.on[propertyName]...
367a0 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 73 65 74 3a 20 28 76 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 ....},.......set:.(value).=>.{..
367c0 20 20 20 20 20 20 20 69 66 20 28 74 68 69 73 2e 6f 6e 5b 70 72 6f 70 65 72 74 79 4e 61 6d 65 5d .......if.(this.on[propertyName]
367e0 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 72 ).{...........this.webviewNode.r
36800 65 6d 6f 76 65 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 65 76 65 6e 74 4e 61 6d 65 2c 20 74 68 emoveEventListener(eventName,.th
36820 69 73 2e 6f 6e 5b 70 72 6f 70 65 72 74 79 4e 61 6d 65 5d 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 is.on[propertyName]).........}..
36840 20 20 20 20 20 20 20 74 68 69 73 2e 6f 6e 5b 70 72 6f 70 65 72 74 79 4e 61 6d 65 5d 20 3d 20 76 .......this.on[propertyName].=.v
36860 61 6c 75 65 0a 20 20 20 20 20 20 20 20 69 66 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 alue.........if.(value).{.......
36880 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 61 64 64 45 ....return.this.webviewNode.addE
368a0 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 65 76 65 6e 74 4e 61 6d 65 2c 20 76 61 6c 75 65 29 0a 20 ventListener(eventName,.value)..
368c0 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 65 6e 75 6d 65 72 61 62 .......}.......},.......enumerab
368e0 6c 65 3a 20 74 72 75 65 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 55 70 64 61 74 65 le:.true.....})...}....//.Update
36900 73 20 73 74 61 74 65 20 75 70 6f 6e 20 6c 6f 61 64 63 6f 6d 6d 69 74 2e 0a 20 20 6f 6e 4c 6f 61 s.state.upon.loadcommit....onLoa
36920 64 43 6f 6d 6d 69 74 20 28 77 65 62 56 69 65 77 45 76 65 6e 74 29 20 7b 0a 20 20 20 20 63 6f 6e dCommit.(webViewEvent).{.....con
36940 73 74 20 6f 6c 64 56 61 6c 75 65 20 3d 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 67 st.oldValue.=.this.webviewNode.g
36960 65 74 41 74 74 72 69 62 75 74 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 etAttribute(webViewConstants.ATT
36980 52 49 42 55 54 45 5f 53 52 43 29 0a 20 20 20 20 63 6f 6e 73 74 20 6e 65 77 56 61 6c 75 65 20 3d RIBUTE_SRC).....const.newValue.=
369a0 20 77 65 62 56 69 65 77 45 76 65 6e 74 2e 75 72 6c 0a 20 20 20 20 69 66 20 28 77 65 62 56 69 65 .webViewEvent.url.....if.(webVie
369c0 77 45 76 65 6e 74 2e 69 73 4d 61 69 6e 46 72 61 6d 65 20 26 26 20 28 6f 6c 64 56 61 6c 75 65 20 wEvent.isMainFrame.&&.(oldValue.
369e0 21 3d 3d 20 6e 65 77 56 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 54 6f 75 63 68 69 !==.newValue)).{.......//.Touchi
36a00 6e 67 20 74 68 65 20 73 72 63 20 61 74 74 72 69 62 75 74 65 20 74 72 69 67 67 65 72 73 20 61 20 ng.the.src.attribute.triggers.a.
36a20 6e 61 76 69 67 61 74 69 6f 6e 2e 20 54 6f 20 61 76 6f 69 64 0a 20 20 20 20 20 20 2f 2f 20 74 72 navigation..To.avoid.......//.tr
36a40 69 67 67 65 72 69 6e 67 20 61 20 70 61 67 65 20 72 65 6c 6f 61 64 20 6f 6e 20 65 76 65 72 79 20 iggering.a.page.reload.on.every.
36a60 67 75 65 73 74 2d 69 6e 69 74 69 61 74 65 64 20 6e 61 76 69 67 61 74 69 6f 6e 2c 0a 20 20 20 20 guest-initiated.navigation,.....
36a80 20 20 2f 2f 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 6e 64 6c 65 20 74 68 69 73 20 6d 75 74 61 74 ..//.we.do.not.handle.this.mutat
36aa0 69 6f 6e 2e 0a 20 20 20 20 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 ion........this.attributes[webVi
36ac0 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 53 52 43 5d 2e 73 65 74 56 61 ewConstants.ATTRIBUTE_SRC].setVa
36ae0 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 28 6e 65 77 56 61 6c 75 65 29 0a 20 20 20 20 lueIgnoreMutation(newValue).....
36b00 7d 0a 20 20 7d 0a 0a 20 20 6f 6e 41 74 74 61 63 68 20 28 73 74 6f 72 61 67 65 50 61 72 74 69 74 }...}....onAttach.(storagePartit
36b20 69 6f 6e 49 64 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 61 74 74 72 69 62 75 ionId).{.....return.this.attribu
36b40 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 tes[webViewConstants.ATTRIBUTE_P
36b60 41 52 54 49 54 49 4f 4e 5d 2e 73 65 74 56 61 6c 75 65 28 73 74 6f 72 61 67 65 50 61 72 74 69 74 ARTITION].setValue(storagePartit
36b80 69 6f 6e 49 64 29 0a 20 20 7d 0a 0a 20 20 62 75 69 6c 64 50 61 72 61 6d 73 20 28 29 20 7b 0a 20 ionId)...}....buildParams.().{..
36ba0 20 20 20 63 6f 6e 73 74 20 70 61 72 61 6d 73 20 3d 20 7b 0a 20 20 20 20 20 20 69 6e 73 74 61 6e ...const.params.=.{.......instan
36bc0 63 65 49 64 3a 20 74 68 69 73 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 2c 0a 20 20 20 20 20 ceId:.this.viewInstanceId,......
36be0 20 75 73 65 72 41 67 65 6e 74 4f 76 65 72 72 69 64 65 3a 20 74 68 69 73 2e 75 73 65 72 41 67 65 .userAgentOverride:.this.userAge
36c00 6e 74 4f 76 65 72 72 69 64 65 0a 20 20 20 20 7d 0a 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 ntOverride.....}.....for.(const.
36c20 61 74 74 72 69 62 75 74 65 4e 61 6d 65 20 69 6e 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 attributeName.in.this.attributes
36c40 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 68 61 73 50 72 6f 70 2e 63 61 6c 6c 28 74 68 69 73 2e ).{.......if.(hasProp.call(this.
36c60 61 74 74 72 69 62 75 74 65 73 2c 20 61 74 74 72 69 62 75 74 65 4e 61 6d 65 29 29 20 7b 0a 20 20 attributes,.attributeName)).{...
36c80 20 20 20 20 20 20 70 61 72 61 6d 73 5b 61 74 74 72 69 62 75 74 65 4e 61 6d 65 5d 20 3d 20 74 68 ......params[attributeName].=.th
36ca0 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 61 74 74 72 69 62 75 74 65 4e 61 6d 65 5d 2e 67 65 74 is.attributes[attributeName].get
36cc0 56 61 6c 75 65 28 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 57 68 Value().......}.....}......//.Wh
36ce0 65 6e 20 74 68 65 20 57 65 62 56 69 65 77 20 69 73 20 6e 6f 74 20 70 61 72 74 69 63 69 70 61 74 en.the.WebView.is.not.participat
36d00 69 6e 67 20 69 6e 20 6c 61 79 6f 75 74 20 28 64 69 73 70 6c 61 79 3a 6e 6f 6e 65 29 0a 20 20 20 ing.in.layout.(display:none)....
36d20 20 2f 2f 20 74 68 65 6e 20 67 65 74 42 6f 75 6e 64 69 6e 67 43 6c 69 65 6e 74 52 65 63 74 28 29 .//.then.getBoundingClientRect()
36d40 20 77 6f 75 6c 64 20 72 65 70 6f 72 74 20 61 20 77 69 64 74 68 20 61 6e 64 20 68 65 69 67 68 74 .would.report.a.width.and.height
36d60 20 6f 66 20 30 2e 0a 20 20 20 20 2f 2f 20 48 6f 77 65 76 65 72 2c 20 69 6e 20 74 68 65 20 63 61 .of.0......//.However,.in.the.ca
36d80 73 65 20 77 68 65 72 65 20 74 68 65 20 57 65 62 56 69 65 77 20 68 61 73 20 61 20 66 69 78 65 64 se.where.the.WebView.has.a.fixed
36da0 20 73 69 7a 65 20 77 65 20 63 61 6e 0a 20 20 20 20 2f 2f 20 75 73 65 20 74 68 61 74 20 76 61 6c .size.we.can.....//.use.that.val
36dc0 75 65 20 74 6f 20 69 6e 69 74 69 61 6c 6c 79 20 73 69 7a 65 20 74 68 65 20 67 75 65 73 74 20 73 ue.to.initially.size.the.guest.s
36de0 6f 20 61 73 20 74 6f 20 61 76 6f 69 64 20 61 20 72 65 6c 61 79 6f 75 74 20 6f 66 0a 20 20 20 20 o.as.to.avoid.a.relayout.of.....
36e00 2f 2f 20 74 68 65 20 6f 6e 20 64 69 73 70 6c 61 79 3a 62 6c 6f 63 6b 2e 0a 20 20 20 20 63 6f 6e //.the.on.display:block......con
36e20 73 74 20 63 73 73 20 3d 20 77 69 6e 64 6f 77 2e 67 65 74 43 6f 6d 70 75 74 65 64 53 74 79 6c 65 st.css.=.window.getComputedStyle
36e40 28 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2c 20 6e 75 6c 6c 29 0a 20 20 20 20 63 6f 6e (this.webviewNode,.null).....con
36e60 73 74 20 65 6c 65 6d 65 6e 74 52 65 63 74 20 3d 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 st.elementRect.=.this.webviewNod
36e80 65 2e 67 65 74 42 6f 75 6e 64 69 6e 67 43 6c 69 65 6e 74 52 65 63 74 28 29 0a 20 20 20 20 70 61 e.getBoundingClientRect().....pa
36ea0 72 61 6d 73 2e 65 6c 65 6d 65 6e 74 57 69 64 74 68 20 3d 20 70 61 72 73 65 49 6e 74 28 65 6c 65 rams.elementWidth.=.parseInt(ele
36ec0 6d 65 6e 74 52 65 63 74 2e 77 69 64 74 68 29 20 7c 7c 20 70 61 72 73 65 49 6e 74 28 63 73 73 2e mentRect.width).||.parseInt(css.
36ee0 67 65 74 50 72 6f 70 65 72 74 79 56 61 6c 75 65 28 27 77 69 64 74 68 27 29 29 0a 20 20 20 20 70 getPropertyValue('width')).....p
36f00 61 72 61 6d 73 2e 65 6c 65 6d 65 6e 74 48 65 69 67 68 74 20 3d 20 70 61 72 73 65 49 6e 74 28 65 arams.elementHeight.=.parseInt(e
36f20 6c 65 6d 65 6e 74 52 65 63 74 2e 68 65 69 67 68 74 29 20 7c 7c 20 70 61 72 73 65 49 6e 74 28 63 lementRect.height).||.parseInt(c
36f40 73 73 2e 67 65 74 50 72 6f 70 65 72 74 79 56 61 6c 75 65 28 27 68 65 69 67 68 74 27 29 29 0a 20 ss.getPropertyValue('height'))..
36f60 20 20 20 72 65 74 75 72 6e 20 70 61 72 61 6d 73 0a 20 20 7d 0a 0a 20 20 61 74 74 61 63 68 47 75 ...return.params...}....attachGu
36f80 65 73 74 49 6e 73 74 61 6e 63 65 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a estInstance.(guestInstanceId).{.
36fa0 20 20 20 20 74 68 69 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 67 75 65 73 74 ....this.guestInstanceId.=.guest
36fc0 49 6e 73 74 61 6e 63 65 49 64 0a 20 20 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 InstanceId.....this.attributes[w
36fe0 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 47 55 45 53 54 49 ebViewConstants.ATTRIBUTE_GUESTI
37000 4e 53 54 41 4e 43 45 5d 2e 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 28 NSTANCE].setValueIgnoreMutation(
37020 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 74 68 69 73 2e 77 65 62 43 6f 6e guestInstanceId).....this.webCon
37040 74 65 6e 74 73 20 3d 20 72 65 6d 6f 74 65 2e 67 65 74 47 75 65 73 74 57 65 62 43 6f 6e 74 65 6e tents.=.remote.getGuestWebConten
37060 74 73 28 74 68 69 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 69 66 20 ts(this.guestInstanceId).....if.
37080 28 21 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 (!this.internalInstanceId).{....
370a0 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 ...return.true.....}.....return.
370c0 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 2e 61 74 74 61 63 68 47 75 65 73 74 28 74 68 guestViewInternal.attachGuest(th
370e0 69 73 2e 69 6e 74 65 72 6e 61 6c 49 6e 73 74 61 6e 63 65 49 64 2c 20 74 68 69 73 2e 67 75 65 73 is.internalInstanceId,.this.gues
37100 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 74 68 69 73 2e 62 75 69 6c 64 50 61 72 61 6d 73 28 29 29 tInstanceId,.this.buildParams())
37120 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 52 65 67 69 73 74 65 72 73 20 62 72 6f 77 73 65 72 20 70 6c 75 ...}.}..//.Registers.browser.plu
37140 67 69 6e 20 3c 6f 62 6a 65 63 74 3e 20 63 75 73 74 6f 6d 20 65 6c 65 6d 65 6e 74 2e 0a 63 6f 6e gin.<object>.custom.element..con
37160 73 74 20 72 65 67 69 73 74 65 72 42 72 6f 77 73 65 72 50 6c 75 67 69 6e 45 6c 65 6d 65 6e 74 20 st.registerBrowserPluginElement.
37180 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 72 6f 74 6f 20 3d 20 =.function.().{...const.proto.=.
371a0 4f 62 6a 65 63 74 2e 63 72 65 61 74 65 28 48 54 4d 4c 4f 62 6a 65 63 74 45 6c 65 6d 65 6e 74 2e Object.create(HTMLObjectElement.
371c0 70 72 6f 74 6f 74 79 70 65 29 0a 20 20 70 72 6f 74 6f 2e 63 72 65 61 74 65 64 43 61 6c 6c 62 61 prototype)...proto.createdCallba
371e0 63 6b 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 73 65 74 41 ck.=.function.().{.....this.setA
37200 74 74 72 69 62 75 74 65 28 27 74 79 70 65 27 2c 20 27 61 70 70 6c 69 63 61 74 69 6f 6e 2f 62 72 ttribute('type',.'application/br
37220 6f 77 73 65 72 2d 70 6c 75 67 69 6e 27 29 0a 20 20 20 20 74 68 69 73 2e 73 65 74 41 74 74 72 69 owser-plugin').....this.setAttri
37240 62 75 74 65 28 27 69 64 27 2c 20 60 62 72 6f 77 73 65 72 2d 70 6c 75 67 69 6e 2d 24 7b 67 65 74 bute('id',.`browser-plugin-${get
37260 4e 65 78 74 49 64 28 29 7d 60 29 0a 0a 20 20 20 20 2f 2f 20 54 68 65 20 3c 6f 62 6a 65 63 74 3e NextId()}`)......//.The.<object>
37280 20 6e 6f 64 65 20 66 69 6c 6c 73 20 69 6e 20 74 68 65 20 3c 77 65 62 76 69 65 77 3e 20 63 6f 6e .node.fills.in.the.<webview>.con
372a0 74 61 69 6e 65 72 2e 0a 20 20 20 20 74 68 69 73 2e 73 74 79 6c 65 2e 66 6c 65 78 20 3d 20 27 31 tainer......this.style.flex.=.'1
372c0 20 31 20 61 75 74 6f 27 0a 20 20 7d 0a 20 20 70 72 6f 74 6f 2e 61 74 74 72 69 62 75 74 65 43 68 .1.auto'...}...proto.attributeCh
372e0 61 6e 67 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 2c 20 angedCallback.=.function.(name,.
37300 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 oldValue,.newValue).{.....const.
37320 69 6e 74 65 72 6e 61 6c 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 internal.=.v8Util.getHiddenValue
37340 28 74 68 69 73 2c 20 27 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 20 20 69 66 20 28 69 6e 74 65 72 (this,.'internal').....if.(inter
37360 6e 61 6c 29 20 7b 0a 20 20 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 68 61 6e 64 6c 65 42 72 6f 77 nal).{.......internal.handleBrow
37380 73 65 72 50 6c 75 67 69 6e 41 74 74 72 69 62 75 74 65 4d 75 74 61 74 69 6f 6e 28 6e 61 6d 65 2c serPluginAttributeMutation(name,
373a0 20 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 .oldValue,.newValue).....}...}..
373c0 20 70 72 6f 74 6f 2e 61 74 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 .proto.attachedCallback.=.functi
373e0 6f 6e 20 28 29 20 7b 0a 20 20 20 20 2f 2f 20 4c 6f 61 64 20 74 68 65 20 70 6c 75 67 69 6e 20 69 on.().{.....//.Load.the.plugin.i
37400 6d 6d 65 64 69 61 74 65 6c 79 2e 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 6e 6f 6e 45 mmediately......return.this.nonE
37420 78 69 73 74 65 6e 74 41 74 74 72 69 62 75 74 65 0a 20 20 7d 0a 20 20 57 65 62 56 69 65 77 49 6d xistentAttribute...}...WebViewIm
37440 70 6c 2e 42 72 6f 77 73 65 72 50 6c 75 67 69 6e 20 3d 20 77 65 62 46 72 61 6d 65 2e 72 65 67 69 pl.BrowserPlugin.=.webFrame.regi
37460 73 74 65 72 45 6d 62 65 64 64 65 72 43 75 73 74 6f 6d 45 6c 65 6d 65 6e 74 28 27 62 72 6f 77 73 sterEmbedderCustomElement('brows
37480 65 72 70 6c 75 67 69 6e 27 2c 20 7b 0a 20 20 20 20 27 65 78 74 65 6e 64 73 27 3a 20 27 6f 62 6a erplugin',.{.....'extends':.'obj
374a0 65 63 74 27 2c 0a 20 20 20 20 70 72 6f 74 6f 74 79 70 65 3a 20 70 72 6f 74 6f 0a 20 20 7d 29 0a ect',.....prototype:.proto...}).
374c0 20 20 64 65 6c 65 74 65 20 70 72 6f 74 6f 2e 63 72 65 61 74 65 64 43 61 6c 6c 62 61 63 6b 0a 20 ..delete.proto.createdCallback..
374e0 20 64 65 6c 65 74 65 20 70 72 6f 74 6f 2e 61 74 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 0a 20 .delete.proto.attachedCallback..
37500 20 64 65 6c 65 74 65 20 70 72 6f 74 6f 2e 64 65 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 0a 20 .delete.proto.detachedCallback..
37520 20 64 65 6c 65 74 65 20 70 72 6f 74 6f 2e 61 74 74 72 69 62 75 74 65 43 68 61 6e 67 65 64 43 61 .delete.proto.attributeChangedCa
37540 6c 6c 62 61 63 6b 0a 7d 0a 0a 2f 2f 20 52 65 67 69 73 74 65 72 73 20 3c 77 65 62 76 69 65 77 3e llback.}..//.Registers.<webview>
37560 20 63 75 73 74 6f 6d 20 65 6c 65 6d 65 6e 74 2e 0a 63 6f 6e 73 74 20 72 65 67 69 73 74 65 72 57 .custom.element..const.registerW
37580 65 62 56 69 65 77 45 6c 65 6d 65 6e 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 ebViewElement.=.function.().{...
375a0 63 6f 6e 73 74 20 70 72 6f 74 6f 20 3d 20 4f 62 6a 65 63 74 2e 63 72 65 61 74 65 28 48 54 4d 4c const.proto.=.Object.create(HTML
375c0 4f 62 6a 65 63 74 45 6c 65 6d 65 6e 74 2e 70 72 6f 74 6f 74 79 70 65 29 0a 20 20 70 72 6f 74 6f ObjectElement.prototype)...proto
375e0 2e 63 72 65 61 74 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b .createdCallback.=.function.().{
37600 0a 20 20 20 20 72 65 74 75 72 6e 20 6e 65 77 20 57 65 62 56 69 65 77 49 6d 70 6c 28 74 68 69 73 .....return.new.WebViewImpl(this
37620 29 0a 20 20 7d 0a 20 20 70 72 6f 74 6f 2e 61 74 74 72 69 62 75 74 65 43 68 61 6e 67 65 64 43 61 )...}...proto.attributeChangedCa
37640 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 2c 20 6f 6c 64 56 61 6c 75 llback.=.function.(name,.oldValu
37660 65 2c 20 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 e,.newValue).{.....const.interna
37680 6c 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2c 20 l.=.v8Util.getHiddenValue(this,.
376a0 27 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 20 20 69 66 20 28 69 6e 74 65 72 6e 61 6c 29 20 7b 0a 'internal').....if.(internal).{.
376c0 20 20 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 68 61 6e 64 6c 65 57 65 62 76 69 65 77 41 74 74 72 ......internal.handleWebviewAttr
376e0 69 62 75 74 65 4d 75 74 61 74 69 6f 6e 28 6e 61 6d 65 2c 20 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 ibuteMutation(name,.oldValue,.ne
37700 77 56 61 6c 75 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 70 72 6f 74 6f 2e 64 65 74 61 63 68 wValue).....}...}...proto.detach
37720 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 63 edCallback.=.function.().{.....c
37740 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e onst.internal.=.v8Util.getHidden
37760 56 61 6c 75 65 28 74 68 69 73 2c 20 27 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 20 20 69 66 20 28 Value(this,.'internal').....if.(
37780 21 69 6e 74 65 72 6e 61 6c 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a !internal).{.......return.....}.
377a0 20 20 20 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 2e 64 65 72 65 67 69 73 74 65 72 ....guestViewInternal.deregister
377c0 45 76 65 6e 74 73 28 69 6e 74 65 72 6e 61 6c 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 29 0a Events(internal.viewInstanceId).
377e0 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 65 6c 65 6d 65 6e 74 41 74 74 61 63 68 65 64 20 3d 20 66 ....internal.elementAttached.=.f
37800 61 6c 73 65 0a 20 20 20 20 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c 49 6e 73 74 61 6e 63 65 49 64 alse.....this.internalInstanceId
37820 20 3d 20 30 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 72 65 73 65 74 28 29 0a 20 20 7d 0a 20 20 .=.0.....internal.reset()...}...
37840 70 72 6f 74 6f 2e 61 74 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f proto.attachedCallback.=.functio
37860 6e 20 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 3d 20 76 38 55 74 n.().{.....const.internal.=.v8Ut
37880 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2c 20 27 69 6e 74 65 72 6e 61 il.getHiddenValue(this,.'interna
378a0 6c 27 29 0a 20 20 20 20 69 66 20 28 21 69 6e 74 65 72 6e 61 6c 29 20 7b 0a 20 20 20 20 20 20 72 l').....if.(!internal).{.......r
378c0 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 21 69 6e 74 65 72 6e 61 6c 2e 65 6c eturn.....}.....if.(!internal.el
378e0 65 6d 65 6e 74 41 74 74 61 63 68 65 64 29 20 7b 0a 20 20 20 20 20 20 67 75 65 73 74 56 69 65 77 ementAttached).{.......guestView
37900 49 6e 74 65 72 6e 61 6c 2e 72 65 67 69 73 74 65 72 45 76 65 6e 74 73 28 69 6e 74 65 72 6e 61 6c Internal.registerEvents(internal
37920 2c 20 69 6e 74 65 72 6e 61 6c 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 20 ,.internal.viewInstanceId)......
37940 20 69 6e 74 65 72 6e 61 6c 2e 65 6c 65 6d 65 6e 74 41 74 74 61 63 68 65 64 20 3d 20 74 72 75 65 .internal.elementAttached.=.true
37960 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 69 6e 73 74 61 6e 63 65 20 3d 20 69 6e 74 65 72 6e 61 6c .......const.instance.=.internal
37980 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 .attributes[webViewConstants.ATT
379a0 52 49 42 55 54 45 5f 47 55 45 53 54 49 4e 53 54 41 4e 43 45 5d 2e 67 65 74 56 61 6c 75 65 28 29 RIBUTE_GUESTINSTANCE].getValue()
379c0 0a 20 20 20 20 20 20 69 66 20 28 69 6e 73 74 61 6e 63 65 29 20 7b 0a 20 20 20 20 20 20 20 20 69 .......if.(instance).{.........i
379e0 6e 74 65 72 6e 61 6c 2e 61 74 74 61 63 68 47 75 65 73 74 49 6e 73 74 61 6e 63 65 28 69 6e 73 74 nternal.attachGuestInstance(inst
37a00 61 6e 63 65 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 69 6e 74 ance).......}.else.{.........int
37a20 65 72 6e 61 6c 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 ernal.attributes[webViewConstant
37a40 73 2e 41 54 54 52 49 42 55 54 45 5f 53 52 43 5d 2e 70 61 72 73 65 28 29 0a 20 20 20 20 20 20 7d s.ATTRIBUTE_SRC].parse().......}
37a60 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 50 75 62 6c 69 63 2d 66 61 63 69 6e 67 20 41 .....}...}....//.Public-facing.A
37a80 50 49 20 6d 65 74 68 6f 64 73 2e 0a 20 20 63 6f 6e 73 74 20 6d 65 74 68 6f 64 73 20 3d 20 5b 0a PI.methods....const.methods.=.[.
37aa0 20 20 20 20 27 67 65 74 55 52 4c 27 2c 0a 20 20 20 20 27 6c 6f 61 64 55 52 4c 27 2c 0a 20 20 20 ....'getURL',.....'loadURL',....
37ac0 20 27 67 65 74 54 69 74 6c 65 27 2c 0a 20 20 20 20 27 69 73 4c 6f 61 64 69 6e 67 27 2c 0a 20 20 .'getTitle',.....'isLoading',...
37ae0 20 20 27 69 73 4c 6f 61 64 69 6e 67 4d 61 69 6e 46 72 61 6d 65 27 2c 0a 20 20 20 20 27 69 73 57 ..'isLoadingMainFrame',.....'isW
37b00 61 69 74 69 6e 67 46 6f 72 52 65 73 70 6f 6e 73 65 27 2c 0a 20 20 20 20 27 73 74 6f 70 27 2c 0a aitingForResponse',.....'stop',.
37b20 20 20 20 20 27 72 65 6c 6f 61 64 27 2c 0a 20 20 20 20 27 72 65 6c 6f 61 64 49 67 6e 6f 72 69 6e ....'reload',.....'reloadIgnorin
37b40 67 43 61 63 68 65 27 2c 0a 20 20 20 20 27 63 61 6e 47 6f 42 61 63 6b 27 2c 0a 20 20 20 20 27 63 gCache',.....'canGoBack',.....'c
37b60 61 6e 47 6f 46 6f 72 77 61 72 64 27 2c 0a 20 20 20 20 27 63 61 6e 47 6f 54 6f 4f 66 66 73 65 74 anGoForward',.....'canGoToOffset
37b80 27 2c 0a 20 20 20 20 27 63 6c 65 61 72 48 69 73 74 6f 72 79 27 2c 0a 20 20 20 20 27 67 6f 42 61 ',.....'clearHistory',.....'goBa
37ba0 63 6b 27 2c 0a 20 20 20 20 27 67 6f 46 6f 72 77 61 72 64 27 2c 0a 20 20 20 20 27 67 6f 54 6f 49 ck',.....'goForward',.....'goToI
37bc0 6e 64 65 78 27 2c 0a 20 20 20 20 27 67 6f 54 6f 4f 66 66 73 65 74 27 2c 0a 20 20 20 20 27 69 73 ndex',.....'goToOffset',.....'is
37be0 43 72 61 73 68 65 64 27 2c 0a 20 20 20 20 27 73 65 74 55 73 65 72 41 67 65 6e 74 27 2c 0a 20 20 Crashed',.....'setUserAgent',...
37c00 20 20 27 67 65 74 55 73 65 72 41 67 65 6e 74 27 2c 0a 20 20 20 20 27 6f 70 65 6e 44 65 76 54 6f ..'getUserAgent',.....'openDevTo
37c20 6f 6c 73 27 2c 0a 20 20 20 20 27 63 6c 6f 73 65 44 65 76 54 6f 6f 6c 73 27 2c 0a 20 20 20 20 27 ols',.....'closeDevTools',.....'
37c40 69 73 44 65 76 54 6f 6f 6c 73 4f 70 65 6e 65 64 27 2c 0a 20 20 20 20 27 69 73 44 65 76 54 6f 6f isDevToolsOpened',.....'isDevToo
37c60 6c 73 46 6f 63 75 73 65 64 27 2c 0a 20 20 20 20 27 69 6e 73 70 65 63 74 45 6c 65 6d 65 6e 74 27 lsFocused',.....'inspectElement'
37c80 2c 0a 20 20 20 20 27 73 65 74 41 75 64 69 6f 4d 75 74 65 64 27 2c 0a 20 20 20 20 27 69 73 41 75 ,.....'setAudioMuted',.....'isAu
37ca0 64 69 6f 4d 75 74 65 64 27 2c 0a 20 20 20 20 27 75 6e 64 6f 27 2c 0a 20 20 20 20 27 72 65 64 6f dioMuted',.....'undo',.....'redo
37cc0 27 2c 0a 20 20 20 20 27 63 75 74 27 2c 0a 20 20 20 20 27 63 6f 70 79 27 2c 0a 20 20 20 20 27 70 ',.....'cut',.....'copy',.....'p
37ce0 61 73 74 65 27 2c 0a 20 20 20 20 27 70 61 73 74 65 41 6e 64 4d 61 74 63 68 53 74 79 6c 65 27 2c aste',.....'pasteAndMatchStyle',
37d00 0a 20 20 20 20 27 64 65 6c 65 74 65 27 2c 0a 20 20 20 20 27 73 65 6c 65 63 74 41 6c 6c 27 2c 0a .....'delete',.....'selectAll',.
37d20 20 20 20 20 27 75 6e 73 65 6c 65 63 74 27 2c 0a 20 20 20 20 27 72 65 70 6c 61 63 65 27 2c 0a 20 ....'unselect',.....'replace',..
37d40 20 20 20 27 72 65 70 6c 61 63 65 4d 69 73 73 70 65 6c 6c 69 6e 67 27 2c 0a 20 20 20 20 27 66 69 ...'replaceMisspelling',.....'fi
37d60 6e 64 49 6e 50 61 67 65 27 2c 0a 20 20 20 20 27 73 74 6f 70 46 69 6e 64 49 6e 50 61 67 65 27 2c ndInPage',.....'stopFindInPage',
37d80 0a 20 20 20 20 27 67 65 74 49 64 27 2c 0a 20 20 20 20 27 64 6f 77 6e 6c 6f 61 64 55 52 4c 27 2c .....'getId',.....'downloadURL',
37da0 0a 20 20 20 20 27 69 6e 73 70 65 63 74 53 65 72 76 69 63 65 57 6f 72 6b 65 72 27 2c 0a 20 20 20 .....'inspectServiceWorker',....
37dc0 20 27 70 72 69 6e 74 27 2c 0a 20 20 20 20 27 70 72 69 6e 74 54 6f 50 44 46 27 2c 0a 20 20 20 20 .'print',.....'printToPDF',.....
37de0 27 73 68 6f 77 44 65 66 69 6e 69 74 69 6f 6e 46 6f 72 53 65 6c 65 63 74 69 6f 6e 27 2c 0a 20 20 'showDefinitionForSelection',...
37e00 20 20 27 63 61 70 74 75 72 65 50 61 67 65 27 2c 0a 20 20 20 20 27 73 65 74 5a 6f 6f 6d 46 61 63 ..'capturePage',.....'setZoomFac
37e20 74 6f 72 27 2c 0a 20 20 20 20 27 73 65 74 5a 6f 6f 6d 4c 65 76 65 6c 27 2c 0a 20 20 20 20 27 67 tor',.....'setZoomLevel',.....'g
37e40 65 74 5a 6f 6f 6d 4c 65 76 65 6c 27 2c 0a 20 20 20 20 27 67 65 74 5a 6f 6f 6d 46 61 63 74 6f 72 etZoomLevel',.....'getZoomFactor
37e60 27 0a 20 20 5d 0a 20 20 63 6f 6e 73 74 20 6e 6f 6e 62 6c 6f 63 6b 4d 65 74 68 6f 64 73 20 3d 20 '...]...const.nonblockMethods.=.
37e80 5b 0a 20 20 20 20 27 69 6e 73 65 72 74 43 53 53 27 2c 0a 20 20 20 20 27 69 6e 73 65 72 74 54 65 [.....'insertCSS',.....'insertTe
37ea0 78 74 27 2c 0a 20 20 20 20 27 73 65 6e 64 27 2c 0a 20 20 20 20 27 73 65 6e 64 49 6e 70 75 74 45 xt',.....'send',.....'sendInputE
37ec0 76 65 6e 74 27 2c 0a 20 20 20 20 27 73 65 74 4c 61 79 6f 75 74 5a 6f 6f 6d 4c 65 76 65 6c 4c 69 vent',.....'setLayoutZoomLevelLi
37ee0 6d 69 74 73 27 2c 0a 20 20 20 20 27 73 65 74 56 69 73 75 61 6c 5a 6f 6f 6d 4c 65 76 65 6c 4c 69 mits',.....'setVisualZoomLevelLi
37f00 6d 69 74 73 27 2c 0a 20 20 20 20 2f 2f 20 54 4f 44 4f 28 6b 65 76 69 6e 73 61 77 69 63 6b 69 29 mits',.....//.TODO(kevinsawicki)
37f20 3a 20 52 65 6d 6f 76 65 20 69 6e 20 32 2e 30 2c 20 64 65 70 72 65 63 61 74 65 20 62 65 66 6f 72 :.Remove.in.2.0,.deprecate.befor
37f40 65 20 74 68 65 6e 20 77 69 74 68 20 77 61 72 6e 69 6e 67 73 0a 20 20 20 20 27 73 65 74 5a 6f 6f e.then.with.warnings.....'setZoo
37f60 6d 4c 65 76 65 6c 4c 69 6d 69 74 73 27 0a 20 20 5d 0a 0a 20 20 2f 2f 20 46 6f 72 77 61 72 64 20 mLevelLimits'...]....//.Forward.
37f80 70 72 6f 74 6f 2e 66 6f 6f 2a 20 6d 65 74 68 6f 64 20 63 61 6c 6c 73 20 74 6f 20 57 65 62 56 69 proto.foo*.method.calls.to.WebVi
37fa0 65 77 49 6d 70 6c 2e 66 6f 6f 2a 2e 0a 20 20 63 6f 6e 73 74 20 63 72 65 61 74 65 42 6c 6f 63 6b ewImpl.foo*....const.createBlock
37fc0 48 61 6e 64 6c 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 29 20 7b 0a 20 20 20 20 72 65 74 Handler.=.function.(m).{.....ret
37fe0 75 72 6e 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 urn.function.(...args).{.......c
38000 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e onst.internal.=.v8Util.getHidden
38020 56 61 6c 75 65 28 74 68 69 73 2c 20 27 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 20 20 20 20 69 66 Value(this,.'internal').......if
38040 20 28 69 6e 74 65 72 6e 61 6c 2e 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 20 20 .(internal.webContents).{.......
38060 20 20 72 65 74 75 72 6e 20 69 6e 74 65 72 6e 61 6c 2e 77 65 62 43 6f 6e 74 65 6e 74 73 5b 6d 5d ..return.internal.webContents[m]
38080 28 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 (...args).......}.else.{........
380a0 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 63 61 6c 6c 20 24 7b .throw.new.Error(`Cannot.call.${
380c0 6d 7d 20 62 65 63 61 75 73 65 20 74 68 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 69 73 20 75 6e m}.because.the.webContents.is.un
380e0 61 76 61 69 6c 61 62 6c 65 2e 20 54 68 65 20 57 65 62 56 69 65 77 20 6d 75 73 74 20 62 65 20 61 available..The.WebView.must.be.a
38100 74 74 61 63 68 65 64 20 74 6f 20 74 68 65 20 44 4f 4d 20 61 6e 64 20 74 68 65 20 64 6f 6d 2d 72 ttached.to.the.DOM.and.the.dom-r
38120 65 61 64 79 20 65 76 65 6e 74 20 65 6d 69 74 74 65 64 20 62 65 66 6f 72 65 20 74 68 69 73 20 6d eady.event.emitted.before.this.m
38140 65 74 68 6f 64 20 63 61 6e 20 62 65 20 63 61 6c 6c 65 64 2e 60 29 0a 20 20 20 20 20 20 7d 0a 20 ethod.can.be.called.`).......}..
38160 20 20 20 7d 0a 20 20 7d 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6d 65 74 68 6f 64 20 6f 66 20 ...}...}...for.(const.method.of.
38180 6d 65 74 68 6f 64 73 29 20 7b 0a 20 20 20 20 70 72 6f 74 6f 5b 6d 65 74 68 6f 64 5d 20 3d 20 63 methods).{.....proto[method].=.c
381a0 72 65 61 74 65 42 6c 6f 63 6b 48 61 6e 64 6c 65 72 28 6d 65 74 68 6f 64 29 0a 20 20 7d 0a 0a 20 reateBlockHandler(method)...}...
381c0 20 63 6f 6e 73 74 20 63 72 65 61 74 65 4e 6f 6e 42 6c 6f 63 6b 48 61 6e 64 6c 65 72 20 3d 20 66 .const.createNonBlockHandler.=.f
381e0 75 6e 63 74 69 6f 6e 20 28 6d 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f unction.(m).{.....return.functio
38200 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e n.(...args).{.......const.intern
38220 61 6c 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2c al.=.v8Util.getHiddenValue(this,
38240 20 27 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 .'internal').......ipcRenderer.s
38260 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 41 53 59 4e 43 5f 43 41 4c 4c end('ELECTRON_BROWSER_ASYNC_CALL
38280 5f 54 4f 5f 47 55 45 53 54 5f 56 49 45 57 27 2c 20 6e 75 6c 6c 2c 20 69 6e 74 65 72 6e 61 6c 2e _TO_GUEST_VIEW',.null,.internal.
382a0 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 6d 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 guestInstanceId,.m,....args)....
382c0 20 7d 0a 20 20 7d 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6d 65 74 68 6f 64 20 6f 66 20 6e 6f .}...}...for.(const.method.of.no
382e0 6e 62 6c 6f 63 6b 4d 65 74 68 6f 64 73 29 20 7b 0a 20 20 20 20 70 72 6f 74 6f 5b 6d 65 74 68 6f nblockMethods).{.....proto[metho
38300 64 5d 20 3d 20 63 72 65 61 74 65 4e 6f 6e 42 6c 6f 63 6b 48 61 6e 64 6c 65 72 28 6d 65 74 68 6f d].=.createNonBlockHandler(metho
38320 64 29 0a 20 20 7d 0a 0a 20 20 70 72 6f 74 6f 2e 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 d)...}....proto.executeJavaScrip
38340 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 6f 64 65 2c 20 68 61 73 55 73 65 72 47 65 73 74 75 t.=.function.(code,.hasUserGestu
38360 72 65 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e re,.callback).{.....const.intern
38380 61 6c 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2c al.=.v8Util.getHiddenValue(this,
383a0 20 27 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 68 61 73 55 .'internal').....if.(typeof.hasU
383c0 73 65 72 47 65 73 74 75 72 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 serGesture.===.'function').{....
383e0 20 20 20 63 61 6c 6c 62 61 63 6b 20 3d 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 0a 20 20 20 ...callback.=.hasUserGesture....
38400 20 20 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 20 3d 20 66 61 6c 73 65 0a 20 20 20 20 7d 0a ...hasUserGesture.=.false.....}.
38420 20 20 20 20 63 6f 6e 73 74 20 72 65 71 75 65 73 74 49 64 20 3d 20 67 65 74 4e 65 78 74 49 64 28 ....const.requestId.=.getNextId(
38440 29 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e ).....ipcRenderer.send('ELECTRON
38460 5f 42 52 4f 57 53 45 52 5f 41 53 59 4e 43 5f 43 41 4c 4c 5f 54 4f 5f 47 55 45 53 54 5f 56 49 45 _BROWSER_ASYNC_CALL_TO_GUEST_VIE
38480 57 27 2c 20 72 65 71 75 65 73 74 49 64 2c 20 69 6e 74 65 72 6e 61 6c 2e 67 75 65 73 74 49 6e 73 W',.requestId,.internal.guestIns
384a0 74 61 6e 63 65 49 64 2c 20 27 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 27 2c 20 63 6f tanceId,.'executeJavaScript',.co
384c0 64 65 2c 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 29 0a 20 20 20 20 69 70 63 52 65 6e 64 65 de,.hasUserGesture).....ipcRende
384e0 72 65 72 2e 6f 6e 63 65 28 60 45 4c 45 43 54 52 4f 4e 5f 52 45 4e 44 45 52 45 52 5f 41 53 59 4e rer.once(`ELECTRON_RENDERER_ASYN
38500 43 5f 43 41 4c 4c 5f 54 4f 5f 47 55 45 53 54 5f 56 49 45 57 5f 52 45 53 50 4f 4e 53 45 5f 24 7b C_CALL_TO_GUEST_VIEW_RESPONSE_${
38520 72 65 71 75 65 73 74 49 64 7d 60 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 72 65 requestId}`,.function.(event,.re
38540 73 75 6c 74 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 20 63 61 6c 6c sult).{.......if.(callback).call
38560 62 61 63 6b 28 72 65 73 75 6c 74 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 57 65 back(result).....})...}....//.We
38580 62 43 6f 6e 74 65 6e 74 73 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 69 73 20 77 bContents.associated.with.this.w
385a0 65 62 76 69 65 77 2e 0a 20 20 70 72 6f 74 6f 2e 67 65 74 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d ebview....proto.getWebContents.=
385c0 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 76 38 55 74 69 6c .function.().{.....return.v8Util
385e0 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2c 20 27 69 6e 74 65 72 6e 61 6c 27 .getHiddenValue(this,.'internal'
38600 29 2e 77 65 62 43 6f 6e 74 65 6e 74 73 0a 20 20 7d 0a 0a 20 20 77 69 6e 64 6f 77 2e 57 65 62 56 ).webContents...}....window.WebV
38620 69 65 77 20 3d 20 77 65 62 46 72 61 6d 65 2e 72 65 67 69 73 74 65 72 45 6d 62 65 64 64 65 72 43 iew.=.webFrame.registerEmbedderC
38640 75 73 74 6f 6d 45 6c 65 6d 65 6e 74 28 27 77 65 62 76 69 65 77 27 2c 20 7b 0a 20 20 20 20 70 72 ustomElement('webview',.{.....pr
38660 6f 74 6f 74 79 70 65 3a 20 70 72 6f 74 6f 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 44 65 6c 65 74 65 ototype:.proto...})....//.Delete
38680 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 73 20 73 6f 20 64 65 76 65 6c 6f 70 65 72 73 20 63 61 6e .the.callbacks.so.developers.can
386a0 6e 6f 74 20 63 61 6c 6c 20 74 68 65 6d 20 61 6e 64 20 70 72 6f 64 75 63 65 20 75 6e 65 78 70 65 not.call.them.and.produce.unexpe
386c0 63 74 65 64 0a 20 20 2f 2f 20 62 65 68 61 76 69 6f 72 2e 0a 20 20 64 65 6c 65 74 65 20 70 72 6f cted...//.behavior....delete.pro
386e0 74 6f 2e 63 72 65 61 74 65 64 43 61 6c 6c 62 61 63 6b 0a 20 20 64 65 6c 65 74 65 20 70 72 6f 74 to.createdCallback...delete.prot
38700 6f 2e 61 74 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 0a 20 20 64 65 6c 65 74 65 20 70 72 6f 74 o.attachedCallback...delete.prot
38720 6f 2e 64 65 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 0a 20 20 64 65 6c 65 74 65 20 70 72 6f 74 o.detachedCallback...delete.prot
38740 6f 2e 61 74 74 72 69 62 75 74 65 43 68 61 6e 67 65 64 43 61 6c 6c 62 61 63 6b 0a 7d 0a 0a 63 6f o.attributeChangedCallback.}..co
38760 6e 73 74 20 75 73 65 43 61 70 74 75 72 65 20 3d 20 74 72 75 65 0a 0a 63 6f 6e 73 74 20 6c 69 73 nst.useCapture.=.true..const.lis
38780 74 65 6e 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 20 69 66 20 tener.=.function.(event).{...if.
387a0 28 64 6f 63 75 6d 65 6e 74 2e 72 65 61 64 79 53 74 61 74 65 20 3d 3d 3d 20 27 6c 6f 61 64 69 6e (document.readyState.===.'loadin
387c0 67 27 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 20 20 72 65 67 69 73 74 65 72 42 g').{.....return...}...registerB
387e0 72 6f 77 73 65 72 50 6c 75 67 69 6e 45 6c 65 6d 65 6e 74 28 29 0a 20 20 72 65 67 69 73 74 65 72 rowserPluginElement()...register
38800 57 65 62 56 69 65 77 45 6c 65 6d 65 6e 74 28 29 0a 20 20 77 69 6e 64 6f 77 2e 72 65 6d 6f 76 65 WebViewElement()...window.remove
38820 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 65 76 65 6e 74 2e 74 79 70 65 2c 20 6c 69 73 74 65 6e EventListener(event.type,.listen
38840 65 72 2c 20 75 73 65 43 61 70 74 75 72 65 29 0a 7d 0a 0a 77 69 6e 64 6f 77 2e 61 64 64 45 76 65 er,.useCapture).}..window.addEve
38860 6e 74 4c 69 73 74 65 6e 65 72 28 27 72 65 61 64 79 73 74 61 74 65 63 68 61 6e 67 65 27 2c 20 6c ntListener('readystatechange',.l
38880 69 73 74 65 6e 65 72 2c 20 74 72 75 65 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d istener,.true)..module.exports.=
388a0 20 57 65 62 56 69 65 77 49 6d 70 6c 0a 2f 2f 20 54 68 69 73 20 66 69 6c 65 20 73 68 6f 75 6c 64 .WebViewImpl.//.This.file.should
388c0 20 68 61 76 65 20 6e 6f 20 72 65 71 75 69 72 65 73 20 73 69 6e 63 65 20 69 74 20 69 73 20 75 73 .have.no.requires.since.it.is.us
388e0 65 64 20 62 79 20 74 68 65 20 69 73 6f 6c 61 74 65 64 20 63 6f 6e 74 65 78 74 0a 2f 2f 20 70 72 ed.by.the.isolated.context.//.pr
38900 65 6c 6f 61 64 20 62 75 6e 64 6c 65 2e 20 49 6e 73 74 65 61 64 20 61 72 67 75 6d 65 6e 74 73 20 eload.bundle..Instead.arguments.
38920 73 68 6f 75 6c 64 20 62 65 20 70 61 73 73 65 64 20 69 6e 20 66 6f 72 20 65 76 65 72 79 74 68 69 should.be.passed.in.for.everythi
38940 6e 67 20 69 74 0a 2f 2f 20 6e 65 65 64 73 2e 0a 0a 2f 2f 20 54 68 69 73 20 66 69 6c 65 20 69 6d ng.it.//.needs...//.This.file.im
38960 70 6c 65 6d 65 6e 74 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 41 50 49 73 3a 0a 2f 2f 20 plements.the.following.APIs:.//.
38980 2d 20 77 69 6e 64 6f 77 2e 61 6c 65 72 74 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 63 6f 6e -.window.alert().//.-.window.con
389a0 66 69 72 6d 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 62 61 63 6b 28 firm().//.-.window.history.back(
389c0 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 66 6f 72 77 61 72 64 28 29 0a ).//.-.window.history.forward().
389e0 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 67 6f 28 29 0a 2f 2f 20 2d 20 77 69 //.-.window.history.go().//.-.wi
38a00 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 6c 65 6e 67 74 68 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e ndow.history.length.//.-.window.
38a20 6f 70 65 6e 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e 62 6c 75 72 28 29 open().//.-.window.opener.blur()
38a40 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e 63 6c 6f 73 65 28 29 0a 2f 2f 20 2d .//.-.window.opener.close().//.-
38a60 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e 65 76 61 6c 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f .window.opener.eval().//.-.windo
38a80 77 2e 6f 70 65 6e 65 72 2e 66 6f 63 75 73 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 w.opener.focus().//.-.window.ope
38aa0 6e 65 72 2e 6c 6f 63 61 74 69 6f 6e 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e ner.location.//.-.window.opener.
38ac0 70 72 69 6e 74 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e 70 6f 73 74 4d print().//.-.window.opener.postM
38ae0 65 73 73 61 67 65 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 70 72 6f 6d 70 74 28 29 0a 2f 2f essage().//.-.window.prompt().//
38b00 20 2d 20 64 6f 63 75 6d 65 6e 74 2e 68 69 64 64 65 6e 0a 2f 2f 20 2d 20 64 6f 63 75 6d 65 6e 74 .-.document.hidden.//.-.document
38b20 2e 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 0a 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a .visibilityState..'use.strict'..
38b40 63 6f 6e 73 74 20 7b 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 7d 20 3d 20 4f 62 6a 65 63 74 0a const.{defineProperty}.=.Object.
38b60 0a 2f 2f 20 48 65 6c 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 72 65 73 6f 6c 76 65 20 72 .//.Helper.function.to.resolve.r
38b80 65 6c 61 74 69 76 65 20 75 72 6c 2e 0a 63 6f 6e 73 74 20 61 20 3d 20 77 69 6e 64 6f 77 2e 74 6f elative.url..const.a.=.window.to
38ba0 70 2e 64 6f 63 75 6d 65 6e 74 2e 63 72 65 61 74 65 45 6c 65 6d 65 6e 74 28 27 61 27 29 0a 63 6f p.document.createElement('a').co
38bc0 6e 73 74 20 72 65 73 6f 6c 76 65 55 52 4c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 72 6c 29 20 nst.resolveURL.=.function.(url).
38be0 7b 0a 20 20 61 2e 68 72 65 66 20 3d 20 75 72 6c 0a 20 20 72 65 74 75 72 6e 20 61 2e 68 72 65 66 {...a.href.=.url...return.a.href
38c00 0a 7d 0a 0a 2f 2f 20 55 73 65 20 74 68 69 73 20 6d 65 74 68 6f 64 20 74 6f 20 65 6e 73 75 72 65 .}..//.Use.this.method.to.ensure
38c20 20 76 61 6c 75 65 73 20 65 78 70 65 63 74 65 64 20 61 73 20 73 74 72 69 6e 67 73 20 69 6e 20 74 .values.expected.as.strings.in.t
38c40 68 65 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 0a 2f 2f 20 61 72 65 20 63 6f 6e 76 65 72 74 69 62 he.main.process.//.are.convertib
38c60 6c 65 20 74 6f 20 73 74 72 69 6e 67 73 20 69 6e 20 74 68 65 20 72 65 6e 64 65 72 65 72 20 70 72 le.to.strings.in.the.renderer.pr
38c80 6f 63 65 73 73 2e 20 54 68 69 73 20 65 6e 73 75 72 65 73 20 65 78 63 65 70 74 69 6f 6e 73 0a 2f ocess..This.ensures.exceptions./
38ca0 2f 20 63 6f 6e 76 65 72 74 69 6e 67 20 76 61 6c 75 65 73 20 74 6f 20 73 74 72 69 6e 67 73 20 61 /.converting.values.to.strings.a
38cc0 72 65 20 74 68 72 6f 77 6e 20 69 6e 20 74 68 69 73 20 70 72 6f 63 65 73 73 2e 0a 63 6f 6e 73 74 re.thrown.in.this.process..const
38ce0 20 74 6f 53 74 72 69 6e 67 20 3d 20 28 76 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 .toString.=.(value).=>.{...retur
38d00 6e 20 76 61 6c 75 65 20 21 3d 20 6e 75 6c 6c 20 3f 20 60 24 7b 76 61 6c 75 65 7d 60 20 3a 20 76 n.value.!=.null.?.`${value}`.:.v
38d20 61 6c 75 65 0a 7d 0a 0a 63 6f 6e 73 74 20 77 69 6e 64 6f 77 50 72 6f 78 69 65 73 20 3d 20 7b 7d alue.}..const.windowProxies.=.{}
38d40 0a 0a 63 6f 6e 73 74 20 67 65 74 4f 72 43 72 65 61 74 65 50 72 6f 78 79 20 3d 20 28 69 70 63 52 ..const.getOrCreateProxy.=.(ipcR
38d60 65 6e 64 65 72 65 72 2c 20 67 75 65 73 74 49 64 29 20 3d 3e 20 7b 0a 20 20 6c 65 74 20 70 72 6f enderer,.guestId).=>.{...let.pro
38d80 78 79 20 3d 20 77 69 6e 64 6f 77 50 72 6f 78 69 65 73 5b 67 75 65 73 74 49 64 5d 0a 20 20 69 66 xy.=.windowProxies[guestId]...if
38da0 20 28 70 72 6f 78 79 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 70 72 6f 78 79 20 3d 20 6e .(proxy.==.null).{.....proxy.=.n
38dc0 65 77 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 50 72 6f 78 79 28 69 70 63 52 65 6e 64 65 72 65 ew.BrowserWindowProxy(ipcRendere
38de0 72 2c 20 67 75 65 73 74 49 64 29 0a 20 20 20 20 77 69 6e 64 6f 77 50 72 6f 78 69 65 73 5b 67 75 r,.guestId).....windowProxies[gu
38e00 65 73 74 49 64 5d 20 3d 20 70 72 6f 78 79 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 70 72 6f 78 estId].=.proxy...}...return.prox
38e20 79 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 6d 6f 76 65 50 72 6f 78 79 20 3d 20 28 67 75 65 73 74 49 y.}..const.removeProxy.=.(guestI
38e40 64 29 20 3d 3e 20 7b 0a 20 20 64 65 6c 65 74 65 20 77 69 6e 64 6f 77 50 72 6f 78 69 65 73 5b 67 d).=>.{...delete.windowProxies[g
38e60 75 65 73 74 49 64 5d 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 42 72 6f 77 73 65 72 57 69 6e 64 6f uestId].}..function.BrowserWindo
38e80 77 50 72 6f 78 79 20 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 67 75 65 73 74 49 64 29 20 7b 0a wProxy.(ipcRenderer,.guestId).{.
38ea0 20 20 74 68 69 73 2e 63 6c 6f 73 65 64 20 3d 20 66 61 6c 73 65 0a 0a 20 20 64 65 66 69 6e 65 50 ..this.closed.=.false....defineP
38ec0 72 6f 70 65 72 74 79 28 74 68 69 73 2c 20 27 6c 6f 63 61 74 69 6f 6e 27 2c 20 7b 0a 20 20 20 20 roperty(this,.'location',.{.....
38ee0 67 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 get:.function.().{.......return.
38f00 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 47 ipcRenderer.sendSync('ELECTRON_G
38f20 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 UEST_WINDOW_MANAGER_WEB_CONTENTS
38f40 5f 4d 45 54 48 4f 44 5f 53 59 4e 43 27 2c 20 67 75 65 73 74 49 64 2c 20 27 67 65 74 55 52 4c 27 _METHOD_SYNC',.guestId,.'getURL'
38f60 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 73 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 75 72 6c 29 ).....},.....set:.function.(url)
38f80 20 7b 0a 20 20 20 20 20 20 75 72 6c 20 3d 20 72 65 73 6f 6c 76 65 55 52 4c 28 75 72 6c 29 0a 20 .{.......url.=.resolveURL(url)..
38fa0 20 20 20 20 20 72 65 74 75 72 6e 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 .....return.ipcRenderer.sendSync
38fc0 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f ('ELECTRON_GUEST_WINDOW_MANAGER_
38fe0 57 45 42 5f 43 4f 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 5f 53 59 4e 43 27 2c 20 67 75 65 73 74 WEB_CONTENTS_METHOD_SYNC',.guest
39000 49 64 2c 20 27 6c 6f 61 64 55 52 4c 27 2c 20 75 72 6c 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a Id,.'loadURL',.url).....}...})..
39020 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 63 65 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 ..ipcRenderer.once(`ELECTRON_GUE
39040 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 43 4c 4f 53 45 44 5f ST_WINDOW_MANAGER_WINDOW_CLOSED_
39060 24 7b 67 75 65 73 74 49 64 7d 60 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 72 65 6d 6f 76 65 50 ${guestId}`,.().=>.{.....removeP
39080 72 6f 78 79 28 67 75 65 73 74 49 64 29 0a 20 20 20 20 74 68 69 73 2e 63 6c 6f 73 65 64 20 3d 20 roxy(guestId).....this.closed.=.
390a0 74 72 75 65 0a 20 20 7d 29 0a 0a 20 20 74 68 69 73 2e 63 6c 6f 73 65 20 3d 20 28 29 20 3d 3e 20 true...})....this.close.=.().=>.
390c0 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e {.....ipcRenderer.send('ELECTRON
390e0 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 43 4c 4f _GUEST_WINDOW_MANAGER_WINDOW_CLO
39100 53 45 27 2c 20 67 75 65 73 74 49 64 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 66 6f 63 75 73 20 SE',.guestId)...}....this.focus.
39120 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 =.().=>.{.....ipcRenderer.send('
39140 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 ELECTRON_GUEST_WINDOW_MANAGER_WI
39160 4e 44 4f 57 5f 4d 45 54 48 4f 44 27 2c 20 67 75 65 73 74 49 64 2c 20 27 66 6f 63 75 73 27 29 0a NDOW_METHOD',.guestId,.'focus').
39180 20 20 7d 0a 0a 20 20 74 68 69 73 2e 62 6c 75 72 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 ..}....this.blur.=.().=>.{.....i
391a0 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f pcRenderer.send('ELECTRON_GUEST_
391c0 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 4d 45 54 48 4f 44 27 2c 20 67 WINDOW_MANAGER_WINDOW_METHOD',.g
391e0 75 65 73 74 49 64 2c 20 27 62 6c 75 72 27 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 70 72 69 6e uestId,.'blur')...}....this.prin
39200 74 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 t.=.().=>.{.....ipcRenderer.send
39220 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f ('ELECTRON_GUEST_WINDOW_MANAGER_
39240 57 45 42 5f 43 4f 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 27 2c 20 67 75 65 73 74 49 64 2c 20 27 WEB_CONTENTS_METHOD',.guestId,.'
39260 70 72 69 6e 74 27 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 70 6f 73 74 4d 65 73 73 61 67 65 20 print')...}....this.postMessage.
39280 3d 20 28 6d 65 73 73 61 67 65 2c 20 74 61 72 67 65 74 4f 72 69 67 69 6e 29 20 3d 3e 20 7b 0a 20 =.(message,.targetOrigin).=>.{..
392a0 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 ...ipcRenderer.send('ELECTRON_GU
392c0 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 50 4f 53 54 4d 45 EST_WINDOW_MANAGER_WINDOW_POSTME
392e0 53 53 41 47 45 27 2c 20 67 75 65 73 74 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 74 6f 53 74 72 69 SSAGE',.guestId,.message,.toStri
39300 6e 67 28 74 61 72 67 65 74 4f 72 69 67 69 6e 29 2c 20 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f ng(targetOrigin),.window.locatio
39320 6e 2e 6f 72 69 67 69 6e 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 65 76 61 6c 20 3d 20 28 2e 2e n.origin)...}....this.eval.=.(..
39340 2e 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 .args).=>.{.....ipcRenderer.send
39360 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f ('ELECTRON_GUEST_WINDOW_MANAGER_
39380 57 45 42 5f 43 4f 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 27 2c 20 67 75 65 73 74 49 64 2c 20 27 WEB_CONTENTS_METHOD',.guestId,.'
393a0 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 27 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d executeJavaScript',....args)...}
393c0 0a 7d 0a 0a 2f 2f 20 46 6f 72 77 61 72 64 20 68 69 73 74 6f 72 79 20 6f 70 65 72 61 74 69 6f 6e .}..//.Forward.history.operation
393e0 73 20 74 6f 20 62 72 6f 77 73 65 72 2e 0a 63 6f 6e 73 74 20 73 65 6e 64 48 69 73 74 6f 72 79 4f s.to.browser..const.sendHistoryO
39400 70 65 72 61 74 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 70 63 52 65 6e 64 65 72 65 72 peration.=.function.(ipcRenderer
39420 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 ,....args).{...ipcRenderer.send(
39440 27 45 4c 45 43 54 52 4f 4e 5f 4e 41 56 49 47 41 54 49 4f 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 27 'ELECTRON_NAVIGATION_CONTROLLER'
39460 2c 20 2e 2e 2e 61 72 67 73 29 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 48 69 73 74 6f 72 79 4f 70 ,....args).}..const.getHistoryOp
39480 65 72 61 74 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 70 63 52 65 6e 64 65 72 65 72 2c eration.=.function.(ipcRenderer,
394a0 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 69 70 63 52 65 6e 64 65 72 65 72 ....args).{...return.ipcRenderer
394c0 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 53 59 4e 43 5f 4e 41 56 49 47 41 54 .sendSync('ELECTRON_SYNC_NAVIGAT
394e0 49 4f 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 27 2c 20 2e 2e 2e 61 72 67 73 29 0a 7d 0a 0a 6d 6f 64 ION_CONTROLLER',....args).}..mod
39500 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 67 75 65 73 ule.exports.=.(ipcRenderer,.gues
39520 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 6f 70 65 6e 65 72 49 64 2c 20 68 69 64 64 65 6e 50 61 67 tInstanceId,.openerId,.hiddenPag
39540 65 2c 20 75 73 65 73 4e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 29 20 3d 3e 20 7b 0a 20 20 e,.usesNativeWindowOpen).=>.{...
39560 69 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 if.(guestInstanceId.==.null).{..
39580 20 20 20 2f 2f 20 4f 76 65 72 72 69 64 65 20 64 65 66 61 75 6c 74 20 77 69 6e 64 6f 77 2e 63 6c ...//.Override.default.window.cl
395a0 6f 73 65 2e 0a 20 20 20 20 77 69 6e 64 6f 77 2e 63 6c 6f 73 65 20 3d 20 66 75 6e 63 74 69 6f 6e ose......window.close.=.function
395c0 20 28 29 20 7b 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 .().{.......ipcRenderer.sendSync
395e0 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 57 49 4e 44 4f 57 5f 43 4c 4f 53 45 27 ('ELECTRON_BROWSER_WINDOW_CLOSE'
39600 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 69 66 20 28 21 75 73 65 73 4e 61 74 69 76 65 57 69 ).....}...}....if.(!usesNativeWi
39620 6e 64 6f 77 4f 70 65 6e 29 20 7b 0a 20 20 20 20 2f 2f 20 4d 61 6b 65 20 74 68 65 20 62 72 6f 77 ndowOpen).{.....//.Make.the.brow
39640 73 65 72 20 77 69 6e 64 6f 77 20 6f 72 20 67 75 65 73 74 20 76 69 65 77 20 65 6d 69 74 20 22 6e ser.window.or.guest.view.emit."n
39660 65 77 2d 77 69 6e 64 6f 77 22 20 65 76 65 6e 74 2e 0a 20 20 20 20 77 69 6e 64 6f 77 2e 6f 70 65 ew-window".event......window.ope
39680 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 66 65 n.=.function.(url,.frameName,.fe
396a0 61 74 75 72 65 73 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 75 72 6c 20 21 3d 20 6e 75 6c 6c 20 atures).{.......if.(url.!=.null.
396c0 26 26 20 75 72 6c 20 21 3d 3d 20 27 27 29 20 7b 0a 20 20 20 20 20 20 20 20 75 72 6c 20 3d 20 72 &&.url.!==.'').{.........url.=.r
396e0 65 73 6f 6c 76 65 55 52 4c 28 75 72 6c 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 63 6f 6e esolveURL(url).......}.......con
39700 73 74 20 67 75 65 73 74 49 64 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e st.guestId.=.ipcRenderer.sendSyn
39720 63 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 c('ELECTRON_GUEST_WINDOW_MANAGER
39740 5f 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 20 75 72 6c 2c 20 74 6f 53 74 72 69 6e 67 28 66 72 61 _WINDOW_OPEN',.url,.toString(fra
39760 6d 65 4e 61 6d 65 29 2c 20 74 6f 53 74 72 69 6e 67 28 66 65 61 74 75 72 65 73 29 29 0a 20 20 20 meName),.toString(features))....
39780 20 20 20 69 66 20 28 67 75 65 73 74 49 64 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 ...if.(guestId.!=.null).{.......
397a0 20 20 72 65 74 75 72 6e 20 67 65 74 4f 72 43 72 65 61 74 65 50 72 6f 78 79 28 69 70 63 52 65 6e ..return.getOrCreateProxy(ipcRen
397c0 64 65 72 65 72 2c 20 67 75 65 73 74 49 64 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 derer,.guestId).......}.else.{..
397e0 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d .......return.null.......}.....}
39800 0a 0a 20 20 20 20 69 66 20 28 6f 70 65 6e 65 72 49 64 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 ......if.(openerId.!=.null).{...
39820 20 20 20 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 20 3d 20 67 65 74 4f 72 43 72 65 61 74 65 50 ....window.opener.=.getOrCreateP
39840 72 6f 78 79 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 6f 70 65 6e 65 72 49 64 29 0a 20 20 20 20 roxy(ipcRenderer,.openerId).....
39860 7d 0a 20 20 7d 0a 0a 20 20 77 69 6e 64 6f 77 2e 61 6c 65 72 74 20 3d 20 66 75 6e 63 74 69 6f 6e }...}....window.alert.=.function
39880 20 28 6d 65 73 73 61 67 65 2c 20 74 69 74 6c 65 29 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 .(message,.title).{.....ipcRende
398a0 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 57 rer.sendSync('ELECTRON_BROWSER_W
398c0 49 4e 44 4f 57 5f 41 4c 45 52 54 27 2c 20 74 6f 53 74 72 69 6e 67 28 6d 65 73 73 61 67 65 29 2c INDOW_ALERT',.toString(message),
398e0 20 74 6f 53 74 72 69 6e 67 28 74 69 74 6c 65 29 29 0a 20 20 7d 0a 0a 20 20 77 69 6e 64 6f 77 2e .toString(title))...}....window.
39900 63 6f 6e 66 69 72 6d 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 65 73 73 61 67 65 2c 20 74 69 74 confirm.=.function.(message,.tit
39920 6c 65 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e le).{.....return.ipcRenderer.sen
39940 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 57 49 4e 44 4f 57 5f 43 dSync('ELECTRON_BROWSER_WINDOW_C
39960 4f 4e 46 49 52 4d 27 2c 20 74 6f 53 74 72 69 6e 67 28 6d 65 73 73 61 67 65 29 2c 20 74 6f 53 74 ONFIRM',.toString(message),.toSt
39980 72 69 6e 67 28 74 69 74 6c 65 29 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 42 75 74 20 77 65 20 64 6f ring(title))...}....//.But.we.do
399a0 20 6e 6f 74 20 73 75 70 70 6f 72 74 20 70 72 6f 6d 70 74 28 29 2e 0a 20 20 77 69 6e 64 6f 77 2e .not.support.prompt()....window.
399c0 70 72 6f 6d 70 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 prompt.=.function.().{.....throw
399e0 20 6e 65 77 20 45 72 72 6f 72 28 27 70 72 6f 6d 70 74 28 29 20 69 73 20 61 6e 64 20 77 69 6c 6c .new.Error('prompt().is.and.will
39a00 20 6e 6f 74 20 62 65 20 73 75 70 70 6f 72 74 65 64 2e 27 29 0a 20 20 7d 0a 0a 20 20 69 70 63 52 .not.be.supported.')...}....ipcR
39a20 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f enderer.on('ELECTRON_GUEST_WINDO
39a40 57 5f 50 4f 53 54 4d 45 53 53 41 47 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c W_POSTMESSAGE',.function.(event,
39a60 20 73 6f 75 72 63 65 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 73 6f 75 72 63 65 4f 72 69 67 69 6e .sourceId,.message,.sourceOrigin
39a80 29 20 7b 0a 20 20 20 20 2f 2f 20 4d 61 6e 75 61 6c 6c 79 20 64 69 73 70 61 74 63 68 20 65 76 65 ).{.....//.Manually.dispatch.eve
39aa0 6e 74 20 69 6e 73 74 65 61 64 20 6f 66 20 75 73 69 6e 67 20 70 6f 73 74 4d 65 73 73 61 67 65 20 nt.instead.of.using.postMessage.
39ac0 62 65 63 61 75 73 65 20 77 65 20 61 6c 73 6f 20 6e 65 65 64 20 74 6f 0a 20 20 20 20 2f 2f 20 73 because.we.also.need.to.....//.s
39ae0 65 74 20 65 76 65 6e 74 2e 73 6f 75 72 63 65 2e 0a 20 20 20 20 65 76 65 6e 74 20 3d 20 64 6f 63 et.event.source......event.=.doc
39b00 75 6d 65 6e 74 2e 63 72 65 61 74 65 45 76 65 6e 74 28 27 45 76 65 6e 74 27 29 0a 20 20 20 20 65 ument.createEvent('Event').....e
39b20 76 65 6e 74 2e 69 6e 69 74 45 76 65 6e 74 28 27 6d 65 73 73 61 67 65 27 2c 20 66 61 6c 73 65 2c vent.initEvent('message',.false,
39b40 20 66 61 6c 73 65 29 0a 20 20 20 20 65 76 65 6e 74 2e 64 61 74 61 20 3d 20 6d 65 73 73 61 67 65 .false).....event.data.=.message
39b60 0a 20 20 20 20 65 76 65 6e 74 2e 6f 72 69 67 69 6e 20 3d 20 73 6f 75 72 63 65 4f 72 69 67 69 6e .....event.origin.=.sourceOrigin
39b80 0a 20 20 20 20 65 76 65 6e 74 2e 73 6f 75 72 63 65 20 3d 20 67 65 74 4f 72 43 72 65 61 74 65 50 .....event.source.=.getOrCreateP
39ba0 72 6f 78 79 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 73 6f 75 72 63 65 49 64 29 0a 20 20 20 20 roxy(ipcRenderer,.sourceId).....
39bc0 77 69 6e 64 6f 77 2e 64 69 73 70 61 74 63 68 45 76 65 6e 74 28 65 76 65 6e 74 29 0a 20 20 7d 29 window.dispatchEvent(event)...})
39be0 0a 0a 20 20 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 ....window.history.back.=.functi
39c00 6f 6e 20 28 29 20 7b 0a 20 20 20 20 73 65 6e 64 48 69 73 74 6f 72 79 4f 70 65 72 61 74 69 6f 6e on.().{.....sendHistoryOperation
39c20 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 27 67 6f 42 61 63 6b 27 29 0a 20 20 7d 0a 0a 20 20 77 (ipcRenderer,.'goBack')...}....w
39c40 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 66 6f 72 77 61 72 64 20 3d 20 66 75 6e 63 74 69 6f 6e indow.history.forward.=.function
39c60 20 28 29 20 7b 0a 20 20 20 20 73 65 6e 64 48 69 73 74 6f 72 79 4f 70 65 72 61 74 69 6f 6e 28 69 .().{.....sendHistoryOperation(i
39c80 70 63 52 65 6e 64 65 72 65 72 2c 20 27 67 6f 46 6f 72 77 61 72 64 27 29 0a 20 20 7d 0a 0a 20 20 pcRenderer,.'goForward')...}....
39ca0 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 67 6f 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 66 window.history.go.=.function.(of
39cc0 66 73 65 74 29 20 7b 0a 20 20 20 20 73 65 6e 64 48 69 73 74 6f 72 79 4f 70 65 72 61 74 69 6f 6e fset).{.....sendHistoryOperation
39ce0 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 27 67 6f 54 6f 4f 66 66 73 65 74 27 2c 20 2b 6f 66 66 (ipcRenderer,.'goToOffset',.+off
39d00 73 65 74 29 0a 20 20 7d 0a 0a 20 20 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 77 69 6e 64 6f set)...}....defineProperty(windo
39d20 77 2e 68 69 73 74 6f 72 79 2c 20 27 6c 65 6e 67 74 68 27 2c 20 7b 0a 20 20 20 20 67 65 74 3a 20 w.history,.'length',.{.....get:.
39d40 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 67 65 74 48 69 function.().{.......return.getHi
39d60 73 74 6f 72 79 4f 70 65 72 61 74 69 6f 6e 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 27 6c 65 6e storyOperation(ipcRenderer,.'len
39d80 67 74 68 27 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a 20 20 69 66 20 28 67 75 65 73 74 49 6e 73 gth').....}...})....if.(guestIns
39da0 74 61 6e 63 65 49 64 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 2f 2f 20 57 65 62 76 69 65 tanceId.!=.null).{.....//.Webvie
39dc0 77 20 60 64 6f 63 75 6d 65 6e 74 2e 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 60 20 74 72 61 w.`document.visibilityState`.tra
39de0 63 6b 73 20 77 69 6e 64 6f 77 20 76 69 73 69 62 69 6c 69 74 79 20 28 61 6e 64 20 69 67 6e 6f 72 cks.window.visibility.(and.ignor
39e00 65 73 0a 20 20 20 20 2f 2f 20 74 68 65 20 61 63 74 75 61 6c 20 3c 77 65 62 76 69 65 77 3e 20 65 es.....//.the.actual.<webview>.e
39e20 6c 65 6d 65 6e 74 20 76 69 73 69 62 69 6c 69 74 79 29 20 66 6f 72 20 62 61 63 6b 77 61 72 64 73 lement.visibility).for.backwards
39e40 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 2e 0a 20 20 20 20 2f 2f 20 53 65 65 20 64 69 73 63 75 .compatibility......//.See.discu
39e60 73 73 69 6f 6e 20 69 6e 20 23 39 31 37 38 2e 0a 20 20 20 20 2f 2f 0a 20 20 20 20 2f 2f 20 4e 6f ssion.in.#9178......//.....//.No
39e80 74 65 20 74 68 61 74 20 74 68 69 73 20 72 65 73 75 6c 74 73 20 69 6e 20 64 75 70 6c 69 63 61 74 te.that.this.results.in.duplicat
39ea0 65 20 76 69 73 69 62 69 6c 69 74 79 63 68 61 6e 67 65 20 65 76 65 6e 74 73 20 28 73 69 6e 63 65 e.visibilitychange.events.(since
39ec0 0a 20 20 20 20 2f 2f 20 43 68 72 6f 6d 69 75 6d 20 61 6c 73 6f 20 66 69 72 65 73 20 74 68 65 6d .....//.Chromium.also.fires.them
39ee0 29 20 61 6e 64 20 70 6f 74 65 6e 74 69 61 6c 6c 79 20 69 6e 63 6f 72 72 65 63 74 20 76 69 73 69 ).and.potentially.incorrect.visi
39f00 62 69 6c 69 74 79 20 63 68 61 6e 67 65 2e 0a 20 20 20 20 2f 2f 20 57 65 20 73 68 6f 75 6c 64 20 bility.change......//.We.should.
39f20 72 65 63 6f 6e 73 69 64 65 72 20 74 68 69 73 20 64 65 63 69 73 69 6f 6e 20 66 6f 72 20 45 6c 65 reconsider.this.decision.for.Ele
39f40 63 74 72 6f 6e 20 32 2e 30 2e 0a 20 20 20 20 6c 65 74 20 63 61 63 68 65 64 56 69 73 69 62 69 6c ctron.2.0......let.cachedVisibil
39f60 69 74 79 53 74 61 74 65 20 3d 20 68 69 64 64 65 6e 50 61 67 65 20 3f 20 27 68 69 64 64 65 6e 27 ityState.=.hiddenPage.?.'hidden'
39f80 20 3a 20 27 76 69 73 69 62 6c 65 27 0a 0a 20 20 20 20 2f 2f 20 53 75 62 73 63 72 69 62 65 20 74 .:.'visible'......//.Subscribe.t
39fa0 6f 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 63 68 61 6e 67 65 73 2e 0a 20 20 20 20 69 o.visibilityState.changes......i
39fc0 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 49 4e pcRenderer.on('ELECTRON_GUEST_IN
39fe0 53 54 41 4e 43 45 5f 56 49 53 49 42 49 4c 49 54 59 5f 43 48 41 4e 47 45 27 2c 20 66 75 6e 63 74 STANCE_VISIBILITY_CHANGE',.funct
3a000 69 6f 6e 20 28 65 76 65 6e 74 2c 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 29 20 7b 0a 20 ion.(event,.visibilityState).{..
3a020 20 20 20 20 20 69 66 20 28 63 61 63 68 65 64 56 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 21 .....if.(cachedVisibilityState.!
3a040 3d 3d 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 29 20 7b 0a 20 20 20 20 20 20 20 20 63 61 ==.visibilityState).{.........ca
3a060 63 68 65 64 56 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 3d 20 76 69 73 69 62 69 6c 69 74 79 chedVisibilityState.=.visibility
3a080 53 74 61 74 65 0a 20 20 20 20 20 20 20 20 64 6f 63 75 6d 65 6e 74 2e 64 69 73 70 61 74 63 68 45 State.........document.dispatchE
3a0a0 76 65 6e 74 28 6e 65 77 20 45 76 65 6e 74 28 27 76 69 73 69 62 69 6c 69 74 79 63 68 61 6e 67 65 vent(new.Event('visibilitychange
3a0c0 27 29 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 2f 2f 20 4d 61 6b 65 20 ')).......}.....})......//.Make.
3a0e0 64 6f 63 75 6d 65 6e 74 2e 68 69 64 64 65 6e 20 61 6e 64 20 64 6f 63 75 6d 65 6e 74 2e 76 69 73 document.hidden.and.document.vis
3a100 69 62 69 6c 69 74 79 53 74 61 74 65 20 72 65 74 75 72 6e 20 74 68 65 20 63 6f 72 72 65 63 74 20 ibilityState.return.the.correct.
3a120 76 61 6c 75 65 2e 0a 20 20 20 20 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 64 6f 63 75 6d 65 value......defineProperty(docume
3a140 6e 74 2c 20 27 68 69 64 64 65 6e 27 2c 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 66 75 6e 63 74 nt,.'hidden',.{.......get:.funct
3a160 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 63 68 65 64 56 69 ion.().{.........return.cachedVi
3a180 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 21 3d 3d 20 27 76 69 73 69 62 6c 65 27 0a 20 20 20 20 sibilityState.!==.'visible'.....
3a1a0 20 20 7d 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 64 ..}.....})......defineProperty(d
3a1c0 6f 63 75 6d 65 6e 74 2c 20 27 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 27 2c 20 7b 0a 20 20 ocument,.'visibilityState',.{...
3a1e0 20 20 20 20 67 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 20 20 72 ....get:.function.().{.........r
3a200 65 74 75 72 6e 20 63 61 63 68 65 64 56 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 0a 20 20 20 20 eturn.cachedVisibilityState.....
3a220 20 20 7d 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 ..}.....})...}.}.'use.strict'..c
3a240 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 onst.path.=.require('path').cons
3a260 74 20 4d 6f 64 75 6c 65 20 3d 20 72 65 71 75 69 72 65 28 27 6d 6f 64 75 6c 65 27 29 0a 0a 2f 2f t.Module.=.require('module')..//
3a280 20 57 65 20 6d 6f 64 69 66 69 65 64 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 72 6f 63 65 73 .We.modified.the.original.proces
3a2a0 73 2e 61 72 67 76 20 74 6f 20 6c 65 74 20 6e 6f 64 65 2e 6a 73 20 6c 6f 61 64 20 74 68 65 0a 2f s.argv.to.let.node.js.load.the./
3a2c0 2f 20 69 6e 69 74 2e 6a 73 2c 20 77 65 20 6e 65 65 64 20 74 6f 20 72 65 73 74 6f 72 65 20 69 74 /.init.js,.we.need.to.restore.it
3a2e0 20 68 65 72 65 2e 0a 70 72 6f 63 65 73 73 2e 61 72 67 76 2e 73 70 6c 69 63 65 28 31 2c 20 31 29 .here..process.argv.splice(1,.1)
3a300 0a 0a 2f 2f 20 43 6c 65 61 72 20 73 65 61 72 63 68 20 70 61 74 68 73 2e 0a 72 65 71 75 69 72 65 ..//.Clear.search.paths..require
3a320 28 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 72 65 73 65 74 2d 73 65 61 72 63 68 2d 70 61 74 68 73 27 29 ('../common/reset-search-paths')
3a340 0a 0a 2f 2f 20 49 6d 70 6f 72 74 20 63 6f 6d 6d 6f 6e 20 73 65 74 74 69 6e 67 73 2e 0a 72 65 71 ..//.Import.common.settings..req
3a360 75 69 72 65 28 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 69 6e 69 74 27 29 0a 0a 2f 2f 20 45 78 70 6f 73 uire('../common/init')..//.Expos
3a380 65 20 70 75 62 6c 69 63 20 41 50 49 73 2e 0a 4d 6f 64 75 6c 65 2e 67 6c 6f 62 61 6c 50 61 74 68 e.public.APIs..Module.globalPath
3a3a0 73 2e 70 75 73 68 28 70 61 74 68 2e 6a 6f 69 6e 28 5f 5f 64 69 72 6e 61 6d 65 2c 20 27 61 70 69 s.push(path.join(__dirname,.'api
3a3c0 27 2c 20 27 65 78 70 6f 72 74 73 27 29 29 0a 0a 2f 2f 20 45 78 70 6f 72 74 20 6e 6f 64 65 20 62 ',.'exports'))..//.Export.node.b
3a3e0 69 6e 64 69 6e 67 73 20 74 6f 20 67 6c 6f 62 61 6c 2e 0a 67 6c 6f 62 61 6c 2e 72 65 71 75 69 72 indings.to.global..global.requir
3a400 65 20 3d 20 72 65 71 75 69 72 65 0a 67 6c 6f 62 61 6c 2e 6d 6f 64 75 6c 65 20 3d 20 6d 6f 64 75 e.=.require.global.module.=.modu
3a420 6c 65 0a 0a 2f 2f 20 53 65 74 20 74 68 65 20 5f 5f 66 69 6c 65 6e 61 6d 65 20 74 6f 20 74 68 65 le..//.Set.the.__filename.to.the
3a440 20 70 61 74 68 20 6f 66 20 68 74 6d 6c 20 66 69 6c 65 20 69 66 20 69 74 20 69 73 20 66 69 6c 65 .path.of.html.file.if.it.is.file
3a460 3a 20 70 72 6f 74 6f 63 6f 6c 2e 0a 69 66 20 28 73 65 6c 66 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 :.protocol..if.(self.location.pr
3a480 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 66 69 6c 65 3a 27 29 20 7b 0a 20 20 6c 65 74 20 70 61 74 68 otocol.===.'file:').{...let.path
3a4a0 6e 61 6d 65 20 3d 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e name.=.process.platform.===.'win
3a4c0 33 32 27 20 26 26 20 73 65 6c 66 2e 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e 61 6d 65 5b 30 5d 32'.&&.self.location.pathname[0]
3a4e0 20 3d 3d 3d 20 27 2f 27 20 3f 20 73 65 6c 66 2e 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e 61 6d .===.'/'.?.self.location.pathnam
3a500 65 2e 73 75 62 73 74 72 28 31 29 20 3a 20 73 65 6c 66 2e 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 e.substr(1).:.self.location.path
3a520 6e 61 6d 65 0a 20 20 67 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 20 3d 20 70 61 74 68 2e name...global.__filename.=.path.
3a540 6e 6f 72 6d 61 6c 69 7a 65 28 64 65 63 6f 64 65 55 52 49 43 6f 6d 70 6f 6e 65 6e 74 28 70 61 74 normalize(decodeURIComponent(pat
3a560 68 6e 61 6d 65 29 29 0a 20 20 67 6c 6f 62 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 20 3d 20 70 61 74 hname))...global.__dirname.=.pat
3a580 68 2e 64 69 72 6e 61 6d 65 28 67 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 29 0a 0a 20 20 h.dirname(global.__filename)....
3a5a0 2f 2f 20 53 65 74 20 6d 6f 64 75 6c 65 27 73 20 66 69 6c 65 6e 61 6d 65 20 73 6f 20 72 65 6c 61 //.Set.module's.filename.so.rela
3a5c0 74 69 76 65 20 72 65 71 75 69 72 65 20 63 61 6e 20 77 6f 72 6b 20 61 73 20 65 78 70 65 63 74 65 tive.require.can.work.as.expecte
3a5e0 64 2e 0a 20 20 6d 6f 64 75 6c 65 2e 66 69 6c 65 6e 61 6d 65 20 3d 20 67 6c 6f 62 61 6c 2e 5f 5f d....module.filename.=.global.__
3a600 66 69 6c 65 6e 61 6d 65 0a 0a 20 20 2f 2f 20 41 6c 73 6f 20 73 65 61 72 63 68 20 66 6f 72 20 6d filename....//.Also.search.for.m
3a620 6f 64 75 6c 65 20 75 6e 64 65 72 20 74 68 65 20 68 74 6d 6c 20 66 69 6c 65 2e 0a 20 20 6d 6f 64 odule.under.the.html.file....mod
3a640 75 6c 65 2e 70 61 74 68 73 20 3d 20 6d 6f 64 75 6c 65 2e 70 61 74 68 73 2e 63 6f 6e 63 61 74 28 ule.paths.=.module.paths.concat(
3a660 4d 6f 64 75 6c 65 2e 5f 6e 6f 64 65 4d 6f 64 75 6c 65 50 61 74 68 73 28 67 6c 6f 62 61 6c 2e 5f Module._nodeModulePaths(global._
3a680 5f 64 69 72 6e 61 6d 65 29 29 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 67 6c 6f 62 61 6c 2e 5f 5f 66 _dirname)).}.else.{...global.__f
3a6a0 69 6c 65 6e 61 6d 65 20 3d 20 5f 5f 66 69 6c 65 6e 61 6d 65 0a 20 20 67 6c 6f 62 61 6c 2e 5f 5f ilename.=.__filename...global.__
3a6c0 64 69 72 6e 61 6d 65 20 3d 20 5f 5f 64 69 72 6e 61 6d 65 0a 7d 0a dirname.=.__dirname.}.