mongo and meteor are removed, peace

This commit is contained in:
George Hotz 2014-07-14 15:30:50 -07:00
parent 4c5febd8c3
commit 7fb6001bd2
60 changed files with 46 additions and 31737 deletions

View File

@ -178,7 +178,6 @@ def serve(path):
return
webstatic = os.path.dirname(os.path.realpath(__file__))+"/../webstatic/"
print path
ext = path.split(".")[-1]
if ext == 'css':

View File

@ -1,20 +1,17 @@
#!/bin/sh
rm -f *.html *.js *.css *.map
wget http://localhost:3000/index.html http://localhost:3000/template.qira.js
rm -f *.js
wget http://localhost:3000/template.qira.js
#wget $(grep style index.html | awk '{ print $3 }' | sed 's/href="/http:\/\/localhost:3000/' | sed 's/\.css.*/\.map/')
#wget $(grep style index.html | awk '{ print $3 }' | sed 's/href="/http:\/\/localhost:3000/' | sed 's/\.css.*/\.css/')
cd packages
rm -f *.js
JSFILES=$(grep packages ../index.html | awk '{ print $3 }' | sed 's/src="/http:\/\/localhost:3000/' | sed 's/?.*//')
JSFILES=$(wget -qO- http://localhost:3000/index.html | grep packages | awk '{ print $3 }' | sed 's/src="/http:\/\/localhost:3000/' | sed 's/?.*//' | grep -v "livedata" | grep -v "application-configuration")
echo $JSFILES
wget -q $JSFILES
wget -qO- $JSFILES | grep -v "^//# sourceMappingURL=" | grep -v "^DDP = Package.livedata.DDP;$" > package.js
yui-compressor package.js -o package.js
rm -f *.map
MAPFILES=$(grep packages ../index.html | awk '{ print $3 }' | sed 's/[^?]*?/http:\/\/localhost:3000\/packages\//' | sed 's/".*/\.map/')
echo $MAPFILES
wget -q $MAPFILES
# *** FOR DEBUGGING ***
CSSFILE=$(grep style ../index.html | awk '{ print $3 }' | sed 's/[^?]*?/http:\/\/localhost:3000\/packages\//' | sed 's/".*/\.map/')
#JSFILES=$(wget -qO- http://localhost:3000/index.html | grep packages | awk '{ print $3 }' | sed 's/src="/http:\/\/localhost:3000/' | sed 's/?.*//')
#cd packages
#wget -q $JSFILES

View File

@ -1,45 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/223948e5b7d3c78ecd03a59e2b49a2198c2cf5f9.css">
<link rel="stylesheet" href="/qira.css">
<script type="text/javascript">__meteor_runtime_config__ = {"meteorRelease":"0.8.2","ROOT_URL":"http://localhost:3000/","ROOT_URL_PATH_PREFIX":""};</script>
<script type="text/javascript" src="/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18"></script>
<script type="text/javascript" src="/packages/meteor.js?439f867e12888606900664d4463e1b3ee3644e44"></script>
<script type="text/javascript" src="/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4"></script>
<script type="text/javascript" src="/packages/deps.js?4a82362ae66e863a1c1a8b0a5fec6f665e2038d1"></script>
<script type="text/javascript" src="/packages/random.js?fe7b46080c91ce482acf6fc326afbc5b176f0502"></script>
<script type="text/javascript" src="/packages/json.js?e22856eae714c681199eabc5c0710b904b125554"></script>
<script type="text/javascript" src="/packages/ejson.js?9ccd48dbafd805e21408c9eae1061468b3ec1f2f"></script>
<script type="text/javascript" src="/packages/ordered-dict.js?bf8af2f26c8d96bf8b2e6b407d3ed69f23c2cd37"></script>
<script type="text/javascript" src="/packages/id-map.js?9ea6eaae8d74693ce2505a858d9a5e60cf191298"></script>
<script type="text/javascript" src="/packages/geojson-utils.js?81b79d5cf96d00b4b7a28987debcffb665c17526"></script>
<script type="text/javascript" src="/packages/minimongo.js?6aa0e153bfd7e4a28ee447a4cbfaf1fef0870a06"></script>
<script type="text/javascript" src="/packages/observe-sequence.js?4e05989af52e13ed5032f712022fe58c7ee894ed"></script>
<script type="text/javascript" src="/packages/htmljs.js?a0a9082010d25b3fb44e0f56bdd0a7b4e6bbeb93"></script>
<script type="text/javascript" src="/packages/ui.js?9419ac08328918a04e7a49464a988d45f851e1b0"></script>
<script type="text/javascript" src="/packages/templating.js?b36d51fd34724d5d501d8557cd9f846874d95aef"></script>
<script type="text/javascript" src="/packages/logging.js?0de00019cf57ae305903f15baf5dc8e10f973ded"></script>
<script type="text/javascript" src="/packages/check.js?c523809f1b6e549675209e7b75fdecd3b3bcdddf"></script>
<script type="text/javascript" src="/packages/retry.js?1f1dd2c35d300110fdaba51ce4473583bc3bf031"></script>
<script type="text/javascript" src="/packages/reactive-dict.js?22667928acc72f619ce81e7ac1e35def1ba9e0ae"></script>
<script type="text/javascript" src="/packages/session.js?5bcd2d86431dc10d5f4be0910cb6567342e1aaf6"></script>
<script type="text/javascript" src="/packages/webapp.js?e1be090051b82f046484dccc2de7d747e50c7328"></script>
<script type="text/javascript" src="/packages/spacebars-common.js?0650288b547b991579f81bb9b9b8f5a62320aa58"></script>
<script type="text/javascript" src="/packages/spacebars.js?8988006be5c29dbe17997e9691a21dce4e537665"></script>
<script type="text/javascript" src="/packages/global-imports.js?6aaf5a5227ca8cc4717cf10edbf4fba38a3661ba"></script>
<script type="text/javascript" src="/template.qira.js?e6390935f103248b183a04718a02ab63953c9982"></script>
<script type="text/javascript" src="/client/compatibility/base.js?2c95ce11ad55c7fdbcbf30ac39ae6bbb9fa123b1"></script>
<script type="text/javascript" src="/client/compatibility/socket.io.min.js?27671fa7e6070859d6aa658a080bc3699055181b"></script>
<script type="text/javascript" src="/client/controls.js?379f935fb4a4115f86eeeed0d7bd09bcde091bd2"></script>
<script type="text/javascript" src="/client/ida.js?816f31ed9bfc414dcea9b97360e30ae01f2d890c"></script>
<script type="text/javascript" src="/client/idump.js?896091578752c2e3fc2406a7863fda0e3b6bf252"></script>
<script type="text/javascript" src="/client/qira.js?07d4668beaea180a348aa7a17264da437f88f1f4"></script>
<script type="text/javascript" src="/client/regmem.js?6c8f0206a80de4b0086fce8d1f5012e154a73034"></script>
<script type="text/javascript" src="/client/vtimeline.js?e70804adf848938bc585412f0b2616c42510389e"></script>
<script type="text/javascript" src="/package.js"></script>
<script type="text/javascript" src="/template.qira.js"></script>
<script type="text/javascript" src="/client/compatibility/base.js"></script>
<script type="text/javascript" src="/client/compatibility/socket.io.min.js"></script>
<script type="text/javascript" src="/client/controls.js"></script>
<script type="text/javascript" src="/client/ida.js"></script>
<script type="text/javascript" src="/client/idump.js"></script>
<script type="text/javascript" src="/client/qira.js"></script>
<script type="text/javascript" src="/client/regmem.js"></script>
<script type="text/javascript" src="/client/vtimeline.js"></script>
<script type="text/javascript">
if (typeof Package === 'undefined' ||

26
webstatic/package.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
)]}'
{"version":3,"file":"/packages/spacebars-common.js","sources":["spacebars-common/spacebars.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,e","sourcesContent":["Spacebars = {};\n"]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
)]}'
{"version":3,"file":"/packages/retry.js","sources":["retry/retry.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2C;AACA,E;AACA,W;AACA,yD;AACA,kE;AACA,kD;AACA,sD;AACA,mE;AACA,qE;;AAEA,4B;AACA,kB;AACA,qD;AACA,kC;AACA,kB;AACA,oE;AACA,8B;AACA,uC;AACA,mB;AACA,gB;AACA,uB;AACA,M;AACA,yB;AACA,E;;AAEA,2B;;AAEA,mC;AACA,sB;AACA,oB;AACA,wB;AACA,oC;AACA,2B;AACA,I;;AAEA,sE;AACA,oC;AACA,8B;AACA,oB;;AAEA,8B;AACA,6B;;AAEA,2B;AACA,sB;AACA,yD;AACA,kE;AACA,wB;AACA,0D;AACA,4C;AACA,mB;AACA,I;;AAEA,0E;AACA,oC;AACA,oB;AACA,uC;AACA,wB;AACA,oC;AACA,qD;AACA,mB;AACA,G;;AAEA,G","sourcesContent":["// Retry logic with an exponential backoff.\n//\n// options:\n// baseTimeout: time for initial reconnect attempt (ms).\n// exponent: exponential factor to increase timeout each attempt.\n// maxTimeout: maximum time between retries (ms).\n// minCount: how many times to reconnect \"instantly\".\n// minTimeout: time to wait for the first `minCount` retries (ms).\n// fuzz: factor to randomize retry times by (to avoid retry storms).\n\nRetry = function (options) {\n var self = this;\n _.extend(self, _.defaults(_.clone(options || {}), {\n baseTimeout: 1000, // 1 second\n exponent: 2.2,\n // The default is high-ish to ensure a server can recover from a\n // failure caused by load.\n maxTimeout: 5 * 60000, // 5 minutes\n minTimeout: 10,\n minCount: 2,\n fuzz: 0.5 // +- 25%\n }));\n self.retryTimer = null;\n};\n\n_.extend(Retry.prototype, {\n\n // Reset a pending retry, if any.\n clear: function () {\n var self = this;\n if (self.retryTimer)\n clearTimeout(self.retryTimer);\n self.retryTimer = null;\n },\n\n // Calculate how long to wait in milliseconds to retry, based on the\n // `count` of which retry this is.\n _timeout: function (count) {\n var self = this;\n\n if (count < self.minCount)\n return self.minTimeout;\n\n var timeout = Math.min(\n self.maxTimeout,\n self.baseTimeout * Math.pow(self.exponent, count));\n // fuzz the timeout randomly, to avoid reconnect storms when a\n // server goes down.\n timeout = timeout * ((Random.fraction() * self.fuzz) +\n (1 - self.fuzz/2));\n return timeout;\n },\n\n // Call `fn` after a delay, based on the `count` of which retry this is.\n retryLater: function (count, fn) {\n var self = this;\n var timeout = self._timeout(count);\n if (self.retryTimer)\n clearTimeout(self.retryTimer);\n self.retryTimer = Meteor.setTimeout(fn, timeout);\n return timeout;\n }\n\n});\n"]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
)]}'
{"version":3,"file":"/packages/follower-livedata.js","sources":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
)]}'
{"version":3,"file":"/packages/session.js","sources":["session/session.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sB;AACA,qB;AACA,sE;AACA,4C;AACA,sC;AACA,G;AACA,C;;AAEA,yC;;AAEA,qB;AACA,2D;AACA,wC;AACA,K;AACA,C","sourcesContent":["var migratedKeys = {};\nif (Package.reload) {\n var migrationData = Package.reload.Reload._migrationData('session');\n if (migrationData && migrationData.keys) {\n migratedKeys = migrationData.keys;\n }\n}\n\nSession = new ReactiveDict(migratedKeys);\n\nif (Package.reload) {\n Package.reload.Reload._onMigrate('session', function () {\n return [true, {keys: Session.keys}];\n });\n}\n"]}

File diff suppressed because one or more lines are too long

View File

@ -1,61 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/223948e5b7d3c78ecd03a59e2b49a2198c2cf5f9.css">
<script type="text/javascript">__meteor_runtime_config__ = {"meteorRelease":"0.8.2","ROOT_URL":"http://localhost:3000/","ROOT_URL_PATH_PREFIX":""};</script>
<script type="text/javascript" src="/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18"></script>
<script type="text/javascript" src="/packages/meteor.js?439f867e12888606900664d4463e1b3ee3644e44"></script>
<script type="text/javascript" src="/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4"></script>
<script type="text/javascript" src="/packages/deps.js?4a82362ae66e863a1c1a8b0a5fec6f665e2038d1"></script>
<script type="text/javascript" src="/packages/random.js?fe7b46080c91ce482acf6fc326afbc5b176f0502"></script>
<script type="text/javascript" src="/packages/json.js?e22856eae714c681199eabc5c0710b904b125554"></script>
<script type="text/javascript" src="/packages/ejson.js?9ccd48dbafd805e21408c9eae1061468b3ec1f2f"></script>
<script type="text/javascript" src="/packages/ordered-dict.js?bf8af2f26c8d96bf8b2e6b407d3ed69f23c2cd37"></script>
<script type="text/javascript" src="/packages/id-map.js?9ea6eaae8d74693ce2505a858d9a5e60cf191298"></script>
<script type="text/javascript" src="/packages/geojson-utils.js?81b79d5cf96d00b4b7a28987debcffb665c17526"></script>
<script type="text/javascript" src="/packages/minimongo.js?6aa0e153bfd7e4a28ee447a4cbfaf1fef0870a06"></script>
<script type="text/javascript" src="/packages/observe-sequence.js?4e05989af52e13ed5032f712022fe58c7ee894ed"></script>
<script type="text/javascript" src="/packages/htmljs.js?a0a9082010d25b3fb44e0f56bdd0a7b4e6bbeb93"></script>
<script type="text/javascript" src="/packages/ui.js?9419ac08328918a04e7a49464a988d45f851e1b0"></script>
<script type="text/javascript" src="/packages/templating.js?b36d51fd34724d5d501d8557cd9f846874d95aef"></script>
<script type="text/javascript" src="/packages/logging.js?0de00019cf57ae305903f15baf5dc8e10f973ded"></script>
<script type="text/javascript" src="/packages/check.js?c523809f1b6e549675209e7b75fdecd3b3bcdddf"></script>
<script type="text/javascript" src="/packages/retry.js?1f1dd2c35d300110fdaba51ce4473583bc3bf031"></script>
<script type="text/javascript" src="/packages/livedata.js?f42db198bc25553e9f50ea290229c73093a576b3"></script>
<script type="text/javascript" src="/packages/follower-livedata.js?39b05f02878030ae806a16a173661b7df1e92eb6"></script>
<script type="text/javascript" src="/packages/application-configuration.js?fa92020e10c808f1287070d009f69a4054676e5a"></script>
<script type="text/javascript" src="/packages/mongo-livedata.js?26f4a1853dbf09c49d7cc49710b6fa14f83b138b"></script>
<script type="text/javascript" src="/packages/reactive-dict.js?22667928acc72f619ce81e7ac1e35def1ba9e0ae"></script>
<script type="text/javascript" src="/packages/session.js?5bcd2d86431dc10d5f4be0910cb6567342e1aaf6"></script>
<script type="text/javascript" src="/packages/webapp.js?e1be090051b82f046484dccc2de7d747e50c7328"></script>
<script type="text/javascript" src="/packages/spacebars-common.js?0650288b547b991579f81bb9b9b8f5a62320aa58"></script>
<script type="text/javascript" src="/packages/spacebars.js?8988006be5c29dbe17997e9691a21dce4e537665"></script>
<script type="text/javascript" src="/packages/global-imports.js?6aaf5a5227ca8cc4717cf10edbf4fba38a3661ba"></script>
<script type="text/javascript" src="/template.qira.js?e6390935f103248b183a04718a02ab63953c9982"></script>
<script type="text/javascript" src="/client/compatibility/base.js?2c95ce11ad55c7fdbcbf30ac39ae6bbb9fa123b1"></script>
<script type="text/javascript" src="/client/compatibility/socket.io.min.js?27671fa7e6070859d6aa658a080bc3699055181b"></script>
<script type="text/javascript" src="/client/controls.js?379f935fb4a4115f86eeeed0d7bd09bcde091bd2"></script>
<script type="text/javascript" src="/client/ida.js?816f31ed9bfc414dcea9b97360e30ae01f2d890c"></script>
<script type="text/javascript" src="/client/idump.js?896091578752c2e3fc2406a7863fda0e3b6bf252"></script>
<script type="text/javascript" src="/client/qira.js?07d4668beaea180a348aa7a17264da437f88f1f4"></script>
<script type="text/javascript" src="/client/regmem.js?6c8f0206a80de4b0086fce8d1f5012e154a73034"></script>
<script type="text/javascript" src="/client/vtimeline.js?e70804adf848938bc585412f0b2616c42510389e"></script>
<script type="text/javascript">
if (typeof Package === 'undefined' ||
! Package.webapp ||
! Package.webapp.WebApp ||
! Package.webapp.WebApp._isCssLoaded())
document.location.reload();
</script>
<title>qira</title>
</head>
<body>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
)]}'
{"version":3,"file":"/packages/id-map.js","sources":["id-map/id-map.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yC;AACA,kB;AACA,iB;AACA,oD;AACA,wC;AACA,E;;AAEA,4E;AACA,6E;AACA,6E;AACA,gD;;AAEA,2B;AACA,sB;AACA,oB;AACA,oC;AACA,0B;AACA,I;AACA,6B;AACA,oB;AACA,oC;AACA,2B;AACA,I;AACA,yB;AACA,oB;AACA,oC;AACA,0B;AACA,I;AACA,sB;AACA,oB;AACA,oC;AACA,iC;AACA,I;AACA,sB;AACA,oB;AACA,gC;AACA,I;AACA,sB;AACA,oB;AACA,mB;AACA,I;AACA,0E;AACA,gC;AACA,oB;AACA,0D;AACA,iC;AACA,2C;AACA,gE;AACA,+D;AACA,iC;AACA,e;AACA,K;AACA,I;AACA,qB;AACA,oB;AACA,6B;AACA,I;AACA,kC;AACA,oB;AACA,oC;AACA,8B;AACA,4B;AACA,yB;AACA,e;AACA,I;AACA,6E;AACA,0D;AACA,sB;AACA,oB;AACA,4D;AACA,uC;AACA,wC;AACA,O;AACA,iB;AACA,G;AACA,G","sourcesContent":["IdMap = function (idStringify, idParse) {\n var self = this;\n self._map = {};\n self._idStringify = idStringify || JSON.stringify;\n self._idParse = idParse || JSON.parse;\n};\n\n// Some of these methods are designed to match methods on OrderedDict, since\n// (eg) ObserveMultiplex and _CachingChangeObserver use them interchangeably.\n// (Conceivably, this should be replaced with \"UnorderedDict\" with a specific\n// set of methods that overlap between the two.)\n\n_.extend(IdMap.prototype, {\n get: function (id) {\n var self = this;\n var key = self._idStringify(id);\n return self._map[key];\n },\n set: function (id, value) {\n var self = this;\n var key = self._idStringify(id);\n self._map[key] = value;\n },\n remove: function (id) {\n var self = this;\n var key = self._idStringify(id);\n delete self._map[key];\n },\n has: function (id) {\n var self = this;\n var key = self._idStringify(id);\n return _.has(self._map, key);\n },\n empty: function () {\n var self = this;\n return _.isEmpty(self._map);\n },\n clear: function () {\n var self = this;\n self._map = {};\n },\n // Iterates over the items in the map. Return `false` to break the loop.\n forEach: function (iterator) {\n var self = this;\n // don't use _.each, because we can't break out of it.\n var keys = _.keys(self._map);\n for (var i = 0; i < keys.length; i++) {\n var breakIfFalse = iterator.call(null, self._map[keys[i]],\n self._idParse(keys[i]));\n if (breakIfFalse === false)\n return;\n }\n },\n size: function () {\n var self = this;\n return _.size(self._map);\n },\n setDefault: function (id, def) {\n var self = this;\n var key = self._idStringify(id);\n if (_.has(self._map, key))\n return self._map[key];\n self._map[key] = def;\n return def;\n },\n // Assumes that values are EJSON-cloneable, and that we don't need to clone\n // IDs (ie, that nobody is going to mutate an ObjectId).\n clone: function () {\n var self = this;\n var clone = new IdMap(self._idStringify, self._idParse);\n self.forEach(function (value, id) {\n clone.set(id, EJSON.clone(value));\n });\n return clone;\n }\n});\n\n"]}

File diff suppressed because one or more lines are too long

View File

@ -1,36 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var Log = Package.logging.Log;
var _ = Package.underscore._;
var DDP = Package.livedata.DDP;
var EJSON = Package.ejson.EJSON;
var Follower = Package['follower-livedata'].Follower;
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['application-configuration'] = {};
})();
//# sourceMappingURL=fa92020e10c808f1287070d009f69a4054676e5a.map

View File

