ox 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (756) hide show
  1. package/Abi/package.json +6 -0
  2. package/Abi.ts +163 -0
  3. package/AbiConstructor/package.json +6 -0
  4. package/AbiConstructor.ts +413 -0
  5. package/AbiError/package.json +6 -0
  6. package/AbiError.ts +719 -0
  7. package/AbiEvent/package.json +6 -0
  8. package/AbiEvent.ts +1284 -0
  9. package/AbiFunction/package.json +6 -0
  10. package/AbiFunction.ts +813 -0
  11. package/AbiItem/package.json +6 -0
  12. package/AbiItem.ts +779 -0
  13. package/AbiParameters/package.json +6 -0
  14. package/AbiParameters.ts +712 -0
  15. package/AccessList/package.json +6 -0
  16. package/AccessList.ts +124 -0
  17. package/AccountProof/package.json +6 -0
  18. package/AccountProof.ts +35 -0
  19. package/Address/package.json +6 -0
  20. package/Address.ts +359 -0
  21. package/AesGcm/package.json +6 -0
  22. package/AesGcm.ts +220 -0
  23. package/Authorization/package.json +6 -0
  24. package/Authorization.ts +639 -0
  25. package/Base58/package.json +6 -0
  26. package/Base58.ts +180 -0
  27. package/Base64/package.json +6 -0
  28. package/Base64.ts +333 -0
  29. package/Blobs/package.json +6 -0
  30. package/Blobs.ts +982 -0
  31. package/Block/package.json +6 -0
  32. package/Block.ts +317 -0
  33. package/Bloom/package.json +6 -0
  34. package/Bloom.ts +80 -0
  35. package/Bls/package.json +6 -0
  36. package/Bls.ts +496 -0
  37. package/BlsPoint/package.json +6 -0
  38. package/BlsPoint.ts +232 -0
  39. package/Bytes/package.json +6 -0
  40. package/Bytes.ts +963 -0
  41. package/CHANGELOG.md +7 -0
  42. package/Caches/package.json +6 -0
  43. package/Caches.ts +21 -0
  44. package/ContractAddress/package.json +6 -0
  45. package/ContractAddress.ts +181 -0
  46. package/Ens/package.json +6 -0
  47. package/Ens.ts +116 -0
  48. package/Errors/package.json +6 -0
  49. package/Errors.ts +95 -0
  50. package/Fee/package.json +6 -0
  51. package/Fee.ts +57 -0
  52. package/Filter/package.json +6 -0
  53. package/Filter.ts +144 -0
  54. package/Hash/package.json +6 -0
  55. package/Hash.ts +210 -0
  56. package/HdKey/package.json +6 -0
  57. package/HdKey.ts +175 -0
  58. package/Hex/package.json +6 -0
  59. package/Hex.ts +1040 -0
  60. package/Json/package.json +6 -0
  61. package/Json.ts +84 -0
  62. package/Kzg/package.json +6 -0
  63. package/Kzg.ts +51 -0
  64. package/LICENSE +21 -0
  65. package/Log/package.json +6 -0
  66. package/Log.ts +248 -0
  67. package/Mnemonic/package.json +6 -0
  68. package/Mnemonic.ts +249 -0
  69. package/P256/package.json +6 -0
  70. package/P256.ts +230 -0
  71. package/PersonalMessage/package.json +6 -0
  72. package/PersonalMessage.ts +70 -0
  73. package/Provider/package.json +6 -0
  74. package/Provider.ts +354 -0
  75. package/PublicKey/package.json +6 -0
  76. package/PublicKey.ts +545 -0
  77. package/README.md +75 -26
  78. package/Rlp/package.json +6 -0
  79. package/Rlp.ts +390 -0
  80. package/RpcRequest/package.json +6 -0
  81. package/RpcRequest.ts +192 -0
  82. package/RpcResponse/package.json +6 -0
  83. package/RpcResponse.ts +389 -0
  84. package/RpcSchema/package.json +6 -0
  85. package/RpcSchema.ts +273 -0
  86. package/RpcTransport/package.json +6 -0
  87. package/RpcTransport.ts +198 -0
  88. package/Secp256k1/package.json +6 -0
  89. package/Secp256k1.ts +304 -0
  90. package/Signature/package.json +6 -0
  91. package/Signature.ts +909 -0
  92. package/Siwe/package.json +6 -0
  93. package/Siwe.ts +516 -0
  94. package/Solidity/package.json +6 -0
  95. package/Solidity.ts +109 -0
  96. package/Transaction/package.json +6 -0
  97. package/Transaction.ts +429 -0
  98. package/TransactionEnvelope/package.json +6 -0
  99. package/TransactionEnvelope.ts +205 -0
  100. package/TransactionEnvelopeEip1559/package.json +6 -0
  101. package/TransactionEnvelopeEip1559.ts +656 -0
  102. package/TransactionEnvelopeEip2930/package.json +6 -0
  103. package/TransactionEnvelopeEip2930.ts +624 -0
  104. package/TransactionEnvelopeEip4844/package.json +6 -0
  105. package/TransactionEnvelopeEip4844.ts +764 -0
  106. package/TransactionEnvelopeEip7702/package.json +6 -0
  107. package/TransactionEnvelopeEip7702.ts +639 -0
  108. package/TransactionEnvelopeLegacy/package.json +6 -0
  109. package/TransactionEnvelopeLegacy.ts +674 -0
  110. package/TransactionReceipt/package.json +6 -0
  111. package/TransactionReceipt.ts +341 -0
  112. package/TransactionRequest/package.json +6 -0
  113. package/TransactionRequest.ts +151 -0
  114. package/TypedData/package.json +6 -0
  115. package/TypedData.ts +931 -0
  116. package/ValidatorData/package.json +6 -0
  117. package/ValidatorData.ts +87 -0
  118. package/Value/package.json +6 -0
  119. package/Value.ts +242 -0
  120. package/WebAuthnP256/package.json +6 -0
  121. package/WebAuthnP256.ts +803 -0
  122. package/WebCryptoP256/package.json +6 -0
  123. package/WebCryptoP256.ts +190 -0
  124. package/Withdrawal/package.json +6 -0
  125. package/Withdrawal.ts +95 -0
  126. package/_cjs/Abi.js +17 -0
  127. package/_cjs/Abi.js.map +1 -0
  128. package/_cjs/AbiConstructor.js +42 -0
  129. package/_cjs/AbiConstructor.js.map +1 -0
  130. package/_cjs/AbiError.js +98 -0
  131. package/_cjs/AbiError.js.map +1 -0
  132. package/_cjs/AbiEvent.js +338 -0
  133. package/_cjs/AbiEvent.js.map +1 -0
  134. package/_cjs/AbiFunction.js +85 -0
  135. package/_cjs/AbiFunction.js.map +1 -0
  136. package/_cjs/AbiItem.js +180 -0
  137. package/_cjs/AbiItem.js.map +1 -0
  138. package/_cjs/AbiParameters.js +229 -0
  139. package/_cjs/AbiParameters.js.map +1 -0
  140. package/_cjs/AccessList.js +51 -0
  141. package/_cjs/AccessList.js.map +1 -0
  142. package/_cjs/AccountProof.js +3 -0
  143. package/_cjs/AccountProof.js.map +1 -0
  144. package/_cjs/Address.js +121 -0
  145. package/_cjs/Address.js.map +1 -0
  146. package/_cjs/AesGcm.js +55 -0
  147. package/_cjs/AesGcm.js.map +1 -0
  148. package/_cjs/Authorization.js +99 -0
  149. package/_cjs/Authorization.js.map +1 -0
  150. package/_cjs/Base58.js +52 -0
  151. package/_cjs/Base58.js.map +1 -0
  152. package/_cjs/Base64.js +76 -0
  153. package/_cjs/Base64.js.map +1 -0
  154. package/_cjs/Blobs.js +255 -0
  155. package/_cjs/Blobs.js.map +1 -0
  156. package/_cjs/Block.js +87 -0
  157. package/_cjs/Block.js.map +1 -0
  158. package/_cjs/Bloom.js +23 -0
  159. package/_cjs/Bloom.js.map +1 -0
  160. package/_cjs/Bls.js +79 -0
  161. package/_cjs/Bls.js.map +1 -0
  162. package/_cjs/BlsPoint.js +32 -0
  163. package/_cjs/BlsPoint.js.map +1 -0
  164. package/_cjs/Bytes.js +279 -0
  165. package/_cjs/Bytes.js.map +1 -0
  166. package/_cjs/Caches.js +14 -0
  167. package/_cjs/Caches.js.map +1 -0
  168. package/_cjs/ContractAddress.js +39 -0
  169. package/_cjs/ContractAddress.js.map +1 -0
  170. package/_cjs/Ens.js +37 -0
  171. package/_cjs/Ens.js.map +1 -0
  172. package/_cjs/Errors.js +99 -0
  173. package/_cjs/Errors.js.map +1 -0
  174. package/_cjs/Fee.js +3 -0
  175. package/_cjs/Fee.js.map +1 -0
  176. package/_cjs/Filter.js +43 -0
  177. package/_cjs/Filter.js.map +1 -0
  178. package/_cjs/Hash.js +40 -0
  179. package/_cjs/Hash.js.map +1 -0
  180. package/_cjs/HdKey.js +30 -0
  181. package/_cjs/HdKey.js.map +1 -0
  182. package/_cjs/Hex.js +324 -0
  183. package/_cjs/Hex.js.map +1 -0
  184. package/_cjs/Json.js +25 -0
  185. package/_cjs/Json.js.map +1 -0
  186. package/_cjs/Kzg.js +14 -0
  187. package/_cjs/Kzg.js.map +1 -0
  188. package/_cjs/Log.js +35 -0
  189. package/_cjs/Log.js.map +1 -0
  190. package/_cjs/Mnemonic.js +56 -0
  191. package/_cjs/Mnemonic.js.map +1 -0
  192. package/_cjs/P256.js +52 -0
  193. package/_cjs/P256.js.map +1 -0
  194. package/_cjs/PersonalMessage.js +16 -0
  195. package/_cjs/PersonalMessage.js.map +1 -0
  196. package/_cjs/Provider.js +90 -0
  197. package/_cjs/Provider.js.map +1 -0
  198. package/_cjs/PublicKey.js +192 -0
  199. package/_cjs/PublicKey.js.map +1 -0
  200. package/_cjs/Rlp.js +179 -0
  201. package/_cjs/Rlp.js.map +1 -0
  202. package/_cjs/RpcRequest.js +27 -0
  203. package/_cjs/RpcRequest.js.map +1 -0
  204. package/_cjs/RpcResponse.js +368 -0
  205. package/_cjs/RpcResponse.js.map +1 -0
  206. package/_cjs/RpcSchema.js +7 -0
  207. package/_cjs/RpcSchema.js.map +1 -0
  208. package/_cjs/RpcTransport.js +95 -0
  209. package/_cjs/RpcTransport.js.map +1 -0
  210. package/_cjs/Secp256k1.js +57 -0
  211. package/_cjs/Secp256k1.js.map +1 -0
  212. package/_cjs/Signature.js +305 -0
  213. package/_cjs/Signature.js.map +1 -0
  214. package/_cjs/Siwe.js +231 -0
  215. package/_cjs/Siwe.js.map +1 -0
  216. package/_cjs/Solidity.js +104 -0
  217. package/_cjs/Solidity.js.map +1 -0
  218. package/_cjs/Transaction.js +106 -0
  219. package/_cjs/Transaction.js.map +1 -0
  220. package/_cjs/TransactionEnvelope.js +80 -0
  221. package/_cjs/TransactionEnvelope.js.map +1 -0
  222. package/_cjs/TransactionEnvelopeEip1559.js +182 -0
  223. package/_cjs/TransactionEnvelopeEip1559.js.map +1 -0
  224. package/_cjs/TransactionEnvelopeEip2930.js +166 -0
  225. package/_cjs/TransactionEnvelopeEip2930.js.map +1 -0
  226. package/_cjs/TransactionEnvelopeEip4844.js +224 -0
  227. package/_cjs/TransactionEnvelopeEip4844.js.map +1 -0
  228. package/_cjs/TransactionEnvelopeEip7702.js +156 -0
  229. package/_cjs/TransactionEnvelopeEip7702.js.map +1 -0
  230. package/_cjs/TransactionEnvelopeLegacy.js +221 -0
  231. package/_cjs/TransactionEnvelopeLegacy.js.map +1 -0
  232. package/_cjs/TransactionReceipt.js +76 -0
  233. package/_cjs/TransactionReceipt.js.map +1 -0
  234. package/_cjs/TransactionRequest.js +51 -0
  235. package/_cjs/TransactionRequest.js.map +1 -0
  236. package/_cjs/TypedData.js +318 -0
  237. package/_cjs/TypedData.js.map +1 -0
  238. package/_cjs/ValidatorData.js +16 -0
  239. package/_cjs/ValidatorData.js.map +1 -0
  240. package/_cjs/Value.js +96 -0
  241. package/_cjs/Value.js.map +1 -0
  242. package/_cjs/WebAuthnP256.js +245 -0
  243. package/_cjs/WebAuthnP256.js.map +1 -0
  244. package/_cjs/WebCryptoP256.js +46 -0
  245. package/_cjs/WebCryptoP256.js.map +1 -0
  246. package/_cjs/Withdrawal.js +24 -0
  247. package/_cjs/Withdrawal.js.map +1 -0
  248. package/_cjs/index.js +66 -0
  249. package/_cjs/index.js.map +1 -0
  250. package/_cjs/internal/abi.js +11 -0
  251. package/_cjs/internal/abi.js.map +1 -0
  252. package/_cjs/internal/abiConstructor.js +3 -0
  253. package/_cjs/internal/abiConstructor.js.map +1 -0
  254. package/_cjs/internal/abiError.js +3 -0
  255. package/_cjs/internal/abiError.js.map +1 -0
  256. package/_cjs/internal/abiEvent.js +3 -0
  257. package/_cjs/internal/abiEvent.js.map +1 -0
  258. package/_cjs/internal/abiFunction.js +3 -0
  259. package/_cjs/internal/abiFunction.js.map +1 -0
  260. package/_cjs/internal/abiItem.js +110 -0
  261. package/_cjs/internal/abiItem.js.map +1 -0
  262. package/_cjs/internal/abiParameters.js +376 -0
  263. package/_cjs/internal/abiParameters.js.map +1 -0
  264. package/_cjs/internal/base58.js +89 -0
  265. package/_cjs/internal/base58.js.map +1 -0
  266. package/_cjs/internal/bytes.js +88 -0
  267. package/_cjs/internal/bytes.js.map +1 -0
  268. package/_cjs/internal/cursor.js +210 -0
  269. package/_cjs/internal/cursor.js.map +1 -0
  270. package/_cjs/internal/ens.js +43 -0
  271. package/_cjs/internal/ens.js.map +1 -0
  272. package/_cjs/internal/errors.js +28 -0
  273. package/_cjs/internal/errors.js.map +1 -0
  274. package/_cjs/internal/hdKey.js +19 -0
  275. package/_cjs/internal/hdKey.js.map +1 -0
  276. package/_cjs/internal/hex.js +66 -0
  277. package/_cjs/internal/hex.js.map +1 -0
  278. package/_cjs/internal/lru.js +34 -0
  279. package/_cjs/internal/lru.js.map +1 -0
  280. package/_cjs/internal/mnemonic/wordlists.js +24 -0
  281. package/_cjs/internal/mnemonic/wordlists.js.map +1 -0
  282. package/_cjs/internal/promise.js +49 -0
  283. package/_cjs/internal/promise.js.map +1 -0
  284. package/_cjs/internal/register.js +3 -0
  285. package/_cjs/internal/register.js.map +1 -0
  286. package/_cjs/internal/rpcSchema.js +3 -0
  287. package/_cjs/internal/rpcSchema.js.map +1 -0
  288. package/_cjs/internal/rpcSchemas/eth.js +3 -0
  289. package/_cjs/internal/rpcSchemas/eth.js.map +1 -0
  290. package/_cjs/internal/rpcSchemas/wallet.js +3 -0
  291. package/_cjs/internal/rpcSchemas/wallet.js.map +1 -0
  292. package/_cjs/internal/rpcTransport.js +19 -0
  293. package/_cjs/internal/rpcTransport.js.map +1 -0
  294. package/_cjs/internal/types.js +3 -0
  295. package/_cjs/internal/types.js.map +1 -0
  296. package/_cjs/internal/uid.js +17 -0
  297. package/_cjs/internal/uid.js.map +1 -0
  298. package/_cjs/internal/webauthn.js +28 -0
  299. package/_cjs/internal/webauthn.js.map +1 -0
  300. package/_cjs/package.json +1 -0
  301. package/_cjs/trusted-setups/Paths.js +6 -0
  302. package/_cjs/trusted-setups/Paths.js.map +1 -0
  303. package/_cjs/trusted-setups/index.js +5 -0
  304. package/_cjs/trusted-setups/index.js.map +1 -0
  305. package/_cjs/trusted-setups/internal/paths.js +11 -0
  306. package/_cjs/trusted-setups/internal/paths.js.map +1 -0
  307. package/_cjs/version.js +5 -0
  308. package/_cjs/version.js.map +1 -0
  309. package/_cjs/window/index.js +3 -0
  310. package/_cjs/window/index.js.map +1 -0
  311. package/_esm/Abi.js +19 -0
  312. package/_esm/Abi.js.map +1 -0
  313. package/_esm/AbiConstructor.js +102 -0
  314. package/_esm/AbiConstructor.js.map +1 -0
  315. package/_esm/AbiError.js +364 -0
  316. package/_esm/AbiError.js.map +1 -0
  317. package/_esm/AbiEvent.js +1038 -0
  318. package/_esm/AbiEvent.js.map +1 -0
  319. package/_esm/AbiFunction.js +549 -0
  320. package/_esm/AbiFunction.js.map +1 -0
  321. package/_esm/AbiItem.js +574 -0
  322. package/_esm/AbiItem.js.map +1 -0
  323. package/_esm/AbiParameters.js +543 -0
  324. package/_esm/AbiParameters.js.map +1 -0
  325. package/_esm/AccessList.js +105 -0
  326. package/_esm/AccessList.js.map +1 -0
  327. package/_esm/AccountProof.js +2 -0
  328. package/_esm/AccountProof.js.map +1 -0
  329. package/_esm/Address.js +268 -0
  330. package/_esm/Address.js.map +1 -0
  331. package/_esm/AesGcm.js +124 -0
  332. package/_esm/AesGcm.js.map +1 -0
  333. package/_esm/Authorization.js +441 -0
  334. package/_esm/Authorization.js.map +1 -0
  335. package/_esm/Base58.js +142 -0
  336. package/_esm/Base58.js.map +1 -0
  337. package/_esm/Base64.js +236 -0
  338. package/_esm/Base64.js.map +1 -0
  339. package/_esm/Blobs.js +624 -0
  340. package/_esm/Blobs.js.map +1 -0
  341. package/_esm/Block.js +177 -0
  342. package/_esm/Block.js.map +1 -0
  343. package/_esm/Bloom.js +57 -0
  344. package/_esm/Bloom.js.map +1 -0
  345. package/_esm/Bls.js +141 -0
  346. package/_esm/Bls.js.map +1 -0
  347. package/_esm/BlsPoint.js +59 -0
  348. package/_esm/BlsPoint.js.map +1 -0
  349. package/_esm/Bytes.js +719 -0
  350. package/_esm/Bytes.js.map +1 -0
  351. package/_esm/Caches.js +19 -0
  352. package/_esm/Caches.js.map +1 -0
  353. package/_esm/ContractAddress.js +110 -0
  354. package/_esm/ContractAddress.js.map +1 -0
  355. package/_esm/Ens.js +84 -0
  356. package/_esm/Ens.js.map +1 -0
  357. package/_esm/Errors.js +105 -0
  358. package/_esm/Errors.js.map +1 -0
  359. package/_esm/Fee.js +2 -0
  360. package/_esm/Fee.js.map +1 -0
  361. package/_esm/Filter.js +100 -0
  362. package/_esm/Filter.js.map +1 -0
  363. package/_esm/Hash.js +126 -0
  364. package/_esm/Hash.js.map +1 -0
  365. package/_esm/HdKey.js +107 -0
  366. package/_esm/HdKey.js.map +1 -0
  367. package/_esm/Hex.js +763 -0
  368. package/_esm/Hex.js.map +1 -0
  369. package/_esm/Json.js +62 -0
  370. package/_esm/Json.js.map +1 -0
  371. package/_esm/Kzg.js +30 -0
  372. package/_esm/Kzg.js.map +1 -0
  373. package/_esm/Log.js +181 -0
  374. package/_esm/Log.js.map +1 -0
  375. package/_esm/Mnemonic.js +154 -0
  376. package/_esm/Mnemonic.js.map +1 -0
  377. package/_esm/P256.js +131 -0
  378. package/_esm/P256.js.map +1 -0
  379. package/_esm/PersonalMessage.js +46 -0
  380. package/_esm/PersonalMessage.js.map +1 -0
  381. package/_esm/Provider.js +122 -0
  382. package/_esm/Provider.js.map +1 -0
  383. package/_esm/PublicKey.js +395 -0
  384. package/_esm/PublicKey.js.map +1 -0
  385. package/_esm/Rlp.js +267 -0
  386. package/_esm/Rlp.js.map +1 -0
  387. package/_esm/RpcRequest.js +131 -0
  388. package/_esm/RpcRequest.js.map +1 -0
  389. package/_esm/RpcResponse.js +457 -0
  390. package/_esm/RpcResponse.js.map +1 -0
  391. package/_esm/RpcSchema.js +46 -0
  392. package/_esm/RpcSchema.js.map +1 -0
  393. package/_esm/RpcTransport.js +110 -0
  394. package/_esm/RpcTransport.js.map +1 -0
  395. package/_esm/Secp256k1.js +173 -0
  396. package/_esm/Secp256k1.js.map +1 -0
  397. package/_esm/Signature.js +696 -0
  398. package/_esm/Signature.js.map +1 -0
  399. package/_esm/Siwe.js +374 -0
  400. package/_esm/Siwe.js.map +1 -0
  401. package/_esm/Solidity.js +104 -0
  402. package/_esm/Solidity.js.map +1 -0
  403. package/_esm/Transaction.js +176 -0
  404. package/_esm/Transaction.js.map +1 -0
  405. package/_esm/TransactionEnvelope.js +139 -0
  406. package/_esm/TransactionEnvelope.js.map +1 -0
  407. package/_esm/TransactionEnvelopeEip1559.js +455 -0
  408. package/_esm/TransactionEnvelopeEip1559.js.map +1 -0
  409. package/_esm/TransactionEnvelopeEip2930.js +439 -0
  410. package/_esm/TransactionEnvelopeEip2930.js.map +1 -0
  411. package/_esm/TransactionEnvelopeEip4844.js +542 -0
  412. package/_esm/TransactionEnvelopeEip4844.js.map +1 -0
  413. package/_esm/TransactionEnvelopeEip7702.js +442 -0
  414. package/_esm/TransactionEnvelopeEip7702.js.map +1 -0
  415. package/_esm/TransactionEnvelopeLegacy.js +495 -0
  416. package/_esm/TransactionEnvelopeLegacy.js.map +1 -0
  417. package/_esm/TransactionReceipt.js +229 -0
  418. package/_esm/TransactionReceipt.js.map +1 -0
  419. package/_esm/TransactionRequest.js +89 -0
  420. package/_esm/TransactionRequest.js.map +1 -0
  421. package/_esm/TypedData.js +635 -0
  422. package/_esm/TypedData.js.map +1 -0
  423. package/_esm/ValidatorData.js +52 -0
  424. package/_esm/ValidatorData.js.map +1 -0
  425. package/_esm/Value.js +196 -0
  426. package/_esm/Value.js.map +1 -0
  427. package/_esm/WebAuthnP256.js +471 -0
  428. package/_esm/WebAuthnP256.js.map +1 -0
  429. package/_esm/WebCryptoP256.js +116 -0
  430. package/_esm/WebCryptoP256.js.map +1 -0
  431. package/_esm/Withdrawal.js +72 -0
  432. package/_esm/Withdrawal.js.map +1 -0
  433. package/_esm/index.js +3366 -0
  434. package/_esm/index.js.map +1 -0
  435. package/_esm/internal/abi.js +9 -0
  436. package/_esm/internal/abi.js.map +1 -0
  437. package/_esm/internal/abiConstructor.js +2 -0
  438. package/_esm/internal/abiConstructor.js.map +1 -0
  439. package/_esm/internal/abiError.js +2 -0
  440. package/_esm/internal/abiError.js.map +1 -0
  441. package/_esm/internal/abiEvent.js +2 -0
  442. package/_esm/internal/abiEvent.js.map +1 -0
  443. package/_esm/internal/abiFunction.js +2 -0
  444. package/_esm/internal/abiFunction.js.map +1 -0
  445. package/_esm/internal/abiItem.js +122 -0
  446. package/_esm/internal/abiItem.js.map +1 -0
  447. package/_esm/internal/abiParameters.js +419 -0
  448. package/_esm/internal/abiParameters.js.map +1 -0
  449. package/_esm/internal/base58.js +91 -0
  450. package/_esm/internal/base58.js.map +1 -0
  451. package/_esm/internal/bytes.js +86 -0
  452. package/_esm/internal/bytes.js.map +1 -0
  453. package/_esm/internal/cursor.js +207 -0
  454. package/_esm/internal/cursor.js.map +1 -0
  455. package/_esm/internal/ens.js +47 -0
  456. package/_esm/internal/ens.js.map +1 -0
  457. package/_esm/internal/errors.js +26 -0
  458. package/_esm/internal/errors.js.map +1 -0
  459. package/_esm/internal/hdKey.js +17 -0
  460. package/_esm/internal/hdKey.js.map +1 -0
  461. package/_esm/internal/hex.js +64 -0
  462. package/_esm/internal/hex.js.map +1 -0
  463. package/_esm/internal/lru.js +36 -0
  464. package/_esm/internal/lru.js.map +1 -0
  465. package/_esm/internal/mnemonic/wordlists.js +11 -0
  466. package/_esm/internal/mnemonic/wordlists.js.map +1 -0
  467. package/_esm/internal/promise.js +52 -0
  468. package/_esm/internal/promise.js.map +1 -0
  469. package/_esm/internal/register.js +2 -0
  470. package/_esm/internal/register.js.map +1 -0
  471. package/_esm/internal/rpcSchema.js +2 -0
  472. package/_esm/internal/rpcSchema.js.map +1 -0
  473. package/_esm/internal/rpcSchemas/eth.js +2 -0
  474. package/_esm/internal/rpcSchemas/eth.js.map +1 -0
  475. package/_esm/internal/rpcSchemas/wallet.js +2 -0
  476. package/_esm/internal/rpcSchemas/wallet.js.map +1 -0
  477. package/_esm/internal/rpcTransport.js +20 -0
  478. package/_esm/internal/rpcTransport.js.map +1 -0
  479. package/_esm/internal/types.js +2 -0
  480. package/_esm/internal/types.js.map +1 -0
  481. package/_esm/internal/uid.js +15 -0
  482. package/_esm/internal/uid.js.map +1 -0
  483. package/_esm/internal/webauthn.js +35 -0
  484. package/_esm/internal/webauthn.js.map +1 -0
  485. package/_esm/package.json +1 -0
  486. package/_esm/trusted-setups/Paths.js +3 -0
  487. package/_esm/trusted-setups/Paths.js.map +1 -0
  488. package/_esm/trusted-setups/index.js +2 -0
  489. package/_esm/trusted-setups/index.js.map +1 -0
  490. package/_esm/trusted-setups/internal/paths.js +12 -0
  491. package/_esm/trusted-setups/internal/paths.js.map +1 -0
  492. package/_esm/version.js +3 -0
  493. package/_esm/version.js.map +1 -0
  494. package/_esm/window/index.js +2 -0
  495. package/_esm/window/index.js.map +1 -0
  496. package/_test/Abi.test-d/package.json +6 -0
  497. package/_test/AbiConstructor.test-d/package.json +6 -0
  498. package/_test/AbiError.test-d/package.json +6 -0
  499. package/_test/AbiEvent.snap-d/package.json +6 -0
  500. package/_test/AbiEvent.snap-d.ts +329 -0
  501. package/_test/AbiFunction.snap-d/package.json +6 -0
  502. package/_test/AbiFunction.snap-d.ts +262 -0
  503. package/_test/AbiItem.snap-d/package.json +6 -0
  504. package/_test/AbiItem.snap-d.ts +131 -0
  505. package/_test/AbiParameters.bench/package.json +6 -0
  506. package/_test/AbiParameters.snap-d/package.json +6 -0
  507. package/_test/AbiParameters.snap-d.ts +66 -0
  508. package/_test/Address.bench/package.json +6 -0
  509. package/_test/Base58.bench/package.json +6 -0
  510. package/_test/Hex.bench/package.json +6 -0
  511. package/_test/Hex.test-d/package.json +6 -0
  512. package/_test/PublicKey.test-d/package.json +6 -0
  513. package/_test/Rlp.bench/package.json +6 -0
  514. package/_test/Rlp.test-d/package.json +6 -0
  515. package/_test/Signature.snap-d/package.json +6 -0
  516. package/_test/Signature.snap-d.ts +96 -0
  517. package/_test/TransactionEnvelopeEip1559.test-d/package.json +6 -0
  518. package/_test/TransactionEnvelopeEip2930.test-d/package.json +6 -0
  519. package/_test/TransactionEnvelopeEip4844.test-d/package.json +6 -0
  520. package/_test/TransactionEnvelopeEip7702.test-d/package.json +6 -0
  521. package/_test/TransactionEnvelopeLegacy.test-d/package.json +6 -0
  522. package/_test/TypedData.test-d/package.json +6 -0
  523. package/_types/Abi.d.ts +137 -0
  524. package/_types/Abi.d.ts.map +1 -0
  525. package/_types/AbiConstructor.d.ts +305 -0
  526. package/_types/AbiConstructor.d.ts.map +1 -0
  527. package/_types/AbiError.d.ts +522 -0
  528. package/_types/AbiError.d.ts.map +1 -0
  529. package/_types/AbiEvent.d.ts +892 -0
  530. package/_types/AbiEvent.d.ts.map +1 -0
  531. package/_types/AbiFunction.d.ts +602 -0
  532. package/_types/AbiFunction.d.ts.map +1 -0
  533. package/_types/AbiItem.d.ts +544 -0
  534. package/_types/AbiItem.d.ts.map +1 -0
  535. package/_types/AbiParameters.d.ts +466 -0
  536. package/_types/AbiParameters.d.ts.map +1 -0
  537. package/_types/AccessList.d.ts +83 -0
  538. package/_types/AccessList.d.ts.map +1 -0
  539. package/_types/AccountProof.d.ts +32 -0
  540. package/_types/AccountProof.d.ts.map +1 -0
  541. package/_types/Address.d.ts +244 -0
  542. package/_types/Address.d.ts.map +1 -0
  543. package/_types/AesGcm.d.ts +116 -0
  544. package/_types/AesGcm.d.ts.map +1 -0
  545. package/_types/Authorization.d.ts +461 -0
  546. package/_types/Authorization.d.ts.map +1 -0
  547. package/_types/Base58.d.ts +131 -0
  548. package/_types/Base58.d.ts.map +1 -0
  549. package/_types/Base64.d.ts +244 -0
  550. package/_types/Base64.d.ts.map +1 -0
  551. package/_types/Blobs.d.ts +556 -0
  552. package/_types/Blobs.d.ts.map +1 -0
  553. package/_types/Block.d.ts +190 -0
  554. package/_types/Block.d.ts.map +1 -0
  555. package/_types/Bloom.d.ts +54 -0
  556. package/_types/Bloom.d.ts.map +1 -0
  557. package/_types/Bls.d.ts +365 -0
  558. package/_types/Bls.d.ts.map +1 -0
  559. package/_types/BlsPoint.d.ts +187 -0
  560. package/_types/BlsPoint.d.ts.map +1 -0
  561. package/_types/Bytes.d.ts +674 -0
  562. package/_types/Bytes.d.ts.map +1 -0
  563. package/_types/Caches.d.ts +13 -0
  564. package/_types/Caches.d.ts.map +1 -0
  565. package/_types/ContractAddress.d.ts +115 -0
  566. package/_types/ContractAddress.d.ts.map +1 -0
  567. package/_types/Ens.d.ts +72 -0
  568. package/_types/Ens.d.ts.map +1 -0
  569. package/_types/Errors.d.ts +33 -0
  570. package/_types/Errors.d.ts.map +1 -0
  571. package/_types/Fee.d.ts +41 -0
  572. package/_types/Fee.d.ts.map +1 -0
  573. package/_types/Filter.d.ts +100 -0
  574. package/_types/Filter.d.ts.map +1 -0
  575. package/_types/Hash.d.ts +135 -0
  576. package/_types/Hash.d.ts.map +1 -0
  577. package/_types/HdKey.d.ts +146 -0
  578. package/_types/HdKey.d.ts.map +1 -0
  579. package/_types/Hex.d.ts +711 -0
  580. package/_types/Hex.d.ts.map +1 -0
  581. package/_types/Json.d.ts +53 -0
  582. package/_types/Json.d.ts.map +1 -0
  583. package/_types/Kzg.d.ts +42 -0
  584. package/_types/Kzg.d.ts.map +1 -0
  585. package/_types/Log.d.ts +194 -0
  586. package/_types/Log.d.ts.map +1 -0
  587. package/_types/Mnemonic.d.ts +176 -0
  588. package/_types/Mnemonic.d.ts.map +1 -0
  589. package/_types/P256.d.ts +207 -0
  590. package/_types/P256.d.ts.map +1 -0
  591. package/_types/PersonalMessage.d.ts +49 -0
  592. package/_types/PersonalMessage.d.ts.map +1 -0
  593. package/_types/Provider.d.ts +268 -0
  594. package/_types/Provider.d.ts.map +1 -0
  595. package/_types/PublicKey.d.ts +327 -0
  596. package/_types/PublicKey.d.ts.map +1 -0
  597. package/_types/Rlp.d.ts +153 -0
  598. package/_types/Rlp.d.ts.map +1 -0
  599. package/_types/RpcRequest.d.ts +144 -0
  600. package/_types/RpcRequest.d.ts.map +1 -0
  601. package/_types/RpcResponse.d.ts +266 -0
  602. package/_types/RpcResponse.d.ts.map +1 -0
  603. package/_types/RpcSchema.d.ts +248 -0
  604. package/_types/RpcSchema.d.ts.map +1 -0
  605. package/_types/RpcTransport.d.ts +65 -0
  606. package/_types/RpcTransport.d.ts.map +1 -0
  607. package/_types/Secp256k1.d.ts +277 -0
  608. package/_types/Secp256k1.d.ts.map +1 -0
  609. package/_types/Signature.d.ts +601 -0
  610. package/_types/Signature.d.ts.map +1 -0
  611. package/_types/Siwe.d.ts +249 -0
  612. package/_types/Siwe.d.ts.map +1 -0
  613. package/_types/Solidity.d.ts +100 -0
  614. package/_types/Solidity.d.ts.map +1 -0
  615. package/_types/Transaction.d.ts +235 -0
  616. package/_types/Transaction.d.ts.map +1 -0
  617. package/_types/TransactionEnvelope.d.ts +141 -0
  618. package/_types/TransactionEnvelope.d.ts.map +1 -0
  619. package/_types/TransactionEnvelopeEip1559.d.ts +367 -0
  620. package/_types/TransactionEnvelopeEip1559.d.ts.map +1 -0
  621. package/_types/TransactionEnvelopeEip2930.d.ts +364 -0
  622. package/_types/TransactionEnvelopeEip2930.d.ts.map +1 -0
  623. package/_types/TransactionEnvelopeEip4844.d.ts +419 -0
  624. package/_types/TransactionEnvelopeEip4844.d.ts.map +1 -0
  625. package/_types/TransactionEnvelopeEip7702.d.ts +377 -0
  626. package/_types/TransactionEnvelopeEip7702.d.ts.map +1 -0
  627. package/_types/TransactionEnvelopeLegacy.d.ts +358 -0
  628. package/_types/TransactionEnvelopeLegacy.d.ts.map +1 -0
  629. package/_types/TransactionReceipt.d.ts +271 -0
  630. package/_types/TransactionReceipt.d.ts.map +1 -0
  631. package/_types/TransactionRequest.d.ts +92 -0
  632. package/_types/TransactionRequest.d.ts.map +1 -0
  633. package/_types/TypedData.d.ts +496 -0
  634. package/_types/TypedData.d.ts.map +1 -0
  635. package/_types/ValidatorData.d.ts +64 -0
  636. package/_types/ValidatorData.d.ts.map +1 -0
  637. package/_types/Value.d.ts +159 -0
  638. package/_types/Value.d.ts.map +1 -0
  639. package/_types/WebAuthnP256.d.ts +445 -0
  640. package/_types/WebAuthnP256.d.ts.map +1 -0
  641. package/_types/WebCryptoP256.d.ts +119 -0
  642. package/_types/WebCryptoP256.d.ts.map +1 -0
  643. package/_types/Withdrawal.d.ts +74 -0
  644. package/_types/Withdrawal.d.ts.map +1 -0
  645. package/_types/index.d.ts +3367 -0
  646. package/_types/index.d.ts.map +1 -0
  647. package/_types/internal/abi.d.ts +4 -0
  648. package/_types/internal/abi.d.ts.map +1 -0
  649. package/_types/internal/abiConstructor.d.ts +11 -0
  650. package/_types/internal/abiConstructor.d.ts.map +1 -0
  651. package/_types/internal/abiError.d.ts +11 -0
  652. package/_types/internal/abiError.d.ts.map +1 -0
  653. package/_types/internal/abiEvent.d.ts +60 -0
  654. package/_types/internal/abiEvent.d.ts.map +1 -0
  655. package/_types/internal/abiFunction.d.ts +11 -0
  656. package/_types/internal/abiFunction.d.ts.map +1 -0
  657. package/_types/internal/abiItem.d.ts +100 -0
  658. package/_types/internal/abiItem.d.ts.map +1 -0
  659. package/_types/internal/abiParameters.d.ts +169 -0
  660. package/_types/internal/abiParameters.d.ts.map +1 -0
  661. package/_types/internal/base58.d.ts +17 -0
  662. package/_types/internal/base58.d.ts.map +1 -0
  663. package/_types/internal/bytes.d.ts +52 -0
  664. package/_types/internal/bytes.d.ts.map +1 -0
  665. package/_types/internal/cursor.d.ts +70 -0
  666. package/_types/internal/cursor.d.ts.map +1 -0
  667. package/_types/internal/ens.d.ts +23 -0
  668. package/_types/internal/ens.d.ts.map +1 -0
  669. package/_types/internal/errors.d.ts +7 -0
  670. package/_types/internal/errors.d.ts.map +1 -0
  671. package/_types/internal/hdKey.d.ts +10 -0
  672. package/_types/internal/hdKey.d.ts.map +1 -0
  673. package/_types/internal/hex.d.ts +39 -0
  674. package/_types/internal/hex.d.ts.map +1 -0
  675. package/_types/internal/lru.d.ts +13 -0
  676. package/_types/internal/lru.d.ts.map +1 -0
  677. package/_types/internal/mnemonic/wordlists.d.ts +11 -0
  678. package/_types/internal/mnemonic/wordlists.d.ts.map +1 -0
  679. package/_types/internal/promise.d.ts +27 -0
  680. package/_types/internal/promise.d.ts.map +1 -0
  681. package/_types/internal/register.d.ts +13 -0
  682. package/_types/internal/register.d.ts.map +1 -0
  683. package/_types/internal/rpcSchema.d.ts +12 -0
  684. package/_types/internal/rpcSchema.d.ts.map +1 -0
  685. package/_types/internal/rpcSchemas/eth.d.ts +718 -0
  686. package/_types/internal/rpcSchemas/eth.d.ts.map +1 -0
  687. package/_types/internal/rpcSchemas/wallet.d.ts +416 -0
  688. package/_types/internal/rpcSchemas/wallet.d.ts.map +1 -0
  689. package/_types/internal/rpcTransport.d.ts +38 -0
  690. package/_types/internal/rpcTransport.d.ts.map +1 -0
  691. package/_types/internal/types.d.ts +284 -0
  692. package/_types/internal/types.d.ts.map +1 -0
  693. package/_types/internal/uid.d.ts +3 -0
  694. package/_types/internal/uid.d.ts.map +1 -0
  695. package/_types/internal/webauthn.d.ts +127 -0
  696. package/_types/internal/webauthn.d.ts.map +1 -0
  697. package/_types/trusted-setups/Paths.d.ts +2 -0
  698. package/_types/trusted-setups/Paths.d.ts.map +1 -0
  699. package/_types/trusted-setups/index.d.ts +2 -0
  700. package/_types/trusted-setups/index.d.ts.map +1 -0
  701. package/_types/trusted-setups/internal/paths.d.ts +3 -0
  702. package/_types/trusted-setups/internal/paths.d.ts.map +1 -0
  703. package/_types/version.d.ts +3 -0
  704. package/_types/version.d.ts.map +1 -0
  705. package/_types/window/index.d.ts +7 -0
  706. package/_types/window/index.d.ts.map +1 -0
  707. package/index.ts +3427 -0
  708. package/internal/abi.ts +11 -0
  709. package/internal/abiConstructor.ts +32 -0
  710. package/internal/abiError.ts +30 -0
  711. package/internal/abiEvent.ts +154 -0
  712. package/internal/abiFunction.ts +32 -0
  713. package/internal/abiItem.ts +593 -0
  714. package/internal/abiParameters.ts +741 -0
  715. package/internal/base58.ts +106 -0
  716. package/internal/bytes.ts +152 -0
  717. package/internal/cursor.ts +252 -0
  718. package/internal/ens.ts +64 -0
  719. package/internal/errors.ts +26 -0
  720. package/internal/hdKey.ts +25 -0
  721. package/internal/hex.ts +123 -0
  722. package/internal/lru.ts +34 -0
  723. package/internal/mnemonic/wordlists.ts +10 -0
  724. package/internal/promise.ts +66 -0
  725. package/internal/register.ts +15 -0
  726. package/internal/rpcSchema.ts +20 -0
  727. package/internal/rpcSchemas/eth.ts +727 -0
  728. package/internal/rpcSchemas/wallet.ts +428 -0
  729. package/internal/rpcTransport.ts +74 -0
  730. package/internal/types.ts +414 -0
  731. package/internal/uid.ts +15 -0
  732. package/internal/webauthn.ts +198 -0
  733. package/package.json +500 -20
  734. package/trusted-setups/Paths/package.json +6 -0
  735. package/trusted-setups/Paths.ts +3 -0
  736. package/trusted-setups/index.ts +1 -0
  737. package/trusted-setups/internal/paths.ts +13 -0
  738. package/trusted-setups/internal/setups/mainnet.json +8265 -0
  739. package/trusted-setups/internal/setups/mainnet.txt +4163 -0
  740. package/trusted-setups/package.json +6 -0
  741. package/tsdoc.json +4 -0
  742. package/version/package.json +6 -0
  743. package/version.ts +2 -0
  744. package/window/index.ts +7 -0
  745. package/window/package.json +6 -0
  746. package/cl/ansiesc.js +0 -25
  747. package/cl/deps.js +0 -7
  748. package/cl/editor.js +0 -141
  749. package/cl/index.html +0 -19
  750. package/cl/ox.js +0 -44
  751. package/cl/socket.io.js +0 -1922
  752. package/cl/style.css +0 -37
  753. package/srv/deps.js +0 -88
  754. package/srv/httpSrv.js +0 -82
  755. package/srv/ox.js +0 -44
  756. package/srv/remoteXtermReq.js +0 -70