@ -1,2 +0,0 @@
)]}'
{"version":3,"file":"/packages/templating.js","sources":["templating/global_template_object.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sE;AACA,kB;AACA,c;;AAEA,2D;AACA,4C;AACA,qH;;AAEA,gD;AACA,qC;AACA,uB;AACA,sB;AACA,K;AACA,E","sourcesContent":["// Create an empty template object. Packages and apps add templates on\n// to this object.\nTemplate = {};\n\nTemplate.__define__ = function (templateName, renderFunc) {\n if (Template.hasOwnProperty(templateName))\n throw new Error(\"There are multiple templates named '\" + templateName + \"'. Each template needs a unique name.\");\n\n Template[templateName] = UI.Component.extend({\n kind: \"Template_\" + templateName,\n render: renderFunc,\n __helperHost: true\n });\n};\n"]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,386 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var _ = Package.underscore._;
var EJSON = Package.ejson.EJSON;
/* Package-scope variables */
var check, Match;
(function () {
///////////////////////////////////////////////////////////////////////////////////
// //
// packages/check/match.js //
// //
///////////////////////////////////////////////////////////////////////////////////
//
// XXX docs // 1
// 2
// Things we explicitly do NOT support: // 3
// - heterogenous arrays // 4
// 5
var currentArgumentChecker = new Meteor.EnvironmentVariable; // 6
// 7
check = function (value, pattern) { // 8
// Record that check got called, if somebody cared. // 9
// // 10
// We use getOrNullIfOutsideFiber so that it's OK to call check() // 11
// from non-Fiber server contexts; the downside is that if you forget to // 12
// bindEnvironment on some random callback in your method/publisher, // 13
// it might not find the argumentChecker and you'll get an error about // 14
// not checking an argument that it looks like you're checking (instead // 15
// of just getting a "Node code must run in a Fiber" error). // 16
var argChecker = currentArgumentChecker.getOrNullIfOutsideFiber(); // 17
if (argChecker) // 18
argChecker.checking(value); // 19
try { // 20
checkSubtree(value, pattern); // 21
} catch (err) { // 22
if ((err instanceof Match.Error) && err.path) // 23
err.message += " in field " + err.path; // 24
throw err; // 25
} // 26
}; // 27
// 28
Match = { // 29
Optional: function (pattern) { // 30
return new Optional(pattern); // 31
}, // 32
OneOf: function (/*arguments*/) { // 33
return new OneOf(_.toArray(arguments)); // 34
}, // 35
Any: ['__any__'], // 36
Where: function (condition) { // 37
return new Where(condition); // 38
}, // 39
ObjectIncluding: function (pattern) { // 40
return new ObjectIncluding(pattern); // 41
}, // 42
// Matches only signed 32-bit integers // 43
Integer: ['__integer__'], // 44
// 45
// XXX matchers should know how to describe themselves for errors // 46
Error: Meteor.makeErrorType("Match.Error", function (msg) { // 47
this.message = "Match error: " + msg; // 48
// The path of the value that failed to match. Initially empty, this gets // 49
// populated by catching and rethrowing the exception as it goes back up the // 50
// stack. // 51
// E.g.: "vals[3].entity.created" // 52
this.path = ""; // 53
// If this gets sent over DDP, don't give full internal details but at least // 54
// provide something better than 500 Internal server error. // 55
this.sanitizedError = new Meteor.Error(400, "Match failed"); // 56
}), // 57
// 58
// Tests to see if value matches pattern. Unlike check, it merely returns true // 59
// or false (unless an error other than Match.Error was thrown). It does not // 60
// interact with _failIfArgumentsAreNotAllChecked. // 61
// XXX maybe also implement a Match.match which returns more information about // 62
// failures but without using exception handling or doing what check() // 63
// does with _failIfArgumentsAreNotAllChecked and Meteor.Error conversion // 64
test: function (value, pattern) { // 65
try { // 66
checkSubtree(value, pattern); // 67
return true; // 68
} catch (e) { // 69
if (e instanceof Match.Error) // 70
return false; // 71
// Rethrow other errors. // 72
throw e; // 73
} // 74
}, // 75
// 76
// Runs `f.apply(context, args)`. If check() is not called on every element of // 77
// `args` (either directly or in the first level of an array), throws an error // 78
// (using `description` in the message). // 79
// // 80
_failIfArgumentsAreNotAllChecked: function (f, context, args, description) { // 81
var argChecker = new ArgumentChecker(args, description); // 82
var result = currentArgumentChecker.withValue(argChecker, function () { // 83
return f.apply(context, args); // 84
}); // 85
// If f didn't itself throw, make sure it checked all of its arguments. // 86
argChecker.throwUnlessAllArgumentsHaveBeenChecked(); // 87
return result; // 88
} // 89
}; // 90
// 91
var Optional = function (pattern) { // 92
this.pattern = pattern; // 93
}; // 94
// 95
var OneOf = function (choices) { // 96
if (_.isEmpty(choices)) // 97
throw new Error("Must provide at least one choice to Match.OneOf"); // 98
this.choices = choices; // 99
}; // 100
// 101
var Where = function (condition) { // 102
this.condition = condition; // 103
}; // 104
// 105
var ObjectIncluding = function (pattern) { // 106
this.pattern = pattern; // 107
}; // 108
// 109
var typeofChecks = [ // 110
[String, "string"], // 111
[Number, "number"], // 112
[Boolean, "boolean"], // 113
// While we don't allow undefined in EJSON, this is good for optional // 114
// arguments with OneOf. // 115
[undefined, "undefined"] // 116
]; // 117
// 118
var checkSubtree = function (value, pattern) { // 119
// Match anything! // 120
if (pattern === Match.Any) // 121
return; // 122
// 123
// Basic atomic types. // 124
// Do not match boxed objects (e.g. String, Boolean) // 125
for (var i = 0; i < typeofChecks.length; ++i) { // 126
if (pattern === typeofChecks[i][0]) { // 127
if (typeof value === typeofChecks[i][1]) // 128
return; // 129
throw new Match.Error("Expected " + typeofChecks[i][1] + ", got " + // 130
typeof value); // 131
} // 132
} // 133
if (pattern === null) { // 134
if (value === null) // 135
return; // 136
throw new Match.Error("Expected null, got " + EJSON.stringify(value)); // 137
} // 138
// 139
// Match.Integer is special type encoded with array // 140
if (pattern === Match.Integer) { // 141
// There is no consistent and reliable way to check if variable is a 64-bit // 142
// integer. One of the popular solutions is to get reminder of division by 1 // 143
// but this method fails on really large floats with big precision. // 144
// E.g.: 1.348192308491824e+23 % 1 === 0 in V8 // 145
// Bitwise operators work consistantly but always cast variable to 32-bit // 146
// signed integer according to JavaScript specs. // 147
if (typeof value === "number" && (value | 0) === value) // 148
return // 149
throw new Match.Error("Expected Integer, got " // 150
+ (value instanceof Object ? EJSON.stringify(value) : value)); // 151
} // 152
// 153
// "Object" is shorthand for Match.ObjectIncluding({}); // 154
if (pattern === Object) // 155
pattern = Match.ObjectIncluding({}); // 156
// 157
// Array (checked AFTER Any, which is implemented as an Array). // 158
if (pattern instanceof Array) { // 159
if (pattern.length !== 1) // 160
throw Error("Bad pattern: arrays must have one type element" + // 161
EJSON.stringify(pattern)); // 162
if (!_.isArray(value) && !_.isArguments(value)) { // 163
throw new Match.Error("Expected array, got " + EJSON.stringify(value)); // 164
} // 165
// 166
_.each(value, function (valueElement, index) { // 167
try { // 168
checkSubtree(valueElement, pattern[0]); // 169
} catch (err) { // 170
if (err instanceof Match.Error) { // 171
err.path = _prependPath(index, err.path); // 172
} // 173
throw err; // 174
} // 175
}); // 176
return; // 177
} // 178
// 179
// Arbitrary validation checks. The condition can return false or throw a // 180
// Match.Error (ie, it can internally use check()) to fail. // 181
if (pattern instanceof Where) { // 182
if (pattern.condition(value)) // 183
return; // 184
// XXX this error is terrible // 185
throw new Match.Error("Failed Match.Where validation"); // 186
} // 187
// 188
// 189
if (pattern instanceof Optional) // 190
pattern = Match.OneOf(undefined, pattern.pattern); // 191
// 192
if (pattern instanceof OneOf) { // 193
for (var i = 0; i < pattern.choices.length; ++i) { // 194
try { // 195
checkSubtree(value, pattern.choices[i]); // 196
// No error? Yay, return. // 197
return; // 198
} catch (err) { // 199
// Other errors should be thrown. Match errors just mean try another // 200
// choice. // 201
if (!(err instanceof Match.Error)) // 202
throw err; // 203
} // 204
} // 205
// XXX this error is terrible // 206
throw new Match.Error("Failed Match.OneOf or Match.Optional validation"); // 207
} // 208
// 209
// A function that isn't something we special-case is assumed to be a // 210
// constructor. // 211
if (pattern instanceof Function) { // 212
if (value instanceof pattern) // 213
return; // 214
// XXX what if .name isn't defined // 215
throw new Match.Error("Expected " + pattern.name); // 216
} // 217
// 218
var unknownKeysAllowed = false; // 219
if (pattern instanceof ObjectIncluding) { // 220
unknownKeysAllowed = true; // 221
pattern = pattern.pattern; // 222
} // 223
// 224
if (typeof pattern !== "object") // 225
throw Error("Bad pattern: unknown pattern type"); // 226
// 227
// An object, with required and optional keys. Note that this does NOT do // 228
// structural matches against objects of special types that happen to match // 229
// the pattern: this really needs to be a plain old {Object}! // 230
if (typeof value !== 'object') // 231
throw new Match.Error("Expected object, got " + typeof value); // 232
if (value === null) // 233
throw new Match.Error("Expected object, got null"); // 234
if (value.constructor !== Object) // 235
throw new Match.Error("Expected plain object"); // 236
// 237
var requiredPatterns = {}; // 238
var optionalPatterns = {}; // 239
_.each(pattern, function (subPattern, key) { // 240
if (subPattern instanceof Optional) // 241
optionalPatterns[key] = subPattern.pattern; // 242
else // 243
requiredPatterns[key] = subPattern; // 244
}); // 245
// 246
_.each(value, function (subValue, key) { // 247
try { // 248
if (_.has(requiredPatterns, key)) { // 249
checkSubtree(subValue, requiredPatterns[key]); // 250
delete requiredPatterns[key]; // 251
} else if (_.has(optionalPatterns, key)) { // 252
checkSubtree(subValue, optionalPatterns[key]); // 253
} else { // 254
if (!unknownKeysAllowed) // 255
throw new Match.Error("Unknown key"); // 256
} // 257
} catch (err) { // 258
if (err instanceof Match.Error) // 259
err.path = _prependPath(key, err.path); // 260
throw err; // 261
} // 262
}); // 263
// 264
_.each(requiredPatterns, function (subPattern, key) { // 265
throw new Match.Error("Missing key '" + key + "'"); // 266
}); // 267
}; // 268
// 269
var ArgumentChecker = function (args, description) { // 270
var self = this; // 271
// Make a SHALLOW copy of the arguments. (We'll be doing identity checks // 272
// against its contents.) // 273
self.args = _.clone(args); // 274
// Since the common case will be to check arguments in order, and we splice // 275
// out arguments when we check them, make it so we splice out from the end // 276
// rather than the beginning. // 277
self.args.reverse(); // 278
self.description = description; // 279
}; // 280
// 281
_.extend(ArgumentChecker.prototype, { // 282
checking: function (value) { // 283
var self = this; // 284
if (self._checkingOneValue(value)) // 285
return; // 286
// Allow check(arguments, [String]) or check(arguments.slice(1), [String]) // 287
// or check([foo, bar], [String]) to count... but only if value wasn't // 288
// itself an argument. // 289
if (_.isArray(value) || _.isArguments(value)) { // 290
_.each(value, _.bind(self._checkingOneValue, self)); // 291
} // 292
}, // 293
_checkingOneValue: function (value) { // 294
var self = this; // 295
for (var i = 0; i < self.args.length; ++i) { // 296
// Is this value one of the arguments? (This can have a false positive if // 297
// the argument is an interned primitive, but it's still a good enough // 298
// check.) // 299
if (value === self.args[i]) { // 300
self.args.splice(i, 1); // 301
return true; // 302
} // 303
} // 304
return false; // 305
}, // 306
throwUnlessAllArgumentsHaveBeenChecked: function () { // 307
var self = this; // 308
if (!_.isEmpty(self.args)) // 309
throw new Error("Did not check() all arguments during " + // 310
self.description); // 311
} // 312
}); // 313
// 314
var _jsKeywords = ["do", "if", "in", "for", "let", "new", "try", "var", "case", // 315
"else", "enum", "eval", "false", "null", "this", "true", "void", "with", // 316
"break", "catch", "class", "const", "super", "throw", "while", "yield", // 317
"delete", "export", "import", "public", "return", "static", "switch", // 318
"typeof", "default", "extends", "finally", "package", "private", "continue", // 319
"debugger", "function", "arguments", "interface", "protected", "implements", // 320
"instanceof"]; // 321
// 322
// Assumes the base of path is already escaped properly // 323
// returns key + base // 324
var _prependPath = function (key, base) { // 325
if ((typeof key) === "number" || key.match(/^[0-9]+$/)) // 326
key = "[" + key + "]"; // 327
else if (!key.match(/^[a-z_$][0-9a-z_$]*$/i) || _.contains(_jsKeywords, key)) // 328
key = JSON.stringify([key]); // 329
// 330
if (base && base[0] !== "[") // 331
return key + '.' + base; // 332
return key + base; // 333
}; // 334
// 335
// 336
///////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.check = {
check: check,
Match: Match
};
})();
//# sourceMappingURL=c523809f1b6e549675209e7b75fdecd3b3bcdddf.map

View File

@ -1,470 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
/* Package-scope variables */
var Deps;
(function () {
//////////////////////////////////////////////////////////////////////////////////
// //
// packages/deps/deps.js //
// //
//////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////// // 1
// Package docs at http://docs.meteor.com/#deps // // 2
////////////////////////////////////////////////// // 3
// 4
Deps = {}; // 5
// 6
// http://docs.meteor.com/#deps_active // 7
Deps.active = false; // 8
// 9
// http://docs.meteor.com/#deps_currentcomputation // 10
Deps.currentComputation = null; // 11
// 12
var setCurrentComputation = function (c) { // 13
Deps.currentComputation = c; // 14
Deps.active = !! c; // 15
}; // 16
// 17
// _assign is like _.extend or the upcoming Object.assign. // 18
// Copy src's own, enumerable properties onto tgt and return // 19
// tgt. // 20
var _hasOwnProperty = Object.prototype.hasOwnProperty; // 21
var _assign = function (tgt, src) { // 22
for (var k in src) { // 23
if (_hasOwnProperty.call(src, k)) // 24
tgt[k] = src[k]; // 25
} // 26
return tgt; // 27
}; // 28
// 29
var _debugFunc = function () { // 30
// lazy evaluation because `Meteor` does not exist right away // 31
return (typeof Meteor !== "undefined" ? Meteor._debug : // 32
((typeof console !== "undefined") && console.log ? // 33
function () { console.log.apply(console, arguments); } : // 34
function () {})); // 35
}; // 36
// 37
var _throwOrLog = function (from, e) { // 38
if (throwFirstError) { // 39
throw e; // 40
} else { // 41
_debugFunc()("Exception from Deps " + from + " function:", // 42
e.stack || e.message); // 43
} // 44
}; // 45
// 46
// Takes a function `f`, and wraps it in a `Meteor._noYieldsAllowed` // 47
// block if we are running on the server. On the client, returns the // 48
// original function (since `Meteor._noYieldsAllowed` is a // 49
// no-op). This has the benefit of not adding an unnecessary stack // 50
// frame on the client. // 51
var withNoYieldsAllowed = function (f) { // 52
if ((typeof Meteor === 'undefined') || Meteor.isClient) { // 53
return f; // 54
} else { // 55
return function () { // 56
var args = arguments; // 57
Meteor._noYieldsAllowed(function () { // 58
f.apply(null, args); // 59
}); // 60
}; // 61
} // 62
}; // 63
// 64
var nextId = 1; // 65
// computations whose callbacks we should call at flush time // 66
var pendingComputations = []; // 67
// `true` if a Deps.flush is scheduled, or if we are in Deps.flush now // 68
var willFlush = false; // 69
// `true` if we are in Deps.flush now // 70
var inFlush = false; // 71
// `true` if we are computing a computation now, either first time // 72
// or recompute. This matches Deps.active unless we are inside // 73
// Deps.nonreactive, which nullfies currentComputation even though // 74
// an enclosing computation may still be running. // 75
var inCompute = false; // 76
// `true` if the `_throwFirstError` option was passed in to the call // 77
// to Deps.flush that we are in. When set, throw rather than log the // 78
// first error encountered while flushing. Before throwing the error, // 79
// finish flushing (from a finally block), logging any subsequent // 80
// errors. // 81
var throwFirstError = false; // 82
// 83
var afterFlushCallbacks = []; // 84
// 85
var requireFlush = function () { // 86
if (! willFlush) { // 87
setTimeout(Deps.flush, 0); // 88
willFlush = true; // 89
} // 90
}; // 91
// 92
// Deps.Computation constructor is visible but private // 93
// (throws an error if you try to call it) // 94
var constructingComputation = false; // 95
// 96
// // 97
// http://docs.meteor.com/#deps_computation // 98
// // 99
Deps.Computation = function (f, parent) { // 100
if (! constructingComputation) // 101
throw new Error( // 102
"Deps.Computation constructor is private; use Deps.autorun"); // 103
constructingComputation = false; // 104
// 105
var self = this; // 106
// 107
// http://docs.meteor.com/#computation_stopped // 108
self.stopped = false; // 109
// 110
// http://docs.meteor.com/#computation_invalidated // 111
self.invalidated = false; // 112
// 113
// http://docs.meteor.com/#computation_firstrun // 114
self.firstRun = true; // 115
// 116
self._id = nextId++; // 117
self._onInvalidateCallbacks = []; // 118
// the plan is at some point to use the parent relation // 119
// to constrain the order that computations are processed // 120
self._parent = parent; // 121
self._func = f; // 122
self._recomputing = false; // 123
// 124
var errored = true; // 125
try { // 126
self._compute(); // 127
errored = false; // 128
} finally { // 129
self.firstRun = false; // 130
if (errored) // 131
self.stop(); // 132
} // 133
}; // 134
// 135
_assign(Deps.Computation.prototype, { // 136
// 137
// http://docs.meteor.com/#computation_oninvalidate // 138
onInvalidate: function (f) { // 139
var self = this; // 140
// 141
if (typeof f !== 'function') // 142
throw new Error("onInvalidate requires a function"); // 143
// 144
if (self.invalidated) { // 145
Deps.nonreactive(function () { // 146
withNoYieldsAllowed(f)(self); // 147
}); // 148
} else { // 149
self._onInvalidateCallbacks.push(f); // 150
} // 151
}, // 152
// 153
// http://docs.meteor.com/#computation_invalidate // 154
invalidate: function () { // 155
var self = this; // 156
if (! self.invalidated) { // 157
// if we're currently in _recompute(), don't enqueue // 158
// ourselves, since we'll rerun immediately anyway. // 159
if (! self._recomputing && ! self.stopped) { // 160
requireFlush(); // 161
pendingComputations.push(this); // 162
} // 163
// 164
self.invalidated = true; // 165
// 166
// callbacks can't add callbacks, because // 167
// self.invalidated === true. // 168
for(var i = 0, f; f = self._onInvalidateCallbacks[i]; i++) { // 169
Deps.nonreactive(function () { // 170
withNoYieldsAllowed(f)(self); // 171
}); // 172
} // 173
self._onInvalidateCallbacks = []; // 174
} // 175
}, // 176
// 177
// http://docs.meteor.com/#computation_stop // 178
stop: function () { // 179
if (! this.stopped) { // 180
this.stopped = true; // 181
this.invalidate(); // 182
} // 183
}, // 184
// 185
_compute: function () { // 186
var self = this; // 187
self.invalidated = false; // 188
// 189
var previous = Deps.currentComputation; // 190
setCurrentComputation(self); // 191
var previousInCompute = inCompute; // 192
inCompute = true; // 193
try { // 194
withNoYieldsAllowed(self._func)(self); // 195
} finally { // 196
setCurrentComputation(previous); // 197
inCompute = false; // 198
} // 199
}, // 200
// 201
_recompute: function () { // 202
var self = this; // 203
// 204
self._recomputing = true; // 205
try { // 206
while (self.invalidated && ! self.stopped) { // 207
try { // 208
self._compute(); // 209
} catch (e) { // 210
_throwOrLog("recompute", e); // 211
} // 212
// If _compute() invalidated us, we run again immediately. // 213
// A computation that invalidates itself indefinitely is an // 214
// infinite loop, of course. // 215
// // 216
// We could put an iteration counter here and catch run-away // 217
// loops. // 218
} // 219
} finally { // 220
self._recomputing = false; // 221
} // 222
} // 223
}); // 224
// 225
// // 226
// http://docs.meteor.com/#deps_dependency // 227
// // 228
Deps.Dependency = function () { // 229
this._dependentsById = {}; // 230
}; // 231
// 232
_assign(Deps.Dependency.prototype, { // 233
// http://docs.meteor.com/#dependency_depend // 234
// // 235
// Adds `computation` to this set if it is not already // 236
// present. Returns true if `computation` is a new member of the set. // 237
// If no argument, defaults to currentComputation, or does nothing // 238
// if there is no currentComputation. // 239
depend: function (computation) { // 240
if (! computation) { // 241
if (! Deps.active) // 242
return false; // 243
// 244
computation = Deps.currentComputation; // 245
} // 246
var self = this; // 247
var id = computation._id; // 248
if (! (id in self._dependentsById)) { // 249
self._dependentsById[id] = computation; // 250
computation.onInvalidate(function () { // 251
delete self._dependentsById[id]; // 252
}); // 253
return true; // 254
} // 255
return false; // 256
}, // 257
// 258
// http://docs.meteor.com/#dependency_changed // 259
changed: function () { // 260
var self = this; // 261
for (var id in self._dependentsById) // 262
self._dependentsById[id].invalidate(); // 263
}, // 264
// 265
// http://docs.meteor.com/#dependency_hasdependents // 266
hasDependents: function () { // 267
var self = this; // 268
for(var id in self._dependentsById) // 269
return true; // 270
return false; // 271
} // 272
}); // 273
// 274
_assign(Deps, { // 275
// http://docs.meteor.com/#deps_flush // 276
flush: function (_opts) { // 277
// XXX What part of the comment below is still true? (We no longer // 278
// have Spark) // 279
// // 280
// Nested flush could plausibly happen if, say, a flush causes // 281
// DOM mutation, which causes a "blur" event, which runs an // 282
// app event handler that calls Deps.flush. At the moment // 283
// Spark blocks event handlers during DOM mutation anyway, // 284
// because the LiveRange tree isn't valid. And we don't have // 285
// any useful notion of a nested flush. // 286
// // 287
// https://app.asana.com/0/159908330244/385138233856 // 288
if (inFlush) // 289
throw new Error("Can't call Deps.flush while flushing"); // 290
// 291
if (inCompute) // 292
throw new Error("Can't flush inside Deps.autorun"); // 293
// 294
inFlush = true; // 295
willFlush = true; // 296
throwFirstError = !! (_opts && _opts._throwFirstError); // 297
// 298
var finishedTry = false; // 299
try { // 300
while (pendingComputations.length || // 301
afterFlushCallbacks.length) { // 302
// 303
// recompute all pending computations // 304
while (pendingComputations.length) { // 305
var comp = pendingComputations.shift(); // 306
comp._recompute(); // 307
} // 308
// 309
if (afterFlushCallbacks.length) { // 310
// call one afterFlush callback, which may // 311
// invalidate more computations // 312
var func = afterFlushCallbacks.shift(); // 313
try { // 314
func(); // 315
} catch (e) { // 316
_throwOrLog("afterFlush function", e); // 317
} // 318
} // 319
} // 320
finishedTry = true; // 321
} finally { // 322
if (! finishedTry) { // 323
// we're erroring // 324
inFlush = false; // needed before calling `Deps.flush()` again // 325
Deps.flush({_throwFirstError: false}); // finish flushing // 326
} // 327
willFlush = false; // 328
inFlush = false; // 329
} // 330
}, // 331
// 332
// http://docs.meteor.com/#deps_autorun // 333
// // 334
// Run f(). Record its dependencies. Rerun it whenever the // 335
// dependencies change. // 336
// // 337
// Returns a new Computation, which is also passed to f. // 338
// // 339
// Links the computation to the current computation // 340
// so that it is stopped if the current computation is invalidated. // 341
autorun: function (f) { // 342
if (typeof f !== 'function') // 343
throw new Error('Deps.autorun requires a function argument'); // 344
// 345
constructingComputation = true; // 346
var c = new Deps.Computation(f, Deps.currentComputation); // 347
// 348
if (Deps.active) // 349
Deps.onInvalidate(function () { // 350
c.stop(); // 351
}); // 352
// 353
return c; // 354
}, // 355
// 356
// http://docs.meteor.com/#deps_nonreactive // 357
// // 358
// Run `f` with no current computation, returning the return value // 359
// of `f`. Used to turn off reactivity for the duration of `f`, // 360
// so that reactive data sources accessed by `f` will not result in any // 361
// computations being invalidated. // 362
nonreactive: function (f) { // 363
var previous = Deps.currentComputation; // 364
setCurrentComputation(null); // 365
try { // 366
return f(); // 367
} finally { // 368
setCurrentComputation(previous); // 369
} // 370
}, // 371
// 372
// http://docs.meteor.com/#deps_oninvalidate // 373
onInvalidate: function (f) { // 374
if (! Deps.active) // 375
throw new Error("Deps.onInvalidate requires a currentComputation"); // 376
// 377
Deps.currentComputation.onInvalidate(f); // 378
}, // 379
// 380
// http://docs.meteor.com/#deps_afterflush // 381
afterFlush: function (f) { // 382
afterFlushCallbacks.push(f); // 383
requireFlush(); // 384
} // 385
}); // 386
// 387
//////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////
// //
// packages/deps/deprecated.js //
// //
//////////////////////////////////////////////////////////////////////////////////
//
// Deprecated (Deps-recated?) functions. // 1
// 2
// These functions used to be on the Meteor object (and worked slightly // 3
// differently). // 4
// XXX COMPAT WITH 0.5.7 // 5
Meteor.flush = Deps.flush; // 6
Meteor.autorun = Deps.autorun; // 7
// 8
// We used to require a special "autosubscribe" call to reactively subscribe to // 9
// things. Now, it works with autorun. // 10
// XXX COMPAT WITH 0.5.4 // 11
Meteor.autosubscribe = Deps.autorun; // 12
// 13
// This Deps API briefly existed in 0.5.8 and 0.5.9 // 14
// XXX COMPAT WITH 0.5.9 // 15
Deps.depend = function (d) { // 16
return d.depend(); // 17
}; // 18
// 19
//////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.deps = {
Deps: Deps
};
})();
//# sourceMappingURL=4a82362ae66e863a1c1a8b0a5fec6f665e2038d1.map

View File

@ -1,2 +0,0 @@
)]}'
{"version":3,"file":"/packages/webapp.js","sources":["webapp/webapp_client.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,U;;AAEA,6B;AACA,0C;AACA,kB;;AAEA,0D;AACA,kD;AACA,kE;AACA,sD;AACA,mE;AACA,S;AACA,O;AACA,G;AACA,E","sourcesContent":["WebApp = {\n\n _isCssLoaded: function () {\n if (document.styleSheets.length === 0)\n return true;\n\n return _.find(document.styleSheets, function (sheet) {\n if (sheet.cssText && !sheet.cssRules) // IE8\n return !sheet.cssText.match(/meteor-css-not-found-error/);\n return !_.find(sheet.cssRules, function (rule) {\n return rule.selectorText === '.meteor-css-not-found-error';\n });\n });\n }\n};\n"]}

File diff suppressed because one or more lines are too long

View File

@ -1,732 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var JSON = Package.json.JSON;
var _ = Package.underscore._;
/* Package-scope variables */
var EJSON, EJSONTest, base64Encode, base64Decode;
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/ejson/ejson.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////
//
EJSON = {}; // 1
EJSONTest = {}; // 2
// 3
var customTypes = {}; // 4
// Add a custom type, using a method of your choice to get to and // 5
// from a basic JSON-able representation. The factory argument // 6
// is a function of JSON-able --> your object // 7
// The type you add must have: // 8
// - A toJSONValue() method, so that Meteor can serialize it // 9
// - a typeName() method, to show how to look it up in our type table. // 10
// It is okay if these methods are monkey-patched on. // 11
// EJSON.clone will use toJSONValue and the given factory to produce // 12
// a clone, but you may specify a method clone() that will be // 13
// used instead. // 14
// Similarly, EJSON.equals will use toJSONValue to make comparisons, // 15
// but you may provide a method equals() instead. // 16
// // 17
EJSON.addType = function (name, factory) { // 18
if (_.has(customTypes, name)) // 19
throw new Error("Type " + name + " already present"); // 20
customTypes[name] = factory; // 21
}; // 22
// 23
var isInfOrNan = function (obj) { // 24
return _.isNaN(obj) || obj === Infinity || obj === -Infinity; // 25
}; // 26
// 27
var builtinConverters = [ // 28
{ // Date // 29
matchJSONValue: function (obj) { // 30
return _.has(obj, '$date') && _.size(obj) === 1; // 31
}, // 32
matchObject: function (obj) { // 33
return obj instanceof Date; // 34
}, // 35
toJSONValue: function (obj) { // 36
return {$date: obj.getTime()}; // 37
}, // 38
fromJSONValue: function (obj) { // 39
return new Date(obj.$date); // 40
} // 41
}, // 42
{ // NaN, Inf, -Inf. (These are the only objects with typeof !== 'object' // 43
// which we match.) // 44
matchJSONValue: function (obj) { // 45
return _.has(obj, '$InfNaN') && _.size(obj) === 1; // 46
}, // 47
matchObject: isInfOrNan, // 48
toJSONValue: function (obj) { // 49
var sign; // 50
if (_.isNaN(obj)) // 51
sign = 0; // 52
else if (obj === Infinity) // 53
sign = 1; // 54
else // 55
sign = -1; // 56
return {$InfNaN: sign}; // 57
}, // 58
fromJSONValue: function (obj) { // 59
return obj.$InfNaN/0; // 60
} // 61
}, // 62
{ // Binary // 63
matchJSONValue: function (obj) { // 64
return _.has(obj, '$binary') && _.size(obj) === 1; // 65
}, // 66
matchObject: function (obj) { // 67
return typeof Uint8Array !== 'undefined' && obj instanceof Uint8Array // 68
|| (obj && _.has(obj, '$Uint8ArrayPolyfill')); // 69
}, // 70
toJSONValue: function (obj) { // 71
return {$binary: base64Encode(obj)}; // 72
}, // 73
fromJSONValue: function (obj) { // 74
return base64Decode(obj.$binary); // 75
} // 76
}, // 77
{ // Escaping one level // 78
matchJSONValue: function (obj) { // 79
return _.has(obj, '$escape') && _.size(obj) === 1; // 80
}, // 81
matchObject: function (obj) { // 82
if (_.isEmpty(obj) || _.size(obj) > 2) { // 83
return false; // 84
} // 85
return _.any(builtinConverters, function (converter) { // 86
return converter.matchJSONValue(obj); // 87
}); // 88
}, // 89
toJSONValue: function (obj) { // 90
var newObj = {}; // 91
_.each(obj, function (value, key) { // 92
newObj[key] = EJSON.toJSONValue(value); // 93
}); // 94
return {$escape: newObj}; // 95
}, // 96
fromJSONValue: function (obj) { // 97
var newObj = {}; // 98
_.each(obj.$escape, function (value, key) { // 99
newObj[key] = EJSON.fromJSONValue(value); // 100
}); // 101
return newObj; // 102
} // 103
}, // 104
{ // Custom // 105
matchJSONValue: function (obj) { // 106
return _.has(obj, '$type') && _.has(obj, '$value') && _.size(obj) === 2; // 107
}, // 108
matchObject: function (obj) { // 109
return EJSON._isCustomType(obj); // 110
}, // 111
toJSONValue: function (obj) { // 112
var jsonValue = Meteor._noYieldsAllowed(function () { // 113
return obj.toJSONValue(); // 114
}); // 115
return {$type: obj.typeName(), $value: jsonValue}; // 116
}, // 117
fromJSONValue: function (obj) { // 118
var typeName = obj.$type; // 119
if (!_.has(customTypes, typeName)) // 120
throw new Error("Custom EJSON type " + typeName + " is not defined"); // 121
var converter = customTypes[typeName]; // 122
return Meteor._noYieldsAllowed(function () { // 123
return converter(obj.$value); // 124
}); // 125
} // 126
} // 127
]; // 128
// 129
EJSON._isCustomType = function (obj) { // 130
return obj && // 131
typeof obj.toJSONValue === 'function' && // 132
typeof obj.typeName === 'function' && // 133
_.has(customTypes, obj.typeName()); // 134
}; // 135
// 136
// 137
// for both arrays and objects, in-place modification. // 138
var adjustTypesToJSONValue = // 139
EJSON._adjustTypesToJSONValue = function (obj) { // 140
// Is it an atom that we need to adjust? // 141
if (obj === null) // 142
return null; // 143
var maybeChanged = toJSONValueHelper(obj); // 144
if (maybeChanged !== undefined) // 145
return maybeChanged; // 146
// 147
// Other atoms are unchanged. // 148
if (typeof obj !== 'object') // 149
return obj; // 150
// 151
// Iterate over array or object structure. // 152
_.each(obj, function (value, key) { // 153
if (typeof value !== 'object' && value !== undefined && // 154
!isInfOrNan(value)) // 155
return; // continue // 156
// 157
var changed = toJSONValueHelper(value); // 158
if (changed) { // 159
obj[key] = changed; // 160
return; // on to the next key // 161
} // 162
// if we get here, value is an object but not adjustable // 163
// at this level. recurse. // 164
adjustTypesToJSONValue(value); // 165
}); // 166
return obj; // 167
}; // 168
// 169
// Either return the JSON-compatible version of the argument, or undefined (if // 170
// the item isn't itself replaceable, but maybe some fields in it are) // 171
var toJSONValueHelper = function (item) { // 172
for (var i = 0; i < builtinConverters.length; i++) { // 173
var converter = builtinConverters[i]; // 174
if (converter.matchObject(item)) { // 175
return converter.toJSONValue(item); // 176
} // 177
} // 178
return undefined; // 179
}; // 180
// 181
EJSON.toJSONValue = function (item) { // 182
var changed = toJSONValueHelper(item); // 183
if (changed !== undefined) // 184
return changed; // 185
if (typeof item === 'object') { // 186
item = EJSON.clone(item); // 187
adjustTypesToJSONValue(item); // 188
} // 189
return item; // 190
}; // 191
// 192
// for both arrays and objects. Tries its best to just // 193
// use the object you hand it, but may return something // 194
// different if the object you hand it itself needs changing. // 195
// // 196
var adjustTypesFromJSONValue = // 197
EJSON._adjustTypesFromJSONValue = function (obj) { // 198
if (obj === null) // 199
return null; // 200
var maybeChanged = fromJSONValueHelper(obj); // 201
if (maybeChanged !== obj) // 202
return maybeChanged; // 203
// 204
// Other atoms are unchanged. // 205
if (typeof obj !== 'object') // 206
return obj; // 207
// 208
_.each(obj, function (value, key) { // 209
if (typeof value === 'object') { // 210
var changed = fromJSONValueHelper(value); // 211
if (value !== changed) { // 212
obj[key] = changed; // 213
return; // 214
} // 215
// if we get here, value is an object but not adjustable // 216
// at this level. recurse. // 217
adjustTypesFromJSONValue(value); // 218
} // 219
}); // 220
return obj; // 221
}; // 222
// 223
// Either return the argument changed to have the non-json // 224
// rep of itself (the Object version) or the argument itself. // 225
// 226
// DOES NOT RECURSE. For actually getting the fully-changed value, use // 227
// EJSON.fromJSONValue // 228
var fromJSONValueHelper = function (value) { // 229
if (typeof value === 'object' && value !== null) { // 230
if (_.size(value) <= 2 // 231
&& _.all(value, function (v, k) { // 232
return typeof k === 'string' && k.substr(0, 1) === '$'; // 233
})) { // 234
for (var i = 0; i < builtinConverters.length; i++) { // 235
var converter = builtinConverters[i]; // 236
if (converter.matchJSONValue(value)) { // 237
return converter.fromJSONValue(value); // 238
} // 239
} // 240
} // 241
} // 242
return value; // 243
}; // 244
// 245
EJSON.fromJSONValue = function (item) { // 246
var changed = fromJSONValueHelper(item); // 247
if (changed === item && typeof item === 'object') { // 248
item = EJSON.clone(item); // 249
adjustTypesFromJSONValue(item); // 250
return item; // 251
} else { // 252
return changed; // 253
} // 254
}; // 255
// 256
EJSON.stringify = function (item, options) { // 257
var json = EJSON.toJSONValue(item); // 258
if (options && (options.canonical || options.indent)) { // 259
return EJSON._canonicalStringify(json, options); // 260
} else { // 261
return JSON.stringify(json); // 262
} // 263
}; // 264
// 265
EJSON.parse = function (item) { // 266
if (typeof item !== 'string') // 267
throw new Error("EJSON.parse argument should be a string"); // 268
return EJSON.fromJSONValue(JSON.parse(item)); // 269
}; // 270
// 271
EJSON.isBinary = function (obj) { // 272
return !!((typeof Uint8Array !== 'undefined' && obj instanceof Uint8Array) || // 273
(obj && obj.$Uint8ArrayPolyfill)); // 274
}; // 275
// 276
EJSON.equals = function (a, b, options) { // 277
var i; // 278
var keyOrderSensitive = !!(options && options.keyOrderSensitive); // 279
if (a === b) // 280
return true; // 281
if (_.isNaN(a) && _.isNaN(b)) // 282
return true; // This differs from the IEEE spec for NaN equality, b/c we don't want // 283
// anything ever with a NaN to be poisoned from becoming equal to anything. // 284
if (!a || !b) // if either one is falsy, they'd have to be === to be equal // 285
return false; // 286
if (!(typeof a === 'object' && typeof b === 'object')) // 287
return false; // 288
if (a instanceof Date && b instanceof Date) // 289
return a.valueOf() === b.valueOf(); // 290
if (EJSON.isBinary(a) && EJSON.isBinary(b)) { // 291
if (a.length !== b.length) // 292
return false; // 293
for (i = 0; i < a.length; i++) { // 294
if (a[i] !== b[i]) // 295
return false; // 296
} // 297
return true; // 298
} // 299
if (typeof (a.equals) === 'function') // 300
return a.equals(b, options); // 301
if (typeof (b.equals) === 'function') // 302
return b.equals(a, options); // 303
if (a instanceof Array) { // 304
if (!(b instanceof Array)) // 305
return false; // 306
if (a.length !== b.length) // 307
return false; // 308
for (i = 0; i < a.length; i++) { // 309
if (!EJSON.equals(a[i], b[i], options)) // 310
return false; // 311
} // 312
return true; // 313
} // 314
// fallback for custom types that don't implement their own equals // 315
switch (EJSON._isCustomType(a) + EJSON._isCustomType(b)) { // 316
case 1: return false; // 317
case 2: return EJSON.equals(EJSON.toJSONValue(a), EJSON.toJSONValue(b)); // 318
} // 319
// fall back to structural equality of objects // 320
var ret; // 321
if (keyOrderSensitive) { // 322
var bKeys = []; // 323
_.each(b, function (val, x) { // 324
bKeys.push(x); // 325
}); // 326
i = 0; // 327
ret = _.all(a, function (val, x) { // 328
if (i >= bKeys.length) { // 329
return false; // 330
} // 331
if (x !== bKeys[i]) { // 332
return false; // 333
} // 334
if (!EJSON.equals(val, b[bKeys[i]], options)) { // 335
return false; // 336
} // 337
i++; // 338
return true; // 339
}); // 340
return ret && i === bKeys.length; // 341
} else { // 342
i = 0; // 343
ret = _.all(a, function (val, key) { // 344
if (!_.has(b, key)) { // 345
return false; // 346
} // 347
if (!EJSON.equals(val, b[key], options)) { // 348
return false; // 349
} // 350
i++; // 351
return true; // 352
}); // 353
return ret && _.size(b) === i; // 354
} // 355
}; // 356
// 357
EJSON.clone = function (v) { // 358
var ret; // 359
if (typeof v !== "object") // 360
return v; // 361
if (v === null) // 362
return null; // null has typeof "object" // 363
if (v instanceof Date) // 364
return new Date(v.getTime()); // 365
// RegExps are not really EJSON elements (eg we don't define a serialization // 366
// for them), but they're immutable anyway, so we can support them in clone. // 367
if (v instanceof RegExp) // 368
return v; // 369
if (EJSON.isBinary(v)) { // 370
ret = EJSON.newBinary(v.length); // 371
for (var i = 0; i < v.length; i++) { // 372
ret[i] = v[i]; // 373
} // 374
return ret; // 375
} // 376
// XXX: Use something better than underscore's isArray // 377
if (_.isArray(v) || _.isArguments(v)) { // 378
// For some reason, _.map doesn't work in this context on Opera (weird test // 379
// failures). // 380
ret = []; // 381
for (i = 0; i < v.length; i++) // 382
ret[i] = EJSON.clone(v[i]); // 383
return ret; // 384
} // 385
// handle general user-defined typed Objects if they have a clone method // 386
if (typeof v.clone === 'function') { // 387
return v.clone(); // 388
} // 389
// handle other custom types // 390
if (EJSON._isCustomType(v)) { // 391
return EJSON.fromJSONValue(EJSON.clone(EJSON.toJSONValue(v)), true); // 392
} // 393
// handle other objects // 394
ret = {}; // 395
_.each(v, function (value, key) { // 396
ret[key] = EJSON.clone(value); // 397
}); // 398
return ret; // 399
}; // 400
// 401
//////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/ejson/stringify.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// Based on json2.js from https://github.com/douglascrockford/JSON-js // 1
// // 2
// json2.js // 3
// 2012-10-08 // 4
// // 5
// Public Domain. // 6
// // 7
// NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. // 8
// 9
function quote(string) { // 10
return JSON.stringify(string); // 11
} // 12
// 13
var str = function (key, holder, singleIndent, outerIndent, canonical) { // 14
// 15
// Produce a string from holder[key]. // 16
// 17
var i; // The loop counter. // 18
var k; // The member key. // 19
var v; // The member value. // 20
var length; // 21
var innerIndent = outerIndent; // 22
var partial; // 23
var value = holder[key]; // 24
// 25
// What happens next depends on the value's type. // 26
// 27
switch (typeof value) { // 28
case 'string': // 29
return quote(value); // 30
case 'number': // 31
// JSON numbers must be finite. Encode non-finite numbers as null. // 32
return isFinite(value) ? String(value) : 'null'; // 33
case 'boolean': // 34
return String(value); // 35
// If the type is 'object', we might be dealing with an object or an array or // 36
// null. // 37
case 'object': // 38
// Due to a specification blunder in ECMAScript, typeof null is 'object', // 39
// so watch out for that case. // 40
if (!value) { // 41
return 'null'; // 42
} // 43
// Make an array to hold the partial results of stringifying this object value. // 44
innerIndent = outerIndent + singleIndent; // 45
partial = []; // 46
// 47
// Is the value an array? // 48
if (_.isArray(value) || _.isArguments(value)) { // 49
// 50
// The value is an array. Stringify every element. Use null as a placeholder // 51
// for non-JSON values. // 52
// 53
length = value.length; // 54
for (i = 0; i < length; i += 1) { // 55
partial[i] = str(i, value, singleIndent, innerIndent, canonical) || 'null'; // 56
} // 57
// 58
// Join all of the elements together, separated with commas, and wrap them in // 59
// brackets. // 60
// 61
if (partial.length === 0) { // 62
v = '[]'; // 63
} else if (innerIndent) { // 64
v = '[\n' + innerIndent + partial.join(',\n' + innerIndent) + '\n' + outerIndent + ']'; // 65
} else { // 66
v = '[' + partial.join(',') + ']'; // 67
} // 68
return v; // 69
} // 70
// 71
// 72
// Iterate through all of the keys in the object. // 73
var keys = _.keys(value); // 74
if (canonical) // 75
keys = keys.sort(); // 76
_.each(keys, function (k) { // 77
v = str(k, value, singleIndent, innerIndent, canonical); // 78
if (v) { // 79
partial.push(quote(k) + (innerIndent ? ': ' : ':') + v); // 80
} // 81
}); // 82
// 83
// 84
// Join all of the member texts together, separated with commas, // 85
// and wrap them in braces. // 86
// 87
if (partial.length === 0) { // 88
v = '{}'; // 89
} else if (innerIndent) { // 90
v = '{\n' + innerIndent + partial.join(',\n' + innerIndent) + '\n' + outerIndent + '}'; // 91
} else { // 92
v = '{' + partial.join(',') + '}'; // 93
} // 94
return v; // 95
} // 96
} // 97
// 98
// If the JSON object does not yet have a stringify method, give it one. // 99
// 100
EJSON._canonicalStringify = function (value, options) { // 101
// Make a fake root object containing our value under the key of ''. // 102
// Return the result of stringifying the value. // 103
options = _.extend({ // 104
indent: "", // 105
canonical: false // 106
}, options); // 107
if (options.indent === true) { // 108
options.indent = " "; // 109
} else if (typeof options.indent === 'number') { // 110
var newIndent = ""; // 111
for (var i = 0; i < options.indent; i++) { // 112
newIndent += ' '; // 113
} // 114
options.indent = newIndent; // 115
} // 116
return str('', {'': value}, options.indent, "", options.canonical); // 117
}; // 118
// 119
//////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/ejson/base64.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// Base 64 encoding // 1
// 2
var BASE_64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; // 3
// 4
var BASE_64_VALS = {}; // 5
// 6
for (var i = 0; i < BASE_64_CHARS.length; i++) { // 7
BASE_64_VALS[BASE_64_CHARS.charAt(i)] = i; // 8
}; // 9
// 10
base64Encode = function (array) { // 11
var answer = []; // 12
var a = null; // 13
var b = null; // 14
var c = null; // 15
var d = null; // 16
for (var i = 0; i < array.length; i++) { // 17
switch (i % 3) { // 18
case 0: // 19
a = (array[i] >> 2) & 0x3F; // 20
b = (array[i] & 0x03) << 4; // 21
break; // 22
case 1: // 23
b = b | (array[i] >> 4) & 0xF; // 24
c = (array[i] & 0xF) << 2; // 25
break; // 26
case 2: // 27
c = c | (array[i] >> 6) & 0x03; // 28
d = array[i] & 0x3F; // 29
answer.push(getChar(a)); // 30
answer.push(getChar(b)); // 31
answer.push(getChar(c)); // 32
answer.push(getChar(d)); // 33
a = null; // 34
b = null; // 35
c = null; // 36
d = null; // 37
break; // 38
} // 39
} // 40
if (a != null) { // 41
answer.push(getChar(a)); // 42
answer.push(getChar(b)); // 43
if (c == null) // 44
answer.push('='); // 45
else // 46
answer.push(getChar(c)); // 47
if (d == null) // 48
answer.push('='); // 49
} // 50
return answer.join(""); // 51
}; // 52
// 53
var getChar = function (val) { // 54
return BASE_64_CHARS.charAt(val); // 55
}; // 56
// 57
var getVal = function (ch) { // 58
if (ch === '=') { // 59
return -1; // 60
} // 61
return BASE_64_VALS[ch]; // 62
}; // 63
// 64
EJSON.newBinary = function (len) { // 65
if (typeof Uint8Array === 'undefined' || typeof ArrayBuffer === 'undefined') { // 66
var ret = []; // 67
for (var i = 0; i < len; i++) { // 68
ret.push(0); // 69
} // 70
ret.$Uint8ArrayPolyfill = true; // 71
return ret; // 72
} // 73
return new Uint8Array(new ArrayBuffer(len)); // 74
}; // 75
// 76
base64Decode = function (str) { // 77
var len = Math.floor((str.length*3)/4); // 78
if (str.charAt(str.length - 1) == '=') { // 79
len--; // 80
if (str.charAt(str.length - 2) == '=') // 81
len--; // 82
} // 83
var arr = EJSON.newBinary(len); // 84
// 85
var one = null; // 86
var two = null; // 87
var three = null; // 88
// 89
var j = 0; // 90
// 91
for (var i = 0; i < str.length; i++) { // 92
var c = str.charAt(i); // 93
var v = getVal(c); // 94
switch (i % 4) { // 95
case 0: // 96
if (v < 0) // 97
throw new Error('invalid base64 string'); // 98
one = v << 2; // 99
break; // 100
case 1: // 101
if (v < 0) // 102
throw new Error('invalid base64 string'); // 103
one = one | (v >> 4); // 104
arr[j++] = one; // 105
two = (v & 0x0F) << 4; // 106
break; // 107
case 2: // 108
if (v >= 0) { // 109
two = two | (v >> 2); // 110
arr[j++] = two; // 111
three = (v & 0x03) << 6; // 112
} // 113
break; // 114
case 3: // 115
if (v >= 0) { // 116
arr[j++] = three | v; // 117
} // 118
break; // 119
} // 120
} // 121
return arr; // 122
}; // 123
// 124
EJSONTest.base64Encode = base64Encode; // 125
// 126
EJSONTest.base64Decode = base64Decode; // 127
// 128
//////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.ejson = {
EJSON: EJSON,
EJSONTest: EJSONTest
};
})();
//# sourceMappingURL=9ccd48dbafd805e21408c9eae1061468b3ec1f2f.map

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
)]}'
{"version":3,"file":"/packages/application-configuration.js","sources":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}

File diff suppressed because one or more lines are too long

View File

@ -1,40 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var Log = Package.logging.Log;
var _ = Package.underscore._;
var DDP = Package.livedata.DDP;
var EJSON = Package.ejson.EJSON;
/* Package-scope variables */
var Follower;
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['follower-livedata'] = {
Follower: Follower
};
})();
//# sourceMappingURL=39b05f02878030ae806a16a173661b7df1e92eb6.map

View File

@ -1,472 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
/* Package-scope variables */
var GeoJSON, module;
(function () {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/geojson-utils/pre.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Define an object named exports. This will cause geojson-utils.js to put `gju` // 1
// as a field on it, instead of in the global namespace. See also post.js. // 2
module = {exports:{}}; // 3
// 4
// 5
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/geojson-utils/geojson-utils.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
(function () { // 1
var gju = {}; // 2
// 3
// Export the geojson object for **CommonJS** // 4
if (typeof module !== 'undefined' && module.exports) { // 5
module.exports = gju; // 6
} // 7
// 8
// adapted from http://www.kevlindev.com/gui/math/intersection/Intersection.js // 9
gju.lineStringsIntersect = function (l1, l2) { // 10
var intersects = []; // 11
for (var i = 0; i <= l1.coordinates.length - 2; ++i) { // 12
for (var j = 0; j <= l2.coordinates.length - 2; ++j) { // 13
var a1 = { // 14
x: l1.coordinates[i][1], // 15
y: l1.coordinates[i][0] // 16
}, // 17
a2 = { // 18
x: l1.coordinates[i + 1][1], // 19
y: l1.coordinates[i + 1][0] // 20
}, // 21
b1 = { // 22
x: l2.coordinates[j][1], // 23
y: l2.coordinates[j][0] // 24
}, // 25
b2 = { // 26
x: l2.coordinates[j + 1][1], // 27
y: l2.coordinates[j + 1][0] // 28
}, // 29
ua_t = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x), // 30
ub_t = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x), // 31
u_b = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y); // 32
if (u_b != 0) { // 33
var ua = ua_t / u_b, // 34
ub = ub_t / u_b; // 35
if (0 <= ua && ua <= 1 && 0 <= ub && ub <= 1) { // 36
intersects.push({ // 37
'type': 'Point', // 38
'coordinates': [a1.x + ua * (a2.x - a1.x), a1.y + ua * (a2.y - a1.y)] // 39
}); // 40
} // 41
} // 42
} // 43
} // 44
if (intersects.length == 0) intersects = false; // 45
return intersects; // 46
} // 47
// 48
// Bounding Box // 49
// 50
function boundingBoxAroundPolyCoords (coords) { // 51
var xAll = [], yAll = [] // 52
// 53
for (var i = 0; i < coords[0].length; i++) { // 54
xAll.push(coords[0][i][1]) // 55
yAll.push(coords[0][i][0]) // 56
} // 57
// 58
xAll = xAll.sort(function (a,b) { return a - b }) // 59
yAll = yAll.sort(function (a,b) { return a - b }) // 60
// 61
return [ [xAll[0], yAll[0]], [xAll[xAll.length - 1], yAll[yAll.length - 1]] ] // 62
} // 63
// 64
gju.pointInBoundingBox = function (point, bounds) { // 65
return !(point.coordinates[1] < bounds[0][0] || point.coordinates[1] > bounds[1][0] || point.coordinates[0] < bounds[0][1] || point.coordinates[0] > bounds[1][1])
} // 67
// 68
// Point in Polygon // 69
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html#Listing the Vertices // 70
// 71
function pnpoly (x,y,coords) { // 72
var vert = [ [0,0] ] // 73
// 74
for (var i = 0; i < coords.length; i++) { // 75
for (var j = 0; j < coords[i].length; j++) { // 76
vert.push(coords[i][j]) // 77
} // 78
vert.push([0,0]) // 79
} // 80
// 81
var inside = false // 82
for (var i = 0, j = vert.length - 1; i < vert.length; j = i++) { // 83
if (((vert[i][0] > y) != (vert[j][0] > y)) && (x < (vert[j][1] - vert[i][1]) * (y - vert[i][0]) / (vert[j][0] - vert[i][0]) + vert[i][1])) inside = !inside
} // 85
// 86
return inside // 87
} // 88
// 89
gju.pointInPolygon = function (p, poly) { // 90
var coords = (poly.type == "Polygon") ? [ poly.coordinates ] : poly.coordinates // 91
// 92
var insideBox = false // 93
for (var i = 0; i < coords.length; i++) { // 94
if (gju.pointInBoundingBox(p, boundingBoxAroundPolyCoords(coords[i]))) insideBox = true // 95
} // 96
if (!insideBox) return false // 97
// 98
var insidePoly = false // 99
for (var i = 0; i < coords.length; i++) { // 100
if (pnpoly(p.coordinates[1], p.coordinates[0], coords[i])) insidePoly = true // 101
} // 102
// 103
return insidePoly // 104
} // 105
// 106
gju.numberToRadius = function (number) { // 107
return number * Math.PI / 180; // 108
} // 109
// 110
gju.numberToDegree = function (number) { // 111
return number * 180 / Math.PI; // 112
} // 113
// 114
// written with help from @tautologe // 115
gju.drawCircle = function (radiusInMeters, centerPoint, steps) { // 116
var center = [centerPoint.coordinates[1], centerPoint.coordinates[0]], // 117
dist = (radiusInMeters / 1000) / 6371, // 118
// convert meters to radiant // 119
radCenter = [gju.numberToRadius(center[0]), gju.numberToRadius(center[1])], // 120
steps = steps || 15, // 121
// 15 sided circle // 122
poly = [[center[0], center[1]]]; // 123
for (var i = 0; i < steps; i++) { // 124
var brng = 2 * Math.PI * i / steps; // 125
var lat = Math.asin(Math.sin(radCenter[0]) * Math.cos(dist) // 126
+ Math.cos(radCenter[0]) * Math.sin(dist) * Math.cos(brng)); // 127
var lng = radCenter[1] + Math.atan2(Math.sin(brng) * Math.sin(dist) * Math.cos(radCenter[0]), // 128
Math.cos(dist) - Math.sin(radCenter[0]) * Math.sin(lat)); // 129
poly[i] = []; // 130
poly[i][1] = gju.numberToDegree(lat); // 131
poly[i][0] = gju.numberToDegree(lng); // 132
} // 133
return { // 134
"type": "Polygon", // 135
"coordinates": [poly] // 136
}; // 137
} // 138
// 139
// assumes rectangle starts at lower left point // 140
gju.rectangleCentroid = function (rectangle) { // 141
var bbox = rectangle.coordinates[0]; // 142
var xmin = bbox[0][0], // 143
ymin = bbox[0][1], // 144
xmax = bbox[2][0], // 145
ymax = bbox[2][1]; // 146
var xwidth = xmax - xmin; // 147
var ywidth = ymax - ymin; // 148
return { // 149
'type': 'Point', // 150
'coordinates': [xmin + xwidth / 2, ymin + ywidth / 2] // 151
}; // 152
} // 153
// 154
// from http://www.movable-type.co.uk/scripts/latlong.html // 155
gju.pointDistance = function (pt1, pt2) { // 156
var lon1 = pt1.coordinates[0], // 157
lat1 = pt1.coordinates[1], // 158
lon2 = pt2.coordinates[0], // 159
lat2 = pt2.coordinates[1], // 160
dLat = gju.numberToRadius(lat2 - lat1), // 161
dLon = gju.numberToRadius(lon2 - lon1), // 162
a = Math.pow(Math.sin(dLat / 2), 2) + Math.cos(gju.numberToRadius(lat1)) // 163
* Math.cos(gju.numberToRadius(lat2)) * Math.pow(Math.sin(dLon / 2), 2), // 164
c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); // 165
// Earth radius is 6371 km // 166
return (6371 * c) * 1000; // returns meters // 167
}, // 168
// 169
// checks if geometry lies entirely within a circle // 170
// works with Point, LineString, Polygon // 171
gju.geometryWithinRadius = function (geometry, center, radius) { // 172
if (geometry.type == 'Point') { // 173
return gju.pointDistance(geometry, center) <= radius; // 174
} else if (geometry.type == 'LineString' || geometry.type == 'Polygon') { // 175
var point = {}; // 176
var coordinates; // 177
if (geometry.type == 'Polygon') { // 178
// it's enough to check the exterior ring of the Polygon // 179
coordinates = geometry.coordinates[0]; // 180
} else { // 181
coordinates = geometry.coordinates; // 182
} // 183
for (var i in coordinates) { // 184
point.coordinates = coordinates[i]; // 185
if (gju.pointDistance(point, center) > radius) { // 186
return false; // 187
} // 188
} // 189
} // 190
return true; // 191
} // 192
// 193
// adapted from http://paulbourke.net/geometry/polyarea/javascript.txt // 194
gju.area = function (polygon) { // 195
var area = 0; // 196
// TODO: polygon holes at coordinates[1] // 197
var points = polygon.coordinates[0]; // 198
var j = points.length - 1; // 199
var p1, p2; // 200
// 201
for (var i = 0; i < points.length; j = i++) { // 202
var p1 = { // 203
x: points[i][1], // 204
y: points[i][0] // 205
}; // 206
var p2 = { // 207
x: points[j][1], // 208
y: points[j][0] // 209
}; // 210
area += p1.x * p2.y; // 211
area -= p1.y * p2.x; // 212
} // 213
// 214
area /= 2; // 215
return area; // 216
}, // 217
// 218
// adapted from http://paulbourke.net/geometry/polyarea/javascript.txt // 219
gju.centroid = function (polygon) { // 220
var f, x = 0, // 221
y = 0; // 222
// TODO: polygon holes at coordinates[1] // 223
var points = polygon.coordinates[0]; // 224
var j = points.length - 1; // 225
var p1, p2; // 226
// 227
for (var i = 0; i < points.length; j = i++) { // 228
var p1 = { // 229
x: points[i][1], // 230
y: points[i][0] // 231
}; // 232
var p2 = { // 233
x: points[j][1], // 234
y: points[j][0] // 235
}; // 236
f = p1.x * p2.y - p2.x * p1.y; // 237
x += (p1.x + p2.x) * f; // 238
y += (p1.y + p2.y) * f; // 239
} // 240
// 241
f = gju.area(polygon) * 6; // 242
return { // 243
'type': 'Point', // 244
'coordinates': [y / f, x / f] // 245
}; // 246
}, // 247
// 248
gju.simplify = function (source, kink) { /* source[] array of geojson points */ // 249
/* kink in metres, kinks above this depth kept */ // 250
/* kink depth is the height of the triangle abc where a-b and b-c are two consecutive line segments */ // 251
kink = kink || 20; // 252
source = source.map(function (o) { // 253
return { // 254
lng: o.coordinates[0], // 255
lat: o.coordinates[1] // 256
} // 257
}); // 258
// 259
var n_source, n_stack, n_dest, start, end, i, sig; // 260
var dev_sqr, max_dev_sqr, band_sqr; // 261
var x12, y12, d12, x13, y13, d13, x23, y23, d23; // 262
var F = (Math.PI / 180.0) * 0.5; // 263
var index = new Array(); /* aray of indexes of source points to include in the reduced line */ // 264
var sig_start = new Array(); /* indices of start & end of working section */ // 265
var sig_end = new Array(); // 266
// 267
/* check for simple cases */ // 268
// 269
if (source.length < 3) return (source); /* one or two points */ // 270
// 271
/* more complex case. initialize stack */ // 272
// 273
n_source = source.length; // 274
band_sqr = kink * 360.0 / (2.0 * Math.PI * 6378137.0); /* Now in degrees */ // 275
band_sqr *= band_sqr; // 276
n_dest = 0; // 277
sig_start[0] = 0; // 278
sig_end[0] = n_source - 1; // 279
n_stack = 1; // 280
// 281
/* while the stack is not empty ... */ // 282
while (n_stack > 0) { // 283
// 284
/* ... pop the top-most entries off the stacks */ // 285
// 286
start = sig_start[n_stack - 1]; // 287
end = sig_end[n_stack - 1]; // 288
n_stack--; // 289
// 290
if ((end - start) > 1) { /* any intermediate points ? */ // 291
// 292
/* ... yes, so find most deviant intermediate point to // 293
either side of line joining start & end points */ // 294
// 295
x12 = (source[end].lng() - source[start].lng()); // 296
y12 = (source[end].lat() - source[start].lat()); // 297
if (Math.abs(x12) > 180.0) x12 = 360.0 - Math.abs(x12); // 298
x12 *= Math.cos(F * (source[end].lat() + source[start].lat())); /* use avg lat to reduce lng */ // 299
d12 = (x12 * x12) + (y12 * y12); // 300
// 301
for (i = start + 1, sig = start, max_dev_sqr = -1.0; i < end; i++) { // 302
// 303
x13 = source[i].lng() - source[start].lng(); // 304
y13 = source[i].lat() - source[start].lat(); // 305
if (Math.abs(x13) > 180.0) x13 = 360.0 - Math.abs(x13); // 306
x13 *= Math.cos(F * (source[i].lat() + source[start].lat())); // 307
d13 = (x13 * x13) + (y13 * y13); // 308
// 309
x23 = source[i].lng() - source[end].lng(); // 310
y23 = source[i].lat() - source[end].lat(); // 311
if (Math.abs(x23) > 180.0) x23 = 360.0 - Math.abs(x23); // 312
x23 *= Math.cos(F * (source[i].lat() + source[end].lat())); // 313
d23 = (x23 * x23) + (y23 * y23); // 314
// 315
if (d13 >= (d12 + d23)) dev_sqr = d23; // 316
else if (d23 >= (d12 + d13)) dev_sqr = d13; // 317
else dev_sqr = (x13 * y12 - y13 * x12) * (x13 * y12 - y13 * x12) / d12; // solve triangle // 318
if (dev_sqr > max_dev_sqr) { // 319
sig = i; // 320
max_dev_sqr = dev_sqr; // 321
} // 322
} // 323
// 324
if (max_dev_sqr < band_sqr) { /* is there a sig. intermediate point ? */ // 325
/* ... no, so transfer current start point */ // 326
index[n_dest] = start; // 327
n_dest++; // 328
} else { /* ... yes, so push two sub-sections on stack for further processing */ // 329
n_stack++; // 330
sig_start[n_stack - 1] = sig; // 331
sig_end[n_stack - 1] = end; // 332
n_stack++; // 333
sig_start[n_stack - 1] = start; // 334
sig_end[n_stack - 1] = sig; // 335
} // 336
} else { /* ... no intermediate points, so transfer current start point */ // 337
index[n_dest] = start; // 338
n_dest++; // 339
} // 340
} // 341
// 342
/* transfer last point */ // 343
index[n_dest] = n_source - 1; // 344
n_dest++; // 345
// 346
/* make return array */ // 347
var r = new Array(); // 348
for (var i = 0; i < n_dest; i++) // 349
r.push(source[index[i]]); // 350
// 351
return r.map(function (o) { // 352
return { // 353
type: "Point", // 354
coordinates: [o.lng, o.lat] // 355
} // 356
}); // 357
} // 358
// 359
// http://www.movable-type.co.uk/scripts/latlong.html#destPoint // 360
gju.destinationPoint = function (pt, brng, dist) { // 361
dist = dist/6371; // convert dist to angular distance in radians // 362
brng = gju.numberToRadius(brng); // 363
// 364
var lat1 = gju.numberToRadius(pt.coordinates[0]); // 365
var lon1 = gju.numberToRadius(pt.coordinates[1]); // 366
// 367
var lat2 = Math.asin( Math.sin(lat1)*Math.cos(dist) + // 368
Math.cos(lat1)*Math.sin(dist)*Math.cos(brng) ); // 369
var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(dist)*Math.cos(lat1), // 370
Math.cos(dist)-Math.sin(lat1)*Math.sin(lat2)); // 371
lon2 = (lon2+3*Math.PI) % (2*Math.PI) - Math.PI; // normalise to -180..+180º // 372
// 373
return { // 374
'type': 'Point', // 375
'coordinates': [gju.numberToDegree(lat2), gju.numberToDegree(lon2)] // 376
}; // 377
}; // 378
// 379
})(); // 380
// 381
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/geojson-utils/post.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// This exports object was created in pre.js. Now copy the `exports` object // 1
// from it into the package-scope variable `GeoJSON`, which will get exported. // 2
GeoJSON = module.exports; // 3
// 4
// 5
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['geojson-utils'] = {
GeoJSON: GeoJSON
};
})();
//# sourceMappingURL=81b79d5cf96d00b4b7a28987debcffb665c17526.map