package/cl/socket.io.js DELETED
@@ -1,1922 +0,0 @@
1
- /** Socket.IO 0.6.2 - Built with build.js */
2
- /**
3
- * Socket.IO client
4
- *
5
- * @author Guillermo Rauch <guillermo@learnboost.com>
6
- * @license The MIT license.
7
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
8
- */
9
-
10
- this.io = {
11
- version: '0.6.2',
12
-
13
- setPath: function(path){
14
- if (window.console && console.error) console.error('io.setPath will be removed. Please set the variable WEB_SOCKET_SWF_LOCATION pointing to WebSocketMain.swf');
15
- this.path = /\/$/.test(path) ? path : path + '/';
16
- WEB_SOCKET_SWF_LOCATION = path + 'lib/vendor/web-socket-js/WebSocketMain.swf';
17
- }
18
- };
19
-
20
- if ('jQuery' in this) jQuery.io = this.io;
21
-
22
- if (typeof window != 'undefined'){
23
- // WEB_SOCKET_SWF_LOCATION = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//cdn.socket.io/' + this.io.version + '/WebSocketMain.swf';
24
- if (typeof WEB_SOCKET_SWF_LOCATION === 'undefined')
25
- WEB_SOCKET_SWF_LOCATION = '/socket.io/lib/vendor/web-socket-js/WebSocketMain.swf';
26
- }
27
-
28
- /**
29
- * Socket.IO client
30
- *
31
- * @author Guillermo Rauch <guillermo@learnboost.com>
32
- * @license The MIT license.
33
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
34
- */
35
-
36
- (function(){
37
-
38
- var _pageLoaded = false;
39
-
40
- io.util = {
41
-
42
- ios: false,
43
-
44
- load: function(fn){
45
- if (/loaded|complete/.test(document.readyState) || _pageLoaded) return fn();
46
- if ('attachEvent' in window){
47
- window.attachEvent('onload', fn);
48
- } else {
49
- window.addEventListener('load', fn, false);
50
- }
51
- },
52
-
53
- inherit: function(ctor, superCtor){
54
- // no support for `instanceof` for now
55
- for (var i in superCtor.prototype){
56
- ctor.prototype[i] = superCtor.prototype[i];
57
- }
58
- },
59
-
60
- indexOf: function(arr, item, from){
61
- for (var l = arr.length, i = (from < 0) ? Math.max(0, l + from) : from || 0; i < l; i++){
62
- if (arr[i] === item) return i;
63
- }
64
- return -1;
65
- },
66
-
67
- isArray: function(obj){
68
- return Object.prototype.toString.call(obj) === '[object Array]';
69
- },
70
-
71
- merge: function(target, additional){
72
- for (var i in additional)
73
- if (additional.hasOwnProperty(i))
74
- target[i] = additional[i];
75
- }
76
-
77
- };
78
-
79
- io.util.ios = /iphone|ipad/i.test(navigator.userAgent);
80
- io.util.android = /android/i.test(navigator.userAgent);
81
- io.util.opera = /opera/i.test(navigator.userAgent);
82
-
83
- io.util.load(function(){
84
- _pageLoaded = true;
85
- });
86
-
87
- })();
88
-
89
- /**
90
- * Socket.IO client
91
- *
92
- * @author Guillermo Rauch <guillermo@learnboost.com>
93
- * @license The MIT license.
94
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
95
- */
96
-
97
- // abstract
98
-
99
- (function(){
100
-
101
- var frame = '~m~',
102
-
103
- stringify = function(message){
104
- if (Object.prototype.toString.call(message) == '[object Object]'){
105
- if (!('JSON' in window)){
106
- if ('console' in window && console.error) console.error('Trying to encode as JSON, but JSON.stringify is missing.');
107
- return '{ "$error": "Invalid message" }';
108
- }
109
- return '~j~' + JSON.stringify(message);
110
- } else {
111
- return String(message);
112
- }
113
- };
114
-
115
- Transport = io.Transport = function(base, options){
116
- this.base = base;
117
- this.options = {
118
- timeout: 15000 // based on heartbeat interval default
119
- };
120
- io.util.merge(this.options, options);
121
- };
122
-
123
- Transport.prototype.send = function(){
124
- throw new Error('Missing send() implementation');
125
- };
126
-
127
- Transport.prototype.connect = function(){
128
- throw new Error('Missing connect() implementation');
129
- };
130
-
131
- Transport.prototype.disconnect = function(){
132
- throw new Error('Missing disconnect() implementation');
133
- };
134
-
135
- Transport.prototype._encode = function(messages){
136
- var ret = '', message,
137
- messages = io.util.isArray(messages) ? messages : [messages];
138
- for (var i = 0, l = messages.length; i < l; i++){
139
- message = messages[i] === null || messages[i] === undefined ? '' : stringify(messages[i]);
140
- ret += frame + message.length + frame + message;
141
- }
142
- return ret;
143
- };
144
-
145
- Transport.prototype._decode = function(data){
146
- var messages = [], number, n;
147
- do {
148
- if (data.substr(0, 3) !== frame) return messages;
149
- data = data.substr(3);
150
- number = '', n = '';
151
- for (var i = 0, l = data.length; i < l; i++){
152
- n = Number(data.substr(i, 1));
153
- if (data.substr(i, 1) == n){
154
- number += n;
155
- } else {
156
- data = data.substr(number.length + frame.length);
157
- number = Number(number);
158
- break;
159
- }
160
- }
161
- messages.push(data.substr(0, number)); // here
162
- data = data.substr(number);
163
- } while(data !== '');
164
- return messages;
165
- };
166
-
167
- Transport.prototype._onData = function(data){
168
- this._setTimeout();
169
- var msgs = this._decode(data);
170
- if (msgs && msgs.length){
171
- for (var i = 0, l = msgs.length; i < l; i++){
172
- this._onMessage(msgs[i]);
173
- }
174
- }
175
- };
176
-
177
- Transport.prototype._setTimeout = function(){
178
- var self = this;
179
- if (this._timeout) clearTimeout(this._timeout);
180
- this._timeout = setTimeout(function(){
181
- self._onTimeout();
182
- }, this.options.timeout);
183
- };
184
-
185
- Transport.prototype._onTimeout = function(){
186
- this._onDisconnect();
187
- };
188
-
189
- Transport.prototype._onMessage = function(message){
190
- if (!this.sessionid){
191
- this.sessionid = message;
192
- this._onConnect();
193
- } else if (message.substr(0, 3) == '~h~'){
194
- this._onHeartbeat(message.substr(3));
195
- } else if (message.substr(0, 3) == '~j~'){
196
- this.base._onMessage(JSON.parse(message.substr(3)));
197
- } else {
198
- this.base._onMessage(message);
199
- }
200
- },
201
-
202
- Transport.prototype._onHeartbeat = function(heartbeat){
203
- this.send('~h~' + heartbeat); // echo
204
- };
205
-
206
- Transport.prototype._onConnect = function(){
207
- this.connected = true;
208
- this.connecting = false;
209
- this.base._onConnect();
210
- this._setTimeout();
211
- };
212
-
213
- Transport.prototype._onDisconnect = function(){
214
- this.connecting = false;
215
- this.connected = false;
216
- this.sessionid = null;
217
- this.base._onDisconnect();
218
- };
219
-
220
- Transport.prototype._prepareUrl = function(){
221
- return (this.base.options.secure ? 'https' : 'http')
222
- + '://' + this.base.host
223
- + ':' + this.base.options.port
224
- + '/' + this.base.options.resource
225
- + '/' + this.type
226
- + (this.sessionid ? ('/' + this.sessionid) : '/');
227
- };
228
-
229
- })();
230
- /**
231
- * Socket.IO client
232
- *
233
- * @author Guillermo Rauch <guillermo@learnboost.com>
234
- * @license The MIT license.
235
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
236
- */
237
-
238
- (function(){
239
-
240
- var empty = new Function,
241
-
242
- XMLHttpRequestCORS = (function(){
243
- if (!('XMLHttpRequest' in window)) return false;
244
- // CORS feature detection
245
- var a = new XMLHttpRequest();
246
- return a.withCredentials != undefined;
247
- })(),
248
-
249
- request = function(xdomain){
250
- if ('XDomainRequest' in window && xdomain) return new XDomainRequest();
251
- if ('XMLHttpRequest' in window && (!xdomain || XMLHttpRequestCORS)) return new XMLHttpRequest();
252
- if (!xdomain){
253
- try {
254
- var a = new ActiveXObject('MSXML2.XMLHTTP');
255
- return a;
256
- } catch(e){}
257
-
258
- try {
259
- var b = new ActiveXObject('Microsoft.XMLHTTP');
260
- return b;
261
- } catch(e){}
262
- }
263
- return false;
264
- },
265
-
266
- XHR = io.Transport.XHR = function(){
267
- io.Transport.apply(this, arguments);
268
- this._sendBuffer = [];
269
- };
270
-
271
- io.util.inherit(XHR, io.Transport);
272
-
273
- XHR.prototype.connect = function(){
274
- this._get();
275
- return this;
276
- };
277
-
278
- XHR.prototype._checkSend = function(){
279
- if (!this._posting && this._sendBuffer.length){
280
- var encoded = this._encode(this._sendBuffer);
281
- this._sendBuffer = [];
282
- this._send(encoded);
283
- }
284
- };
285
-
286
- XHR.prototype.send = function(data){
287
- if (io.util.isArray(data)){
288
- this._sendBuffer.push.apply(this._sendBuffer, data);
289
- } else {
290
- this._sendBuffer.push(data);
291
- }
292
- this._checkSend();
293
- return this;
294
- };
295
-
296
- XHR.prototype._send = function(data){
297
- var self = this;
298
- this._posting = true;
299
- this._sendXhr = this._request('send', 'POST');
300
- this._sendXhr.onreadystatechange = function(){
301
- var status;
302
- if (self._sendXhr.readyState == 4){
303
- self._sendXhr.onreadystatechange = empty;
304
- try { status = self._sendXhr.status; } catch(e){}
305
- self._posting = false;
306
- if (status == 200){
307
- self._checkSend();
308
- } else {
309
- self._onDisconnect();
310
- }
311
- }
312
- };
313
- this._sendXhr.send('data=' + encodeURIComponent(data));
314
- };
315
-
316
- XHR.prototype.disconnect = function(){
317
- // send disconnection signal
318
- this._onDisconnect();
319
- return this;
320
- };
321
-
322
- XHR.prototype._onDisconnect = function(){
323
- if (this._xhr){
324
- this._xhr.onreadystatechange = empty;
325
- try {
326
- this._xhr.abort();
327
- } catch(e){}
328
- this._xhr = null;
329
- }
330
- if (this._sendXhr){
331
- this._sendXhr.onreadystatechange = empty;
332
- try {
333
- this._sendXhr.abort();
334
- } catch(e){}
335
- this._sendXhr = null;
336
- }
337
- this._sendBuffer = [];
338
- io.Transport.prototype._onDisconnect.call(this);
339
- };
340
-
341
- XHR.prototype._request = function(url, method, multipart){
342
- var req = request(this.base._isXDomain());
343
- if (multipart) req.multipart = true;
344
- req.open(method || 'GET', this._prepareUrl() + (url ? '/' + url : ''));
345
- if (method == 'POST' && 'setRequestHeader' in req){
346
- req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');
347
- }
348
- return req;
349
- };
350
-
351
- XHR.check = function(xdomain){
352
- try {
353
- if (request(xdomain)) return true;
354
- } catch(e){}
355
- return false;
356
- };
357
-
358
- XHR.xdomainCheck = function(){
359
- return XHR.check(true);
360
- };
361
-
362
- XHR.request = request;
363
-
364
- })();
365
-
366
- /**
367
- * Socket.IO client
368
- *
369
- * @author Guillermo Rauch <guillermo@learnboost.com>
370
- * @license The MIT license.
371
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
372
- */
373
-
374
- (function(){
375
-
376
- var WS = io.Transport.websocket = function(){
377
- io.Transport.apply(this, arguments);
378
- };
379
-
380
- io.util.inherit(WS, io.Transport);
381
-
382
- WS.prototype.type = 'websocket';
383
-
384
- WS.prototype.connect = function(){
385
- var self = this;
386
- this.socket = new WebSocket(this._prepareUrl());
387
- this.socket.onmessage = function(ev){ self._onData(ev.data); };
388
- this.socket.onclose = function(ev){ self._onClose(); };
389
- this.socket.onerror = function(e){ self._onError(e); };
390
- return this;
391
- };
392
-
393
- WS.prototype.send = function(data){
394
- if (this.socket) this.socket.send(this._encode(data));
395
- return this;
396
- };
397
-
398
- WS.prototype.disconnect = function(){
399
- if (this.socket) this.socket.close();
400
- return this;
401
- };
402
-
403
- WS.prototype._onClose = function(){
404
- this._onDisconnect();
405
- return this;
406
- };
407
-
408
- WS.prototype._onError = function(e){
409
- this.base.emit('error', [e]);
410
- };
411
-
412
- WS.prototype._prepareUrl = function(){
413
- return (this.base.options.secure ? 'wss' : 'ws')
414
- + '://' + this.base.host
415
- + ':' + this.base.options.port
416
- + '/' + this.base.options.resource
417
- + '/' + this.type
418
- + (this.sessionid ? ('/' + this.sessionid) : '');
419
- };
420
-
421
- WS.check = function(){
422
- // we make sure WebSocket is not confounded with a previously loaded flash WebSocket
423
- return 'WebSocket' in window && WebSocket.prototype && ( WebSocket.prototype.send && !!WebSocket.prototype.send.toString().match(/native/i)) && typeof WebSocket !== "undefined";
424
- };
425
-
426
- WS.xdomainCheck = function(){
427
- return true;
428
- };
429
-
430
- })();
431
-
432
- /**
433
- * Socket.IO client
434
- *
435
- * @author Guillermo Rauch <guillermo@learnboost.com>
436
- * @license The MIT license.
437
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
438
- */
439
-
440
- (function(){
441
-
442
- var Flashsocket = io.Transport.flashsocket = function(){
443
- io.Transport.websocket.apply(this, arguments);
444
- };
445
-
446
- io.util.inherit(Flashsocket, io.Transport.websocket);
447
-
448
- Flashsocket.prototype.type = 'flashsocket';
449
-
450
- Flashsocket.prototype.connect = function(){
451
- var self = this, args = arguments;
452
- WebSocket.__addTask(function(){
453
- io.Transport.websocket.prototype.connect.apply(self, args);
454
- });
455
- return this;
456
- };
457
-
458
- Flashsocket.prototype.send = function(){
459
- var self = this, args = arguments;
460
- WebSocket.__addTask(function(){
461
- io.Transport.websocket.prototype.send.apply(self, args);
462
- });
463
- return this;
464
- };
465
-
466
- Flashsocket.check = function(){
467
- if (typeof WebSocket == 'undefined' || !('__addTask' in WebSocket)) return false;
468
- if (io.util.opera) return false; // opera is buggy with this transport
469
- if ('navigator' in window && 'plugins' in navigator && navigator.plugins['Shockwave Flash']){
470
- return !!navigator.plugins['Shockwave Flash'].description;
471
- }
472
- if ('ActiveXObject' in window) {
473
- try {
474
- return !!new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
475
- } catch (e) {}
476
- }
477
- return false;
478
- };
479
-
480
- Flashsocket.xdomainCheck = function(){
481
- return true;
482
- };
483
-
484
- })();
485
- /**
486
- * Socket.IO client
487
- *
488
- * @author Guillermo Rauch <guillermo@learnboost.com>
489
- * @license The MIT license.
490
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
491
- */
492
-
493
- (function(){
494
-
495
- var HTMLFile = io.Transport.htmlfile = function(){
496
- io.Transport.XHR.apply(this, arguments);
497
- };
498
-
499
- io.util.inherit(HTMLFile, io.Transport.XHR);
500
-
501
- HTMLFile.prototype.type = 'htmlfile';
502
-
503
- HTMLFile.prototype._get = function(){
504
- var self = this;
505
- this._open();
506
- window.attachEvent('onunload', function(){ self._destroy(); });
507
- };
508
-
509
- HTMLFile.prototype._open = function(){
510
- this._doc = new ActiveXObject('htmlfile');
511
- this._doc.open();
512
- this._doc.write('<html></html>');
513
- this._doc.parentWindow.s = this;
514
- this._doc.close();
515
-
516
- var _iframeC = this._doc.createElement('div');
517
- this._doc.body.appendChild(_iframeC);
518
- this._iframe = this._doc.createElement('iframe');
519
- _iframeC.appendChild(this._iframe);
520
- this._iframe.src = this._prepareUrl() + '/' + (+ new Date);
521
- };
522
-
523
- HTMLFile.prototype._ = function(data, doc){
524
- this._onData(data);
525
- var script = doc.getElementsByTagName('script')[0];
526
- script.parentNode.removeChild(script);
527
- };
528
-
529
- HTMLFile.prototype._destroy = function(){
530
- if (this._iframe){
531
- this._iframe.src = 'about:blank';
532
- this._doc = null;
533
- CollectGarbage();
534
- }
535
- };
536
-
537
- HTMLFile.prototype.disconnect = function(){
538
- this._destroy();
539
- return io.Transport.XHR.prototype.disconnect.call(this);
540
- };
541
-
542
- HTMLFile.check = function(){
543
- if ('ActiveXObject' in window){
544
- try {
545
- var a = new ActiveXObject('htmlfile');
546
- return a && io.Transport.XHR.check();
547
- } catch(e){}
548
- }
549
- return false;
550
- };
551
-
552
- HTMLFile.xdomainCheck = function(){
553
- // we can probably do handling for sub-domains, we should test that it's cross domain but a subdomain here
554
- return false;
555
- };
556
-
557
- })();
558
- /**
559
- * Socket.IO client
560
- *
561
- * @author Guillermo Rauch <guillermo@learnboost.com>
562
- * @license The MIT license.
563
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
564
- */
565
-
566
- (function(){
567
-
568
- var XHRMultipart = io.Transport['xhr-multipart'] = function(){
569
- io.Transport.XHR.apply(this, arguments);
570
- };
571
-
572
- io.util.inherit(XHRMultipart, io.Transport.XHR);
573
-
574
- XHRMultipart.prototype.type = 'xhr-multipart';
575
-
576
- XHRMultipart.prototype._get = function(){
577
- var self = this;
578
- this._xhr = this._request('', 'GET', true);
579
- this._xhr.onreadystatechange = function(){
580
- if (self._xhr.readyState == 4) self._onData(self._xhr.responseText);
581
- };
582
- this._xhr.send(null);
583
- };
584
-
585
- XHRMultipart.check = function(){
586
- return 'XMLHttpRequest' in window && 'prototype' in XMLHttpRequest && 'multipart' in XMLHttpRequest.prototype;
587
- };
588
-
589
- XHRMultipart.xdomainCheck = function(){
590
- return true;
591
- };
592
-
593
- })();
594
-
595
- /**
596
- * Socket.IO client
597
- *
598
- * @author Guillermo Rauch <guillermo@learnboost.com>
599
- * @license The MIT license.
600
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
601
- */
602
-
603
- (function(){
604
-
605
- var empty = new Function(),
606
-
607
- XHRPolling = io.Transport['xhr-polling'] = function(){
608
- io.Transport.XHR.apply(this, arguments);
609
- };
610
-
611
- io.util.inherit(XHRPolling, io.Transport.XHR);
612
-
613
- XHRPolling.prototype.type = 'xhr-polling';
614
-
615
- XHRPolling.prototype.connect = function(){
616
- if (io.util.ios || io.util.android){
617
- var self = this;
618
- io.util.load(function(){
619
- setTimeout(function(){
620
- io.Transport.XHR.prototype.connect.call(self);
621
- }, 10);
622
- });
623
- } else {
624
- io.Transport.XHR.prototype.connect.call(this);
625
- }
626
- };
627
-
628
- XHRPolling.prototype._get = function(){
629
- var self = this;
630
- this._xhr = this._request(+ new Date, 'GET');
631
- this._xhr.onreadystatechange = function(){
632
- var status;
633
- if (self._xhr.readyState == 4){
634
- self._xhr.onreadystatechange = empty;
635
- try { status = self._xhr.status; } catch(e){}
636
- if (status == 200){
637
- self._onData(self._xhr.responseText);
638
- self._get();
639
- } else {
640
- self._onDisconnect();
641
- }
642
- }
643
- };
644
- this._xhr.send(null);
645
- };
646
-
647
- XHRPolling.check = function(){
648
- return io.Transport.XHR.check();
649
- };
650
-
651
- XHRPolling.xdomainCheck = function(){
652
- return io.Transport.XHR.xdomainCheck();
653
- };
654
-
655
- })();
656
-
657
- /**
658
- * Socket.IO client
659
- *
660
- * @author Guillermo Rauch <guillermo@learnboost.com>
661
- * @license The MIT license.
662
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
663
- */
664
-
665
- io.JSONP = [];
666
-
667
- JSONPPolling = io.Transport['jsonp-polling'] = function(){
668
- io.Transport.XHR.apply(this, arguments);
669
- this._insertAt = document.getElementsByTagName('script')[0];
670
- this._index = io.JSONP.length;
671
- io.JSONP.push(this);
672
- };
673
-
674
- io.util.inherit(JSONPPolling, io.Transport['xhr-polling']);
675
-
676
- JSONPPolling.prototype.type = 'jsonp-polling';
677
-
678
- JSONPPolling.prototype._send = function(data){
679
- var self = this;
680
- if (!('_form' in this)){
681
- var form = document.createElement('FORM'),
682
- area = document.createElement('TEXTAREA'),
683
- id = this._iframeId = 'socket_io_iframe_' + this._index,
684
- iframe;
685
-
686
- form.style.position = 'absolute';
687
- form.style.top = '-1000px';
688
- form.style.left = '-1000px';
689
- form.target = id;
690
- form.method = 'POST';
691
- form.action = this._prepareUrl() + '/' + (+new Date) + '/' + this._index;
692
- area.name = 'data';
693
- form.appendChild(area);
694
- this._insertAt.parentNode.insertBefore(form, this._insertAt);
695
- document.body.appendChild(form);
696
-
697
- this._form = form;
698
- this._area = area;
699
- }
700
-
701
- function complete(){
702
- initIframe();
703
- self._posting = false;
704
- self._checkSend();
705
- };
706
-
707
- function initIframe(){
708
- if (self._iframe){
709
- self._form.removeChild(self._iframe);
710
- }
711
-
712
- try {
713
- // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
714
- iframe = document.createElement('<iframe name="'+ self._iframeId +'">');
715
- } catch(e){
716
- iframe = document.createElement('iframe');
717
- iframe.name = self._iframeId;
718
- }
719
-
720
- iframe.id = self._iframeId;
721
-
722
- self._form.appendChild(iframe);
723
- self._iframe = iframe;
724
- };
725
-
726
- initIframe();
727
-
728
- this._posting = true;
729
- this._area.value = data;
730
-
731
- try {
732
- this._form.submit();
733
- } catch(e){}
734
-
735
- if (this._iframe.attachEvent){
736
- iframe.onreadystatechange = function(){
737
- if (self._iframe.readyState == 'complete') complete();
738
- };
739
- } else {
740
- this._iframe.onload = complete;
741
- }
742
- };
743
-
744
- JSONPPolling.prototype._get = function(){
745
- var self = this,
746
- script = document.createElement('SCRIPT');
747
- if (this._script){
748
- this._script.parentNode.removeChild(this._script);
749
- this._script = null;
750
- }
751
- script.async = true;
752
- script.src = this._prepareUrl() + '/' + (+new Date) + '/' + this._index;
753
- script.onerror = function(){
754
- self._onDisconnect();
755
- };
756
- this._insertAt.parentNode.insertBefore(script, this._insertAt);
757
- this._script = script;
758
- };
759
-
760
- JSONPPolling.prototype._ = function(){
761
- this._onData.apply(this, arguments);
762
- this._get();
763
- return this;
764
- };
765
-
766
- JSONPPolling.check = function(){
767
- return true;
768
- };
769
-
770
- JSONPPolling.xdomainCheck = function(){
771
- return true;
772
- };
773
- /**
774
- * Socket.IO client
775
- *
776
- * @author Guillermo Rauch <guillermo@learnboost.com>
777
- * @license The MIT license.
778
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
779
- */
780
-
781
- (function(){
782
-
783
- var Socket = io.Socket = function(host, options){
784
- this.host = host || document.domain;
785
- this.options = {
786
- secure: false,
787
- document: document,
788
- port: document.location.port || 80,
789
- resource: 'socket.io',
790
- transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling', 'jsonp-polling'],
791
- transportOptions: {
792
- 'xhr-polling': {
793
- timeout: 25000 // based on polling duration default
794
- },
795
- 'jsonp-polling': {
796
- timeout: 25000
797
- }
798
- },
799
- connectTimeout: 5000,
800
- tryTransportsOnConnectTimeout: true,
801
- rememberTransport: true
802
- };
803
- io.util.merge(this.options, options);
804
- this.connected = false;
805
- this.connecting = false;
806
- this._events = {};
807
- this.transport = this.getTransport();
808
- if (!this.transport && 'console' in window) console.error('No transport available');
809
- };
810
-
811
- Socket.prototype.getTransport = function(override){
812
- var transports = override || this.options.transports, match;
813
- if (this.options.rememberTransport && !override){
814
- match = this.options.document.cookie.match('(?:^|;)\\s*socketio=([^;]*)');
815
- if (match){
816
- this._rememberedTransport = true;
817
- transports = [decodeURIComponent(match[1])];
818
- }
819
- }
820
- for (var i = 0, transport; transport = transports[i]; i++){
821
- if (io.Transport[transport]
822
- && io.Transport[transport].check()
823
- && (!this._isXDomain() || io.Transport[transport].xdomainCheck())){
824
- return new io.Transport[transport](this, this.options.transportOptions[transport] || {});
825
- }
826
- }
827
- return null;
828
- };
829
-
830
- Socket.prototype.connect = function(){
831
- if (this.transport && !this.connected){
832
- if (this.connecting) this.disconnect();
833
- this.connecting = true;
834
- this.emit('connecting', [this.transport.type]);
835
- this.transport.connect();
836
- if (this.options.connectTimeout){
837
- var self = this;
838
- this.connectTimeoutTimer = setTimeout(function(){
839
- if (!self.connected){
840
- self.disconnect();
841
- if (self.options.tryTransportsOnConnectTimeout && !self._rememberedTransport){
842
- if(!self._remainingTransports) self._remainingTransports = self.options.transports.slice(0);
843
- var transports = self._remainingTransports;
844
- while(transports.length > 0 && transports.splice(0,1)[0] != self.transport.type){}
845
- if(transports.length){
846
- self.transport = self.getTransport(transports);
847
- self.connect();
848
- }
849
- }
850
- if(!self._remainingTransports || self._remainingTransports.length == 0) self.emit('connect_failed');
851
- }
852
- if(self._remainingTransports && self._remainingTransports.length == 0) delete self._remainingTransports;
853
- }, this.options.connectTimeout);
854
- }
855
- }
856
- return this;
857
- };
858
-
859
- Socket.prototype.send = function(data){
860
- if (!this.transport || !this.transport.connected) return this._queue(data);
861
- this.transport.send(data);
862
- return this;
863
- };
864
-
865
- Socket.prototype.disconnect = function(){
866
- if (this.connectTimeoutTimer) clearTimeout(this.connectTimeoutTimer);
867
- this.transport.disconnect();
868
- return this;
869
- };
870
-
871
- Socket.prototype.on = function(name, fn){
872
- if (!(name in this._events)) this._events[name] = [];
873
- this._events[name].push(fn);
874
- return this;
875
- };
876
-
877
- Socket.prototype.emit = function(name, args){
878
- if (name in this._events){
879
- var events = this._events[name].concat();
880
- for (var i = 0, ii = events.length; i < ii; i++)
881
- events[i].apply(this, args === undefined ? [] : args);
882
- }
883
- return this;
884
- };
885
-
886
- Socket.prototype.removeEvent = function(name, fn){
887
- if (name in this._events){
888
- for (var a = 0, l = this._events[name].length; a < l; a++)
889
- if (this._events[name][a] == fn) this._events[name].splice(a, 1);
890
- }
891
- return this;
892
- };
893
-
894
- Socket.prototype._queue = function(message){
895
- if (!('_queueStack' in this)) this._queueStack = [];
896
- this._queueStack.push(message);
897
- return this;
898
- };
899
-
900
- Socket.prototype._doQueue = function(){
901
- if (!('_queueStack' in this) || !this._queueStack.length) return this;
902
- this.transport.send(this._queueStack);
903
- this._queueStack = [];
904
- return this;
905
- };
906
-
907
- Socket.prototype._isXDomain = function(){
908
- return this.host !== document.domain;
909
- };
910
-
911
- Socket.prototype._onConnect = function(){
912
- this.connected = true;
913
- this.connecting = false;
914
- this._doQueue();
915
- if (this.options.rememberTransport) this.options.document.cookie = 'socketio=' + encodeURIComponent(this.transport.type);
916
- this.emit('connect');
917
- };
918
-
919
- Socket.prototype._onMessage = function(data){
920
- this.emit('message', [data]);
921
- };
922
-
923
- Socket.prototype._onDisconnect = function(){
924
- var wasConnected = this.connected;
925
- this.connected = false;
926
- this.connecting = false;
927
- this._queueStack = [];
928
- if (wasConnected) this.emit('disconnect');
929
- };
930
-
931
- Socket.prototype.fire = Socket.prototype.emit;
932
-
933
- Socket.prototype.addListener = Socket.prototype.addEvent = Socket.prototype.addEventListener = Socket.prototype.on;
934
-
935
- })();
936
-
937
- /* SWFObject v2.2 <http://code.google.com/p/swfobject/>
938
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
939
- */
940
- var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
941
- /*
942
- /*
943
- Copyright 2006 Adobe Systems Incorporated
944
-
945
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
946
- to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
947
- and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
948
-
949
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
950
-
951
-
952
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
953
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
954
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
955
- OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
956
-
957
- */
958
-
959
-
960
- /*
961
- * The Bridge class, responsible for navigating AS instances
962
- */
963
- function FABridge(target,bridgeName)
964
- {
965
- this.target = target;
966
- this.remoteTypeCache = {};
967
- this.remoteInstanceCache = {};
968
- this.remoteFunctionCache = {};
969
- this.localFunctionCache = {};
970
- this.bridgeID = FABridge.nextBridgeID++;
971
- this.name = bridgeName;
972
- this.nextLocalFuncID = 0;
973
- FABridge.instances[this.name] = this;
974
- FABridge.idMap[this.bridgeID] = this;
975
-
976
- return this;
977
- }
978
-
979
- // type codes for packed values
980
- FABridge.TYPE_ASINSTANCE = 1;
981
- FABridge.TYPE_ASFUNCTION = 2;
982
-
983
- FABridge.TYPE_JSFUNCTION = 3;
984
- FABridge.TYPE_ANONYMOUS = 4;
985
-
986
- FABridge.initCallbacks = {};
987
- FABridge.userTypes = {};
988
-
989
- FABridge.addToUserTypes = function()
990
- {
991
- for (var i = 0; i < arguments.length; i++)
992
- {
993
- FABridge.userTypes[arguments[i]] = {
994
- 'typeName': arguments[i],
995
- 'enriched': false
996
- };
997
- }
998
- }
999
-
1000
- FABridge.argsToArray = function(args)
1001
- {
1002
- var result = [];
1003
- for (var i = 0; i < args.length; i++)
1004
- {
1005
- result[i] = args[i];
1006
- }
1007
- return result;
1008
- }
1009
-
1010
- function instanceFactory(objID)
1011
- {
1012
- this.fb_instance_id = objID;
1013
- return this;
1014
- }
1015
-
1016
- function FABridge__invokeJSFunction(args)
1017
- {
1018
- var funcID = args[0];
1019
- var throughArgs = args.concat();//FABridge.argsToArray(arguments);
1020
- throughArgs.shift();
1021
-
1022
- var bridge = FABridge.extractBridgeFromID(funcID);
1023
- return bridge.invokeLocalFunction(funcID, throughArgs);
1024
- }
1025
-
1026
- FABridge.addInitializationCallback = function(bridgeName, callback)
1027
- {
1028
- var inst = FABridge.instances[bridgeName];
1029
- if (inst != undefined)
1030
- {
1031
- callback.call(inst);
1032
- return;
1033
- }
1034
-
1035
- var callbackList = FABridge.initCallbacks[bridgeName];
1036
- if(callbackList == null)
1037
- {
1038
- FABridge.initCallbacks[bridgeName] = callbackList = [];
1039
- }
1040
-
1041
- callbackList.push(callback);
1042
- }
1043
-
1044
- // updated for changes to SWFObject2
1045
- function FABridge__bridgeInitialized(bridgeName) {
1046
- var objects = document.getElementsByTagName("object");
1047
- var ol = objects.length;
1048
- var activeObjects = [];
1049
- if (ol > 0) {
1050
- for (var i = 0; i < ol; i++) {
1051
- if (typeof objects[i].SetVariable != "undefined") {
1052
- activeObjects[activeObjects.length] = objects[i];
1053
- }
1054
- }
1055
- }
1056
- var embeds = document.getElementsByTagName("embed");
1057
- var el = embeds.length;
1058
- var activeEmbeds = [];
1059
- if (el > 0) {
1060
- for (var j = 0; j < el; j++) {
1061
- if (typeof embeds[j].SetVariable != "undefined") {
1062
- activeEmbeds[activeEmbeds.length] = embeds[j];
1063
- }
1064
- }
1065
- }
1066
- var aol = activeObjects.length;
1067
- var ael = activeEmbeds.length;
1068
- var searchStr = "bridgeName="+ bridgeName;
1069
- if ((aol == 1 && !ael) || (aol == 1 && ael == 1)) {
1070
- FABridge.attachBridge(activeObjects[0], bridgeName);
1071
- }
1072
- else if (ael == 1 && !aol) {
1073
- FABridge.attachBridge(activeEmbeds[0], bridgeName);
1074
- }
1075
- else {
1076
- var flash_found = false;
1077
- if (aol > 1) {
1078
- for (var k = 0; k < aol; k++) {
1079
- var params = activeObjects[k].childNodes;
1080
- for (var l = 0; l < params.length; l++) {
1081
- var param = params[l];
1082
- if (param.nodeType == 1 && param.tagName.toLowerCase() == "param" && param["name"].toLowerCase() == "flashvars" && param["value"].indexOf(searchStr) >= 0) {
1083
- FABridge.attachBridge(activeObjects[k], bridgeName);
1084
- flash_found = true;
1085
- break;
1086
- }
1087
- }
1088
- if (flash_found) {
1089
- break;
1090
- }
1091
- }
1092
- }
1093
- if (!flash_found && ael > 1) {
1094
- for (var m = 0; m < ael; m++) {
1095
- var flashVars = activeEmbeds[m].attributes.getNamedItem("flashVars").nodeValue;
1096
- if (flashVars.indexOf(searchStr) >= 0) {
1097
- FABridge.attachBridge(activeEmbeds[m], bridgeName);
1098
- break;
1099
- }
1100
- }
1101
- }
1102
- }
1103
- return true;
1104
- }
1105
-
1106
- // used to track multiple bridge instances, since callbacks from AS are global across the page.
1107
-
1108
- FABridge.nextBridgeID = 0;
1109
- FABridge.instances = {};
1110
- FABridge.idMap = {};
1111
- FABridge.refCount = 0;
1112
-
1113
- FABridge.extractBridgeFromID = function(id)
1114
- {
1115
- var bridgeID = (id >> 16);
1116
- return FABridge.idMap[bridgeID];
1117
- }
1118
-
1119
- FABridge.attachBridge = function(instance, bridgeName)
1120
- {
1121
- var newBridgeInstance = new FABridge(instance, bridgeName);
1122
-
1123
- FABridge[bridgeName] = newBridgeInstance;
1124
-
1125
- /* FABridge[bridgeName] = function() {
1126
- return newBridgeInstance.root();
1127
- }
1128
- */
1129
- var callbacks = FABridge.initCallbacks[bridgeName];
1130
- if (callbacks == null)
1131
- {
1132
- return;
1133
- }
1134
- for (var i = 0; i < callbacks.length; i++)
1135
- {
1136
- callbacks[i].call(newBridgeInstance);
1137
- }
1138
- delete FABridge.initCallbacks[bridgeName]
1139
- }
1140
-
1141
- // some methods can't be proxied. You can use the explicit get,set, and call methods if necessary.
1142
-
1143
- FABridge.blockedMethods =
1144
- {
1145
- toString: true,
1146
- get: true,
1147
- set: true,
1148
- call: true
1149
- };
1150
-
1151
- FABridge.prototype =
1152
- {
1153
-
1154
-
1155
- // bootstrapping
1156
-
1157
- root: function()
1158
- {
1159
- return this.deserialize(this.target.getRoot());
1160
- },
1161
- //clears all of the AS objects in the cache maps
1162
- releaseASObjects: function()
1163
- {
1164
- return this.target.releaseASObjects();
1165
- },
1166
- //clears a specific object in AS from the type maps
1167
- releaseNamedASObject: function(value)
1168
- {
1169
- if(typeof(value) != "object")
1170
- {
1171
- return false;
1172
- }
1173
- else
1174
- {
1175
- var ret = this.target.releaseNamedASObject(value.fb_instance_id);
1176
- return ret;
1177
- }
1178
- },
1179
- //create a new AS Object
1180
- create: function(className)
1181
- {
1182
- return this.deserialize(this.target.create(className));
1183
- },
1184
-
1185
-
1186
- // utilities
1187
-
1188
- makeID: function(token)
1189
- {
1190
- return (this.bridgeID << 16) + token;
1191
- },
1192
-
1193
-
1194
- // low level access to the flash object
1195
-
1196
- //get a named property from an AS object
1197
- getPropertyFromAS: function(objRef, propName)
1198
- {
1199
- if (FABridge.refCount > 0)
1200
- {
1201
- throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
1202
- }
1203
- else
1204
- {
1205
- FABridge.refCount++;
1206
- retVal = this.target.getPropFromAS(objRef, propName);
1207
- retVal = this.handleError(retVal);
1208
- FABridge.refCount--;
1209
- return retVal;
1210
- }
1211
- },
1212
- //set a named property on an AS object
1213
- setPropertyInAS: function(objRef,propName, value)
1214
- {
1215
- if (FABridge.refCount > 0)
1216
- {
1217
- throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
1218
- }
1219
- else
1220
- {
1221
- FABridge.refCount++;
1222
- retVal = this.target.setPropInAS(objRef,propName, this.serialize(value));
1223
- retVal = this.handleError(retVal);
1224
- FABridge.refCount--;
1225
- return retVal;
1226
- }
1227
- },
1228
-
1229
- //call an AS function
1230
- callASFunction: function(funcID, args)
1231
- {
1232
- if (FABridge.refCount > 0)
1233
- {
1234
- throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
1235
- }
1236
- else
1237
- {
1238
- FABridge.refCount++;
1239
- retVal = this.target.invokeASFunction(funcID, this.serialize(args));
1240
- retVal = this.handleError(retVal);
1241
- FABridge.refCount--;
1242
- return retVal;
1243
- }
1244
- },
1245
- //call a method on an AS object
1246
- callASMethod: function(objID, funcName, args)
1247
- {
1248
- if (FABridge.refCount > 0)
1249
- {
1250
- throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
1251
- }
1252
- else
1253
- {
1254
- FABridge.refCount++;
1255
- args = this.serialize(args);
1256
- retVal = this.target.invokeASMethod(objID, funcName, args);
1257
- retVal = this.handleError(retVal);
1258
- FABridge.refCount--;
1259
- return retVal;
1260
- }
1261
- },
1262
-
1263
- // responders to remote calls from flash
1264
-
1265
- //callback from flash that executes a local JS function
1266
- //used mostly when setting js functions as callbacks on events
1267
- invokeLocalFunction: function(funcID, args)
1268
- {
1269
- var result;
1270
- var func = this.localFunctionCache[funcID];
1271
-
1272
- if(func != undefined)
1273
- {
1274
- result = this.serialize(func.apply(null, this.deserialize(args)));
1275
- }
1276
-
1277
- return result;
1278
- },
1279
-
1280
- // Object Types and Proxies
1281
-
1282
- // accepts an object reference, returns a type object matching the obj reference.
1283
- getTypeFromName: function(objTypeName)
1284
- {
1285
- return this.remoteTypeCache[objTypeName];
1286
- },
1287
- //create an AS proxy for the given object ID and type
1288
- createProxy: function(objID, typeName)
1289
- {
1290
- var objType = this.getTypeFromName(typeName);
1291
- instanceFactory.prototype = objType;
1292
- var instance = new instanceFactory(objID);
1293
- this.remoteInstanceCache[objID] = instance;
1294
- return instance;
1295
- },
1296
- //return the proxy associated with the given object ID
1297
- getProxy: function(objID)
1298
- {
1299
- return this.remoteInstanceCache[objID];
1300
- },
1301
-
1302
- // accepts a type structure, returns a constructed type
1303
- addTypeDataToCache: function(typeData)
1304
- {
1305
- var newType = new ASProxy(this, typeData.name);
1306
- var accessors = typeData.accessors;
1307
- for (var i = 0; i < accessors.length; i++)
1308
- {
1309
- this.addPropertyToType(newType, accessors[i]);
1310
- }
1311
-
1312
- var methods = typeData.methods;
1313
- for (var i = 0; i < methods.length; i++)
1314
- {
1315
- if (FABridge.blockedMethods[methods[i]] == undefined)
1316
- {
1317
- this.addMethodToType(newType, methods[i]);
1318
- }
1319
- }
1320
-
1321
-
1322
- this.remoteTypeCache[newType.typeName] = newType;
1323
- return newType;
1324
- },
1325
-
1326
- //add a property to a typename; used to define the properties that can be called on an AS proxied object
1327
- addPropertyToType: function(ty, propName)
1328
- {
1329
- var c = propName.charAt(0);
1330
- var setterName;
1331
- var getterName;
1332
- if(c >= "a" && c <= "z")
1333
- {
1334
- getterName = "get" + c.toUpperCase() + propName.substr(1);
1335
- setterName = "set" + c.toUpperCase() + propName.substr(1);
1336
- }
1337
- else
1338
- {
1339
- getterName = "get" + propName;
1340
- setterName = "set" + propName;
1341
- }
1342
- ty[setterName] = function(val)
1343
- {
1344
- this.bridge.setPropertyInAS(this.fb_instance_id, propName, val);
1345
- }
1346
- ty[getterName] = function()
1347
- {
1348
- return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName));
1349
- }
1350
- },
1351
-
1352
- //add a method to a typename; used to define the methods that can be callefd on an AS proxied object
1353
- addMethodToType: function(ty, methodName)
1354
- {
1355
- ty[methodName] = function()
1356
- {
1357
- return this.bridge.deserialize(this.bridge.callASMethod(this.fb_instance_id, methodName, FABridge.argsToArray(arguments)));
1358
- }
1359
- },
1360
-
1361
- // Function Proxies
1362
-
1363
- //returns the AS proxy for the specified function ID
1364
- getFunctionProxy: function(funcID)
1365
- {
1366
- var bridge = this;
1367
- if (this.remoteFunctionCache[funcID] == null)
1368
- {
1369
- this.remoteFunctionCache[funcID] = function()
1370
- {
1371
- bridge.callASFunction(funcID, FABridge.argsToArray(arguments));
1372
- }
1373
- }
1374
- return this.remoteFunctionCache[funcID];
1375
- },
1376
-
1377
- //reutrns the ID of the given function; if it doesnt exist it is created and added to the local cache
1378
- getFunctionID: function(func)
1379
- {
1380
- if (func.__bridge_id__ == undefined)
1381
- {
1382
- func.__bridge_id__ = this.makeID(this.nextLocalFuncID++);
1383
- this.localFunctionCache[func.__bridge_id__] = func;
1384
- }
1385
- return func.__bridge_id__;
1386
- },
1387
-
1388
- // serialization / deserialization
1389
-
1390
- serialize: function(value)
1391
- {
1392
- var result = {};
1393
-
1394
- var t = typeof(value);
1395
- //primitives are kept as such
1396
- if (t == "number" || t == "string" || t == "boolean" || t == null || t == undefined)
1397
- {
1398
- result = value;
1399
- }
1400
- else if (value instanceof Array)
1401
- {
1402
- //arrays are serializesd recursively
1403
- result = [];
1404
- for (var i = 0; i < value.length; i++)
1405
- {
1406
- result[i] = this.serialize(value[i]);
1407
- }
1408
- }
1409
- else if (t == "function")
1410
- {
1411
- //js functions are assigned an ID and stored in the local cache
1412
- result.type = FABridge.TYPE_JSFUNCTION;
1413
- result.value = this.getFunctionID(value);
1414
- }
1415
- else if (value instanceof ASProxy)
1416
- {
1417
- result.type = FABridge.TYPE_ASINSTANCE;
1418
- result.value = value.fb_instance_id;
1419
- }
1420
- else
1421
- {
1422
- result.type = FABridge.TYPE_ANONYMOUS;
1423
- result.value = value;
1424
- }
1425
-
1426
- return result;
1427
- },
1428
-
1429
- //on deserialization we always check the return for the specific error code that is used to marshall NPE's into JS errors
1430
- // the unpacking is done by returning the value on each pachet for objects/arrays
1431
- deserialize: function(packedValue)
1432
- {
1433
-
1434
- var result;
1435
-
1436
- var t = typeof(packedValue);
1437
- if (t == "number" || t == "string" || t == "boolean" || packedValue == null || packedValue == undefined)
1438
- {
1439
- result = this.handleError(packedValue);
1440
- }
1441
- else if (packedValue instanceof Array)
1442
- {
1443
- result = [];
1444
- for (var i = 0; i < packedValue.length; i++)
1445
- {
1446
- result[i] = this.deserialize(packedValue[i]);
1447
- }
1448
- }
1449
- else if (t == "object")
1450
- {
1451
- for(var i = 0; i < packedValue.newTypes.length; i++)
1452
- {
1453
- this.addTypeDataToCache(packedValue.newTypes[i]);
1454
- }
1455
- for (var aRefID in packedValue.newRefs)
1456
- {
1457
- this.createProxy(aRefID, packedValue.newRefs[aRefID]);
1458
- }
1459
- if (packedValue.type == FABridge.TYPE_PRIMITIVE)
1460
- {
1461
- result = packedValue.value;
1462
- }
1463
- else if (packedValue.type == FABridge.TYPE_ASFUNCTION)
1464
- {
1465
- result = this.getFunctionProxy(packedValue.value);
1466
- }
1467
- else if (packedValue.type == FABridge.TYPE_ASINSTANCE)
1468
- {
1469
- result = this.getProxy(packedValue.value);
1470
- }
1471
- else if (packedValue.type == FABridge.TYPE_ANONYMOUS)
1472
- {
1473
- result = packedValue.value;
1474
- }
1475
- }
1476
- return result;
1477
- },
1478
- //increases the reference count for the given object
1479
- addRef: function(obj)
1480
- {
1481
- this.target.incRef(obj.fb_instance_id);
1482
- },
1483
- //decrease the reference count for the given object and release it if needed
1484
- release:function(obj)
1485
- {
1486
- this.target.releaseRef(obj.fb_instance_id);
1487
- },
1488
-
1489
- // check the given value for the components of the hard-coded error code : __FLASHERROR
1490
- // used to marshall NPE's into flash
1491
-
1492
- handleError: function(value)
1493
- {
1494
- if (typeof(value)=="string" && value.indexOf("__FLASHERROR")==0)
1495
- {
1496
- var myErrorMessage = value.split("||");
1497
- if(FABridge.refCount > 0 )
1498
- {
1499
- FABridge.refCount--;
1500
- }
1501
- throw new Error(myErrorMessage[1]);
1502
- return value;
1503
- }
1504
- else
1505
- {
1506
- return value;
1507
- }
1508
- }
1509
- };
1510
-
1511
- // The root ASProxy class that facades a flash object
1512
-
1513
- ASProxy = function(bridge, typeName)
1514
- {
1515
- this.bridge = bridge;
1516
- this.typeName = typeName;
1517
- return this;
1518
- };
1519
- //methods available on each ASProxy object
1520
- ASProxy.prototype =
1521
- {
1522
- get: function(propName)
1523
- {
1524
- return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName));
1525
- },
1526
-
1527
- set: function(propName, value)
1528
- {
1529
- this.bridge.setPropertyInAS(this.fb_instance_id, propName, value);
1530
- },
1531
-
1532
- call: function(funcName, args)
1533
- {
1534
- this.bridge.callASMethod(this.fb_instance_id, funcName, args);
1535
- },
1536
-
1537
- addRef: function() {
1538
- this.bridge.addRef(this);
1539
- },
1540
-
1541
- release: function() {
1542
- this.bridge.release(this);
1543
- }
1544
- };
1545
-
1546
- // Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
1547
- // License: New BSD License
1548
- // Reference: http://dev.w3.org/html5/websockets/
1549
- // Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol
1550
-
1551
- (function() {
1552
-
1553
- if (window.WebSocket) return;
1554
-
1555
- var console = window.console;
1556
- if (!console || !console.log || !console.error) {
1557
- console = {log: function(){ }, error: function(){ }};
1558
- }
1559
-
1560
- if (!swfobject.hasFlashPlayerVersion("9.0.0")) {
1561
- console.error("Flash Player is not installed.");
1562
- return;
1563
- }
1564
- if (location.protocol == "file:") {
1565
- console.error(
1566
- "WARNING: web-socket-js doesn't work in file:///... URL " +
1567
- "unless you set Flash Security Settings properly. " +
1568
- "Open the page via Web server i.e. http://...");
1569
- }
1570
-
1571
- WebSocket = function(url, protocol, proxyHost, proxyPort, headers) {
1572
- var self = this;
1573
- self.readyState = WebSocket.CONNECTING;
1574
- self.bufferedAmount = 0;
1575
- // Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc.
1576
- // Otherwise, when onopen fires immediately, onopen is called before it is set.
1577
- setTimeout(function() {
1578
- WebSocket.__addTask(function() {
1579
- self.__createFlash(url, protocol, proxyHost, proxyPort, headers);
1580
- });
1581
- }, 0);
1582
- };
1583
-
1584
- WebSocket.prototype.__createFlash = function(url, protocol, proxyHost, proxyPort, headers) {
1585
- var self = this;
1586
- self.__flash =
1587
- WebSocket.__flash.create(url, protocol, proxyHost || null, proxyPort || 0, headers || null);
1588
- self.__flash.addEventListener("event", function(fe) {
1589
- // Uses setTimeout() to workaround the error:
1590
- // > You are trying to call recursively into the Flash Player which is not allowed.
1591
- setTimeout(function() { self.__handleEvents(); }, 0);
1592
- });
1593
- //console.log("[WebSocket] Flash object is ready");
1594
- };
1595
-
1596
- WebSocket.prototype.send = function(data) {
1597
- if (!this.__flash || this.readyState == WebSocket.CONNECTING) {
1598
- throw "INVALID_STATE_ERR: Web Socket connection has not been established";
1599
- }
1600
- // We use encodeURIComponent() here, because FABridge doesn't work if
1601
- // the argument includes some characters. We don't use escape() here
1602
- // because of this:
1603
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Functions#escape_and_unescape_Functions
1604
- // But it looks decodeURIComponent(encodeURIComponent(s)) doesn't
1605
- // preserve all Unicode characters either e.g. "\uffff" in Firefox.
1606
- var result = this.__flash.send(encodeURIComponent(data));
1607
- if (result < 0) { // success
1608
- return true;
1609
- } else {
1610
- this.bufferedAmount += result;
1611
- return false;
1612
- }
1613
- };
1614
-
1615
- WebSocket.prototype.close = function() {
1616
- var self = this;
1617
- if (!self.__flash) return;
1618
- if (self.readyState == WebSocket.CLOSED || self.readyState == WebSocket.CLOSING) return;
1619
- self.__flash.close();
1620
- // Sets/calls them manually here because Flash WebSocketConnection.close cannot fire events
1621
- // which causes weird error:
1622
- // > You are trying to call recursively into the Flash Player which is not allowed.
1623
- self.readyState = WebSocket.CLOSED;
1624
- if (self.__timer) clearInterval(self.__timer);
1625
- if (self.onclose) {
1626
- // Make it asynchronous so that it looks more like an actual
1627
- // close event
1628
- setTimeout(self.onclose, 0);
1629
- }
1630
- };
1631
-
1632
- /**
1633
- * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
1634
- *
1635
- * @param {string} type
1636
- * @param {function} listener
1637
- * @param {boolean} useCapture !NB Not implemented yet
1638
- * @return void
1639
- */
1640
- WebSocket.prototype.addEventListener = function(type, listener, useCapture) {
1641
- if (!('__events' in this)) {
1642
- this.__events = {};
1643
- }
1644
- if (!(type in this.__events)) {
1645
- this.__events[type] = [];
1646
- if ('function' == typeof this['on' + type]) {
1647
- this.__events[type].defaultHandler = this['on' + type];
1648
- this['on' + type] = this.__createEventHandler(this, type);
1649
- }
1650
- }
1651
- this.__events[type].push(listener);
1652
- };
1653
-
1654
- /**
1655
- * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
1656
- *
1657
- * @param {string} type
1658
- * @param {function} listener
1659
- * @param {boolean} useCapture NB! Not implemented yet
1660
- * @return void
1661
- */
1662
- WebSocket.prototype.removeEventListener = function(type, listener, useCapture) {
1663
- if (!('__events' in this)) {
1664
- this.__events = {};
1665
- }
1666
- if (!(type in this.__events)) return;
1667
- for (var i = this.__events.length; i > -1; --i) {
1668
- if (listener === this.__events[type][i]) {
1669
- this.__events[type].splice(i, 1);
1670
- break;
1671
- }
1672
- }
1673
- };
1674
-
1675
- /**
1676
- * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
1677
- *
1678
- * @param {WebSocketEvent} event
1679
- * @return void
1680
- */
1681
- WebSocket.prototype.dispatchEvent = function(event) {
1682
- if (!('__events' in this)) throw 'UNSPECIFIED_EVENT_TYPE_ERR';
1683
- if (!(event.type in this.__events)) throw 'UNSPECIFIED_EVENT_TYPE_ERR';
1684
-
1685
- for (var i = 0, l = this.__events[event.type].length; i < l; ++ i) {
1686
- this.__events[event.type][i](event);
1687
- if (event.cancelBubble) break;
1688
- }
1689
-
1690
- if (false !== event.returnValue &&
1691
- 'function' == typeof this.__events[event.type].defaultHandler)
1692
- {
1693
- this.__events[event.type].defaultHandler(event);
1694
- }
1695
- };
1696
-
1697
- WebSocket.prototype.__handleEvents = function() {
1698
- // Gets events using receiveEvents() instead of getting it from event object
1699
- // of Flash event. This is to make sure to keep message order.
1700
- // It seems sometimes Flash events don't arrive in the same order as they are sent.
1701
- var events = this.__flash.receiveEvents();
1702
- for (var i = 0; i < events.length; i++) {
1703
- try {
1704
- var event = events[i];
1705
- if ("readyState" in event) {
1706
- this.readyState = event.readyState;
1707
- }
1708
- if (event.type == "open") {
1709
-
1710
- if (this.__timer) clearInterval(this.__timer);
1711
- if (window.opera) {
1712
- // Workaround for weird behavior of Opera which sometimes drops events.
1713
- this.__timer = setInterval(function () {
1714
- this.__handleEvents();
1715
- }, 500);
1716
- }
1717
- if (this.onopen) this.onopen();
1718
-
1719
- } else if (event.type == "close") {
1720
-
1721
- if (this.__timer) clearInterval(this.__timer);
1722
- if (this.onclose) this.onclose();
1723
-
1724
- } else if (event.type == "message") {
1725
-
1726
- if (this.onmessage) {
1727
- var data = decodeURIComponent(event.data);
1728
- var e;
1729
- if (window.MessageEvent && !window.opera) {
1730
- e = document.createEvent("MessageEvent");
1731
- e.initMessageEvent("message", false, false, data, null, null, window, null);
1732
- } else {
1733
- // IE and Opera, the latter one truncates the data parameter after any 0x00 bytes.
1734
- e = {data: data};
1735
- }
1736
- this.onmessage(e);
1737
- }
1738
-
1739
- } else if (event.type == "error") {
1740
-
1741
- if (this.__timer) clearInterval(this.__timer);
1742
- if (this.onerror) this.onerror();
1743
-
1744
- } else {
1745
- throw "unknown event type: " + event.type;
1746
- }
1747
- } catch (e) {
1748
- console.error(e.toString());
1749
- }
1750
- }
1751
- };
1752
-
1753
- /**
1754
- * @param {object} object
1755
- * @param {string} type
1756
- */
1757
- WebSocket.prototype.__createEventHandler = function(object, type) {
1758
- return function(data) {
1759
- var event = new WebSocketEvent();
1760
- event.initEvent(type, true, true);
1761
- event.target = event.currentTarget = object;
1762
- for (var key in data) {
1763
- event[key] = data[key];
1764
- }
1765
- object.dispatchEvent(event, arguments);
1766
- };
1767
- };
1768
-
1769
- /**
1770
- * Basic implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface">DOM 2 EventInterface</a>}
1771
- *
1772
- * @class
1773
- * @constructor
1774
- */
1775
- function WebSocketEvent(){}
1776
-
1777
- /**
1778
- *
1779
- * @type boolean
1780
- */
1781
- WebSocketEvent.prototype.cancelable = true;
1782
-
1783
- /**
1784
- *
1785
- * @type boolean
1786
- */
1787
- WebSocketEvent.prototype.cancelBubble = false;
1788
-
1789
- /**
1790
- *
1791
- * @return void
1792
- */
1793
- WebSocketEvent.prototype.preventDefault = function() {
1794
- if (this.cancelable) {
1795
- this.returnValue = false;
1796
- }
1797
- };
1798
-
1799
- /**
1800
- *
1801
- * @return void
1802
- */
1803
- WebSocketEvent.prototype.stopPropagation = function() {
1804
- this.cancelBubble = true;
1805
- };
1806
-
1807
- /**
1808
- *
1809
- * @param {string} eventTypeArg
1810
- * @param {boolean} canBubbleArg
1811
- * @param {boolean} cancelableArg
1812
- * @return void
1813
- */
1814
- WebSocketEvent.prototype.initEvent = function(eventTypeArg, canBubbleArg, cancelableArg) {
1815
- this.type = eventTypeArg;
1816
- this.cancelable = cancelableArg;
1817
- this.timeStamp = new Date();
1818
- };
1819
-
1820
-
1821
- WebSocket.CONNECTING = 0;
1822
- WebSocket.OPEN = 1;
1823
- WebSocket.CLOSING = 2;
1824
- WebSocket.CLOSED = 3;
1825
-
1826
- WebSocket.__tasks = [];
1827
-
1828
- WebSocket.loadFlashPolicyFile = function(url) {
1829
- WebSocket.__addTask(function() {
1830
- WebSocket.__flash.loadManualPolicyFile(url);
1831
- });
1832
- }
1833
-
1834
- WebSocket.__initialize = function() {
1835
- if (WebSocket.__swfLocation) {
1836
- // For backword compatibility.
1837
- window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation;
1838
- }
1839
- if (!window.WEB_SOCKET_SWF_LOCATION) {
1840
- console.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");
1841
- return;
1842
- }
1843
- var container = document.createElement("div");
1844
- container.id = "webSocketContainer";
1845
- // Hides Flash box. We cannot use display: none or visibility: hidden because it prevents
1846
- // Flash from loading at least in IE. So we move it out of the screen at (-100, -100).
1847
- // But this even doesn't work with Flash Lite (e.g. in Droid Incredible). So with Flash
1848
- // Lite, we put it at (0, 0). This shows 1x1 box visible at left-top corner but this is
1849
- // the best we can do as far as we know now.
1850
- container.style.position = "absolute";
1851
- if (WebSocket.__isFlashLite()) {
1852
- container.style.left = "0px";
1853
- container.style.top = "0px";
1854
- } else {
1855
- container.style.left = "-100px";
1856
- container.style.top = "-100px";
1857
- }
1858
- var holder = document.createElement("div");
1859
- holder.id = "webSocketFlash";
1860
- container.appendChild(holder);
1861
- document.body.appendChild(container);
1862
- // See this article for hasPriority:
1863
- // http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html
1864
- swfobject.embedSWF(
1865
- WEB_SOCKET_SWF_LOCATION, "webSocketFlash",
1866
- "1" /* width */, "1" /* height */, "9.0.0" /* SWF version */,
1867
- null, {bridgeName: "webSocket"}, {hasPriority: true, allowScriptAccess: "always"}, null,
1868
- function(e) {
1869
- if (!e.success) console.error("[WebSocket] swfobject.embedSWF failed");
1870
- }
1871
- );
1872
- FABridge.addInitializationCallback("webSocket", function() {
1873
- try {
1874
- //console.log("[WebSocket] FABridge initializad");
1875
- WebSocket.__flash = FABridge.webSocket.root();
1876
- WebSocket.__flash.setCallerUrl(location.href);
1877
- WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);
1878
- for (var i = 0; i < WebSocket.__tasks.length; ++i) {
1879
- WebSocket.__tasks[i]();
1880
- }
1881
- WebSocket.__tasks = [];
1882
- } catch (e) {
1883
- console.error("[WebSocket] " + e.toString());
1884
- }
1885
- });
1886
- };
1887
-
1888
- WebSocket.__addTask = function(task) {
1889
- if (WebSocket.__flash) {
1890
- task();
1891
- } else {
1892
- WebSocket.__tasks.push(task);
1893
- }
1894
- };
1895
-
1896
- WebSocket.__isFlashLite = function() {
1897
- if (!window.navigator || !window.navigator.mimeTypes) return false;
1898
- var mimeType = window.navigator.mimeTypes["application/x-shockwave-flash"];
1899
- if (!mimeType || !mimeType.enabledPlugin || !mimeType.enabledPlugin.filename) return false;
1900
- return mimeType.enabledPlugin.filename.match(/flashlite/i) ? true : false;
1901
- };
1902
-
1903
- // called from Flash
1904
- window.webSocketLog = function(message) {
1905
- console.log(decodeURIComponent(message));
1906
- };
1907
-
1908
- // called from Flash
1909
- window.webSocketError = function(message) {
1910
- console.error(decodeURIComponent(message));
1911
- };
1912
-
1913
- if (!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION) {
1914
- if (window.addEventListener) {
1915
- window.addEventListener("load", WebSocket.__initialize, false);
1916
- } else {
1917
- window.attachEvent("onload", WebSocket.__initialize);
1918
- }
1919
- }
1920
-
1921
- })();
1922
-