View File

@ -1,17 +0,0 @@
/* Imports for global scope */
$ = Package.jquery.$;
jQuery = Package.jquery.jQuery;
Meteor = Package.meteor.Meteor;
_ = Package.underscore._;
Deps = Package.deps.Deps;
Template = Package.templating.Template;
Session = Package.session.Session;
WebApp = Package.webapp.WebApp;
check = Package.check.check;
Match = Package.check.Match;
UI = Package.ui.UI;
Handlebars = Package.ui.Handlebars;
Spacebars = Package['spacebars-common'].Spacebars;
HTML = Package.htmljs.HTML;

View File

@ -1,575 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
/* Package-scope variables */
var HTML, callReactiveFunction, stopWithLater;
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/htmljs/utils.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// 1
HTML = {}; // 2
// 3
HTML.isNully = function (node) { // 4
if (node == null) // 5
// null or undefined // 6
return true; // 7
// 8
if (node instanceof Array) { // 9
// is it an empty array or an array of all nully items? // 10
for (var i = 0; i < node.length; i++) // 11
if (! HTML.isNully(node[i])) // 12
return false; // 13
return true; // 14
} // 15
// 16
return false; // 17
}; // 18
// 19
HTML.escapeData = function (str) { // 20
// string; escape the two special chars in HTML data and RCDATA // 21
return str.replace(/&/g, '&amp;').replace(/</g, '&lt;'); // 22
}; // 23
// 24
// 25
// The HTML spec and the DOM API (in particular `setAttribute`) have different // 26
// definitions of what characters are legal in an attribute. The HTML // 27
// parser is extremely permissive (allowing, for example, `<a %=%>`), while // 28
// `setAttribute` seems to use something like the XML grammar for names (and // 29
// throws an error if a name is invalid, making that attribute unsettable). // 30
// If we knew exactly what grammar browsers used for `setAttribute`, we could // 31
// include various Unicode ranges in what's legal. For now, allow ASCII chars // 32
// that are known to be valid XML, valid HTML, and settable via `setAttribute`: // 33
// // 34
// * Starts with `:`, `_`, `A-Z` or `a-z` // 35
// * Consists of any of those plus `-`, `.`, and `0-9`. // 36
// // 37
// See <http://www.w3.org/TR/REC-xml/#NT-Name> and // 38
// <http://dev.w3.org/html5/markup/syntax.html#syntax-attributes>. // 39
HTML.isValidAttributeName = function (name) { // 40
return /^[:_A-Za-z][:_A-Za-z0-9.\-]*/.test(name); // 41
}; // 42
// 43
//////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/htmljs/html.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// 1
// Tag instances are `instanceof HTML.Tag`. // 2
// // 3
// Tag objects should be considered immutable. // 4
// // 5
// This is a private constructor of an abstract class; don't call it. // 6
HTML.Tag = function () {}; // 7
HTML.Tag.prototype.tagName = ''; // this will be set per Tag subclass // 8
HTML.Tag.prototype.attrs = null; // 9
HTML.Tag.prototype.children = Object.freeze ? Object.freeze([]) : []; // 10
// 11
// Given "p", create and assign `HTML.P` if it doesn't already exist. // 12
// Then return it. `tagName` must have proper case (usually all lowercase). // 13
HTML.getTag = function (tagName) { // 14
var symbolName = HTML.getSymbolName(tagName); // 15
if (symbolName === tagName) // all-caps tagName // 16
throw new Error("Use the lowercase or camelCase form of '" + tagName + "' here"); // 17
// 18
if (! HTML[symbolName]) // 19
HTML[symbolName] = makeTagConstructor(tagName); // 20
// 21
return HTML[symbolName]; // 22
}; // 23
// 24
// Given "p", make sure `HTML.P` exists. `tagName` must have proper case // 25
// (usually all lowercase). // 26
HTML.ensureTag = function (tagName) { // 27
HTML.getTag(tagName); // don't return it // 28
}; // 29
// 30
// Given "p" create the function `HTML.P`. // 31
var makeTagConstructor = function (tagName) { // 32
// HTMLTag is the per-tagName constructor of a HTML.Tag subclass // 33
var HTMLTag = function (/*arguments*/) { // 34
// Work with or without `new`. If not called with `new`, // 35
// perform instantiation by recursively calling this constructor. // 36
// We can't pass varargs, so pass no args. // 37
var instance = (this instanceof HTML.Tag) ? this : new HTMLTag; // 38
// 39
var i = 0; // 40
var attrs = arguments.length && arguments[0]; // 41
if (attrs && (typeof attrs === 'object') && // 42
(attrs.constructor === Object)) { // 43
instance.attrs = attrs; // 44
i++; // 45
} // 46
// 47
// If no children, don't create an array at all, use the prototype's // 48
// (frozen, empty) array. This way we don't create an empty array // 49
// every time someone creates a tag without `new` and this constructor // 50
// calls itself with no arguments (above). // 51
if (i < arguments.length) // 52
instance.children = Array.prototype.slice.call(arguments, i); // 53
// 54
return instance; // 55
}; // 56
HTMLTag.prototype = new HTML.Tag; // 57
HTMLTag.prototype.constructor = HTMLTag; // 58
HTMLTag.prototype.tagName = tagName; // 59
// 60
return HTMLTag; // 61
}; // 62
// 63
var CharRef = HTML.CharRef = function (attrs) { // 64
if (! (this instanceof CharRef)) // 65
// called without `new` // 66
return new CharRef(attrs); // 67
// 68
if (! (attrs && attrs.html && attrs.str)) // 69
throw new Error( // 70
"HTML.CharRef must be constructed with ({html:..., str:...})"); // 71
// 72
this.html = attrs.html; // 73
this.str = attrs.str; // 74
}; // 75
// 76
var Comment = HTML.Comment = function (value) { // 77
if (! (this instanceof Comment)) // 78
// called without `new` // 79
return new Comment(value); // 80
// 81
if (typeof value !== 'string') // 82
throw new Error('HTML.Comment must be constructed with a string'); // 83
// 84
this.value = value; // 85
// Kill illegal hyphens in comment value (no way to escape them in HTML) // 86
this.sanitizedValue = value.replace(/^-|--+|-$/g, ''); // 87
}; // 88
// 89
// 90
//---------- KNOWN ELEMENTS // 91
// 92
// These lists of known elements are public. You can use them, for example, to // 93
// write a helper that determines the proper case for an SVG element name. // 94
// Such helpers that may not be needed at runtime are not provided here. // 95
// 96
HTML.knownElementNames = 'a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var article aside audio bdi canvas command data datagrid datalist details embed eventsource figcaption figure footer header hgroup keygen mark meter nav output progress ruby rp rt section source summary time track video wbr'.split(' ');
// 98
// omitted because also an HTML element: "a" // 99
HTML.knownSVGElementNames = 'altGlyph altGlyphDef altGlyphItem animate animateColor animateMotion animateTransform circle clipPath color-profile cursor defs desc ellipse feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence filter font font-face font-face-format font-face-name font-face-src font-face-uri foreignObject g glyph glyphRef hkern image line linearGradient marker mask metadata missing-glyph path pattern polygon polyline radialGradient rect script set stop style svg switch symbol text textPath title tref tspan use view vkern'.split(' ');
// Append SVG element names to list of known element names // 101
HTML.knownElementNames = HTML.knownElementNames.concat(HTML.knownSVGElementNames); // 102
// 103
HTML.voidElementNames = 'area base br col command embed hr img input keygen link meta param source track wbr'.split(' ');
// 105
// Speed up search through lists of known elements by creating internal "sets" // 106
// of strings. // 107
var YES = {yes:true}; // 108
var makeSet = function (array) { // 109
var set = {}; // 110
for (var i = 0; i < array.length; i++) // 111
set[array[i]] = YES; // 112
return set; // 113
}; // 114
var voidElementSet = makeSet(HTML.voidElementNames); // 115
var knownElementSet = makeSet(HTML.knownElementNames); // 116
var knownSVGElementSet = makeSet(HTML.knownSVGElementNames); // 117
// 118
// Is the given element (in proper case) a known HTML element? // 119
// This includes SVG elements. // 120
HTML.isKnownElement = function (name) { // 121
return knownElementSet[name] === YES; // 122
}; // 123
// 124
// Is the given element (in proper case) an element with no end tag // 125
// in HTML, like "br", "hr", or "input"? // 126
HTML.isVoidElement = function (name) { // 127
return voidElementSet[name] === YES; // 128
}; // 129
// 130
// Is the given element (in proper case) a known SVG element? // 131
HTML.isKnownSVGElement = function (name) { // 132
return knownSVGElementSet[name] === YES; // 133
}; // 134
// 135
// For code generators, is a particular tag (in proper case) guaranteed // 136
// to be available on the HTML object (under the name returned by // 137
// getSymbolName)? // 138
HTML.isTagEnsured = function (t) { // 139
return HTML.isKnownElement(t); // 140
}; // 141
// 142
// For code generators, take a tagName like "p" and return an uppercase // 143
// symbol name like "P" which is available on the "HTML" object for // 144
// known elements or after calling getTag or ensureTag. // 145
HTML.getSymbolName = function (tagName) { // 146
// "foo-bar" -> "FOO_BAR" // 147
return tagName.toUpperCase().replace(/-/g, '_'); // 148
}; // 149
// 150
// Ensure tags for all known elements // 151
for (var i = 0; i < HTML.knownElementNames.length; i++) // 152
HTML.ensureTag(HTML.knownElementNames[i]); // 153
// 154
//////////////////////////////////////////////////////////////////////////////// // 155
// 156
callReactiveFunction = function (func) { // 157
var result; // 158
var cc = Deps.currentComputation; // 159
var h = Deps.autorun(function (c) { // 160
result = func(); // 161
}); // 162
h.onInvalidate(function () { // 163
if (cc) // 164
cc.invalidate(); // 165
}); // 166
if (Deps.active) { // 167
Deps.onInvalidate(function () { // 168
h.stop(); // 169
func.stop && func.stop(); // 170
}); // 171
} else { // 172
h.stop(); // 173
func.stop && func.stop(); // 174
} // 175
return result; // 176
}; // 177
// 178
stopWithLater = function (instance) { // 179
if (instance.materialized && instance.materialized.isWith) { // 180
if (Deps.active) { // 181
instance.materialized(); // 182
} else { // 183
if (instance.data) // `UI.With` // 184
instance.data.stop(); // 185
else if (instance.v) // `Spacebars.With` // 186
instance.v.stop(); // 187
} // 188
} // 189
}; // 190
// 191
// Call all functions and instantiate all components, when fine-grained // 192
// reactivity is not needed (for example, in attributes). // 193
HTML.evaluate = function (node, parentComponent) { // 194
if (node == null) { // 195
return node; // 196
} else if (typeof node === 'function') { // 197
return HTML.evaluate(callReactiveFunction(node), parentComponent); // 198
} else if (node instanceof Array) { // 199
var result = []; // 200
for (var i = 0; i < node.length; i++) // 201
result.push(HTML.evaluate(node[i], parentComponent)); // 202
return result; // 203
} else if (typeof node.instantiate === 'function') { // 204
// component // 205
var instance = node.instantiate(parentComponent || null); // 206
var content = instance.render('STATIC'); // 207
stopWithLater(instance); // 208
return HTML.evaluate(content, instance); // 209
} else if (node instanceof HTML.Tag) { // 210
var newChildren = []; // 211
for (var i = 0; i < node.children.length; i++) // 212
newChildren.push(HTML.evaluate(node.children[i], parentComponent)); // 213
var newTag = HTML.getTag(node.tagName).apply(null, newChildren); // 214
newTag.attrs = {}; // 215
for (var k in node.attrs) // 216
newTag.attrs[k] = HTML.evaluate(node.attrs[k], parentComponent); // 217
return newTag; // 218
} else { // 219
return node; // 220
} // 221
}; // 222
// 223
var extendAttrs = function (tgt, src, parentComponent) { // 224
for (var k in src) { // 225
if (k === '$dynamic') // 226
continue; // 227
if (! HTML.isValidAttributeName(k)) // 228
throw new Error("Illegal HTML attribute name: " + k); // 229
var value = HTML.evaluate(src[k], parentComponent); // 230
if (! HTML.isNully(value)) // 231
tgt[k] = value; // 232
} // 233
}; // 234
// 235
// Process the `attrs.$dynamic` directive, if present, returning the final // 236
// attributes dictionary. The value of `attrs.$dynamic` must be an array // 237
// of attributes dictionaries or functions returning attribute dictionaries. // 238
// These attributes are used to extend `attrs` as long as they are non-nully. // 239
// All attributes are "evaluated," calling functions and instantiating // 240
// components. // 241
HTML.evaluateAttributes = function (attrs, parentComponent) { // 242
if (! attrs) // 243
return attrs; // 244
// 245
var result = {}; // 246
extendAttrs(result, attrs, parentComponent); // 247
// 248
if ('$dynamic' in attrs) { // 249
if (! (attrs.$dynamic instanceof Array)) // 250
throw new Error("$dynamic must be an array"); // 251
// iterate over attrs.$dynamic, calling each element if it // 252
// is a function and then using it to extend `result`. // 253
var dynamics = attrs.$dynamic; // 254
for (var i = 0; i < dynamics.length; i++) { // 255
var moreAttrs = dynamics[i]; // 256
if (typeof moreAttrs === 'function') // 257
moreAttrs = moreAttrs(); // 258
extendAttrs(result, moreAttrs, parentComponent); // 259
} // 260
} // 261
// 262
return result; // 263
}; // 264
// 265
HTML.Tag.prototype.evaluateAttributes = function (parentComponent) { // 266
return HTML.evaluateAttributes(this.attrs, parentComponent); // 267
}; // 268
// 269
HTML.Raw = function (value) { // 270
if (! (this instanceof HTML.Raw)) // 271
// called without `new` // 272
return new HTML.Raw(value); // 273
// 274
if (typeof value !== 'string') // 275
throw new Error('HTML.Raw must be constructed with a string'); // 276
// 277
this.value = value; // 278
}; // 279
// 280
HTML.EmitCode = function (value) { // 281
if (! (this instanceof HTML.EmitCode)) // 282
// called without `new` // 283
return new HTML.EmitCode(value); // 284
// 285
if (typeof value !== 'string') // 286
throw new Error('HTML.EmitCode must be constructed with a string'); // 287
// 288
this.value = value; // 289
}; // 290
// 291
//////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/htmljs/tohtml.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// 1
HTML.toHTML = function (node, parentComponent) { // 2
if (node == null) { // 3
// null or undefined // 4
return ''; // 5
} else if ((typeof node === 'string') || (typeof node === 'boolean') || (typeof node === 'number')) { // 6
// string; escape special chars // 7
return HTML.escapeData(String(node)); // 8
} else if (node instanceof Array) { // 9
// array // 10
var parts = []; // 11
for (var i = 0; i < node.length; i++) // 12
parts.push(HTML.toHTML(node[i], parentComponent)); // 13
return parts.join(''); // 14
} else if (typeof node.instantiate === 'function') { // 15
// component // 16
var instance = node.instantiate(parentComponent || null); // 17
var content = instance.render('STATIC'); // 18
stopWithLater(instance); // 19
// recurse with a new value for parentComponent // 20
return HTML.toHTML(content, instance); // 21
} else if (typeof node === 'function') { // 22
return HTML.toHTML(callReactiveFunction(node), parentComponent); // 23
} else if (node.toHTML) { // 24
// Tag or something else // 25
return node.toHTML(parentComponent); // 26
} else { // 27
throw new Error("Expected tag, string, array, component, null, undefined, or " + // 28
"object with a toHTML method; found: " + node); // 29
} // 30
}; // 31
// 32
HTML.Comment.prototype.toHTML = function () { // 33
return '<!--' + this.sanitizedValue + '-->'; // 34
}; // 35
// 36
HTML.CharRef.prototype.toHTML = function () { // 37
return this.html; // 38
}; // 39
// 40
HTML.Raw.prototype.toHTML = function () { // 41
return this.value; // 42
}; // 43
// 44
HTML.Tag.prototype.toHTML = function (parentComponent) { // 45
var attrStrs = []; // 46
var attrs = this.evaluateAttributes(parentComponent); // 47
if (attrs) { // 48
for (var k in attrs) { // 49
var v = HTML.toText(attrs[k], HTML.TEXTMODE.ATTRIBUTE, parentComponent); // 50
attrStrs.push(' ' + k + '="' + v + '"'); // 51
} // 52
} // 53
// 54
var tagName = this.tagName; // 55
var startTag = '<' + tagName + attrStrs.join('') + '>'; // 56
// 57
var childStrs = []; // 58
var content; // 59
if (tagName === 'textarea') { // 60
for (var i = 0; i < this.children.length; i++) // 61
childStrs.push(HTML.toText(this.children[i], HTML.TEXTMODE.RCDATA, parentComponent)); // 62
// 63
content = childStrs.join(''); // 64
if (content.slice(0, 1) === '\n') // 65
// TEXTAREA will absorb a newline, so if we see one, add // 66
// another one. // 67
content = '\n' + content; // 68
// 69
} else { // 70
for (var i = 0; i < this.children.length; i++) // 71
childStrs.push(HTML.toHTML(this.children[i], parentComponent)); // 72
// 73
content = childStrs.join(''); // 74
} // 75
// 76
var result = startTag + content; // 77
// 78
if (this.children.length || ! HTML.isVoidElement(tagName)) { // 79
// "Void" elements like BR are the only ones that don't get a close // 80
// tag in HTML5. They shouldn't have contents, either, so we could // 81
// throw an error upon seeing contents here. // 82
result += '</' + tagName + '>'; // 83
} // 84
// 85
return result; // 86
}; // 87
// 88
HTML.TEXTMODE = { // 89
ATTRIBUTE: 1, // 90
RCDATA: 2, // 91
STRING: 3 // 92
}; // 93
// 94
HTML.toText = function (node, textMode, parentComponent) { // 95
if (node == null) { // 96
// null or undefined // 97
return ''; // 98
} else if ((typeof node === 'string') || (typeof node === 'boolean') || (typeof node === 'number')) { // 99
node = String(node); // 100
// string // 101
if (textMode === HTML.TEXTMODE.STRING) { // 102
return node; // 103
} else if (textMode === HTML.TEXTMODE.RCDATA) { // 104
return HTML.escapeData(node); // 105
} else if (textMode === HTML.TEXTMODE.ATTRIBUTE) { // 106
// escape `&` and `"` this time, not `&` and `<` // 107
return node.replace(/&/g, '&amp;').replace(/"/g, '&quot;'); // 108
} else { // 109
throw new Error("Unknown TEXTMODE: " + textMode); // 110
} // 111
} else if (node instanceof Array) { // 112
// array // 113
var parts = []; // 114
for (var i = 0; i < node.length; i++) // 115
parts.push(HTML.toText(node[i], textMode, parentComponent)); // 116
return parts.join(''); // 117
} else if (typeof node === 'function') { // 118
return HTML.toText(callReactiveFunction(node), textMode, parentComponent); // 119
} else if (typeof node.instantiate === 'function') { // 120
// component // 121
var instance = node.instantiate(parentComponent || null); // 122
var content = instance.render('STATIC'); // 123
var result = HTML.toText(content, textMode, instance); // 124
stopWithLater(instance); // 125
return result; // 126
} else if (node.toText) { // 127
// Something else // 128
return node.toText(textMode, parentComponent); // 129
} else { // 130
throw new Error("Expected tag, string, array, component, null, undefined, or " + // 131
"object with a toText method; found: " + node); // 132
} // 133
// 134
}; // 135
// 136
HTML.Raw.prototype.toText = function () { // 137
return this.value; // 138
}; // 139
// 140
// used when including templates within {{#markdown}} // 141
HTML.Tag.prototype.toText = function (textMode, parentComponent) { // 142
if (textMode === HTML.TEXTMODE.STRING) // 143
// stringify the tag as HTML, then convert to text // 144
return HTML.toText(this.toHTML(parentComponent), textMode); // 145
else // 146
throw new Error("Can't insert tags in attributes or TEXTAREA elements"); // 147
}; // 148
// 149
HTML.CharRef.prototype.toText = function (textMode) { // 150
if (textMode === HTML.TEXTMODE.STRING) // 151
return this.str; // 152
else if (textMode === HTML.TEXTMODE.RCDATA) // 153
return this.html; // 154
else if (textMode === HTML.TEXTMODE.ATTRIBUTE) // 155
return this.html; // 156
else // 157
throw new Error("Unknown TEXTMODE: " + textMode); // 158
}; // 159
// 160
//////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.htmljs = {
HTML: HTML
};
})();
//# sourceMappingURL=a0a9082010d25b3fb44e0f56bdd0a7b4e6bbeb93.map

View File

@ -1,128 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var _ = Package.underscore._;
var JSON = Package.json.JSON;
var EJSON = Package.ejson.EJSON;
/* Package-scope variables */
var IdMap;
(function () {
////////////////////////////////////////////////////////////////////////////////
// //
// packages/id-map/id-map.js //
// //
////////////////////////////////////////////////////////////////////////////////
//
IdMap = function (idStringify, idParse) { // 1
var self = this; // 2
self._map = {}; // 3
self._idStringify = idStringify || JSON.stringify; // 4
self._idParse = idParse || JSON.parse; // 5
}; // 6
// 7
// Some of these methods are designed to match methods on OrderedDict, since // 8
// (eg) ObserveMultiplex and _CachingChangeObserver use them interchangeably. // 9
// (Conceivably, this should be replaced with "UnorderedDict" with a specific // 10
// set of methods that overlap between the two.) // 11
// 12
_.extend(IdMap.prototype, { // 13
get: function (id) { // 14
var self = this; // 15
var key = self._idStringify(id); // 16
return self._map[key]; // 17
}, // 18
set: function (id, value) { // 19
var self = this; // 20
var key = self._idStringify(id); // 21
self._map[key] = value; // 22
}, // 23
remove: function (id) { // 24
var self = this; // 25
var key = self._idStringify(id); // 26
delete self._map[key]; // 27
}, // 28
has: function (id) { // 29
var self = this; // 30
var key = self._idStringify(id); // 31
return _.has(self._map, key); // 32
}, // 33
empty: function () { // 34
var self = this; // 35
return _.isEmpty(self._map); // 36
}, // 37
clear: function () { // 38
var self = this; // 39
self._map = {}; // 40
}, // 41
// Iterates over the items in the map. Return `false` to break the loop. // 42
forEach: function (iterator) { // 43
var self = this; // 44
// don't use _.each, because we can't break out of it. // 45
var keys = _.keys(self._map); // 46
for (var i = 0; i < keys.length; i++) { // 47
var breakIfFalse = iterator.call(null, self._map[keys[i]], // 48
self._idParse(keys[i])); // 49
if (breakIfFalse === false) // 50
return; // 51
} // 52
}, // 53
size: function () { // 54
var self = this; // 55
return _.size(self._map); // 56
}, // 57
setDefault: function (id, def) { // 58
var self = this; // 59
var key = self._idStringify(id); // 60
if (_.has(self._map, key)) // 61
return self._map[key]; // 62
self._map[key] = def; // 63
return def; // 64
}, // 65
// Assumes that values are EJSON-cloneable, and that we don't need to clone // 66
// IDs (ie, that nobody is going to mutate an ObjectId). // 67
clone: function () { // 68
var self = this; // 69
var clone = new IdMap(self._idStringify, self._idParse); // 70
self.forEach(function (value, id) { // 71
clone.set(id, EJSON.clone(value)); // 72
}); // 73
return clone; // 74
} // 75
}); // 76
// 77
// 78
////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['id-map'] = {
IdMap: IdMap
};
})();
//# sourceMappingURL=9ea6eaae8d74693ce2505a858d9a5e60cf191298.map

File diff suppressed because it is too large Load Diff

View File

@ -1,555 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
/* Package-scope variables */
var JSON;
(function () {
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/json/json_native.js //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Do we already have a global JSON object? Export it as our JSON object. // 1
if (window.JSON) // 2
JSON = window.JSON; // 3
// 4
////////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/json/json2.js //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
/* // 1
json2.js // 2
2012-10-08 // 3
// 4
Public Domain. // 5
// 6
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. // 7
// 8
See http://www.JSON.org/js.html // 9
// 10
// 11
This code should be minified before deployment. // 12
See http://javascript.crockford.com/jsmin.html // 13
// 14
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO // 15
NOT CONTROL. // 16
// 17
// 18
This file creates a global JSON object containing two methods: stringify // 19
and parse. // 20
// 21
JSON.stringify(value, replacer, space) // 22
value any JavaScript value, usually an object or array. // 23
// 24
replacer an optional parameter that determines how object // 25
values are stringified for objects. It can be a // 26
function or an array of strings. // 27
// 28
space an optional parameter that specifies the indentation // 29
of nested structures. If it is omitted, the text will // 30
be packed without extra whitespace. If it is a number, // 31
it will specify the number of spaces to indent at each // 32
level. If it is a string (such as '\t' or '&nbsp;'), // 33
it contains the characters used to indent at each level. // 34
// 35
This method produces a JSON text from a JavaScript value. // 36
// 37
When an object value is found, if the object contains a toJSON // 38
method, its toJSON method will be called and the result will be // 39
stringified. A toJSON method does not serialize: it returns the // 40
value represented by the name/value pair that should be serialized, // 41
or undefined if nothing should be serialized. The toJSON method // 42
will be passed the key associated with the value, and this will be // 43
bound to the value // 44
// 45
For example, this would serialize Dates as ISO strings. // 46
// 47
Date.prototype.toJSON = function (key) { // 48
function f(n) { // 49
// Format integers to have at least two digits. // 50
return n < 10 ? '0' + n : n; // 51
} // 52
// 53
return this.getUTCFullYear() + '-' + // 54
f(this.getUTCMonth() + 1) + '-' + // 55
f(this.getUTCDate()) + 'T' + // 56
f(this.getUTCHours()) + ':' + // 57
f(this.getUTCMinutes()) + ':' + // 58
f(this.getUTCSeconds()) + 'Z'; // 59
}; // 60
// 61
You can provide an optional replacer method. It will be passed the // 62
key and value of each member, with this bound to the containing // 63
object. The value that is returned from your method will be // 64
serialized. If your method returns undefined, then the member will // 65
be excluded from the serialization. // 66
// 67
If the replacer parameter is an array of strings, then it will be // 68
used to select the members to be serialized. It filters the results // 69
such that only members with keys listed in the replacer array are // 70
stringified. // 71
// 72
Values that do not have JSON representations, such as undefined or // 73
functions, will not be serialized. Such values in objects will be // 74
dropped; in arrays they will be replaced with null. You can use // 75
a replacer function to replace those with JSON values. // 76
JSON.stringify(undefined) returns undefined. // 77
// 78
The optional space parameter produces a stringification of the // 79
value that is filled with line breaks and indentation to make it // 80
easier to read. // 81
// 82
If the space parameter is a non-empty string, then that string will // 83
be used for indentation. If the space parameter is a number, then // 84
the indentation will be that many spaces. // 85
// 86
Example: // 87
// 88
text = JSON.stringify(['e', {pluribus: 'unum'}]); // 89
// text is '["e",{"pluribus":"unum"}]' // 90
// 91
// 92
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); // 93
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' // 94
// 95
text = JSON.stringify([new Date()], function (key, value) { // 96
return this[key] instanceof Date ? // 97
'Date(' + this[key] + ')' : value; // 98
}); // 99
// text is '["Date(---current time---)"]' // 100
// 101
// 102
JSON.parse(text, reviver) // 103
This method parses a JSON text to produce an object or array. // 104
It can throw a SyntaxError exception. // 105
// 106
The optional reviver parameter is a function that can filter and // 107
transform the results. It receives each of the keys and values, // 108
and its return value is used instead of the original value. // 109
If it returns what it received, then the structure is not modified. // 110
If it returns undefined then the member is deleted. // 111
// 112
Example: // 113
// 114
// Parse the text. Values that look like ISO date strings will // 115
// be converted to Date objects. // 116
// 117
myData = JSON.parse(text, function (key, value) { // 118
var a; // 119
if (typeof value === 'string') { // 120
a = // 121
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); // 122
if (a) { // 123
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], // 124
+a[5], +a[6])); // 125
} // 126
} // 127
return value; // 128
}); // 129
// 130
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { // 131
var d; // 132
if (typeof value === 'string' && // 133
value.slice(0, 5) === 'Date(' && // 134
value.slice(-1) === ')') { // 135
d = new Date(value.slice(5, -1)); // 136
if (d) { // 137
return d; // 138
} // 139
} // 140
return value; // 141
}); // 142
// 143
// 144
This is a reference implementation. You are free to copy, modify, or // 145
redistribute. // 146
*/ // 147
// 148
/*jslint evil: true, regexp: true */ // 149
// 150
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, // 151
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, // 152
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, // 153
lastIndex, length, parse, prototype, push, replace, slice, stringify, // 154
test, toJSON, toString, valueOf // 155
*/ // 156
// 157
// 158
// Create a JSON object only if one does not already exist. We create the // 159
// methods in a closure to avoid creating global variables. // 160
// 161
if (typeof JSON !== 'object') { // 162
JSON = {}; // 163
} // 164
// 165
(function () { // 166
'use strict'; // 167
// 168
function f(n) { // 169
// Format integers to have at least two digits. // 170
return n < 10 ? '0' + n : n; // 171
} // 172
// 173
if (typeof Date.prototype.toJSON !== 'function') { // 174
// 175
Date.prototype.toJSON = function (key) { // 176
// 177
return isFinite(this.valueOf()) // 178
? this.getUTCFullYear() + '-' + // 179
f(this.getUTCMonth() + 1) + '-' + // 180
f(this.getUTCDate()) + 'T' + // 181
f(this.getUTCHours()) + ':' + // 182
f(this.getUTCMinutes()) + ':' + // 183
f(this.getUTCSeconds()) + 'Z' // 184
: null; // 185
}; // 186
// 187
String.prototype.toJSON = // 188
Number.prototype.toJSON = // 189
Boolean.prototype.toJSON = function (key) { // 190
return this.valueOf(); // 191
}; // 192
} // 193
// 194
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap, // 197
indent, // 198
meta = { // table of character substitutions // 199
'\b': '\\b', // 200
'\t': '\\t', // 201
'\n': '\\n', // 202
'\f': '\\f', // 203
'\r': '\\r', // 204
'"' : '\\"', // 205
'\\': '\\\\' // 206
}, // 207
rep; // 208
// 209
// 210
function quote(string) { // 211
// 212
// If the string contains no control characters, no quote characters, and no // 213
// backslash characters, then we can safely slap some quotes around it. // 214
// Otherwise we must also replace the offending characters with safe escape // 215
// sequences. // 216
// 217
escapable.lastIndex = 0; // 218
return escapable.test(string) ? '"' + string.replace(escapable, function (a) { // 219
var c = meta[a]; // 220
return typeof c === 'string' // 221
? c // 222
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); // 223
}) + '"' : '"' + string + '"'; // 224
} // 225
// 226
// 227
function str(key, holder) { // 228
// 229
// Produce a string from holder[key]. // 230
// 231
var i, // The loop counter. // 232
k, // The member key. // 233
v, // The member value. // 234
length, // 235
mind = gap, // 236
partial, // 237
value = holder[key]; // 238
// 239
// If the value has a toJSON method, call it to obtain a replacement value. // 240
// 241
if (value && typeof value === 'object' && // 242
typeof value.toJSON === 'function') { // 243
value = value.toJSON(key); // 244
} // 245
// 246
// If we were called with a replacer function, then call the replacer to // 247
// obtain a replacement value. // 248
// 249
if (typeof rep === 'function') { // 250
value = rep.call(holder, key, value); // 251
} // 252
// 253
// What happens next depends on the value's type. // 254
// 255
switch (typeof value) { // 256
case 'string': // 257
return quote(value); // 258
// 259
case 'number': // 260
// 261
// JSON numbers must be finite. Encode non-finite numbers as null. // 262
// 263
return isFinite(value) ? String(value) : 'null'; // 264
// 265
case 'boolean': // 266
case 'null': // 267
// 268
// If the value is a boolean or null, convert it to a string. Note: // 269
// typeof null does not produce 'null'. The case is included here in // 270
// the remote chance that this gets fixed someday. // 271
// 272
return String(value); // 273
// 274
// If the type is 'object', we might be dealing with an object or an array or // 275
// null. // 276
// 277
case 'object': // 278
// 279
// Due to a specification blunder in ECMAScript, typeof null is 'object', // 280
// so watch out for that case. // 281
// 282
if (!value) { // 283
return 'null'; // 284
} // 285
// 286
// Make an array to hold the partial results of stringifying this object value. // 287
// 288
gap += indent; // 289
partial = []; // 290
// 291
// Is the value an array? // 292
// 293
if (Object.prototype.toString.apply(value) === '[object Array]') { // 294
// 295
// The value is an array. Stringify every element. Use null as a placeholder // 296
// for non-JSON values. // 297
// 298
length = value.length; // 299
for (i = 0; i < length; i += 1) { // 300
partial[i] = str(i, value) || 'null'; // 301
} // 302
// 303
// Join all of the elements together, separated with commas, and wrap them in // 304
// brackets. // 305
// 306
v = partial.length === 0 // 307
? '[]' // 308
: gap // 309
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' // 310
: '[' + partial.join(',') + ']'; // 311
gap = mind; // 312
return v; // 313
} // 314
// 315
// If the replacer is an array, use it to select the members to be stringified. // 316
// 317
if (rep && typeof rep === 'object') { // 318
length = rep.length; // 319
for (i = 0; i < length; i += 1) { // 320
if (typeof rep[i] === 'string') { // 321
k = rep[i]; // 322
v = str(k, value); // 323
if (v) { // 324
partial.push(quote(k) + (gap ? ': ' : ':') + v); // 325
} // 326
} // 327
} // 328
} else { // 329
// 330
// Otherwise, iterate through all of the keys in the object. // 331
// 332
for (k in value) { // 333
if (Object.prototype.hasOwnProperty.call(value, k)) { // 334
v = str(k, value); // 335
if (v) { // 336
partial.push(quote(k) + (gap ? ': ' : ':') + v); // 337
} // 338
} // 339
} // 340
} // 341
// 342
// Join all of the member texts together, separated with commas, // 343
// and wrap them in braces. // 344
// 345
v = partial.length === 0 // 346
? '{}' // 347
: gap // 348
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' // 349
: '{' + partial.join(',') + '}'; // 350
gap = mind; // 351
return v; // 352
} // 353
} // 354
// 355
// If the JSON object does not yet have a stringify method, give it one. // 356
// 357
if (typeof JSON.stringify !== 'function') { // 358
JSON.stringify = function (value, replacer, space) { // 359
// 360
// The stringify method takes a value and an optional replacer, and an optional // 361
// space parameter, and returns a JSON text. The replacer can be a function // 362
// that can replace values, or an array of strings that will select the keys. // 363
// A default replacer method can be provided. Use of the space parameter can // 364
// produce text that is more easily readable. // 365
// 366
var i; // 367
gap = ''; // 368
indent = ''; // 369
// 370
// If the space parameter is a number, make an indent string containing that // 371
// many spaces. // 372
// 373
if (typeof space === 'number') { // 374
for (i = 0; i < space; i += 1) { // 375
indent += ' '; // 376
} // 377
// 378
// If the space parameter is a string, it will be used as the indent string. // 379
// 380
} else if (typeof space === 'string') { // 381
indent = space; // 382
} // 383
// 384
// If there is a replacer, it must be a function or an array. // 385
// Otherwise, throw an error. // 386
// 387
rep = replacer; // 388
if (replacer && typeof replacer !== 'function' && // 389
(typeof replacer !== 'object' || // 390
typeof replacer.length !== 'number')) { // 391
throw new Error('JSON.stringify'); // 392
} // 393
// 394
// Make a fake root object containing our value under the key of ''. // 395
// Return the result of stringifying the value. // 396
// 397
return str('', {'': value}); // 398
}; // 399
} // 400
// 401
// 402
// If the JSON object does not yet have a parse method, give it one. // 403
// 404
if (typeof JSON.parse !== 'function') { // 405
JSON.parse = function (text, reviver) { // 406
// 407
// The parse method takes a text and an optional reviver function, and returns // 408
// a JavaScript value if the text is a valid JSON text. // 409
// 410
var j; // 411
// 412
function walk(holder, key) { // 413
// 414
// The walk method is used to recursively walk the resulting structure so // 415
// that modifications can be made. // 416
// 417
var k, v, value = holder[key]; // 418
if (value && typeof value === 'object') { // 419
for (k in value) { // 420
if (Object.prototype.hasOwnProperty.call(value, k)) { // 421
v = walk(value, k); // 422
if (v !== undefined) { // 423
value[k] = v; // 424
} else { // 425
delete value[k]; // 426
} // 427
} // 428
} // 429
} // 430
return reviver.call(holder, key, value); // 431
} // 432
// 433
// 434
// Parsing happens in four stages. In the first stage, we replace certain // 435
// Unicode characters with escape sequences. JavaScript handles many characters // 436
// incorrectly, either silently deleting them, or treating them as line endings. // 437
// 438
text = String(text); // 439
cx.lastIndex = 0; // 440
if (cx.test(text)) { // 441
text = text.replace(cx, function (a) { // 442
return '\\u' + // 443
('0000' + a.charCodeAt(0).toString(16)).slice(-4); // 444
}); // 445
} // 446
// 447
// In the second stage, we run the text against regular expressions that look // 448
// for non-JSON patterns. We are especially concerned with '()' and 'new' // 449
// because they can cause invocation, and '=' because it can cause mutation. // 450
// But just to be safe, we want to reject all unexpected forms. // 451
// 452
// We split the second stage into 4 regexp operations in order to work around // 453
// crippling inefficiencies in IE's and Safari's regexp engines. First we // 454
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // 455
// replace all simple value tokens with ']' characters. Third, we delete all // 456
// open brackets that follow a colon or comma or that begin the text. Finally, // 457
// we look to see that the remaining characters are only whitespace or ']' or // 458
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. // 459
// 460
if (/^[\],:{}\s]*$/ // 461
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') // 462
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') // 463
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // 464
// 465
// In the third stage we use the eval function to compile the text into a // 466
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity // 467
// in JavaScript: it can begin a block or an object literal. We wrap the text // 468
// in parens to eliminate the ambiguity. // 469
// 470
j = eval('(' + text + ')'); // 471
// 472
// In the optional fourth stage, we recursively walk the new structure, passing // 473
// each name/value pair to a reviver function for possible transformation. // 474
// 475
return typeof reviver === 'function' // 476
? walk({'': j}, '') // 477
: j; // 478
} // 479
// 480
// If the text is not JSON parseable, then a SyntaxError is thrown. // 481
// 482
throw new SyntaxError('JSON.parse'); // 483
}; // 484
} // 485
}()); // 486
// 487
////////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.json = {
JSON: JSON
};
})();
//# sourceMappingURL=e22856eae714c681199eabc5c0710b904b125554.map

File diff suppressed because it is too large Load Diff

View File

@ -1,324 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var _ = Package.underscore._;
var EJSON = Package.ejson.EJSON;
/* Package-scope variables */
var Log;
(function () {
/////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/logging/logging.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////
//
Log = function () { // 1
return Log.info.apply(this, arguments); // 2
}; // 3
// 4
/// FOR TESTING // 5
var intercept = 0; // 6
var interceptedLines = []; // 7
var suppress = 0; // 8
// 9
// Intercept the next 'count' calls to a Log function. The actual // 10
// lines printed to the console can be cleared and read by calling // 11
// Log._intercepted(). // 12
Log._intercept = function (count) { // 13
intercept += count; // 14
}; // 15
// 16
// Suppress the next 'count' calls to a Log function. Use this to stop // 17
// tests from spamming the console, especially with red errors that // 18
// might look like a failing test. // 19
Log._suppress = function (count) { // 20
suppress += count; // 21
}; // 22
// 23
// Returns intercepted lines and resets the intercept counter. // 24
Log._intercepted = function () { // 25
var lines = interceptedLines; // 26
interceptedLines = []; // 27
intercept = 0; // 28
return lines; // 29
}; // 30
// 31
// Either 'json' or 'colored-text'. // 32
// // 33
// When this is set to 'json', print JSON documents that are parsed by another // 34
// process ('satellite' or 'meteor run'). This other process should call // 35
// 'Log.format' for nice output. // 36
// // 37
// When this is set to 'colored-text', call 'Log.format' before printing. // 38
// This should be used for logging from within satellite, since there is no // 39
// other process that will be reading its standard output. // 40
Log.outputFormat = 'json'; // 41
// 42
var LEVEL_COLORS = { // 43
debug: 'green', // 44
// leave info as the default color // 45
warn: 'magenta', // 46
error: 'red' // 47
}; // 48
// 49
var META_COLOR = 'blue'; // 50
// 51
// XXX package // 52
var RESTRICTED_KEYS = ['time', 'timeInexact', 'level', 'file', 'line', // 53
'program', 'originApp', 'satellite', 'stderr']; // 54
// 55
var FORMATTED_KEYS = RESTRICTED_KEYS.concat(['app', 'message']); // 56
// 57
var logInBrowser = function (obj) { // 58
var str = Log.format(obj); // 59
// 60
// XXX Some levels should be probably be sent to the server // 61
var level = obj.level; // 62
// 63
if ((typeof console !== 'undefined') && console[level]) { // 64
console[level](str); // 65
} else { // 66
// XXX Uses of Meteor._debug should probably be replaced by Log.debug or // 67
// Log.info, and we should have another name for "do your best to // 68
// call call console.log". // 69
Meteor._debug(str); // 70
} // 71
}; // 72
// 73
// @returns {Object: { line: Number, file: String }} // 74
Log._getCallerDetails = function () { // 75
var getStack = function () { // 76
// We do NOT use Error.prepareStackTrace here (a V8 extension that gets us a // 77
// pre-parsed stack) since it's impossible to compose it with the use of // 78
// Error.prepareStackTrace used on the server for source maps. // 79
var err = new Error; // 80
var stack = err.stack; // 81
return stack; // 82
}; // 83
// 84
var stack = getStack(); // 85
// 86
if (!stack) return {}; // 87
// 88
var lines = stack.split('\n'); // 89
// 90
// looking for the first line outside the logging package (or an // 91
// eval if we find that first) // 92
var line; // 93
for (var i = 1; i < lines.length; ++i) { // 94
line = lines[i]; // 95
if (line.match(/^\s*at eval \(eval/)) { // 96
return {file: "eval"}; // 97
} // 98
// 99
// XXX probably wants to be / or .js in case no source maps // 100
if (!line.match(/packages\/logging(?:\/|(?::tests)?\.js)/)) // 101
break; // 102
} // 103
// 104
var details = {}; // 105
// 106
// The format for FF is 'functionName@filePath:lineNumber' // 107
// The format for V8 is 'functionName (packages/logging/logging.js:81)' or // 108
// 'packages/logging/logging.js:81' // 109
var match = /(?:[@(]| at )([^(]+?):([0-9:]+)(?:\)|$)/.exec(line); // 110
if (!match) // 111
return details; // 112
// in case the matched block here is line:column // 113
details.line = match[2].split(':')[0]; // 114
// 115
// Possible format: https://foo.bar.com/scripts/file.js?random=foobar // 116
// XXX: if you can write the following in better way, please do it // 117
// XXX: what about evals? // 118
details.file = match[1].split('/').slice(-1)[0].split('?')[0]; // 119
// 120
return details; // 121
}; // 122
// 123
_.each(['debug', 'info', 'warn', 'error'], function (level) { // 124
// @param arg {String|Object} // 125
Log[level] = function (arg) { // 126
if (suppress) { // 127
suppress--; // 128
return; // 129
} // 130
// 131
var intercepted = false; // 132
if (intercept) { // 133
intercept--; // 134
intercepted = true; // 135
} // 136
// 137
var obj = (_.isObject(arg) && !_.isRegExp(arg) && !_.isDate(arg) ) ? // 138
arg : {message: new String(arg).toString() }; // 139
// 140
_.each(RESTRICTED_KEYS, function (key) { // 141
if (obj[key]) // 142
throw new Error("Can't set '" + key + "' in log message"); // 143
}); // 144
// 145
if (_.has(obj, 'message') && !_.isString(obj.message)) // 146
throw new Error("The 'message' field in log objects must be a string"); // 147
if (!obj.omitCallerDetails) // 148
obj = _.extend(Log._getCallerDetails(), obj); // 149
obj.time = new Date(); // 150
obj.level = level; // 151
// 152
// XXX allow you to enable 'debug', probably per-package // 153
if (level === 'debug') // 154
return; // 155
// 156
if (intercepted) { // 157
interceptedLines.push(EJSON.stringify(obj)); // 158
} else if (Meteor.isServer) { // 159
if (Log.outputFormat === 'colored-text') { // 160
console.log(Log.format(obj, {color: true})); // 161
} else if (Log.outputFormat === 'json') { // 162
console.log(EJSON.stringify(obj)); // 163
} else { // 164
throw new Error("Unknown logging output format: " + Log.outputFormat); // 165
} // 166
} else { // 167
logInBrowser(obj); // 168
} // 169
}; // 170
}); // 171
// 172
// tries to parse line as EJSON. returns object if parse is successful, or null if not // 173
Log.parse = function (line) { // 174
var obj = null; // 175
if (line && line.charAt(0) === '{') { // might be json generated from calling 'Log' // 176
try { obj = EJSON.parse(line); } catch (e) {} // 177
} // 178
// 179
// XXX should probably check fields other than 'time' // 180
if (obj && obj.time && (obj.time instanceof Date)) // 181
return obj; // 182
else // 183
return null; // 184
}; // 185
// 186
// formats a log object into colored human and machine-readable text // 187
Log.format = function (obj, options) { // 188
obj = EJSON.clone(obj); // don't mutate the argument // 189
options = options || {}; // 190
// 191
var time = obj.time; // 192
if (!(time instanceof Date)) // 193
throw new Error("'time' must be a Date object"); // 194
var timeInexact = obj.timeInexact; // 195
// 196
// store fields that are in FORMATTED_KEYS since we strip them // 197
var level = obj.level || 'info'; // 198
var file = obj.file; // 199
var lineNumber = obj.line; // 200
var appName = obj.app || ''; // 201
var originApp = obj.originApp; // 202
var message = obj.message || ''; // 203
var program = obj.program || ''; // 204
var satellite = obj.satellite; // 205
var stderr = obj.stderr || ''; // 206
// 207
_.each(FORMATTED_KEYS, function(key) { // 208
delete obj[key]; // 209
}); // 210
// 211
if (!_.isEmpty(obj)) { // 212
if (message) message += " "; // 213
message += EJSON.stringify(obj); // 214
} // 215
// 216
var pad2 = function(n) { return n < 10 ? '0' + n : n.toString(); }; // 217
var pad3 = function(n) { return n < 100 ? '0' + pad2(n) : n.toString(); }; // 218
// 219
var dateStamp = time.getFullYear().toString() + // 220
pad2(time.getMonth() + 1 /*0-based*/) + // 221
pad2(time.getDate()); // 222
var timeStamp = pad2(time.getHours()) + // 223
':' + // 224
pad2(time.getMinutes()) + // 225
':' + // 226
pad2(time.getSeconds()) + // 227
'.' + // 228
pad3(time.getMilliseconds()); // 229
// 230
// eg in San Francisco in June this will be '(-7)' // 231
var utcOffsetStr = '(' + (-(new Date().getTimezoneOffset() / 60)) + ')'; // 232
// 233
var appInfo = ''; // 234
if (appName) appInfo += appName; // 235
if (originApp && originApp !== appName) appInfo += ' via ' + originApp; // 236
if (appInfo) appInfo = '[' + appInfo + '] '; // 237
// 238
var sourceInfo = (file && lineNumber) ? // 239
['(', (program ? program + ':' : ''), file, ':', lineNumber, ') '].join('') // 240
: ''; // 241
// 242
if (satellite) // 243
sourceInfo += ['[', satellite, ']'].join(''); // 244
// 245
var stderrIndicator = stderr ? '(STDERR) ' : ''; // 246
// 247
var metaPrefix = [ // 248
level.charAt(0).toUpperCase(), // 249
dateStamp, // 250
'-', // 251
timeStamp, // 252
utcOffsetStr, // 253
timeInexact ? '? ' : ' ', // 254
appInfo, // 255
sourceInfo, // 256
stderrIndicator].join(''); // 257
// 258
var prettify = function (line, color) { // 259
return (options.color && Meteor.isServer && color) ? // 260
Npm.require('cli-color')[color](line) : line; // 261
}; // 262
// 263
return prettify(metaPrefix, META_COLOR) // 264
+ prettify(message, LEVEL_COLORS[level]); // 265
}; // 266
// 267
// Turn a line of text into a loggable object. // 268
// @param line {String} // 269
// @param override {Object} // 270
Log.objFromText = function (line, override) { // 271
var obj = {message: line, level: "info", time: new Date(), timeInexact: true}; // 272
return _.extend(obj, override); // 273
}; // 274
// 275
/////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.logging = {
Log: Log
};
})();
//# sourceMappingURL=0de00019cf57ae305903f15baf5dc8e10f973ded.map

View File

@ -1,914 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var _ = Package.underscore._;
/* Package-scope variables */
var Meteor;
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/client_environment.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
Meteor = { // 1
isClient: true, // 2
isServer: false // 3
}; // 4
// 5
if (typeof __meteor_runtime_config__ === 'object' && // 6
__meteor_runtime_config__.PUBLIC_SETTINGS) { // 7
Meteor.settings = { 'public': __meteor_runtime_config__.PUBLIC_SETTINGS }; // 8
} // 9
// 10
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/helpers.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
if (Meteor.isServer) // 1
var Future = Npm.require('fibers/future'); // 2
// 3
if (typeof __meteor_runtime_config__ === 'object' && // 4
__meteor_runtime_config__.meteorRelease) // 5
Meteor.release = __meteor_runtime_config__.meteorRelease; // 6
// 7
// XXX find a better home for these? Ideally they would be _.get, // 8
// _.ensure, _.delete.. // 9
// 10
_.extend(Meteor, { // 11
// _get(a,b,c,d) returns a[b][c][d], or else undefined if a[b] or // 12
// a[b][c] doesn't exist. // 13
// // 14
_get: function (obj /*, arguments */) { // 15
for (var i = 1; i < arguments.length; i++) { // 16
if (!(arguments[i] in obj)) // 17
return undefined; // 18
obj = obj[arguments[i]]; // 19
} // 20
return obj; // 21
}, // 22
// 23
// _ensure(a,b,c,d) ensures that a[b][c][d] exists. If it does not, // 24
// it is created and set to {}. Either way, it is returned. // 25
// // 26
_ensure: function (obj /*, arguments */) { // 27
for (var i = 1; i < arguments.length; i++) { // 28
var key = arguments[i]; // 29
if (!(key in obj)) // 30
obj[key] = {}; // 31
obj = obj[key]; // 32
} // 33
// 34
return obj; // 35
}, // 36
// 37
// _delete(a, b, c, d) deletes a[b][c][d], then a[b][c] unless it // 38
// isn't empty, then a[b] unless it isn't empty. // 39
// // 40
_delete: function (obj /*, arguments */) { // 41
var stack = [obj]; // 42
var leaf = true; // 43
for (var i = 1; i < arguments.length - 1; i++) { // 44
var key = arguments[i]; // 45
if (!(key in obj)) { // 46
leaf = false; // 47
break; // 48
} // 49
obj = obj[key]; // 50
if (typeof obj !== "object") // 51
break; // 52
stack.push(obj); // 53
} // 54
// 55
for (var i = stack.length - 1; i >= 0; i--) { // 56
var key = arguments[i+1]; // 57
// 58
if (leaf) // 59
leaf = false; // 60
else // 61
for (var other in stack[i][key]) // 62
return; // not empty -- we're done // 63
// 64
delete stack[i][key]; // 65
} // 66
}, // 67
// 68
// _wrapAsync can wrap any function that takes some number of arguments that // 69
// can't be undefined, followed by some optional arguments, where the callback // 70
// is the last optional argument. // 71
// e.g. fs.readFile(pathname, [callback]), // 72
// fs.open(pathname, flags, [mode], [callback]) // 73
// For maximum effectiveness and least confusion, wrapAsync should be used on // 74
// functions where the callback is the only argument of type Function. // 75
// // 76
_wrapAsync: function (fn) { // 77
return function (/* arguments */) { // 78
var self = this; // 79
var callback; // 80
var fut; // 81
var newArgs = _.toArray(arguments); // 82
// 83
var logErr = function (err) { // 84
if (err) // 85
return Meteor._debug("Exception in callback of async function", // 86
err.stack ? err.stack : err); // 87
}; // 88
// 89
// Pop off optional args that are undefined // 90
while (newArgs.length > 0 && // 91
typeof(newArgs[newArgs.length - 1]) === "undefined") { // 92
newArgs.pop(); // 93
} // 94
// If we have any left and the last one is a function, then that's our // 95
// callback; otherwise, we don't have one. // 96
if (newArgs.length > 0 && // 97
newArgs[newArgs.length - 1] instanceof Function) { // 98
callback = newArgs.pop(); // 99
} else { // 100
if (Meteor.isClient) { // 101
callback = logErr; // 102
} else { // 103
fut = new Future(); // 104
callback = fut.resolver(); // 105
} // 106
} // 107
newArgs.push(Meteor.bindEnvironment(callback)); // 108
var result = fn.apply(self, newArgs); // 109
if (fut) // 110
return fut.wait(); // 111
return result; // 112
}; // 113
}, // 114
// 115
// Sets child's prototype to a new object whose prototype is parent's // 116
// prototype. Used as: // 117
// Meteor._inherits(ClassB, ClassA). // 118
// _.extend(ClassB.prototype, { ... }) // 119
// Inspired by CoffeeScript's `extend` and Google Closure's `goog.inherits`. // 120
_inherits: function (Child, Parent) { // 121
// copy static fields // 122
_.each(Parent, function (prop, field) { // 123
Child[field] = prop; // 124
}); // 125
// 126
// a middle member of prototype chain: takes the prototype from the Parent // 127
var Middle = function () { // 128
this.constructor = Child; // 129
}; // 130
Middle.prototype = Parent.prototype; // 131
Child.prototype = new Middle(); // 132
Child.__super__ = Parent.prototype; // 133
return Child; // 134
} // 135
}); // 136
// 137
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/setimmediate.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Chooses one of three setImmediate implementations: // 1
// // 2
// * Native setImmediate (IE 10, Node 0.9+) // 3
// // 4
// * postMessage (many browsers) // 5
// // 6
// * setTimeout (fallback) // 7
// // 8
// The postMessage implementation is based on // 9
// https://github.com/NobleJS/setImmediate/tree/1.0.1 // 10
// // 11
// Don't use `nextTick` for Node since it runs its callbacks before // 12
// I/O, which is stricter than we're looking for. // 13
// // 14
// Not installed as a polyfill, as our public API is `Meteor.defer`. // 15
// Since we're not trying to be a polyfill, we have some // 16
// simplifications: // 17
// // 18
// If one invocation of a setImmediate callback pauses itself by a // 19
// call to alert/prompt/showModelDialog, the NobleJS polyfill // 20
// implementation ensured that no setImmedate callback would run until // 21
// the first invocation completed. While correct per the spec, what it // 22
// would mean for us in practice is that any reactive updates relying // 23
// on Meteor.defer would be hung in the main window until the modal // 24
// dialog was dismissed. Thus we only ensure that a setImmediate // 25
// function is called in a later event loop. // 26
// // 27
// We don't need to support using a string to be eval'ed for the // 28
// callback, arguments to the function, or clearImmediate. // 29
// 30
"use strict"; // 31
// 32
var global = this; // 33
// 34
// 35
// IE 10, Node >= 9.1 // 36
// 37
function useSetImmediate() { // 38
if (! global.setImmediate) // 39
return null; // 40
else { // 41
var setImmediate = function (fn) { // 42
global.setImmediate(fn); // 43
}; // 44
setImmediate.implementation = 'setImmediate'; // 45
return setImmediate; // 46
} // 47
} // 48
// 49
// 50
// Android 2.3.6, Chrome 26, Firefox 20, IE 8-9, iOS 5.1.1 Safari // 51
// 52
function usePostMessage() { // 53
// The test against `importScripts` prevents this implementation // 54
// from being installed inside a web worker, where // 55
// `global.postMessage` means something completely different and // 56
// can't be used for this purpose. // 57
// 58
if (!global.postMessage || global.importScripts) { // 59
return null; // 60
} // 61
// 62
// Avoid synchronous post message implementations. // 63
// 64
var postMessageIsAsynchronous = true; // 65
var oldOnMessage = global.onmessage; // 66
global.onmessage = function () { // 67
postMessageIsAsynchronous = false; // 68
}; // 69
global.postMessage("", "*"); // 70
global.onmessage = oldOnMessage; // 71
// 72
if (! postMessageIsAsynchronous) // 73
return null; // 74
// 75
var funcIndex = 0; // 76
var funcs = {}; // 77
// 78
// Installs an event handler on `global` for the `message` event: see // 79
// * https://developer.mozilla.org/en/DOM/window.postMessage // 80
// * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages // 81
// 82
// XXX use Random.id() here? // 83
var MESSAGE_PREFIX = "Meteor._setImmediate." + Math.random() + '.'; // 84
// 85
function isStringAndStartsWith(string, putativeStart) { // 86
return (typeof string === "string" && // 87
string.substring(0, putativeStart.length) === putativeStart); // 88
} // 89
// 90
function onGlobalMessage(event) { // 91
// This will catch all incoming messages (even from other // 92
// windows!), so we need to try reasonably hard to avoid letting // 93
// anyone else trick us into firing off. We test the origin is // 94
// still this window, and that a (randomly generated) // 95
// unpredictable identifying prefix is present. // 96
if (event.source === global && // 97
isStringAndStartsWith(event.data, MESSAGE_PREFIX)) { // 98
var index = event.data.substring(MESSAGE_PREFIX.length); // 99
try { // 100
if (funcs[index]) // 101
funcs[index](); // 102
} // 103
finally { // 104
delete funcs[index]; // 105
} // 106
} // 107
} // 108
// 109
if (global.addEventListener) { // 110
global.addEventListener("message", onGlobalMessage, false); // 111
} else { // 112
global.attachEvent("onmessage", onGlobalMessage); // 113
} // 114
// 115
var setImmediate = function (fn) { // 116
// Make `global` post a message to itself with the handle and // 117
// identifying prefix, thus asynchronously invoking our // 118
// onGlobalMessage listener above. // 119
++funcIndex; // 120
funcs[funcIndex] = fn; // 121
global.postMessage(MESSAGE_PREFIX + funcIndex, "*"); // 122
}; // 123
setImmediate.implementation = 'postMessage'; // 124
return setImmediate; // 125
} // 126
// 127
// 128
function useTimeout() { // 129
var setImmediate = function (fn) { // 130
global.setTimeout(fn, 0); // 131
}; // 132
setImmediate.implementation = 'setTimeout'; // 133
return setImmediate; // 134
} // 135
// 136
// 137
Meteor._setImmediate = // 138
useSetImmediate() || // 139
usePostMessage() || // 140
useTimeout(); // 141
// 142
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/timers.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
var withoutInvocation = function (f) { // 1
if (Package.livedata) { // 2
var _CurrentInvocation = Package.livedata.DDP._CurrentInvocation; // 3
if (_CurrentInvocation.get() && _CurrentInvocation.get().isSimulation) // 4
throw new Error("Can't set timers inside simulations"); // 5
return function () { _CurrentInvocation.withValue(null, f); }; // 6
} // 7
else // 8
return f; // 9
}; // 10
// 11
var bindAndCatch = function (context, f) { // 12
return Meteor.bindEnvironment(withoutInvocation(f), context); // 13
}; // 14
// 15
_.extend(Meteor, { // 16
// Meteor.setTimeout and Meteor.setInterval callbacks scheduled // 17
// inside a server method are not part of the method invocation and // 18
// should clear out the CurrentInvocation environment variable. // 19
// 20
setTimeout: function (f, duration) { // 21
return setTimeout(bindAndCatch("setTimeout callback", f), duration); // 22
}, // 23
// 24
setInterval: function (f, duration) { // 25
return setInterval(bindAndCatch("setInterval callback", f), duration); // 26
}, // 27
// 28
clearInterval: function(x) { // 29
return clearInterval(x); // 30
}, // 31
// 32
clearTimeout: function(x) { // 33
return clearTimeout(x); // 34
}, // 35
// 36
// XXX consider making this guarantee ordering of defer'd callbacks, like // 37
// Deps.afterFlush or Node's nextTick (in practice). Then tests can do: // 38
// callSomethingThatDefersSomeWork(); // 39
// Meteor.defer(expect(somethingThatValidatesThatTheWorkHappened)); // 40
defer: function (f) { // 41
Meteor._setImmediate(bindAndCatch("defer callback", f)); // 42
} // 43
}); // 44
// 45
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/errors.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Makes an error subclass which properly contains a stack trace in most // 1
// environments. constructor can set fields on `this` (and should probably set // 2
// `message`, which is what gets displayed at the top of a stack trace). // 3
// // 4
Meteor.makeErrorType = function (name, constructor) { // 5
var errorClass = function (/*arguments*/) { // 6
var self = this; // 7
// 8
// Ensure we get a proper stack trace in most Javascript environments // 9
if (Error.captureStackTrace) { // 10
// V8 environments (Chrome and Node.js) // 11
Error.captureStackTrace(self, errorClass); // 12
} else { // 13
// Firefox // 14
var e = new Error; // 15
e.__proto__ = errorClass.prototype; // 16
if (e instanceof errorClass) // 17
self = e; // 18
} // 19
// Safari magically works. // 20
// 21
constructor.apply(self, arguments); // 22
// 23
self.errorType = name; // 24
// 25
return self; // 26
}; // 27
// 28
Meteor._inherits(errorClass, Error); // 29
// 30
return errorClass; // 31
}; // 32
// 33
// This should probably be in the livedata package, but we don't want // 34
// to require you to use the livedata package to get it. Eventually we // 35
// should probably rename it to DDP.Error and put it back in the // 36
// 'livedata' package (which we should rename to 'ddp' also.) // 37
// // 38
// Note: The DDP server assumes that Meteor.Error EJSON-serializes as an object // 39
// containing 'error' and optionally 'reason' and 'details'. // 40
// The DDP client manually puts these into Meteor.Error objects. (We don't use // 41
// EJSON.addType here because the type is determined by location in the // 42
// protocol, not text on the wire.) // 43
// // 44
Meteor.Error = Meteor.makeErrorType( // 45
"Meteor.Error", // 46
function (error, reason, details) { // 47
var self = this; // 48
// 49
// Currently, a numeric code, likely similar to a HTTP code (eg, // 50
// 404, 500). That is likely to change though. // 51
self.error = error; // 52
// 53
// Optional: A short human-readable summary of the error. Not // 54
// intended to be shown to end users, just developers. ("Not Found", // 55
// "Internal Server Error") // 56
self.reason = reason; // 57
// 58
// Optional: Additional information about the error, say for // 59
// debugging. It might be a (textual) stack trace if the server is // 60
// willing to provide one. The corresponding thing in HTTP would be // 61
// the body of a 404 or 500 response. (The difference is that we // 62
// never expect this to be shown to end users, only developers, so // 63
// it doesn't need to be pretty.) // 64
self.details = details; // 65
// 66
// This is what gets displayed at the top of a stack trace. Current // 67
// format is "[404]" (if no reason is set) or "File not found [404]" // 68
if (self.reason) // 69
self.message = self.reason + ' [' + self.error + ']'; // 70
else // 71
self.message = '[' + self.error + ']'; // 72
}); // 73
// 74
// Meteor.Error is basically data and is sent over DDP, so you should be able to // 75
// properly EJSON-clone it. This is especially important because if a // 76
// Meteor.Error is thrown through a Future, the error, reason, and details // 77
// properties become non-enumerable so a standard Object clone won't preserve // 78
// them and they will be lost from DDP. // 79
Meteor.Error.prototype.clone = function () { // 80
var self = this; // 81
return new Meteor.Error(self.error, self.reason, self.details); // 82
}; // 83
// 84
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/fiber_stubs_client.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// This file is a partial analogue to fiber_helpers.js, which allows the client // 1
// to use a queue too, and also to call noYieldsAllowed. // 2
// 3
// The client has no ability to yield, so noYieldsAllowed is a noop. // 4
// // 5
Meteor._noYieldsAllowed = function (f) { // 6
return f(); // 7
}; // 8
// 9
// An even simpler queue of tasks than the fiber-enabled one. This one just // 10
// runs all the tasks when you call runTask or flush, synchronously. // 11
// // 12
Meteor._SynchronousQueue = function () { // 13
var self = this; // 14
self._tasks = []; // 15
self._running = false; // 16
}; // 17
// 18
_.extend(Meteor._SynchronousQueue.prototype, { // 19
runTask: function (task) { // 20
var self = this; // 21
if (!self.safeToRunTask()) // 22
throw new Error("Could not synchronously run a task from a running task"); // 23
self._tasks.push(task); // 24
var tasks = self._tasks; // 25
self._tasks = []; // 26
self._running = true; // 27
try { // 28
while (!_.isEmpty(tasks)) { // 29
var t = tasks.shift(); // 30
try { // 31
t(); // 32
} catch (e) { // 33
if (_.isEmpty(tasks)) { // 34
// this was the last task, that is, the one we're calling runTask // 35
// for. // 36
throw e; // 37
} else { // 38
Meteor._debug("Exception in queued task: " + e.stack); // 39
} // 40
} // 41
} // 42
} finally { // 43
self._running = false; // 44
} // 45
}, // 46
// 47
queueTask: function (task) { // 48
var self = this; // 49
var wasEmpty = _.isEmpty(self._tasks); // 50
self._tasks.push(task); // 51
// Intentionally not using Meteor.setTimeout, because it doesn't like runing // 52
// in stubs for now. // 53
if (wasEmpty) // 54
setTimeout(_.bind(self.flush, self), 0); // 55
}, // 56
// 57
flush: function () { // 58
var self = this; // 59
self.runTask(function () {}); // 60
}, // 61
// 62
drain: function () { // 63
var self = this; // 64
if (!self.safeToRunTask()) // 65
return; // 66
while (!_.isEmpty(self._tasks)) { // 67
self.flush(); // 68
} // 69
}, // 70
// 71
safeToRunTask: function () { // 72
var self = this; // 73
return !self._running; // 74
} // 75
}); // 76
// 77
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/startup_client.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
var queue = []; // 1
var loaded = document.readyState === "loaded" || // 2
document.readyState == "complete"; // 3
// 4
var ready = function() { // 5
loaded = true; // 6
while (queue.length) // 7
(queue.shift())(); // 8
}; // 9
// 10
if (document.addEventListener) { // 11
document.addEventListener('DOMContentLoaded', ready, false); // 12
window.addEventListener('load', ready, false); // 13
} else { // 14
document.attachEvent('onreadystatechange', function () { // 15
if (document.readyState === "complete") // 16
ready(); // 17
}); // 18
window.attachEvent('load', ready); // 19
} // 20
// 21
Meteor.startup = function (cb) { // 22
var doScroll = !document.addEventListener && // 23
document.documentElement.doScroll; // 24
// 25
if (!doScroll || window !== top) { // 26
if (loaded) // 27
cb(); // 28
else // 29
queue.push(cb); // 30
} else { // 31
try { doScroll('left'); } // 32
catch (e) { // 33
setTimeout(function() { Meteor.startup(cb); }, 50); // 34
return; // 35
}; // 36
cb(); // 37
} // 38
}; // 39
// 40
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/debug.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
var suppress = 0; // 1
// 2
// replacement for console.log. This is a temporary API. We should // 3
// provide a real logging API soon (possibly just a polyfill for // 4
// console?) // 5
// // 6
// NOTE: this is used on the server to print the warning about // 7
// having autopublish enabled when you probably meant to turn it // 8
// off. it's not really the proper use of something called // 9
// _debug. the intent is for this message to go to the terminal and // 10
// be very visible. if you change _debug to go someplace else, etc, // 11
// please fix the autopublish code to do something reasonable. // 12
// // 13
Meteor._debug = function (/* arguments */) { // 14
if (suppress) { // 15
suppress--; // 16
return; // 17
} // 18
if (typeof console !== 'undefined' && // 19
typeof console.log !== 'undefined') { // 20
if (arguments.length == 0) { // IE Companion breaks otherwise // 21
// IE10 PP4 requires at least one argument // 22
console.log(''); // 23
} else { // 24
// IE doesn't have console.log.apply, it's not a real Object. // 25
// http://stackoverflow.com/questions/5538972/console-log-apply-not-working-in-ie9 // 26
// http://patik.com/blog/complete-cross-browser-console-log/ // 27
if (typeof console.log.apply === "function") { // 28
// Most browsers // 29
// 30
// Chrome and Safari only hyperlink URLs to source files in first argument of // 31
// console.log, so try to call it with one argument if possible. // 32
// Approach taken here: If all arguments are strings, join them on space. // 33
// See https://github.com/meteor/meteor/pull/732#issuecomment-13975991 // 34
var allArgumentsOfTypeString = true; // 35
for (var i = 0; i < arguments.length; i++) // 36
if (typeof arguments[i] !== "string") // 37
allArgumentsOfTypeString = false; // 38
// 39
if (allArgumentsOfTypeString) // 40
console.log.apply(console, [Array.prototype.join.call(arguments, " ")]); // 41
else // 42
console.log.apply(console, arguments); // 43
// 44
} else if (typeof Function.prototype.bind === "function") { // 45
// IE9 // 46
var log = Function.prototype.bind.call(console.log, console); // 47
log.apply(console, arguments); // 48
} else { // 49
// IE8 // 50
Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments)); // 51
} // 52
} // 53
} // 54
}; // 55
// 56
// Suppress the next 'count' Meteor._debug messsages. Use this to // 57
// stop tests from spamming the console. // 58
// // 59
Meteor._suppress_log = function (count) { // 60
suppress += count; // 61
}; // 62
// 63
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/dynamics_browser.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Simple implementation of dynamic scoping, for use in browsers // 1
// 2
var nextSlot = 0; // 3
var currentValues = []; // 4
// 5
Meteor.EnvironmentVariable = function () { // 6
this.slot = nextSlot++; // 7
}; // 8
// 9
_.extend(Meteor.EnvironmentVariable.prototype, { // 10
get: function () { // 11
return currentValues[this.slot]; // 12
}, // 13
// 14
getOrNullIfOutsideFiber: function () { // 15
return this.get(); // 16
}, // 17
// 18
withValue: function (value, func) { // 19
var saved = currentValues[this.slot]; // 20
try { // 21
currentValues[this.slot] = value; // 22
var ret = func(); // 23
} finally { // 24
currentValues[this.slot] = saved; // 25
} // 26
return ret; // 27
} // 28
}); // 29
// 30
Meteor.bindEnvironment = function (func, onException, _this) { // 31
// needed in order to be able to create closures inside func and // 32
// have the closed variables not change back to their original // 33
// values // 34
var boundValues = _.clone(currentValues); // 35
// 36
if (!onException || typeof(onException) === 'string') { // 37
var description = onException || "callback of async function"; // 38
onException = function (error) { // 39
Meteor._debug( // 40
"Exception in " + description + ":", // 41
error && error.stack || error // 42
); // 43
}; // 44
} // 45
// 46
return function (/* arguments */) { // 47
var savedValues = currentValues; // 48
try { // 49
currentValues = boundValues; // 50
var ret = func.apply(_this, _.toArray(arguments)); // 51
} catch (e) { // 52
// note: callback-hook currently relies on the fact that if onException // 53
// throws in the browser, the wrapped call throws. // 54
onException(e); // 55
} finally { // 56
currentValues = savedValues; // 57
} // 58
return ret; // 59
}; // 60
}; // 61
// 62
Meteor._nodeCodeMustBeInFiber = function () { // 63
// no-op on browser // 64
}; // 65
// 66
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/meteor/url_common.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//
Meteor.absoluteUrl = function (path, options) { // 1
// path is optional // 2
if (!options && typeof path === 'object') { // 3
options = path; // 4
path = undefined; // 5
} // 6
// merge options with defaults // 7
options = _.extend({}, Meteor.absoluteUrl.defaultOptions, options || {}); // 8
// 9
var url = options.rootUrl; // 10
if (!url) // 11
throw new Error("Must pass options.rootUrl or set ROOT_URL in the server environment"); // 12
// 13
if (!/^http[s]?:\/\//i.test(url)) // url starts with 'http://' or 'https://' // 14
url = 'http://' + url; // we will later fix to https if options.secure is set // 15
// 16
if (!/\/$/.test(url)) // url ends with '/' // 17
url += '/'; // 18
// 19
if (path) // 20
url += path; // 21
// 22
// turn http to https if secure option is set, and we're not talking // 23
// to localhost. // 24
if (options.secure && // 25
/^http:/.test(url) && // url starts with 'http:' // 26
!/http:\/\/localhost[:\/]/.test(url) && // doesn't match localhost // 27
!/http:\/\/127\.0\.0\.1[:\/]/.test(url)) // or 127.0.0.1 // 28
url = url.replace(/^http:/, 'https:'); // 29
// 30
if (options.replaceLocalhost) // 31
url = url.replace(/^http:\/\/localhost([:\/].*)/, 'http://127.0.0.1$1'); // 32
// 33
return url; // 34
}; // 35
// 36
// allow later packages to override default options // 37
Meteor.absoluteUrl.defaultOptions = { }; // 38
if (typeof __meteor_runtime_config__ === "object" && // 39
__meteor_runtime_config__.ROOT_URL) // 40
Meteor.absoluteUrl.defaultOptions.rootUrl = __meteor_runtime_config__.ROOT_URL; // 41
// 42
// 43
Meteor._relativeToSiteRootUrl = function (link) { // 44
if (typeof __meteor_runtime_config__ === "object" && // 45
link.substr(0, 1) === "/") // 46
link = (__meteor_runtime_config__.ROOT_URL_PATH_PREFIX || "") + link; // 47
return link; // 48
}; // 49
// 50
//////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.meteor = {
Meteor: Meteor
};
})();
//# sourceMappingURL=439f867e12888606900664d4463e1b3ee3644e44.map

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,360 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var Deps = Package.deps.Deps;
var LocalCollection = Package.minimongo.LocalCollection;
var Minimongo = Package.minimongo.Minimongo;
var _ = Package.underscore._;
var Random = Package.random.Random;
/* Package-scope variables */
var ObserveSequence;
(function () {
//////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/observe-sequence/observe_sequence.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////
//
var warn = function () { // 1
if (ObserveSequence._suppressWarnings) { // 2
ObserveSequence._suppressWarnings--; // 3
} else { // 4
if (typeof console !== 'undefined' && console.warn) // 5
console.warn.apply(console, arguments); // 6
// 7
ObserveSequence._loggedWarnings++; // 8
} // 9
}; // 10
// 11
var idStringify = LocalCollection._idStringify; // 12
var idParse = LocalCollection._idParse; // 13
// 14
ObserveSequence = { // 15
_suppressWarnings: 0, // 16
_loggedWarnings: 0, // 17
// 18
// A mechanism similar to cursor.observe which receives a reactive // 19
// function returning a sequence type and firing appropriate callbacks // 20
// when the value changes. // 21
// // 22
// @param sequenceFunc {Function} a reactive function returning a // 23
// sequence type. The currently supported sequence types are: // 24
// 'null', arrays and cursors. // 25
// // 26
// @param callbacks {Object} similar to a specific subset of // 27
// callbacks passed to `cursor.observe` // 28
// (http://docs.meteor.com/#observe), with minor variations to // 29
// support the fact that not all sequences contain objects with // 30
// _id fields. Specifically: // 31
// // 32
// * addedAt(id, item, atIndex, beforeId) // 33
// * changedAt(id, newItem, oldItem, atIndex) // 34
// * removedAt(id, oldItem, atIndex) // 35
// * movedTo(id, item, fromIndex, toIndex, beforeId) // 36
// // 37
// @returns {Object(stop: Function)} call 'stop' on the return value // 38
// to stop observing this sequence function. // 39
// // 40
// We don't make any assumptions about our ability to compare sequence // 41
// elements (ie, we don't assume EJSON.equals works; maybe there is extra // 42
// state/random methods on the objects) so unlike cursor.observe, we may // 43
// sometimes call changedAt() when nothing actually changed. // 44
// XXX consider if we *can* make the stronger assumption and avoid // 45
// no-op changedAt calls (in some cases?) // 46
// // 47
// XXX currently only supports the callbacks used by our // 48
// implementation of {{#each}}, but this can be expanded. // 49
// // 50
// XXX #each doesn't use the indices (though we'll eventually need // 51
// a way to get them when we support `@index`), but calling // 52
// `cursor.observe` causes the index to be calculated on every // 53
// callback using a linear scan (unless you turn it off by passing // 54
// `_no_indices`). Any way to avoid calculating indices on a pure // 55
// cursor observe like we used to? // 56
observe: function (sequenceFunc, callbacks) { // 57
var lastSeq = null; // 58
var activeObserveHandle = null; // 59
// 60
// 'lastSeqArray' contains the previous value of the sequence // 61
// we're observing. It is an array of objects with '_id' and // 62
// 'item' fields. 'item' is the element in the array, or the // 63
// document in the cursor. // 64
// // 65
// '_id' is whichever of the following is relevant, unless it has // 66
// already appeared -- in which case it's randomly generated. // 67
// // 68
// * if 'item' is an object: // 69
// * an '_id' field, if present // 70
// * otherwise, the index in the array // 71
// // 72
// * if 'item' is a number or string, use that value // 73
// // 74
// XXX this can be generalized by allowing {{#each}} to accept a // 75
// general 'key' argument which could be a function, a dotted // 76
// field name, or the special @index value. // 77
var lastSeqArray = []; // elements are objects of form {_id, item} // 78
var computation = Deps.autorun(function () { // 79
var seq = sequenceFunc(); // 80
// 81
Deps.nonreactive(function () { // 82
var seqArray; // same structure as `lastSeqArray` above. // 83
// 84
// If we were previously observing a cursor, replace lastSeqArray with // 85
// more up-to-date information (specifically, the state of the observe // 86
// before it was stopped, which may be older than the DB). // 87
if (activeObserveHandle) { // 88
lastSeqArray = _.map(activeObserveHandle._fetch(), function (doc) { // 89
return {_id: doc._id, item: doc}; // 90
}); // 91
activeObserveHandle.stop(); // 92
activeObserveHandle = null; // 93
} // 94
// 95
if (!seq) { // 96
seqArray = []; // 97
diffArray(lastSeqArray, seqArray, callbacks); // 98
} else if (seq instanceof Array) { // 99
var idsUsed = {}; // 100
seqArray = _.map(seq, function (item, index) { // 101
var id; // 102
if (typeof item === 'string') { // 103
// ensure not empty, since other layers (eg DomRange) assume this as well // 104
id = "-" + item; // 105
} else if (typeof item === 'number' || // 106
typeof item === 'boolean' || // 107
item === undefined) { // 108
id = item; // 109
} else if (typeof item === 'object') { // 110
id = (item && item._id) || index; // 111
} else { // 112
throw new Error("{{#each}} doesn't support arrays with " + // 113
"elements of type " + typeof item); // 114
} // 115
// 116
var idString = idStringify(id); // 117
if (idsUsed[idString]) { // 118
warn("duplicate id " + id + " in", seq); // 119
id = Random.id(); // 120
} else { // 121
idsUsed[idString] = true; // 122
} // 123
// 124
return { _id: id, item: item }; // 125
}); // 126
// 127
diffArray(lastSeqArray, seqArray, callbacks); // 128
} else if (isMinimongoCursor(seq)) { // 129
var cursor = seq; // 130
seqArray = []; // 131
// 132
var initial = true; // are we observing initial data from cursor? // 133
activeObserveHandle = cursor.observe({ // 134
addedAt: function (document, atIndex, before) { // 135
if (initial) { // 136
// keep track of initial data so that we can diff once // 137
// we exit `observe`. // 138
if (before !== null) // 139
throw new Error("Expected initial data from observe in order"); // 140
seqArray.push({ _id: document._id, item: document }); // 141
} else { // 142
callbacks.addedAt(document._id, document, atIndex, before); // 143
} // 144
}, // 145
changedAt: function (newDocument, oldDocument, atIndex) { // 146
callbacks.changedAt(newDocument._id, newDocument, oldDocument, // 147
atIndex); // 148
}, // 149
removedAt: function (oldDocument, atIndex) { // 150
callbacks.removedAt(oldDocument._id, oldDocument, atIndex); // 151
}, // 152
movedTo: function (document, fromIndex, toIndex, before) { // 153
callbacks.movedTo( // 154
document._id, document, fromIndex, toIndex, before); // 155
} // 156
}); // 157
initial = false; // 158
// 159
// diff the old sequnce with initial data in the new cursor. this will // 160
// fire `addedAt` callbacks on the initial data. // 161
diffArray(lastSeqArray, seqArray, callbacks); // 162
// 163
} else { // 164
throw badSequenceError(); // 165
} // 166
// 167
lastSeq = seq; // 168
lastSeqArray = seqArray; // 169
}); // 170
}); // 171
// 172
return { // 173
stop: function () { // 174
computation.stop(); // 175
if (activeObserveHandle) // 176
activeObserveHandle.stop(); // 177
} // 178
}; // 179
}, // 180
// 181
// Fetch the items of `seq` into an array, where `seq` is of one of the // 182
// sequence types accepted by `observe`. If `seq` is a cursor, a // 183
// dependency is established. // 184
fetch: function (seq) { // 185
if (!seq) { // 186
return []; // 187
} else if (seq instanceof Array) { // 188
return seq; // 189
} else if (isMinimongoCursor(seq)) { // 190
return seq.fetch(); // 191
} else { // 192
throw badSequenceError(); // 193
} // 194
} // 195
}; // 196
// 197
var badSequenceError = function () { // 198
return new Error("{{#each}} currently only accepts " + // 199
"arrays, cursors or falsey values."); // 200
}; // 201
// 202
var isMinimongoCursor = function (seq) { // 203
var minimongo = Package.minimongo; // 204
return !!minimongo && (seq instanceof minimongo.LocalCollection.Cursor); // 205
}; // 206
// 207
// Calculates the differences between `lastSeqArray` and // 208
// `seqArray` and calls appropriate functions from `callbacks`. // 209
// Reuses Minimongo's diff algorithm implementation. // 210
var diffArray = function (lastSeqArray, seqArray, callbacks) { // 211
var diffFn = Package.minimongo.LocalCollection._diffQueryOrderedChanges; // 212
var oldIdObjects = []; // 213
var newIdObjects = []; // 214
var posOld = {}; // maps from idStringify'd ids // 215
var posNew = {}; // ditto // 216
var posCur = {}; // 217
var lengthCur = lastSeqArray.length; // 218
// 219
_.each(seqArray, function (doc, i) { // 220
newIdObjects.push({_id: doc._id}); // 221
posNew[idStringify(doc._id)] = i; // 222
}); // 223
_.each(lastSeqArray, function (doc, i) { // 224
oldIdObjects.push({_id: doc._id}); // 225
posOld[idStringify(doc._id)] = i; // 226
posCur[idStringify(doc._id)] = i; // 227
}); // 228
// 229
// Arrays can contain arbitrary objects. We don't diff the // 230
// objects. Instead we always fire 'changedAt' callback on every // 231
// object. The consumer of `observe-sequence` should deal with // 232
// it appropriately. // 233
diffFn(oldIdObjects, newIdObjects, { // 234
addedBefore: function (id, doc, before) { // 235
var position = before ? posCur[idStringify(before)] : lengthCur; // 236
// 237
_.each(posCur, function (pos, id) { // 238
if (pos >= position) // 239
posCur[id]++; // 240
}); // 241
// 242
lengthCur++; // 243
posCur[idStringify(id)] = position; // 244
// 245
callbacks.addedAt( // 246
id, // 247
seqArray[posNew[idStringify(id)]].item, // 248
position, // 249
before); // 250
}, // 251
movedBefore: function (id, before) { // 252
var prevPosition = posCur[idStringify(id)]; // 253
var position = before ? posCur[idStringify(before)] : lengthCur - 1; // 254
// 255
_.each(posCur, function (pos, id) { // 256
if (pos >= prevPosition && pos <= position) // 257
posCur[id]--; // 258
else if (pos <= prevPosition && pos >= position) // 259
posCur[id]++; // 260
}); // 261
// 262
posCur[idStringify(id)] = position; // 263
// 264
callbacks.movedTo( // 265
id, // 266
seqArray[posNew[idStringify(id)]].item, // 267
prevPosition, // 268
position, // 269
before); // 270
}, // 271
removed: function (id) { // 272
var prevPosition = posCur[idStringify(id)]; // 273
// 274
_.each(posCur, function (pos, id) { // 275
if (pos >= prevPosition) // 276
posCur[id]--; // 277
}); // 278
// 279
delete posCur[idStringify(id)]; // 280
lengthCur--; // 281
// 282
callbacks.removedAt( // 283
id, // 284
lastSeqArray[posOld[idStringify(id)]].item, // 285
prevPosition); // 286
} // 287
}); // 288
// 289
_.each(posNew, function (pos, idString) { // 290
var id = idParse(idString); // 291
if (_.has(posOld, idString)) { // 292
// specifically for primitive types, compare equality before // 293
// firing the 'changedAt' callback. otherwise, always fire it // 294
// because doing a deep EJSON comparison is not guaranteed to // 295
// work (an array can contain arbitrary objects, and 'transform' // 296
// can be used on cursors). also, deep diffing is not // 297
// necessarily the most efficient (if only a specific subfield // 298
// of the object is later accessed). // 299
var newItem = seqArray[pos].item; // 300
var oldItem = lastSeqArray[posOld[idString]].item; // 301
// 302
if (typeof newItem === 'object' || newItem !== oldItem) // 303
callbacks.changedAt(id, newItem, oldItem, pos); // 304
} // 305
}); // 306
}; // 307
// 308
//////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['observe-sequence'] = {
ObserveSequence: ObserveSequence
};
})();
//# sourceMappingURL=4e05989af52e13ed5032f712022fe58c7ee894ed.map

View File

@ -1,258 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var _ = Package.underscore._;
/* Package-scope variables */
var OrderedDict;
(function () {
///////////////////////////////////////////////////////////////////////////////////
// //
// packages/ordered-dict/ordered_dict.js //
// //
///////////////////////////////////////////////////////////////////////////////////
//
// This file defines an ordered dictionary abstraction that is useful for // 1
// maintaining a dataset backed by observeChanges. It supports ordering items // 2
// by specifying the item they now come before. // 3
// 4
// The implementation is a dictionary that contains nodes of a doubly-linked // 5
// list as its values. // 6
// 7
// constructs a new element struct // 8
// next and prev are whole elements, not keys. // 9
var element = function (key, value, next, prev) { // 10
return { // 11
key: key, // 12
value: value, // 13
next: next, // 14
prev: prev // 15
}; // 16
}; // 17
OrderedDict = function (/* ... */) { // 18
var self = this; // 19
self._dict = {}; // 20
self._first = null; // 21
self._last = null; // 22
self._size = 0; // 23
var args = _.toArray(arguments); // 24
self._stringify = function (x) { return x; }; // 25
if (typeof args[0] === 'function') // 26
self._stringify = args.shift(); // 27
_.each(args, function (kv) { // 28
self.putBefore(kv[0], kv[1], null); // 29
}); // 30
}; // 31
// 32
_.extend(OrderedDict.prototype, { // 33
// the "prefix keys with a space" thing comes from here // 34
// https://github.com/documentcloud/underscore/issues/376#issuecomment-2815649 // 35
_k: function (key) { return " " + this._stringify(key); }, // 36
// 37
empty: function () { // 38
var self = this; // 39
return !self._first; // 40
}, // 41
size: function () { // 42
var self = this; // 43
return self._size; // 44
}, // 45
_linkEltIn: function (elt) { // 46
var self = this; // 47
if (!elt.next) { // 48
elt.prev = self._last; // 49
if (self._last) // 50
self._last.next = elt; // 51
self._last = elt; // 52
} else { // 53
elt.prev = elt.next.prev; // 54
elt.next.prev = elt; // 55
if (elt.prev) // 56
elt.prev.next = elt; // 57
} // 58
if (self._first === null || self._first === elt.next) // 59
self._first = elt; // 60
}, // 61
_linkEltOut: function (elt) { // 62
var self = this; // 63
if (elt.next) // 64
elt.next.prev = elt.prev; // 65
if (elt.prev) // 66
elt.prev.next = elt.next; // 67
if (elt === self._last) // 68
self._last = elt.prev; // 69
if (elt === self._first) // 70
self._first = elt.next; // 71
}, // 72
putBefore: function (key, item, before) { // 73
var self = this; // 74
if (self._dict[self._k(key)]) // 75
throw new Error("Item " + key + " already present in OrderedDict"); // 76
var elt = before ? // 77
element(key, item, self._dict[self._k(before)]) : // 78
element(key, item, null); // 79
if (elt.next === undefined) // 80
throw new Error("could not find item to put this one before"); // 81
self._linkEltIn(elt); // 82
self._dict[self._k(key)] = elt; // 83
self._size++; // 84
}, // 85
append: function (key, item) { // 86
var self = this; // 87
self.putBefore(key, item, null); // 88
}, // 89
remove: function (key) { // 90
var self = this; // 91
var elt = self._dict[self._k(key)]; // 92
if (elt === undefined) // 93
throw new Error("Item " + key + " not present in OrderedDict"); // 94
self._linkEltOut(elt); // 95
self._size--; // 96
delete self._dict[self._k(key)]; // 97
return elt.value; // 98
}, // 99
get: function (key) { // 100
var self = this; // 101
if (self.has(key)) // 102
return self._dict[self._k(key)].value; // 103
return undefined; // 104
}, // 105
has: function (key) { // 106
var self = this; // 107
return _.has(self._dict, self._k(key)); // 108
}, // 109
// Iterate through the items in this dictionary in order, calling // 110
// iter(value, key, index) on each one. // 111
// 112
// Stops whenever iter returns OrderedDict.BREAK, or after the last element. // 113
forEach: function (iter) { // 114
var self = this; // 115
var i = 0; // 116
var elt = self._first; // 117
while (elt !== null) { // 118
var b = iter(elt.value, elt.key, i); // 119
if (b === OrderedDict.BREAK) // 120
return; // 121
elt = elt.next; // 122
i++; // 123
} // 124
}, // 125
first: function () { // 126
var self = this; // 127
if (self.empty()) // 128
return undefined; // 129
return self._first.key; // 130
}, // 131
firstValue: function () { // 132
var self = this; // 133
if (self.empty()) // 134
return undefined; // 135
return self._first.value; // 136
}, // 137
last: function () { // 138
var self = this; // 139
if (self.empty()) // 140
return undefined; // 141
return self._last.key; // 142
}, // 143
lastValue: function () { // 144
var self = this; // 145
if (self.empty()) // 146
return undefined; // 147
return self._last.value; // 148
}, // 149
prev: function (key) { // 150
var self = this; // 151
if (self.has(key)) { // 152
var elt = self._dict[self._k(key)]; // 153
if (elt.prev) // 154
return elt.prev.key; // 155
} // 156
return null; // 157
}, // 158
next: function (key) { // 159
var self = this; // 160
if (self.has(key)) { // 161
var elt = self._dict[self._k(key)]; // 162
if (elt.next) // 163
return elt.next.key; // 164
} // 165
return null; // 166
}, // 167
moveBefore: function (key, before) { // 168
var self = this; // 169
var elt = self._dict[self._k(key)]; // 170
var eltBefore = before ? self._dict[self._k(before)] : null; // 171
if (elt === undefined) // 172
throw new Error("Item to move is not present"); // 173
if (eltBefore === undefined) { // 174
throw new Error("Could not find element to move this one before"); // 175
} // 176
if (eltBefore === elt.next) // no moving necessary // 177
return; // 178
// remove from its old place // 179
self._linkEltOut(elt); // 180
// patch into its new place // 181
elt.next = eltBefore; // 182
self._linkEltIn(elt); // 183
}, // 184
// Linear, sadly. // 185
indexOf: function (key) { // 186
var self = this; // 187
var ret = null; // 188
self.forEach(function (v, k, i) { // 189
if (self._k(k) === self._k(key)) { // 190
ret = i; // 191
return OrderedDict.BREAK; // 192
} // 193
return undefined; // 194
}); // 195
return ret; // 196
}, // 197
_checkRep: function () { // 198
var self = this; // 199
_.each(self._dict, function (k, v) { // 200
if (v.next === v) // 201
throw new Error("Next is a loop"); // 202
if (v.prev === v) // 203
throw new Error("Prev is a loop"); // 204
}); // 205
} // 206
// 207
}); // 208
OrderedDict.BREAK = {"break": true}; // 209
// 210
///////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['ordered-dict'] = {
OrderedDict: OrderedDict
};
})();
//# sourceMappingURL=bf8af2f26c8d96bf8b2e6b407d3ed69f23c2cd37.map

View File

@ -1,302 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var _ = Package.underscore._;
/* Package-scope variables */
var Random;
(function () {
//////////////////////////////////////////////////////////////////////////////////////
// //
// packages/random/random.js //
// //
//////////////////////////////////////////////////////////////////////////////////////
//
// We use cryptographically strong PRNGs (crypto.getRandomBytes() on the server, // 1
// window.crypto.getRandomValues() in the browser) when available. If these // 2
// PRNGs fail, we fall back to the Alea PRNG, which is not cryptographically // 3
// strong, and we seed it with various sources such as the date, Math.random, // 4
// and window size on the client. When using crypto.getRandomValues(), our // 5
// primitive is hexString(), from which we construct fraction(). When using // 6
// window.crypto.getRandomValues() or alea, the primitive is fraction and we use // 7
// that to construct hex string. // 8
// 9
if (Meteor.isServer) // 10
var nodeCrypto = Npm.require('crypto'); // 11
// 12
// see http://baagoe.org/en/wiki/Better_random_numbers_for_javascript // 13
// for a full discussion and Alea implementation. // 14
var Alea = function () { // 15
function Mash() { // 16
var n = 0xefc8249d; // 17
// 18
var mash = function(data) { // 19
data = data.toString(); // 20
for (var i = 0; i < data.length; i++) { // 21
n += data.charCodeAt(i); // 22
var h = 0.02519603282416938 * n; // 23
n = h >>> 0; // 24
h -= n; // 25
h *= n; // 26
n = h >>> 0; // 27
h -= n; // 28
n += h * 0x100000000; // 2^32 // 29
} // 30
return (n >>> 0) * 2.3283064365386963e-10; // 2^-32 // 31
}; // 32
// 33
mash.version = 'Mash 0.9'; // 34
return mash; // 35
} // 36
// 37
return (function (args) { // 38
var s0 = 0; // 39
var s1 = 0; // 40
var s2 = 0; // 41
var c = 1; // 42
// 43
if (args.length == 0) { // 44
args = [+new Date]; // 45
} // 46
var mash = Mash(); // 47
s0 = mash(' '); // 48
s1 = mash(' '); // 49
s2 = mash(' '); // 50
// 51
for (var i = 0; i < args.length; i++) { // 52
s0 -= mash(args[i]); // 53
if (s0 < 0) { // 54
s0 += 1; // 55
} // 56
s1 -= mash(args[i]); // 57
if (s1 < 0) { // 58
s1 += 1; // 59
} // 60
s2 -= mash(args[i]); // 61
if (s2 < 0) { // 62
s2 += 1; // 63
} // 64
} // 65
mash = null; // 66
// 67
var random = function() { // 68
var t = 2091639 * s0 + c * 2.3283064365386963e-10; // 2^-32 // 69
s0 = s1; // 70
s1 = s2; // 71
return s2 = t - (c = t | 0); // 72
}; // 73
random.uint32 = function() { // 74
return random() * 0x100000000; // 2^32 // 75
}; // 76
random.fract53 = function() { // 77
return random() + // 78
(random() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53 // 79
}; // 80
random.version = 'Alea 0.9'; // 81
random.args = args; // 82
return random; // 83
// 84
} (Array.prototype.slice.call(arguments))); // 85
}; // 86
// 87
var UNMISTAKABLE_CHARS = "23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijkmnopqrstuvwxyz"; // 88
var BASE64_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + // 89
"0123456789-_"; // 90
// 91
// If seeds are provided, then the alea PRNG will be used, since cryptographic // 92
// PRNGs (Node crypto and window.crypto.getRandomValues) don't allow us to // 93
// specify seeds. The caller is responsible for making sure to provide a seed // 94
// for alea if a csprng is not available. // 95
var RandomGenerator = function (seedArray) { // 96
var self = this; // 97
if (seedArray !== undefined) // 98
self.alea = Alea.apply(null, seedArray); // 99
}; // 100
// 101
RandomGenerator.prototype.fraction = function () { // 102
var self = this; // 103
if (self.alea) { // 104
return self.alea(); // 105
} else if (nodeCrypto) { // 106
var numerator = parseInt(self.hexString(8), 16); // 107
return numerator * 2.3283064365386963e-10; // 2^-32 // 108
} else if (typeof window !== "undefined" && window.crypto && // 109
window.crypto.getRandomValues) { // 110
var array = new Uint32Array(1); // 111
window.crypto.getRandomValues(array); // 112
return array[0] * 2.3283064365386963e-10; // 2^-32 // 113
} else { // 114
throw new Error('No random generator available'); // 115
} // 116
}; // 117
// 118
RandomGenerator.prototype.hexString = function (digits) { // 119
var self = this; // 120
if (nodeCrypto && ! self.alea) { // 121
var numBytes = Math.ceil(digits / 2); // 122
var bytes; // 123
// Try to get cryptographically strong randomness. Fall back to // 124
// non-cryptographically strong if not available. // 125
try { // 126
bytes = nodeCrypto.randomBytes(numBytes); // 127
} catch (e) { // 128
// XXX should re-throw any error except insufficient entropy // 129
bytes = nodeCrypto.pseudoRandomBytes(numBytes); // 130
} // 131
var result = bytes.toString("hex"); // 132
// If the number of digits is odd, we'll have generated an extra 4 bits // 133
// of randomness, so we need to trim the last digit. // 134
return result.substring(0, digits); // 135
} else { // 136
var hexDigits = []; // 137
for (var i = 0; i < digits; ++i) { // 138
hexDigits.push(self.choice("0123456789abcdef")); // 139
} // 140
return hexDigits.join(''); // 141
} // 142
}; // 143
// 144
RandomGenerator.prototype._randomString = function (charsCount, // 145
alphabet) { // 146
var self = this; // 147
var digits = []; // 148
for (var i = 0; i < charsCount; i++) { // 149
digits[i] = self.choice(alphabet); // 150
} // 151
return digits.join(""); // 152
}; // 153
// 154
RandomGenerator.prototype.id = function (charsCount) { // 155
var self = this; // 156
// 17 characters is around 96 bits of entropy, which is the amount of // 157
// state in the Alea PRNG. // 158
if (charsCount === undefined) // 159
charsCount = 17; // 160
// 161
return self._randomString(charsCount, UNMISTAKABLE_CHARS); // 162
}; // 163
// 164
RandomGenerator.prototype.secret = function (charsCount) { // 165
var self = this; // 166
// Default to 256 bits of entropy, or 43 characters at 6 bits per // 167
// character. // 168
if (charsCount === undefined) // 169
charsCount = 43; // 170
return self._randomString(charsCount, BASE64_CHARS); // 171
}; // 172
// 173
RandomGenerator.prototype.choice = function (arrayOrString) { // 174
var index = Math.floor(this.fraction() * arrayOrString.length); // 175
if (typeof arrayOrString === "string") // 176
return arrayOrString.substr(index, 1); // 177
else // 178
return arrayOrString[index]; // 179
}; // 180
// 181
// instantiate RNG. Heuristically collect entropy from various sources when a // 182
// cryptographic PRNG isn't available. // 183
// 184
// client sources // 185
var height = (typeof window !== 'undefined' && window.innerHeight) || // 186
(typeof document !== 'undefined' // 187
&& document.documentElement // 188
&& document.documentElement.clientHeight) || // 189
(typeof document !== 'undefined' // 190
&& document.body // 191
&& document.body.clientHeight) || // 192
1; // 193
// 194
var width = (typeof window !== 'undefined' && window.innerWidth) || // 195
(typeof document !== 'undefined' // 196
&& document.documentElement // 197
&& document.documentElement.clientWidth) || // 198
(typeof document !== 'undefined' // 199
&& document.body // 200
&& document.body.clientWidth) || // 201
1; // 202
// 203
var agent = (typeof navigator !== 'undefined' && navigator.userAgent) || ""; // 204
// 205
if (nodeCrypto || // 206
(typeof window !== "undefined" && // 207
window.crypto && window.crypto.getRandomValues)) // 208
Random = new RandomGenerator(); // 209
else // 210
Random = new RandomGenerator([new Date(), height, width, agent, Math.random()]); // 211
// 212
Random.createWithSeeds = function () { // 213
if (arguments.length === 0) { // 214
throw new Error('No seeds were provided'); // 215
} // 216
return new RandomGenerator(arguments); // 217
}; // 218
// 219
//////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////
// //
// packages/random/deprecated.js //
// //
//////////////////////////////////////////////////////////////////////////////////////
//
// Before this package existed, we used to use this Meteor.uuid() // 1
// implementing the RFC 4122 v4 UUID. It is no longer documented // 2
// and will go away. // 3
// XXX COMPAT WITH 0.5.6 // 4
Meteor.uuid = function () { // 5
var HEX_DIGITS = "0123456789abcdef"; // 6
var s = []; // 7
for (var i = 0; i < 36; i++) { // 8
s[i] = Random.choice(HEX_DIGITS); // 9
} // 10
s[14] = "4"; // 11
s[19] = HEX_DIGITS.substr((parseInt(s[19],16) & 0x3) | 0x8, 1); // 12
s[8] = s[13] = s[18] = s[23] = "-"; // 13
// 14
var uuid = s.join(""); // 15
return uuid; // 16
}; // 17
// 18
//////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.random = {
Random: Random
};
})();
//# sourceMappingURL=fe7b46080c91ce482acf6fc326afbc5b176f0502.map

View File

@ -1,174 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var _ = Package.underscore._;
var Deps = Package.deps.Deps;
var EJSON = Package.ejson.EJSON;
/* Package-scope variables */
var ReactiveDict;
(function () {
//////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/reactive-dict/reactive-dict.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////
//
// XXX come up with a serialization method which canonicalizes object key // 1
// order, which would allow us to use objects as values for equals. // 2
var stringify = function (value) { // 3
if (value === undefined) // 4
return 'undefined'; // 5
return EJSON.stringify(value); // 6
}; // 7
var parse = function (serialized) { // 8
if (serialized === undefined || serialized === 'undefined') // 9
return undefined; // 10
return EJSON.parse(serialized); // 11
}; // 12
// 13
// migrationData, if present, should be data previously returned from // 14
// getMigrationData() // 15
ReactiveDict = function (migrationData) { // 16
this.keys = migrationData || {}; // key -> value // 17
this.keyDeps = {}; // key -> Dependency // 18
this.keyValueDeps = {}; // key -> Dependency // 19
}; // 20
// 21
_.extend(ReactiveDict.prototype, { // 22
set: function (key, value) { // 23
var self = this; // 24
// 25
value = stringify(value); // 26
// 27
var oldSerializedValue = 'undefined'; // 28
if (_.has(self.keys, key)) oldSerializedValue = self.keys[key]; // 29
if (value === oldSerializedValue) // 30
return; // 31
self.keys[key] = value; // 32
// 33
var changed = function (v) { // 34
v && v.changed(); // 35
}; // 36
// 37
changed(self.keyDeps[key]); // 38
if (self.keyValueDeps[key]) { // 39
changed(self.keyValueDeps[key][oldSerializedValue]); // 40
changed(self.keyValueDeps[key][value]); // 41
} // 42
}, // 43
// 44
setDefault: function (key, value) { // 45
var self = this; // 46
// for now, explicitly check for undefined, since there is no // 47
// ReactiveDict.clear(). Later we might have a ReactiveDict.clear(), in which case // 48
// we should check if it has the key. // 49
if (self.keys[key] === undefined) { // 50
self.set(key, value); // 51
} // 52
}, // 53
// 54
get: function (key) { // 55
var self = this; // 56
self._ensureKey(key); // 57
self.keyDeps[key].depend(); // 58
return parse(self.keys[key]); // 59
}, // 60
// 61
equals: function (key, value) { // 62
var self = this; // 63
// 64
// XXX hardcoded awareness of the 'mongo-livedata' package is not ideal // 65
var ObjectID = Package['mongo-livedata'] && Meteor.Collection.ObjectID; // 66
// 67
// We don't allow objects (or arrays that might include objects) for // 68
// .equals, because JSON.stringify doesn't canonicalize object key // 69
// order. (We can make equals have the right return value by parsing the // 70
// current value and using EJSON.equals, but we won't have a canonical // 71
// element of keyValueDeps[key] to store the dependency.) You can still use // 72
// "EJSON.equals(reactiveDict.get(key), value)". // 73
// // 74
// XXX we could allow arrays as long as we recursively check that there // 75
// are no objects // 76
if (typeof value !== 'string' && // 77
typeof value !== 'number' && // 78
typeof value !== 'boolean' && // 79
typeof value !== 'undefined' && // 80
!(value instanceof Date) && // 81
!(ObjectID && value instanceof ObjectID) && // 82
value !== null) // 83
throw new Error("ReactiveDict.equals: value must be scalar"); // 84
var serializedValue = stringify(value); // 85
// 86
if (Deps.active) { // 87
self._ensureKey(key); // 88
// 89
if (! _.has(self.keyValueDeps[key], serializedValue)) // 90
self.keyValueDeps[key][serializedValue] = new Deps.Dependency; // 91
// 92
var isNew = self.keyValueDeps[key][serializedValue].depend(); // 93
if (isNew) { // 94
Deps.onInvalidate(function () { // 95
// clean up [key][serializedValue] if it's now empty, so we don't // 96
// use O(n) memory for n = values seen ever // 97
if (! self.keyValueDeps[key][serializedValue].hasDependents()) // 98
delete self.keyValueDeps[key][serializedValue]; // 99
}); // 100
} // 101
} // 102
// 103
var oldValue = undefined; // 104
if (_.has(self.keys, key)) oldValue = parse(self.keys[key]); // 105
return EJSON.equals(oldValue, value); // 106
}, // 107
// 108
_ensureKey: function (key) { // 109
var self = this; // 110
if (!(key in self.keyDeps)) { // 111
self.keyDeps[key] = new Deps.Dependency; // 112
self.keyValueDeps[key] = {}; // 113
} // 114
}, // 115
// 116
// Get a JSON value that can be passed to the constructor to // 117
// create a new ReactiveDict with the same contents as this one // 118
getMigrationData: function () { // 119
// XXX sanitize and make sure it's JSONible? // 120
return this.keys; // 121
} // 122
}); // 123
// 124
//////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['reactive-dict'] = {
ReactiveDict: ReactiveDict
};
})();
//# sourceMappingURL=22667928acc72f619ce81e7ac1e35def1ba9e0ae.map

View File

@ -1,114 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var _ = Package.underscore._;
var Random = Package.random.Random;
/* Package-scope variables */
var Retry;
(function () {
/////////////////////////////////////////////////////////////////////////////
// //
// packages/retry/retry.js //
// //
/////////////////////////////////////////////////////////////////////////////
//
// Retry logic with an exponential backoff. // 1
// // 2
// options: // 3
// baseTimeout: time for initial reconnect attempt (ms). // 4
// exponent: exponential factor to increase timeout each attempt. // 5
// maxTimeout: maximum time between retries (ms). // 6
// minCount: how many times to reconnect "instantly". // 7
// minTimeout: time to wait for the first `minCount` retries (ms). // 8
// fuzz: factor to randomize retry times by (to avoid retry storms). // 9
// 10
Retry = function (options) { // 11
var self = this; // 12
_.extend(self, _.defaults(_.clone(options || {}), { // 13
baseTimeout: 1000, // 1 second // 14
exponent: 2.2, // 15
// The default is high-ish to ensure a server can recover from a // 16
// failure caused by load. // 17
maxTimeout: 5 * 60000, // 5 minutes // 18
minTimeout: 10, // 19
minCount: 2, // 20
fuzz: 0.5 // +- 25% // 21
})); // 22
self.retryTimer = null; // 23
}; // 24
// 25
_.extend(Retry.prototype, { // 26
// 27
// Reset a pending retry, if any. // 28
clear: function () { // 29
var self = this; // 30
if (self.retryTimer) // 31
clearTimeout(self.retryTimer); // 32
self.retryTimer = null; // 33
}, // 34
// 35
// Calculate how long to wait in milliseconds to retry, based on the // 36
// `count` of which retry this is. // 37
_timeout: function (count) { // 38
var self = this; // 39
// 40
if (count < self.minCount) // 41
return self.minTimeout; // 42
// 43
var timeout = Math.min( // 44
self.maxTimeout, // 45
self.baseTimeout * Math.pow(self.exponent, count)); // 46
// fuzz the timeout randomly, to avoid reconnect storms when a // 47
// server goes down. // 48
timeout = timeout * ((Random.fraction() * self.fuzz) + // 49
(1 - self.fuzz/2)); // 50
return timeout; // 51
}, // 52
// 53
// Call `fn` after a delay, based on the `count` of which retry this is. // 54
retryLater: function (count, fn) { // 55
var self = this; // 56
var timeout = self._timeout(count); // 57
if (self.retryTimer) // 58
clearTimeout(self.retryTimer); // 59
self.retryTimer = Meteor.setTimeout(fn, timeout); // 60
return timeout; // 61
} // 62
// 63
}); // 64
// 65
/////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.retry = {
Retry: Retry
};
})();
//# sourceMappingURL=1f1dd2c35d300110fdaba51ce4473583bc3bf031.map

View File

@ -1,66 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var _ = Package.underscore._;
var ReactiveDict = Package['reactive-dict'].ReactiveDict;
var EJSON = Package.ejson.EJSON;
/* Package-scope variables */
var Session;
(function () {
/////////////////////////////////////////////////////////////////////////
// //
// packages/session/session.js //
// //
/////////////////////////////////////////////////////////////////////////
//
var migratedKeys = {}; // 1
if (Package.reload) { // 2
var migrationData = Package.reload.Reload._migrationData('session'); // 3
if (migrationData && migrationData.keys) { // 4
migratedKeys = migrationData.keys; // 5
} // 6
} // 7
// 8
Session = new ReactiveDict(migratedKeys); // 9
// 10
if (Package.reload) { // 11
Package.reload.Reload._onMigrate('session', function () { // 12
return [true, {keys: Session.keys}]; // 13
}); // 14
} // 15
// 16
/////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.session = {
Session: Session
};
})();
//# sourceMappingURL=5bcd2d86431dc10d5f4be0910cb6567342e1aaf6.map

View File

@ -1,49 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
/* Package-scope variables */
var Spacebars;
(function () {
///////////////////////////////////////////////////////////////////////
// //
// packages/spacebars-common/spacebars.js //
// //
///////////////////////////////////////////////////////////////////////
//
Spacebars = {}; // 1
// 2
///////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package['spacebars-common'] = {
Spacebars: Spacebars
};
})();
//# sourceMappingURL=0650288b547b991579f81bb9b9b8f5a62320aa58.map

View File

@ -1,399 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var Spacebars = Package['spacebars-common'].Spacebars;
var HTML = Package.htmljs.HTML;
var UI = Package.ui.UI;
var Handlebars = Package.ui.Handlebars;
var Template = Package.templating.Template;
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/spacebars/spacebars-runtime.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// * `templateOrFunction` - template (component) or function returning a template // 1
// or null // 2
Spacebars.include = function (templateOrFunction, contentBlock, elseContentBlock) { // 3
if (contentBlock && ! UI.isComponent(contentBlock)) // 4
throw new Error('Second argument to Spacebars.include must be a template or UI.block if present'); // 5
if (elseContentBlock && ! UI.isComponent(elseContentBlock)) // 6
throw new Error('Third argument to Spacebars.include must be a template or UI.block if present'); // 7
// 8
var props = null; // 9
if (contentBlock) { // 10
props = (props || {}); // 11
props.__content = contentBlock; // 12
} // 13
if (elseContentBlock) { // 14
props = (props || {}); // 15
props.__elseContent = elseContentBlock; // 16
} // 17
// 18
if (UI.isComponent(templateOrFunction)) // 19
return templateOrFunction.extend(props); // 20
// 21
var func = templateOrFunction; // 22
// 23
var f = function () { // 24
var emboxedFunc = UI.namedEmboxValue('Spacebars.include', func); // 25
f.stop = function () { // 26
emboxedFunc.stop(); // 27
}; // 28
var tmpl = emboxedFunc(); // 29
// 30
if (tmpl === null) // 31
return null; // 32
if (! UI.isComponent(tmpl)) // 33
throw new Error("Expected null or template in return value from inclusion function, found: " + tmpl); // 34
// 35
return tmpl.extend(props); // 36
}; // 37
// 38
return f; // 39
}; // 40
// 41
// Executes `{{foo bar baz}}` when called on `(foo, bar, baz)`. // 42
// If `bar` and `baz` are functions, they are called before // 43
// `foo` is called on them. // 44
// // 45
// This is the shared part of Spacebars.mustache and // 46
// Spacebars.attrMustache, which differ in how they post-process the // 47
// result. // 48
Spacebars.mustacheImpl = function (value/*, args*/) { // 49
var args = arguments; // 50
// if we have any arguments (pos or kw), add an options argument // 51
// if there isn't one. // 52
if (args.length > 1) { // 53
var kw = args[args.length - 1]; // 54
if (! (kw instanceof Spacebars.kw)) { // 55
kw = Spacebars.kw(); // 56
// clone arguments into an actual array, then push // 57
// the empty kw object. // 58
args = Array.prototype.slice.call(arguments); // 59
args.push(kw); // 60
} else { // 61
// For each keyword arg, call it if it's a function // 62
var newHash = {}; // 63
for (var k in kw.hash) { // 64
var v = kw.hash[k]; // 65
newHash[k] = (typeof v === 'function' ? v() : v); // 66
} // 67
args[args.length - 1] = Spacebars.kw(newHash); // 68
} // 69
} // 70
// 71
return Spacebars.call.apply(null, args); // 72
}; // 73
// 74
Spacebars.mustache = function (value/*, args*/) { // 75
var result = Spacebars.mustacheImpl.apply(null, arguments); // 76
// 77
if (result instanceof Spacebars.SafeString) // 78
return HTML.Raw(result.toString()); // 79
else // 80
// map `null`, `undefined`, and `false` to null, which is important // 81
// so that attributes with nully values are considered absent. // 82
// stringify anything else (e.g. strings, booleans, numbers including 0). // 83
return (result == null || result === false) ? null : String(result); // 84
}; // 85
// 86
Spacebars.attrMustache = function (value/*, args*/) { // 87
var result = Spacebars.mustacheImpl.apply(null, arguments); // 88
// 89
if (result == null || result === '') { // 90
return null; // 91
} else if (typeof result === 'object') { // 92
return result; // 93
} else if (typeof result === 'string' && HTML.isValidAttributeName(result)) { // 94
var obj = {}; // 95
obj[result] = ''; // 96
return obj; // 97
} else { // 98
throw new Error("Expected valid attribute name, '', null, or object"); // 99
} // 100
}; // 101
// 102
Spacebars.dataMustache = function (value/*, args*/) { // 103
var result = Spacebars.mustacheImpl.apply(null, arguments); // 104
// 105
return result; // 106
}; // 107
// 108
// Idempotently wrap in `HTML.Raw`. // 109
// // 110
// Called on the return value from `Spacebars.mustache` in case the // 111
// template uses triple-stache (`{{{foo bar baz}}}`). // 112
Spacebars.makeRaw = function (value) { // 113
if (value == null) // null or undefined // 114
return null; // 115
else if (value instanceof HTML.Raw) // 116
return value; // 117
else // 118
return HTML.Raw(value); // 119
}; // 120
// 121
// If `value` is a function, called it on the `args`, after // 122
// evaluating the args themselves (by calling them if they are // 123
// functions). Otherwise, simply return `value` (and assert that // 124
// there are no args). // 125
Spacebars.call = function (value/*, args*/) { // 126
if (typeof value === 'function') { // 127
// evaluate arguments if they are functions (by calling them) // 128
var newArgs = []; // 129
for (var i = 1; i < arguments.length; i++) { // 130
var arg = arguments[i]; // 131
newArgs[i-1] = (typeof arg === 'function' ? arg() : arg); // 132
} // 133
// 134
return value.apply(null, newArgs); // 135
} else { // 136
if (arguments.length > 1) // 137
throw new Error("Can't call non-function: " + value); // 138
// 139
return value; // 140
} // 141
}; // 142
// 143
// Call this as `Spacebars.kw({ ... })`. The return value // 144
// is `instanceof Spacebars.kw`. // 145
Spacebars.kw = function (hash) { // 146
if (! (this instanceof Spacebars.kw)) // 147
// called without new; call with new // 148
return new Spacebars.kw(hash); // 149
// 150
this.hash = hash || {}; // 151
}; // 152
// 153
// Call this as `Spacebars.SafeString("some HTML")`. The return value // 154
// is `instanceof Spacebars.SafeString` (and `instanceof Handlebars.SafeString). // 155
Spacebars.SafeString = function (html) { // 156
if (! (this instanceof Spacebars.SafeString)) // 157
// called without new; call with new // 158
return new Spacebars.SafeString(html); // 159
// 160
return new Handlebars.SafeString(html); // 161
}; // 162
Spacebars.SafeString.prototype = Handlebars.SafeString.prototype; // 163
// 164
// `Spacebars.dot(foo, "bar", "baz")` performs a special kind // 165
// of `foo.bar.baz` that allows safe indexing of `null` and // 166
// indexing of functions (which calls the function). If the // 167
// result is a function, it is always a bound function (e.g. // 168
// a wrapped version of `baz` that always uses `foo.bar` as // 169
// `this`). // 170
// // 171
// In `Spacebars.dot(foo, "bar")`, `foo` is assumed to be either // 172
// a non-function value or a "fully-bound" function wrapping a value, // 173
// where fully-bound means it takes no arguments and ignores `this`. // 174
// // 175
// `Spacebars.dot(foo, "bar")` performs the following steps: // 176
// // 177
// * If `foo` is falsy, return `foo`. // 178
// // 179
// * If `foo` is a function, call it (set `foo` to `foo()`). // 180
// // 181
// * If `foo` is falsy now, return `foo`. // 182
// // 183
// * Return `foo.bar`, binding it to `foo` if it's a function. // 184
Spacebars.dot = function (value, id1/*, id2, ...*/) { // 185
if (arguments.length > 2) { // 186
// Note: doing this recursively is probably less efficient than // 187
// doing it in an iterative loop. // 188
var argsForRecurse = []; // 189
argsForRecurse.push(Spacebars.dot(value, id1)); // 190
argsForRecurse.push.apply(argsForRecurse, // 191
Array.prototype.slice.call(arguments, 2)); // 192
return Spacebars.dot.apply(null, argsForRecurse); // 193
} // 194
// 195
if (typeof value === 'function') // 196
value = value(); // 197
// 198
if (! value) // 199
return value; // falsy, don't index, pass through // 200
// 201
var result = value[id1]; // 202
if (typeof result !== 'function') // 203
return result; // 204
// `value[id1]` (or `value()[id1]`) is a function. // 205
// Bind it so that when called, `value` will be placed in `this`. // 206
return function (/*arguments*/) { // 207
return result.apply(value, arguments); // 208
}; // 209
}; // 210
// 211
// Implement Spacebars's #with, which renders its else case (or nothing) // 212
// if the argument is falsy. // 213
Spacebars.With = function (argFunc, contentBlock, elseContentBlock) { // 214
return UI.Component.extend({ // 215
init: function () { // 216
this.v = UI.emboxValue(argFunc, UI.safeEquals); // 217
}, // 218
render: function () { // 219
return UI.If(this.v, UI.With(this.v, contentBlock), elseContentBlock); // 220
}, // 221
materialized: (function () { // 222
var f = function (range) { // 223
var self = this; // 224
if (Deps.active) { // 225
Deps.onInvalidate(function () { // 226
self.v.stop(); // 227
}); // 228
} // 229
if (range) { // 230
range.removed = function () { // 231
self.v.stop(); // 232
}; // 233
} // 234
}; // 235
f.isWith = true; // 236
return f; // 237
})() // 238
}); // 239
}; // 240
// 241
Spacebars.TemplateWith = function (argFunc, contentBlock) { // 242
var w = UI.With(argFunc, contentBlock); // 243
w.__isTemplateWith = true; // 244
return w; // 245
}; // 246
// 247
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/spacebars/template.dynamic.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// 1
Template.__define__("__dynamic", (function() { // 2
var self = this; // 3
var template = this; // 4
return [ function() { // 5
return Spacebars.mustache(self.lookup("checkContext")); // 6
}, "\n ", UI.If(function() { // 7
return Spacebars.call(self.lookup("dataContextPresent")); // 8
}, UI.block(function() { // 9
var self = this; // 10
return [ "\n ", Spacebars.include(self.lookupTemplate("__dynamicWithDataContext")), "\n " ]; // 11
}), UI.block(function() { // 12
var self = this; // 13
return [ "\n \n ", Spacebars.TemplateWith(function() { // 14
return { // 15
template: Spacebars.call(self.lookup("template")), // 16
data: Spacebars.call(self.lookup("..")) // 17
}; // 18
}, UI.block(function() { // 19
var self = this; // 20
return Spacebars.include(self.lookupTemplate("__dynamicWithDataContext")); // 21
})), "\n " ]; // 22
})) ]; // 23
})); // 24
// 25
Template.__define__("__dynamicWithDataContext", (function() { // 26
var self = this; // 27
var template = this; // 28
return Spacebars.With(function() { // 29
return Spacebars.dataMustache(self.lookup("chooseTemplate"), self.lookup("template")); // 30
}, UI.block(function() { // 31
var self = this; // 32
return [ "\n ", Spacebars.With(function() { // 33
return Spacebars.call(Spacebars.dot(self.lookup(".."), "data")); // 34
}, UI.block(function() { // 35
var self = this; // 36
return [ " \n ", Spacebars.include(self.lookupTemplate("..")), " \n " ]; // 37
}), UI.block(function() { // 38
var self = this; // 39
return [ " \n ", Spacebars.TemplateWith(function() { // 40
return Spacebars.call(Spacebars.dot(self.lookup(".."), "data")); // 41
}, UI.block(function() { // 42
var self = this; // 43
return Spacebars.include(self.lookupTemplate("..")); // 44
})), " \n " ]; // 45
})), "\n " ]; // 46
})); // 47
})); // 48
// 49
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
(function () {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/spacebars/dynamic.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
Template.__dynamicWithDataContext.chooseTemplate = function (name) { // 1
return Template[name] || null; // 2
}; // 3
// 4
Template.__dynamic.dataContextPresent = function () { // 5
return _.has(this, "data"); // 6
}; // 7
// 8
Template.__dynamic.checkContext = function () { // 9
if (! _.has(this, "template")) { // 10
throw new Error("Must specify name in the 'template' argument " + // 11
"to {{> UI.dynamic}}."); // 12
} // 13
// 14
_.each(this, function (v, k) { // 15
if (k !== "template" && k !== "data") { // 16
throw new Error("Invalid argument to {{> UI.dynamic}}: " + // 17
k); // 18
} // 19
}); // 20
}; // 21
// 22
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.spacebars = {};
})();
//# sourceMappingURL=8988006be5c29dbe17997e9691a21dce4e537665.map

View File

@ -1,65 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var UI = Package.ui.UI;
var Handlebars = Package.ui.Handlebars;
var HTML = Package.htmljs.HTML;
/* Package-scope variables */
var Template;
(function () {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/templating/global_template_object.js //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Create an empty template object. Packages and apps add templates on // 1
// to this object. // 2
Template = {}; // 3
// 4
Template.__define__ = function (templateName, renderFunc) { // 5
if (Template.hasOwnProperty(templateName)) // 6
throw new Error("There are multiple templates named '" + templateName + "'. Each template needs a unique name."); // 7
// 8
Template[templateName] = UI.Component.extend({ // 9
kind: "Template_" + templateName, // 10
render: renderFunc, // 11
__helperHost: true // 12
}); // 13
}; // 14
// 15
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.templating = {
Template: Template
};
})();
//# sourceMappingURL=b36d51fd34724d5d501d8557cd9f846874d95aef.map

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,64 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
var Meteor = Package.meteor.Meteor;
var _ = Package.underscore._;
/* Package-scope variables */
var WebApp;
(function () {
///////////////////////////////////////////////////////////////////////
// //
// packages/webapp/webapp_client.js //
// //
///////////////////////////////////////////////////////////////////////
//
WebApp = { // 1
// 2
_isCssLoaded: function () { // 3
if (document.styleSheets.length === 0) // 4
return true; // 5
// 6
return _.find(document.styleSheets, function (sheet) { // 7
if (sheet.cssText && !sheet.cssRules) // IE8 // 8
return !sheet.cssText.match(/meteor-css-not-found-error/); // 9
return !_.find(sheet.cssRules, function (rule) { // 10
return rule.selectorText === '.meteor-css-not-found-error'; // 11
}); // 12
}); // 13
} // 14
}; // 15
// 16
///////////////////////////////////////////////////////////////////////
}).call(this);
/* Exports */
if (typeof Package === 'undefined') Package = {};
Package.webapp = {
WebApp: WebApp
};
})();
//# sourceMappingURL=e1be090051b82f046484dccc2de7d747e50c7328.map