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AAsB,IAAU,EAAK,OAA2D,IAAnD,EAAI,KAAK,uBAAuB,QAAQ,IAChG,OAAO,CAGV,CACD,CAEA,IAAI,EAAQ,EAAW,MACvB,GAAG,EACF,IAAI,EAAE,EAAG,EAAE,EAAM,OAAQ,IACxB,IAAI,EAAI,KAAK,uBAAuB,EAAM,IACzC,OAAO,EAIV,OAAO,CACR,EAKA,EAAI,MAAQ,EAAI,OAAS,CAAE,MAAO,CAAC,GAKnC,EAAI,MAAM,QAAU,SAAS,EAAS,GAClC,EAAI,MAAM,IAAI,EAAI,MAAM,MAAM,GAChC,EAAI,MAAM,MAAM,GAAU,KAAK,GAG/B,EAAI,MAAM,MAAM,GAAY,CAAC,EAE/B,EAKA,EAAI,MAAM,WAAa,SAAS,GAC/B,IAAI,EAAO,MAAM,UAAU,MAAM,KAAK,UAAU,GAChD,GAAG,EAAI,MAAM,IAAI,EAAI,MAAM,MAAM,GAChC,IAAK,IAAI,EAAI,EAAG,EAAI,EAAI,MAAM,MAAM,GAAU,OAAQ,IACrD,EAAK,GAAK,EAAI,MAAM,MAAM,GAAU,GAAG,MAAM,KAAK,GAGpD,OAAO,EAAK,EACb,EAIA,EAAI,KAAK,KAAO,SAAS,GAExB,EAAI,OAAS,IAAI,EAAI,MAAM,OAExB,EAAI,UAAY,EAAI,OACtB,EAAI,eAAiB,IAAI,EAAI,MAAM,gBAGpC,EAAI,KAAK,0BAAyB,WAEjC,EAAI,KAAK,QAAQ,CAAC,SAAU,GAC7B,GACD,EAIG,EAAI,UAAY,EAAI,KAAK,cAC3B,EAAI,KAAK,OAGH,CAEN,EAEsB,oBAAd,QACR,QAAQ,WAAa,MAErB,MAAM,OAAO","file":"/npm/tiddlywiki-production-client@5.2.2/boot/boot.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/tiddlywiki-production-client@5.2.2/boot/boot.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*\\\ntitle: $:/boot/boot.js\ntype: application/javascript\n\nThe main boot kernel for TiddlyWiki. This single file creates a barebones TW environment that is just sufficient to bootstrap the modules containing the main logic of the application.\n\nOn the server this file is executed directly to boot TiddlyWiki. In the browser, this file is packed into a single HTML file.\n\n\\*/\n\nvar _boot = (function($tw) {\n\n/*jslint node: true, browser: true */\n/*global modules: false, $tw: false */\n\"use strict\";\n\n// Include bootprefix if we're not given module data\nif(!$tw) {\n\t$tw = require(\"./bootprefix.js\").bootprefix();\n}\n\n$tw.utils = $tw.utils || Object.create(null);\n\n/////////////////////////// Standard node.js libraries\n\nvar fs, path, vm;\nif($tw.node) {\n\tfs = require(\"fs\");\n\tpath = require(\"path\");\n\tvm = require(\"vm\");\n}\n\n/////////////////////////// Utility functions\n\n$tw.boot.log = function(str) {\n\t$tw.boot.logMessages = $tw.boot.logMessages || [];\n\t$tw.boot.logMessages.push(str);\n}\n\n/*\nCheck if an object has a property\n*/\n$tw.utils.hop = function(object,property) {\n\treturn object ? Object.prototype.hasOwnProperty.call(object,property) : false;\n};\n\n/*\nDetermine if a value is an array\n*/\n$tw.utils.isArray = function(value) {\n\treturn Object.prototype.toString.call(value) == \"[object Array]\";\n};\n\n/*\nCheck if an array is equal by value and by reference.\n*/\n$tw.utils.isArrayEqual = function(array1,array2) {\n\tif(array1 === array2) {\n\t\treturn true;\n\t}\n\tarray1 = array1 || [];\n\tarray2 = array2 || [];\n\tif(array1.length !== array2.length) {\n\t\treturn false;\n\t}\n\treturn array1.every(function(value,index) {\n\t\treturn value === array2[index];\n\t});\n};\n\n/*\nAdd an entry to a sorted array if it doesn't already exist, while maintaining the sort order\n*/\n$tw.utils.insertSortedArray = function(array,value) {\n\tvar low = 0, high = array.length - 1, mid, cmp;\n\twhile(low <= high) {\n\t\tmid = (low + high) >> 1;\n\t\tcmp = value.localeCompare(array[mid]);\n\t\tif(cmp > 0) {\n\t\t\tlow = mid + 1;\n\t\t} else if(cmp < 0) {\n\t\t\thigh = mid - 1;\n\t\t} else {\n\t\t\treturn array;\n\t\t}\n\t}\n\tarray.splice(low,0,value);\n\treturn array;\n};\n\n/*\nPush entries onto an array, removing them first if they already exist in the array\n\tarray: array to modify (assumed to be free of duplicates)\n\tvalue: a single value to push or an array of values to push\n*/\n$tw.utils.pushTop = function(array,value) {\n\tvar t,p;\n\tif($tw.utils.isArray(value)) {\n\t\t// Remove any array entries that are duplicated in the new values\n\t\tif(value.length !== 0) {\n\t\t\tif(array.length !== 0) {\n\t\t\t\tif(value.length < array.length) {\n\t\t\t\t\tfor(t=0; t<value.length; t++) {\n\t\t\t\t\t\tp = array.indexOf(value[t]);\n\t\t\t\t\t\tif(p !== -1) {\n\t\t\t\t\t\t\tarray.splice(p,1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor(t=array.length-1; t>=0; t--) {\n\t\t\t\t\t\tp = value.indexOf(array[t]);\n\t\t\t\t\t\tif(p !== -1) {\n\t\t\t\t\t\t\tarray.splice(t,1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Push the values on top of the main array\n\t\t\tarray.push.apply(array,value);\n\t\t}\n\t} else {\n\t\tp = array.indexOf(value);\n\t\tif(p !== -1) {\n\t\t\tarray.splice(p,1);\n\t\t}\n\t\tarray.push(value);\n\t}\n\treturn array;\n};\n\n/*\nDetermine if a value is a date\n*/\n$tw.utils.isDate = function(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Date]\";\n};\n\n/*\nIterate through all the own properties of an object or array. Callback is invoked with (element,title,object)\n*/\n$tw.utils.each = function(object,callback) {\n\tvar next,f,length;\n\tif(object) {\n\t\tif(Object.prototype.toString.call(object) == \"[object Array]\") {\n\t\t\tfor (f=0, length=object.length; f<length; f++) {\n\t\t\t\tnext = callback(object[f],f,object);\n\t\t\t\tif(next === false) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t    }\n\t\t} else {\n\t\t\tvar keys = Object.keys(object);\n\t\t\tfor (f=0, length=keys.length; f<length; f++) {\n\t\t\t\tvar key = keys[f];\n\t\t\t\tnext = callback(object[key],key,object);\n\t\t\t\tif(next === false) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\n/*\nHelper for making DOM elements\ntag: tag name\noptions: see below\nOptions include:\nnamespace: defaults to http://www.w3.org/1999/xhtml\nattributes: hashmap of attribute values\nstyle: hashmap of styles\ntext: text to add as a child node\nchildren: array of further child nodes\ninnerHTML: optional HTML for element\nclass: class name(s)\ndocument: defaults to current document\neventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded)\n*/\n$tw.utils.domMaker = function(tag,options) {\n\tvar doc = options.document || document;\n\tvar element = doc.createElementNS(options.namespace || \"http://www.w3.org/1999/xhtml\",tag);\n\tif(options[\"class\"]) {\n\t\telement.className = options[\"class\"];\n\t}\n\tif(options.text) {\n\t\telement.appendChild(doc.createTextNode(options.text));\n\t}\n\t$tw.utils.each(options.children,function(child) {\n\t\telement.appendChild(child);\n\t});\n\tif(options.innerHTML) {\n\t\telement.innerHTML = options.innerHTML;\n\t}\n\t$tw.utils.each(options.attributes,function(attribute,name) {\n\t\telement.setAttribute(name,attribute);\n\t});\n\t$tw.utils.each(options.style,function(value,name) {\n\t\telement.style[name] = value;\n\t});\n\tif(options.eventListeners) {\n\t\t$tw.utils.addEventListeners(element,options.eventListeners);\n\t}\n\treturn element;\n};\n\n/*\nDisplay an error and exit\n*/\n$tw.utils.error = function(err) {\n\t// Prepare the error message\n\tvar errHeading = ( $tw.language == undefined ? \"Internal JavaScript Error\" : $tw.language.getString(\"InternalJavaScriptError/Title\") ),\n\t\tpromptMsg = ( $tw.language == undefined ? \"Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser\" : $tw.language.getString(\"InternalJavaScriptError/Hint\") );\n\t// Log the error to the console\n\tconsole.error($tw.node ? \"\\x1b[1;31m\" + err + \"\\x1b[0m\" : err);\n\tif($tw.browser && !$tw.node) {\n\t\t// Display an error message to the user\n\t\tvar dm = $tw.utils.domMaker,\n\t\t\theading = dm(\"h1\",{text: errHeading}),\n\t\t\tprompt = dm(\"div\",{text: promptMsg, \"class\": \"tc-error-prompt\"}),\n\t\t\tmessage = dm(\"div\",{text: err, \"class\":\"tc-error-message\"}),\n\t\t\tbutton = dm(\"div\",{children: [dm(\"button\",{text: ( $tw.language == undefined ? \"close\" : $tw.language.getString(\"Buttons/Close/Caption\") )})], \"class\": \"tc-error-prompt\"}),\n\t\t\tform = dm(\"form\",{children: [heading,prompt,message,button], \"class\": \"tc-error-form\"});\n\t\tdocument.body.insertBefore(form,document.body.firstChild);\n\t\tform.addEventListener(\"submit\",function(event) {\n\t\t\tdocument.body.removeChild(form);\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t},true);\n\t\treturn null;\n\t} else if(!$tw.browser) {\n\t\t// Exit if we're under node.js\n\t\tprocess.exit(1);\n\t}\n};\n\n/*\nUse our custom error handler if we're in the browser\n*/\nif($tw.boot.tasks.trapErrors) {\n\twindow.onerror = function(errorMsg,url,lineNumber) {\n\t\t$tw.utils.error(errorMsg);\n\t\treturn false;\n\t};\n}\n\n/*\nExtend an object with the properties from a list of source objects\n*/\n$tw.utils.extend = function(object /*, sourceObjectList */) {\n\t$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {\n\t\tif(source) {\n\t\t\tfor (var p in source) {\n\t\t\t\tobject[p] = source[p];\n\t\t\t}\n\t\t}\n\t});\n\treturn object;\n};\n\n/*\nFill in any null or undefined properties of an object with the properties from a list of source objects. Each property that is an object is called recursively\n*/\n$tw.utils.deepDefaults = function(object /*, sourceObjectList */) {\n\t$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {\n\t\tif(source) {\n\t\t\tfor (var p in source) {\n\t\t\t\tif(object[p] === null || object[p] === undefined) {\n\t\t\t\t\tobject[p] = source[p];\n\t\t\t\t}\n\t\t\t\tif(typeof object[p] === \"object\" && typeof source[p] === \"object\") {\n\t\t\t\t\t$tw.utils.deepDefaults(object[p],source[p]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\treturn object;\n};\n\n/*\nConvert a URIComponent encoded string to a string safely\n*/\n$tw.utils.decodeURIComponentSafe = function(s) {\n\tvar v = s;\n\ttry {\n\t\tv = decodeURIComponent(s);\n\t} catch(e) {}\n\treturn v;\n};\n\n/*\nConvert a URI encoded string to a string safely\n*/\n$tw.utils.decodeURISafe = function(s) {\n\tvar v = s;\n\ttry {\n\t\tv = decodeURI(s);\n\t} catch(e) {}\n\treturn v;\n};\n\n/*\nConvert \"&amp;\" to &, \"&nbsp;\" to nbsp, \"&lt;\" to <, \"&gt;\" to > and \"&quot;\" to \"\n*/\n$tw.utils.htmlDecode = function(s) {\n\treturn s.toString().replace(/&lt;/mg,\"<\").replace(/&nbsp;/mg,\"\\xA0\").replace(/&gt;/mg,\">\").replace(/&quot;/mg,\"\\\"\").replace(/&amp;/mg,\"&\");\n};\n\n/*\nGet the browser location.hash. We don't use location.hash because of the way that Firefox auto-urldecodes it (see http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash)\n*/\n$tw.utils.getLocationHash = function() {\n\tvar href = window.location.href;\n\tvar idx = href.indexOf('#');\n\tif(idx === -1) {\n\t\treturn \"#\";\n\t} else if(idx < href.length-1 && href[idx+1] === '#') {\n\t\t// Special case: ignore location hash if it itself starts with a #\n\t\treturn \"#\";\n\t} else {\n\t\treturn href.substring(idx);\n\t}\n};\n\n/*\nPad a string to a given length with \"0\"s. Length defaults to 2\n*/\n$tw.utils.pad = function(value,length) {\n\tlength = length || 2;\n\tvar s = value.toString();\n\tif(s.length < length) {\n\t\ts = \"000000000000000000000000000\".substr(0,length - s.length) + s;\n\t}\n\treturn s;\n};\n\n// Convert a date into UTC YYYYMMDDHHMMSSmmm format\n$tw.utils.stringifyDate = function(value) {\n\treturn value.getUTCFullYear() +\n\t\t\t$tw.utils.pad(value.getUTCMonth() + 1) +\n\t\t\t$tw.utils.pad(value.getUTCDate()) +\n\t\t\t$tw.utils.pad(value.getUTCHours()) +\n\t\t\t$tw.utils.pad(value.getUTCMinutes()) +\n\t\t\t$tw.utils.pad(value.getUTCSeconds()) +\n\t\t\t$tw.utils.pad(value.getUTCMilliseconds(),3);\n};\n\n// Parse a date from a UTC YYYYMMDDHHMMSSmmm format string\n$tw.utils.parseDate = function(value) {\n\tif(typeof value === \"string\") {\n\t\tvar negative = 1;\n\t\tif(value.charAt(0) === \"-\") {\n\t\t\tnegative = -1;\n\t\t\tvalue = value.substr(1);\n\t\t}\n\t\tvar year = parseInt(value.substr(0,4),10) * negative,\n\t\t\td = new Date(Date.UTC(year,\n\t\t\t\tparseInt(value.substr(4,2),10)-1,\n\t\t\t\tparseInt(value.substr(6,2),10),\n\t\t\t\tparseInt(value.substr(8,2)||\"00\",10),\n\t\t\t\tparseInt(value.substr(10,2)||\"00\",10),\n\t\t\t\tparseInt(value.substr(12,2)||\"00\",10),\n\t\t\t\tparseInt(value.substr(14,3)||\"000\",10)));\n\t\t  d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822\n\t\t  return d;\n\t} else if($tw.utils.isDate(value)) {\n\t\treturn value;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n// Stringify an array of tiddler titles into a list string\n$tw.utils.stringifyList = function(value) {\n\tif($tw.utils.isArray(value)) {\n\t\tvar result = new Array(value.length);\n\t\tfor(var t=0, l=value.length; t<l; t++) {\n\t\t\tvar entry = value[t] || \"\";\n\t\t\tif(entry.indexOf(\" \") !== -1) {\n\t\t\t\tresult[t] = \"[[\" + entry + \"]]\";\n\t\t\t} else {\n\t\t\t\tresult[t] = entry;\n\t\t\t}\n\t\t}\n\t\treturn result.join(\" \");\n\t} else {\n\t\treturn value || \"\";\n\t}\n};\n\n// Parse a string array from a bracketted list. For example \"OneTiddler [[Another Tiddler]] LastOne\"\n$tw.utils.parseStringArray = function(value, allowDuplicate) {\n\tif(typeof value === \"string\") {\n\t\tvar memberRegExp = /(?:^|[^\\S\\xA0])(?:\\[\\[(.*?)\\]\\])(?=[^\\S\\xA0]|$)|([\\S\\xA0]+)/mg,\n\t\t\tresults = [], names = {},\n\t\t\tmatch;\n\t\tdo {\n\t\t\tmatch = memberRegExp.exec(value);\n\t\t\tif(match) {\n\t\t\t\tvar item = match[1] || match[2];\n\t\t\t\tif(item !== undefined && (!$tw.utils.hop(names,item) || allowDuplicate)) {\n\t\t\t\t\tresults.push(item);\n\t\t\t\t\tnames[item] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t} while(match);\n\t\treturn results;\n\t} else if($tw.utils.isArray(value)) {\n\t\treturn value;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n// Parse a block of name:value fields. The `fields` object is used as the basis for the return value\n$tw.utils.parseFields = function(text,fields) {\n\tfields = fields || Object.create(null);\n\ttext.split(/\\r?\\n/mg).forEach(function(line) {\n\t\tif(line.charAt(0) !== \"#\") {\n\t\t\tvar p = line.indexOf(\":\");\n\t\t\tif(p !== -1) {\n\t\t\t\tvar field = line.substr(0, p).trim(),\n\t\t\t\t\tvalue = line.substr(p+1).trim();\n\t\t\t\tif(field) {\n\t\t\t\t\tfields[field] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\treturn fields;\n};\n\n// Safely parse a string as JSON\n$tw.utils.parseJSONSafe = function(text,defaultJSON) {\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch(e) {\n\t\tif(typeof defaultJSON === \"function\") {\n\t\t\treturn defaultJSON(e);\n\t\t} else {\n\t\t\treturn defaultJSON || {};\n\t\t}\n\t}\n};\n\n/*\nResolves a source filepath delimited with `/` relative to a specified absolute root filepath.\nIn relative paths, the special folder name `..` refers to immediate parent directory, and the\nname `.` refers to the current directory\n*/\n$tw.utils.resolvePath = function(sourcepath,rootpath) {\n\t// If the source path starts with ./ or ../ then it is relative to the root\n\tif(sourcepath.substr(0,2) === \"./\" || sourcepath.substr(0,3) === \"../\" ) {\n\t\tvar src = sourcepath.split(\"/\"),\n\t\t\troot = rootpath.split(\"/\");\n\t\t// Remove the filename part of the root\n\t\troot.splice(root.length-1,1);\n\t\t// Process the source path bit by bit onto the end of the root path\n\t\twhile(src.length > 0) {\n\t\t\tvar c = src.shift();\n\t\t\tif(c === \"..\") { // Slice off the last root entry for a double dot\n\t\t\t\tif(root.length > 0) {\n\t\t\t\t\troot.splice(root.length-1,1);\n\t\t\t\t}\n\t\t\t} else if(c !== \".\") { // Ignore dots\n\t\t\t\troot.push(c); // Copy other elements across\n\t\t\t}\n\t\t}\n\t\treturn root.join(\"/\");\n\t} else {\n\t\t// If it isn't relative, just return the path\n\t\tif(rootpath) {\n\t\t\tvar root = rootpath.split(\"/\");\n\t\t\t// Remove the filename part of the root\n\t\t\troot.splice(root.length - 1, 1);\n\t\t\treturn root.join(\"/\") + \"/\" + sourcepath;\n\t\t} else {\n\t\t\treturn sourcepath;\n\t\t}\n\t}\n};\n\n/*\nParse a semantic version string into its constituent parts -- see https://semver.org\n*/\n$tw.utils.parseVersion = function(version) {\n\tvar match = /^v?((\\d+)\\.(\\d+)\\.(\\d+))(?:-([\\dA-Za-z\\-]+(?:\\.[\\dA-Za-z\\-]+)*))?(?:\\+([\\dA-Za-z\\-]+(?:\\.[\\dA-Za-z\\-]+)*))?$/.exec(version);\n\tif(match) {\n\t\treturn {\n\t\t\tversion: match[1],\n\t\t\tmajor: parseInt(match[2],10),\n\t\t\tminor: parseInt(match[3],10),\n\t\t\tpatch: parseInt(match[4],10),\n\t\t\tprerelease: match[5],\n\t\t\tbuild: match[6]\n\t\t};\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nReturns +1 if the version string A is greater than the version string B, 0 if they are the same, and +1 if B is greater than A.\nMissing or malformed version strings are parsed as 0.0.0\n*/\n$tw.utils.compareVersions = function(versionStringA,versionStringB) {\n\tvar defaultVersion = {\n\t\t\tmajor: 0,\n\t\t\tminor: 0,\n\t\t\tpatch: 0\n\t\t},\n\t\tversionA = $tw.utils.parseVersion(versionStringA) || defaultVersion,\n\t\tversionB = $tw.utils.parseVersion(versionStringB) || defaultVersion,\n\t\tdiff = [\n\t\t\tversionA.major - versionB.major,\n\t\t\tversionA.minor - versionB.minor,\n\t\t\tversionA.patch - versionB.patch\n\t\t];\n\tif((diff[0] > 0) || (diff[0] === 0 && diff[1] > 0) || (diff[0] === 0 & diff[1] === 0 & diff[2] > 0)) {\n\t\treturn +1;\n\t} else if((diff[0] < 0) || (diff[0] === 0 && diff[1] < 0) || (diff[0] === 0 & diff[1] === 0 & diff[2] < 0)) {\n\t\treturn -1;\n\t} else {\n\t\treturn 0;\n\t}\n};\n\n/*\nReturns true if the version string A is greater than the version string B. Returns true if the versions are the same\n*/\n$tw.utils.checkVersions = function(versionStringA,versionStringB) {\n\treturn $tw.utils.compareVersions(versionStringA,versionStringB) !== -1;\n};\n\n/*\nRegister file type information\noptions: {flags: flags,deserializerType: deserializerType}\n\tflags:\"image\" for image types\n\tdeserializerType: defaults to type if not specified\n*/\n$tw.utils.registerFileType = function(type,encoding,extension,options) {\n\toptions = options || {};\n\tif($tw.utils.isArray(extension)) {\n\t\t$tw.utils.each(extension,function(extension) {\n\t\t\t$tw.config.fileExtensionInfo[extension] = {type: type};\n\t\t});\n\t\textension = extension[0];\n\t} else {\n\t\t$tw.config.fileExtensionInfo[extension] = {type: type};\n\t}\n\t$tw.config.contentTypeInfo[type] = {encoding: encoding, extension: extension, flags: options.flags || [], deserializerType: options.deserializerType || type};\n};\n\n/*\nGiven an extension, always access the $tw.config.fileExtensionInfo\nusing a lowercase extension only.\n*/\n$tw.utils.getFileExtensionInfo = function(ext) {\n\treturn ext ? $tw.config.fileExtensionInfo[ext.toLowerCase()] : null;\n}\n\n/*\nGiven an extension, get the correct encoding for that file.\ndefaults to utf8\n*/\n$tw.utils.getTypeEncoding = function(ext) {\n\tvar extensionInfo = $tw.utils.getFileExtensionInfo(ext),\n\t\ttype = extensionInfo ? extensionInfo.type : null,\n\t\ttypeInfo = type ? $tw.config.contentTypeInfo[type] : null;\n\treturn typeInfo ? typeInfo.encoding : \"utf8\";\n};\n\n/*\nRun code globally with specified context variables in scope\n*/\n$tw.utils.evalGlobal = function(code,context,filename) {\n\tvar contextCopy = $tw.utils.extend(Object.create(null),context);\n\t// Get the context variables as a pair of arrays of names and values\n\tvar contextNames = [], contextValues = [];\n\t$tw.utils.each(contextCopy,function(value,name) {\n\t\tcontextNames.push(name);\n\t\tcontextValues.push(value);\n\t});\n\t// Add the code prologue and epilogue\n\tcode = \"(function(\" + contextNames.join(\",\") + \") {(function(){\\n\" + code + \"\\n;})();\\nreturn exports;\\n})\\n\";\n\t// Compile the code into a function\n\tvar fn;\n\tif($tw.browser) {\n\t\tfn = window[\"eval\"](code + \"\\n\\n//# sourceURL=\" + filename);\n\t} else {\n\t\tfn = vm.runInThisContext(code,filename);\n\t}\n\t// Call the function and return the exports\n\treturn fn.apply(null,contextValues);\n};\n\n/*\nRun code in a sandbox with only the specified context variables in scope\n*/\n$tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code,context,filename) {\n\tvar sandbox = $tw.utils.extend(Object.create(null),context);\n\tvm.runInNewContext(code,sandbox,filename);\n\treturn sandbox.exports;\n};\n\n/*\nCreates a PasswordPrompt object\n*/\n$tw.utils.PasswordPrompt = function() {\n\t// Store of pending password prompts\n\tthis.passwordPrompts = [];\n\t// Create the wrapper\n\tthis.promptWrapper = $tw.utils.domMaker(\"div\",{\"class\":\"tc-password-wrapper\"});\n\tdocument.body.appendChild(this.promptWrapper);\n\t// Hide the empty wrapper\n\tthis.setWrapperDisplay();\n};\n\n/*\nHides or shows the wrapper depending on whether there are any outstanding prompts\n*/\n$tw.utils.PasswordPrompt.prototype.setWrapperDisplay = function() {\n\tif(this.passwordPrompts.length) {\n\t\tthis.promptWrapper.style.display = \"block\";\n\t} else {\n\t\tthis.promptWrapper.style.display = \"none\";\n\t}\n};\n\n/*\nAdds a new password prompt. Options are:\nsubmitText: text to use for submit button (defaults to \"Login\")\nserviceName: text of the human readable service name\nnoUserName: set true to disable username prompt\ncanCancel: set true to enable a cancel button (callback called with null)\nrepeatPassword: set true to prompt for the password twice\ncallback: function to be called on submission with parameter of object {username:,password:}. Callback must return `true` to remove the password prompt\n*/\n$tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {\n\t// Create and add the prompt to the DOM\n\tvar self = this,\n\t\tsubmitText = options.submitText || \"Login\",\n\t\tdm = $tw.utils.domMaker,\n\t\tchildren = [dm(\"h1\",{text: options.serviceName})];\n\tif(!options.noUserName) {\n\t\tchildren.push(dm(\"input\",{\n\t\t\tattributes: {type: \"text\", name: \"username\", placeholder: $tw.language.getString(\"Encryption/Username\")}\n\t\t}));\n\t}\n\tchildren.push(dm(\"input\",{\n\t\tattributes: {\n\t\t\ttype: \"password\",\n\t\t\tname: \"password\",\n\t\t\tplaceholder: ( $tw.language == undefined ? \"Password\" : $tw.language.getString(\"Encryption/Password\") )\n\t\t}\n\t}));\n\tif(options.repeatPassword) {\n\t\tchildren.push(dm(\"input\",{\n\t\t\tattributes: {\n\t\t\t\ttype: \"password\",\n\t\t\t\tname: \"password2\",\n\t\t\t\tplaceholder: $tw.language.getString(\"Encryption/RepeatPassword\")\n\t\t\t}\n\t\t}));\n\t}\n\tif(options.canCancel) {\n\t\tchildren.push(dm(\"button\",{\n\t\t\ttext: $tw.language.getString(\"Encryption/Cancel\"),\n\t\t\tattributes: {\n\t\t\t\ttype: \"button\"\n\t\t\t},\n\t\t\teventListeners: [{\n\t\t\t\t\tname: \"click\",\n\t\t\t\t\thandlerFunction: function(event) {\n\t\t\t\t\t\tself.removePrompt(promptInfo);\n\t\t\t\t\t\toptions.callback(null);\n\t\t\t\t\t}\n\t\t\t\t}]\n\t\t}));\n\t}\n\tchildren.push(dm(\"button\",{\n\t\tattributes: {type: \"submit\"},\n\t\ttext: submitText\n\t}));\n\tvar form = dm(\"form\",{\n\t\tattributes: {autocomplete: \"off\"},\n\t\tchildren: children\n\t});\n\tthis.promptWrapper.appendChild(form);\n\twindow.setTimeout(function() {\n\t\tform.elements[0].focus();\n\t},10);\n\t// Add a submit event handler\n\tvar self = this;\n\tform.addEventListener(\"submit\",function(event) {\n\t\t// Collect the form data\n\t\tvar data = {},t;\n\t\t$tw.utils.each(form.elements,function(element) {\n\t\t\tif(element.name && element.value) {\n\t\t\t\tdata[element.name] = element.value;\n\t\t\t}\n\t\t});\n\t\t// Check that the passwords match\n\t\tif(options.repeatPassword && data.password !== data.password2) {\n\t\t\talert($tw.language.getString(\"Encryption/PasswordNoMatch\"));\n\t\t} else {\n\t\t\t// Call the callback\n\t\t\tif(options.callback(data)) {\n\t\t\t\t// Remove the prompt if the callback returned true\n\t\t\t\tself.removePrompt(promptInfo);\n\t\t\t} else {\n\t\t\t\t// Clear the password if the callback returned false\n\t\t\t\t$tw.utils.each(form.elements,function(element) {\n\t\t\t\t\tif(element.name === \"password\" || element.name === \"password2\") {\n\t\t\t\t\t\telement.value = \"\";\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tevent.preventDefault();\n\t\treturn false;\n\t},true);\n\t// Add the prompt to the list\n\tvar promptInfo = {\n\t\tserviceName: options.serviceName,\n\t\tcallback: options.callback,\n\t\tform: form,\n\t\towner: this\n\t};\n\tthis.passwordPrompts.push(promptInfo);\n\t// Make sure the wrapper is displayed\n\tthis.setWrapperDisplay();\n\treturn promptInfo;\n};\n\n$tw.utils.PasswordPrompt.prototype.removePrompt = function(promptInfo) {\n\tvar i = this.passwordPrompts.indexOf(promptInfo);\n\tif(i !== -1) {\n\t\tthis.passwordPrompts.splice(i,1);\n\t\tpromptInfo.form.parentNode.removeChild(promptInfo.form);\n\t\tthis.setWrapperDisplay();\n\t}\n}\n\n/*\nCrypto helper object for encrypted content. It maintains the password text in a closure, and provides methods to change\nthe password, and to encrypt/decrypt a block of text\n*/\n$tw.utils.Crypto = function() {\n\tvar sjcl = $tw.node ? (global.sjcl || require(\"./sjcl.js\")) : window.sjcl,\n\t\tcurrentPassword = null,\n\t\tcallSjcl = function(method,inputText,password) {\n\t\t\tpassword = password || currentPassword;\n\t\t\tvar outputText;\n\t\t\ttry {\n\t\t\t\tif(password) {\n\t\t\t\t\toutputText = sjcl[method](password,inputText);\n\t\t\t\t}\n\t\t\t} catch(ex) {\n\t\t\t\tconsole.log(\"Crypto error:\" + ex);\n\t\t\t\toutputText = null;\n\t\t\t}\n\t\t\treturn outputText;\n\t\t};\n\tthis.setPassword = function(newPassword) {\n\t\tcurrentPassword = newPassword;\n\t\tthis.updateCryptoStateTiddler();\n\t};\n\tthis.updateCryptoStateTiddler = function() {\n\t\tif($tw.wiki) {\n\t\t\tvar state = currentPassword ? \"yes\" : \"no\",\n\t\t\t\ttiddler = $tw.wiki.getTiddler(\"$:/isEncrypted\");\n\t\t\tif(!tiddler || tiddler.fields.text !== state) {\n\t\t\t\t$tw.wiki.addTiddler(new $tw.Tiddler({title: \"$:/isEncrypted\", text: state}));\n\t\t\t}\n\t\t}\n\t};\n\tthis.hasPassword = function() {\n\t\treturn !!currentPassword;\n\t}\n\tthis.encrypt = function(text,password) {\n\t\treturn callSjcl(\"encrypt\",text,password);\n\t};\n\tthis.decrypt = function(text,password) {\n\t\treturn callSjcl(\"decrypt\",text,password);\n\t};\n};\n\n/////////////////////////// Module mechanism\n\n/*\nExecute the module named 'moduleName'. The name can optionally be relative to the module named 'moduleRoot'\n*/\n$tw.modules.execute = function(moduleName,moduleRoot) {\n\tvar name = moduleName;\n\tif(moduleName.charAt(0) === \".\") {\n\t\tname = $tw.utils.resolvePath(moduleName,moduleRoot)\n\t}\n\tif(!$tw.modules.titles[name]) {\n\t\tif($tw.modules.titles[name + \".js\"]) {\n\t\t\tname = name + \".js\";\n\t\t} else if($tw.modules.titles[name + \"/index.js\"]) {\n\t\t\tname = name + \"/index.js\";\n\t\t} else if($tw.modules.titles[moduleName]) {\n\t\t\tname = moduleName;\n\t\t} else if($tw.modules.titles[moduleName + \".js\"]) {\n\t\t\tname = moduleName + \".js\";\n\t\t} else if($tw.modules.titles[moduleName + \"/index.js\"]) {\n\t\t\tname = moduleName + \"/index.js\";\n\t\t}\n\t}\n\tvar moduleInfo = $tw.modules.titles[name],\n\t\ttiddler = $tw.wiki.getTiddler(name),\n\t\t_exports = {},\n\t\tsandbox = {\n\t\t\tmodule: {exports: _exports},\n\t\t\t//moduleInfo: moduleInfo,\n\t\t\texports: _exports,\n\t\t\tconsole: console,\n\t\t\tsetInterval: setInterval,\n\t\t\tclearInterval: clearInterval,\n\t\t\tsetTimeout: setTimeout,\n\t\t\tclearTimeout: clearTimeout,\n\t\t\tBuffer: $tw.browser ? undefined : Buffer,\n\t\t\t$tw: $tw,\n\t\t\trequire: function(title) {\n\t\t\t\treturn $tw.modules.execute(title, name);\n\t\t\t}\n\t\t};\n\n\tObject.defineProperty(sandbox.module, \"id\", {\n\t\tvalue: name,\n\t\twritable: false,\n\t\tenumerable: true,\n\t\tconfigurable: false\n\t});\n\n\tif(!$tw.browser) {\n\t\t$tw.utils.extend(sandbox,{\n\t\t\tprocess: process\n\t\t});\n\t} else {\n\t\t/*\n\t\tCommonJS optional require.main property:\n\t\t In a browser we offer a fake main module which points back to the boot function\n\t\t (Theoretically, this may allow TW to eventually load itself as a module in the browser)\n\t\t*/\n\t\tObject.defineProperty(sandbox.require, \"main\", {\n\t\t\tvalue: (typeof(require) !== \"undefined\") ? require.main : {TiddlyWiki: _boot},\n\t\t\twritable: false,\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false\n\t\t});\n\t}\n\tif(!moduleInfo) {\n\t\t// We could not find the module on this path\n\t\t// Try to defer to browserify etc, or node\n\t\tvar deferredModule;\n\t\tif($tw.browser) {\n\t\t\tif(window.require) {\n\t\t\t\ttry {\n\t\t\t\t\treturn window.require(moduleName);\n\t\t\t\t} catch(e) {}\n\t\t\t}\n\t\t\tthrow \"Cannot find module named '\" + moduleName + \"' required by module '\" + moduleRoot + \"', resolved to \" + name;\n\t\t} else {\n\t\t\t// If we don't have a module with that name, let node.js try to find it\n\t\t\treturn require(moduleName);\n\t\t}\n\t}\n\t// Execute the module if we haven't already done so\n\tif(!moduleInfo.exports) {\n\t\ttry {\n\t\t\t// Check the type of the definition\n\t\t\tif(typeof moduleInfo.definition === \"function\") { // Function\n\t\t\t\tmoduleInfo.exports = _exports;\n\t\t\t\tmoduleInfo.definition(moduleInfo,moduleInfo.exports,sandbox.require);\n\t\t\t} else if(typeof moduleInfo.definition === \"string\") { // String\n\t\t\t\tmoduleInfo.exports = _exports;\n\t\t\t\t$tw.utils.evalSandboxed(moduleInfo.definition,sandbox,tiddler.fields.title);\n\t\t\t\tif(sandbox.module.exports) {\n\t\t\t\t\tmoduleInfo.exports = sandbox.module.exports; //more codemirror workaround\n\t\t\t\t}\n\t\t\t} else { // Object\n\t\t\t\tmoduleInfo.exports = moduleInfo.definition;\n\t\t\t}\n\t\t} catch(e) {\n\t\t\tif (e instanceof SyntaxError) {\n\t\t\t\tvar line = e.lineNumber || e.line; // Firefox || Safari\n\t\t\t\tif (typeof(line) != \"undefined\" && line !== null) {\n\t\t\t\t\t$tw.utils.error(\"Syntax error in boot module \" + name + \":\" + line + \":\\n\" + e.stack);\n\t\t\t\t} else if(!$tw.browser) {\n\t\t\t\t\t// this is the only way to get node.js to display the line at which the syntax error appeared,\n\t\t\t\t\t// and $tw.utils.error would exit anyway\n\t\t\t\t\t// cf. https://bugs.chromium.org/p/v8/issues/detail?id=2589\n\t\t\t\t\tthrow e;\n\t\t\t\t} else {\n\t\t\t\t\t// Opera: line number is included in e.message\n\t\t\t\t\t// Chrome/IE: there's currently no way to get the line number\n\t\t\t\t\t$tw.utils.error(\"Syntax error in boot module \" + name + \": \" + e.message + \"\\n\" + e.stack);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// line number should be included in e.stack for runtime errors\n\t\t\t\t$tw.utils.error(\"Error executing boot module \" + name + \": \" + JSON.stringify(e) + \"\\n\\n\" + e.stack);\n\t\t\t}\n\t\t}\n\t}\n\t// Return the exports of the module\n\treturn moduleInfo.exports;\n};\n\n/*\nApply a callback to each module of a particular type\n\tmoduleType: type of modules to enumerate\n\tcallback: function called as callback(title,moduleExports) for each module\n*/\n$tw.modules.forEachModuleOfType = function(moduleType,callback) {\n\tvar modules = $tw.modules.types[moduleType];\n\t$tw.utils.each(modules,function(element,title) {\n\t\tcallback(title,$tw.modules.execute(title));\n\t});\n};\n\n/*\nGet all the modules of a particular type in a hashmap by their `name` field\n*/\n$tw.modules.getModulesByTypeAsHashmap = function(moduleType,nameField) {\n\tnameField = nameField || \"name\";\n\tvar results = Object.create(null);\n\t$tw.modules.forEachModuleOfType(moduleType,function(title,module) {\n\t\tresults[module[nameField]] = module;\n\t});\n\treturn results;\n};\n\n/*\nApply the exports of the modules of a particular type to a target object\n*/\n$tw.modules.applyMethods = function(moduleType,targetObject) {\n\tif(!targetObject) {\n\t\ttargetObject = Object.create(null);\n\t}\n\t$tw.modules.forEachModuleOfType(moduleType,function(title,module) {\n\t\t$tw.utils.each(module,function(element,title,object) {\n\t\t\ttargetObject[title] = module[title];\n\t\t});\n\t});\n\treturn targetObject;\n};\n\n/*\nReturn a class created from a modules. The module should export the properties to be added to those of the optional base class\n*/\n$tw.modules.createClassFromModule = function(moduleExports,baseClass) {\n\tvar newClass = function() {};\n\tif(baseClass) {\n\t\tnewClass.prototype = new baseClass();\n\t\tnewClass.prototype.constructor = baseClass;\n\t}\n\t$tw.utils.extend(newClass.prototype,moduleExports);\n\treturn newClass;\n};\n\n/*\nReturn an array of classes created from the modules of a specified type. Each module should export the properties to be added to those of the optional base class\n*/\n$tw.modules.createClassesFromModules = function(moduleType,subType,baseClass) {\n\tvar classes = Object.create(null);\n\t$tw.modules.forEachModuleOfType(moduleType,function(title,moduleExports) {\n\t\tif(!subType || moduleExports.types[subType]) {\n\t\t\tclasses[moduleExports.name] = $tw.modules.createClassFromModule(moduleExports,baseClass);\n\t\t}\n\t});\n\treturn classes;\n};\n\n/////////////////////////// Barebones tiddler object\n\n/*\nConstruct a tiddler object from a hashmap of tiddler fields. If multiple hasmaps are provided they are merged,\ntaking precedence to the right\n*/\n$tw.Tiddler = function(/* [fields,] fields */) {\n\tthis.fields = Object.create(null);\n\tthis.cache = Object.create(null);\n\tfor(var c=0; c<arguments.length; c++) {\n\t\tvar arg = arguments[c],\n\t\t\tsrc = (arg instanceof $tw.Tiddler) ? arg.fields : arg;\n\t\tfor(var t in src) {\n\t\t\tif(src[t] === undefined || src[t] === null) {\n\t\t\t\tif(t in this.fields) {\n\t\t\t\t\tdelete this.fields[t]; // If we get a field that's undefined, delete any previous field value\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Parse the field with the associated field module (if any)\n\t\t\t\tvar fieldModule = $tw.Tiddler.fieldModules[t],\n\t\t\t\t\tvalue;\n\t\t\t\tif(fieldModule && fieldModule.parse) {\n\t\t\t\t\tvalue = fieldModule.parse.call(this,src[t]);\n\t\t\t\t} else {\n\t\t\t\t\tvalue = src[t];\n\t\t\t\t}\n\t\t\t\t// Freeze the field to keep it immutable\n\t\t\t\tif(value != null && typeof value === \"object\") {\n\t\t\t\t\tObject.freeze(value);\n\t\t\t\t}\n\t\t\t\tthis.fields[t] = value;\n\t\t\t}\n\t\t}\n\t}\n\t// Freeze the tiddler against modification\n\tObject.freeze(this.fields);\n\tObject.freeze(this);\n};\n\n$tw.Tiddler.prototype.hasField = function(field) {\n\treturn $tw.utils.hop(this.fields,field);\n};\n\n/*\nCompare two tiddlers for equality\ntiddler: the tiddler to compare\nexcludeFields: array of field names to exclude from the comparison\n*/\n$tw.Tiddler.prototype.isEqual = function(tiddler,excludeFields) {\n\tif(!(tiddler instanceof $tw.Tiddler)) {\n\t\treturn false;\n\t}\n\texcludeFields = excludeFields || [];\n\tvar self = this,\n\t\tdifferences = []; // Fields that have differences\n\t// Add to the differences array\n\tfunction addDifference(fieldName) {\n\t\t// Check for this field being excluded\n\t\tif(excludeFields.indexOf(fieldName) === -1) {\n\t\t\t// Save the field as a difference\n\t\t\t$tw.utils.pushTop(differences,fieldName);\n\t\t}\n\t}\n\t// Returns true if the two values of this field are equal\n\tfunction isFieldValueEqual(fieldName) {\n\t\tvar valueA = self.fields[fieldName],\n\t\t\tvalueB = tiddler.fields[fieldName];\n\t\t// Check for identical string values\n\t\tif(typeof(valueA) === \"string\" && typeof(valueB) === \"string\" && valueA === valueB) {\n\t\t\treturn true;\n\t\t}\n\t\t// Check for identical array values\n\t\tif($tw.utils.isArray(valueA) && $tw.utils.isArray(valueB) && $tw.utils.isArrayEqual(valueA,valueB)) {\n\t\t\treturn true;\n\t\t}\n\t\t// Check for identical date values\n\t\tif($tw.utils.isDate(valueA) && $tw.utils.isDate(valueB) && valueA.getTime() === valueB.getTime()) {\n\t\t\treturn true;\n\t\t}\n\t\t// Otherwise the fields must be different\n\t\treturn false;\n\t}\n\t// Compare our fields\n\tfor(var fieldName in this.fields) {\n\t\tif(!isFieldValueEqual(fieldName)) {\n\t\t\taddDifference(fieldName);\n\t\t}\n\t}\n\t// There's a difference for every field in the other tiddler that we don't have\n\tfor(fieldName in tiddler.fields) {\n\t\tif(!(fieldName in this.fields)) {\n\t\t\taddDifference(fieldName);\n\t\t}\n\t}\n\t// Return whether there were any differences\n\treturn differences.length === 0;\n};\n\n/*\nRegister and install the built in tiddler field modules\n*/\n$tw.modules.define(\"$:/boot/tiddlerfields/modified\",\"tiddlerfield\",{\n\tname: \"modified\",\n\tparse: $tw.utils.parseDate,\n\tstringify: $tw.utils.stringifyDate\n});\n$tw.modules.define(\"$:/boot/tiddlerfields/created\",\"tiddlerfield\",{\n\tname: \"created\",\n\tparse: $tw.utils.parseDate,\n\tstringify: $tw.utils.stringifyDate\n});\n$tw.modules.define(\"$:/boot/tiddlerfields/color\",\"tiddlerfield\",{\n\tname: \"color\",\n\teditTag: \"input\",\n\teditType: \"color\"\n});\n$tw.modules.define(\"$:/boot/tiddlerfields/tags\",\"tiddlerfield\",{\n\tname: \"tags\",\n\tparse: $tw.utils.parseStringArray,\n\tstringify: $tw.utils.stringifyList\n});\n$tw.modules.define(\"$:/boot/tiddlerfields/list\",\"tiddlerfield\",{\n\tname: \"list\",\n\tparse: $tw.utils.parseStringArray,\n\tstringify: $tw.utils.stringifyList\n});\n\n/////////////////////////// Barebones wiki store\n\n/*\nWiki constructor. State is stored in private members that only a small number of privileged accessor methods have direct access. Methods added via the prototype have to use these accessors and cannot access the state data directly.\noptions include:\nenableIndexers - Array of indexer names to enable, or null to use all available indexers\n*/\n$tw.Wiki = function(options) {\n\toptions = options || {};\n\tvar self = this,\n\t\ttiddlers = Object.create(null), // Hashmap of tiddlers\n\t\ttiddlerTitles = null, // Array of tiddler titles\n\t\tgetTiddlerTitles = function() {\n\t\t\tif(!tiddlerTitles) {\n\t\t\t\ttiddlerTitles = Object.keys(tiddlers).sort(function(a,b) {return a.localeCompare(b);});\n\t\t\t}\n\t\t\treturn tiddlerTitles;\n\t\t},\n\t\tpluginTiddlers = [], // Array of tiddlers containing registered plugins, ordered by priority\n\t\tpluginInfo = Object.create(null), // Hashmap of parsed plugin content\n\t\tshadowTiddlers = Object.create(null), // Hashmap by title of {source:, tiddler:}\n\t\tshadowTiddlerTitles = null,\n\t\tgetShadowTiddlerTitles = function() {\n\t\t\tif(!shadowTiddlerTitles) {\n\t\t\t\tshadowTiddlerTitles = Object.keys(shadowTiddlers);\n\t\t\t}\n\t\t\treturn shadowTiddlerTitles;\n\t\t},\n\t\tenableIndexers = options.enableIndexers || null,\n\t\tindexers = [],\n\t\tindexersByName = Object.create(null);\n\n\tthis.addIndexer = function(indexer,name) {\n\t\t// Bail if this indexer is not enabled\n\t\tif(enableIndexers && enableIndexers.indexOf(name) === -1) {\n\t\t\treturn;\n\t\t}\n\t\tindexers.push(indexer);\n\t\tindexersByName[name] = indexer;\n\t\tindexer.init();\n\t};\n\n\tthis.getIndexer = function(name) {\n\t\treturn indexersByName[name] || null;\n\t};\n\n\t// Add a tiddler to the store\n\tthis.addTiddler = function(tiddler) {\n\t\tif(!(tiddler instanceof $tw.Tiddler)) {\n\t\t\ttiddler = new $tw.Tiddler(tiddler);\n\t\t}\n\t\t// Save the tiddler\n\t\tif(tiddler) {\n\t\t\tvar title = tiddler.fields.title;\n\t\t\tif(title) {\n// Uncomment the following line for detailed logs of all tiddler writes\n// console.log(\"Adding\",title,tiddler)\n\t\t\t\t// Record the old tiddler state\n\t\t\t\tvar updateDescriptor = {\n\t\t\t\t\told: {\n\t\t\t\t\t\ttiddler: this.getTiddler(title),\n\t\t\t\t\t\tshadow: this.isShadowTiddler(title),\n\t\t\t\t\t\texists: this.tiddlerExists(title)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Save the new tiddler\n\t\t\t\ttiddlers[title] = tiddler;\n\t\t\t\t// Check we've got the title\n\t\t\t\ttiddlerTitles = $tw.utils.insertSortedArray(tiddlerTitles || [],title);\n\t\t\t\t// Record the new tiddler state\n\t\t\t\tupdateDescriptor[\"new\"] = {\n\t\t\t\t\ttiddler: tiddler,\n\t\t\t\t\tshadow: this.isShadowTiddler(title),\n\t\t\t\t\texists: this.tiddlerExists(title)\n\t\t\t\t}\n\t\t\t\t// Update indexes\n\t\t\t\tthis.clearCache(title);\n\t\t\t\tthis.clearGlobalCache();\n\t\t\t\t$tw.utils.each(indexers,function(indexer) {\n\t\t\t\t\tindexer.update(updateDescriptor);\n\t\t\t\t});\n\t\t\t\t// Queue a change event\n\t\t\t\tthis.enqueueTiddlerEvent(title);\n\t\t\t}\n\t\t}\n\t};\n\n\t// Delete a tiddler\n\tthis.deleteTiddler = function(title) {\n// Uncomment the following line for detailed logs of all tiddler deletions\n// console.log(\"Deleting\",title)\n\t\tif($tw.utils.hop(tiddlers,title)) {\n\t\t\t// Record the old tiddler state\n\t\t\tvar updateDescriptor = {\n\t\t\t\told: {\n\t\t\t\t\ttiddler: this.getTiddler(title),\n\t\t\t\t\tshadow: this.isShadowTiddler(title),\n\t\t\t\t\texists: this.tiddlerExists(title)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Delete the tiddler\n\t\t\tdelete tiddlers[title];\n\t\t\t// Delete it from the list of titles\n\t\t\tif(tiddlerTitles) {\n\t\t\t\tvar index = tiddlerTitles.indexOf(title);\n\t\t\t\tif(index !== -1) {\n\t\t\t\t\ttiddlerTitles.splice(index,1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Record the new tiddler state\n\t\t\tupdateDescriptor[\"new\"] = {\n\t\t\t\ttiddler: this.getTiddler(title),\n\t\t\t\tshadow: this.isShadowTiddler(title),\n\t\t\t\texists: this.tiddlerExists(title)\n\t\t\t}\n\t\t\t// Update indexes\n\t\t\tthis.clearCache(title);\n\t\t\tthis.clearGlobalCache();\n\t\t\t$tw.utils.each(indexers,function(indexer) {\n\t\t\t\tindexer.update(updateDescriptor);\n\t\t\t});\n\t\t\t// Queue a change event\n\t\t\tthis.enqueueTiddlerEvent(title,true);\n\t\t}\n\t};\n\n\t// Get a tiddler from the store\n\tthis.getTiddler = function(title) {\n\t\tif(title) {\n\t\t\tvar t = tiddlers[title];\n\t\t\tif(t instanceof $tw.Tiddler) {\n\t\t\t\treturn t;\n\t\t\t} else if(title !== undefined && shadowTiddlers[title]) {\n\t\t\t\treturn shadowTiddlers[title].tiddler;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t};\n\n\t// Get an array of all tiddler titles\n\tthis.allTitles = function() {\n\t\treturn getTiddlerTitles().slice(0);\n\t};\n\n\t// Iterate through all tiddler titles\n\tthis.each = function(callback) {\n\t\tvar titles = getTiddlerTitles(),\n\t\t\tindex,titlesLength,title;\n\t\tfor(index = 0, titlesLength = titles.length; index < titlesLength; index++) {\n\t\t\ttitle = titles[index];\n\t\t\tcallback(tiddlers[title],title);\n\t\t}\n\t};\n\n\t// Get an array of all shadow tiddler titles\n\tthis.allShadowTitles = function() {\n\t\treturn getShadowTiddlerTitles().slice(0);\n\t};\n\n\t// Iterate through all shadow tiddler titles\n\tthis.eachShadow = function(callback) {\n\t\tvar titles = getShadowTiddlerTitles(),\n\t\t\tindex,titlesLength,title;\n\t\tfor(index = 0, titlesLength = titles.length; index < titlesLength; index++) {\n\t\t\ttitle = titles[index];\n\t\t\tif(tiddlers[title]) {\n\t\t\t\tcallback(tiddlers[title],title);\n\t\t\t} else {\n\t\t\t\tvar shadowInfo = shadowTiddlers[title];\n\t\t\t\tcallback(shadowInfo.tiddler,title);\n\t\t\t}\n\t\t}\n\t};\n\n\t// Iterate through all tiddlers and then the shadows\n\tthis.eachTiddlerPlusShadows = function(callback) {\n\t\tvar index,titlesLength,title,\n\t\t\ttitles = getTiddlerTitles();\n\t\tfor(index = 0, titlesLength = titles.length; index < titlesLength; index++) {\n\t\t\ttitle = titles[index];\n\t\t\tcallback(tiddlers[title],title);\n\t\t}\n\t\ttitles = getShadowTiddlerTitles();\n\t\tfor(index = 0, titlesLength = titles.length; index < titlesLength; index++) {\n\t\t\ttitle = titles[index];\n\t\t\tif(!tiddlers[title]) {\n\t\t\t\tvar shadowInfo = shadowTiddlers[title];\n\t\t\t\tcallback(shadowInfo.tiddler,title);\n\t\t\t}\n\t\t}\n\t};\n\n\t// Iterate through all the shadows and then the tiddlers\n\tthis.eachShadowPlusTiddlers = function(callback) {\n\t\tvar index,titlesLength,title,\n\t\t\ttitles = getShadowTiddlerTitles();\n\t\tfor(index = 0, titlesLength = titles.length; index < titlesLength; index++) {\n\t\t\ttitle = titles[index];\n\t\t\tif(tiddlers[title]) {\n\t\t\t\tcallback(tiddlers[title],title);\n\t\t\t} else {\n\t\t\t\tvar shadowInfo = shadowTiddlers[title];\n\t\t\t\tcallback(shadowInfo.tiddler,title);\n\t\t\t}\n\t\t}\n\t\ttitles = getTiddlerTitles();\n\t\tfor(index = 0, titlesLength = titles.length; index < titlesLength; index++) {\n\t\t\ttitle = titles[index];\n\t\t\tif(!shadowTiddlers[title]) {\n\t\t\t\tcallback(tiddlers[title],title);\n\t\t\t}\n\t\t}\n\t};\n\n\t// Test for the existence of a tiddler (excludes shadow tiddlers)\n\tthis.tiddlerExists = function(title) {\n\t\treturn !!$tw.utils.hop(tiddlers,title);\n\t};\n\n\t// Determines if a tiddler is a shadow tiddler, regardless of whether it has been overridden by a real tiddler\n\tthis.isShadowTiddler = function(title) {\n\t\treturn $tw.utils.hop(shadowTiddlers,title);\n\t};\n\n\tthis.getShadowSource = function(title) {\n\t\tif($tw.utils.hop(shadowTiddlers,title)) {\n\t\t\treturn shadowTiddlers[title].source;\n\t\t}\n\t\treturn null;\n\t};\n\n\t// Get an array of all the currently recognised plugin types\n\tthis.getPluginTypes = function() {\n\t\tvar types = [];\n\t\t$tw.utils.each(pluginTiddlers,function(pluginTiddler) {\n\t\t\tvar pluginType = pluginTiddler.fields[\"plugin-type\"];\n\t\t\tif(pluginType && types.indexOf(pluginType) === -1) {\n\t\t\t\ttypes.push(pluginType);\n\t\t\t}\n\t\t});\n\t\treturn types;\n\t};\n\n\t// Read plugin info for all plugins, or just an array of titles. Returns the number of plugins updated or deleted\n\tthis.readPluginInfo = function(titles) {\n\t\tvar results = {\n\t\t\tmodifiedPlugins: [],\n\t\t\tdeletedPlugins: []\n\t\t};\n\t\t$tw.utils.each(titles || getTiddlerTitles(),function(title) {\n\t\t\tvar tiddler = tiddlers[title];\n\t\t\tif(tiddler) {\n\t\t\t\tif(tiddler.fields.type === \"application/json\" && tiddler.hasField(\"plugin-type\") && tiddler.fields.text) {\n\t\t\t\t\tpluginInfo[tiddler.fields.title] = $tw.utils.parseJSONSafe(tiddler.fields.text);\n\t\t\t\t\tresults.modifiedPlugins.push(tiddler.fields.title);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif(pluginInfo[title]) {\n\t\t\t\t\tdelete pluginInfo[title];\n\t\t\t\t\tresults.deletedPlugins.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn results;\n\t};\n\n\t// Get plugin info for a plugin\n\tthis.getPluginInfo = function(title) {\n\t\treturn pluginInfo[title];\n\t};\n\n\t// Register the plugin tiddlers of a particular type, or null/undefined for any type, optionally restricting registration to an array of tiddler titles. Return the array of titles affected\n\tthis.registerPluginTiddlers = function(pluginType,titles) {\n\t\tvar self = this,\n\t\t\tregisteredTitles = [],\n\t\t\tcheckTiddler = function(tiddler,title) {\n\t\t\t\tif(tiddler && tiddler.fields.type === \"application/json\" && tiddler.fields[\"plugin-type\"] && (!pluginType || tiddler.fields[\"plugin-type\"] === pluginType)) {\n\t\t\t\t\tvar disablingTiddler = self.getTiddler(\"$:/config/Plugins/Disabled/\" + title);\n\t\t\t\t\tif(title === \"$:/core\" || !disablingTiddler || (disablingTiddler.fields.text || \"\").trim() !== \"yes\") {\n\t\t\t\t\t\tself.unregisterPluginTiddlers(null,[title]); // Unregister the plugin if it's already registered\n\t\t\t\t\t\tpluginTiddlers.push(tiddler);\n\t\t\t\t\t\tregisteredTitles.push(tiddler.fields.title);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\tif(titles) {\n\t\t\t$tw.utils.each(titles,function(title) {\n\t\t\t\tcheckTiddler(self.getTiddler(title),title);\n\t\t\t});\n\t\t} else {\n\t\t\tthis.each(function(tiddler,title) {\n\t\t\t\tcheckTiddler(tiddler,title);\n\t\t\t});\n\t\t}\n\t\treturn registeredTitles;\n\t};\n\n\t// Unregister the plugin tiddlers of a particular type, or null/undefined for any type, optionally restricting unregistering to an array of tiddler titles. Returns an array of the titles affected\n\tthis.unregisterPluginTiddlers = function(pluginType,titles) {\n\t\tvar self = this,\n\t\t\tunregisteredTitles = [];\n\t\t// Remove any previous registered plugins of this type\n\t\tfor(var t=pluginTiddlers.length-1; t>=0; t--) {\n\t\t\tvar tiddler = pluginTiddlers[t];\n\t\t\tif(tiddler.fields[\"plugin-type\"] && (!pluginType || tiddler.fields[\"plugin-type\"] === pluginType) && (!titles || titles.indexOf(tiddler.fields.title) !== -1)) {\n\t\t\t\tunregisteredTitles.push(tiddler.fields.title);\n\t\t\t\tpluginTiddlers.splice(t,1);\n\t\t\t}\n\t\t}\n\t\treturn unregisteredTitles;\n\t};\n\n\t// Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers\n\tthis.unpackPluginTiddlers = function() {\n\t\tvar self = this;\n\t\t// Sort the plugin titles by the `plugin-priority` field\n\t\tpluginTiddlers.sort(function(a,b) {\n\t\t\tif(\"plugin-priority\" in a.fields && \"plugin-priority\" in b.fields) {\n\t\t\t\treturn a.fields[\"plugin-priority\"] - b.fields[\"plugin-priority\"];\n\t\t\t} else if(\"plugin-priority\" in a.fields) {\n\t\t\t\treturn -1;\n\t\t\t} else if(\"plugin-priority\" in b.fields) {\n\t\t\t\treturn +1;\n\t\t\t} else if(a.fields.title < b.fields.title) {\n\t\t\t\treturn -1;\n\t\t\t} else if(a.fields.title === b.fields.title) {\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn +1;\n\t\t\t}\n\t\t});\n\t\t// Now go through the plugins in ascending order and assign the shadows\n\t\tshadowTiddlers = Object.create(null);\n\t\t$tw.utils.each(pluginTiddlers,function(tiddler) {\n\t\t\t// Extract the constituent tiddlers\n\t\t\tif($tw.utils.hop(pluginInfo,tiddler.fields.title)) {\n\t\t\t\t$tw.utils.each(pluginInfo[tiddler.fields.title].tiddlers,function(constituentTiddler,constituentTitle) {\n\t\t\t\t\t// Save the tiddler object\n\t\t\t\t\tif(constituentTitle) {\n\t\t\t\t\t\tshadowTiddlers[constituentTitle] = {\n\t\t\t\t\t\t\tsource: tiddler.fields.title,\n\t\t\t\t\t\t\ttiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\tshadowTiddlerTitles = null;\n\t\tthis.clearCache(null);\n\t\tthis.clearGlobalCache();\n\t\t$tw.utils.each(indexers,function(indexer) {\n\t\t\tindexer.rebuild();\n\t\t});\n\t};\n\n\tif(this.addIndexersToWiki) {\n\t\tthis.addIndexersToWiki();\n\t}\n};\n\n// Dummy methods that will be filled in after boot\n$tw.Wiki.prototype.clearCache =\n$tw.Wiki.prototype.clearGlobalCache =\n$tw.Wiki.prototype.enqueueTiddlerEvent = function() {};\n\n// Add an array of tiddlers\n$tw.Wiki.prototype.addTiddlers = function(tiddlers) {\n\tfor(var t=0; t<tiddlers.length; t++) {\n\t\tthis.addTiddler(tiddlers[t]);\n\t}\n};\n\n/*\nDefine all modules stored in ordinary tiddlers\n*/\n$tw.Wiki.prototype.defineTiddlerModules = function() {\n\tthis.each(function(tiddler,title) {\n\t\tif(tiddler.hasField(\"module-type\")) {\n\t\t\tswitch (tiddler.fields.type) {\n\t\t\t\tcase \"application/javascript\":\n\t\t\t\t\t// We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script\n\t\t\t\t\tif(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) {\n\t\t\t\t\t\t$tw.modules.define(tiddler.fields.title,tiddler.fields[\"module-type\"],tiddler.fields.text);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"application/json\":\n\t\t\t\t\t$tw.modules.define(tiddler.fields.title,tiddler.fields[\"module-type\"],$tw.utils.parseJSONSafe(tiddler.fields.text));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"application/x-tiddler-dictionary\":\n\t\t\t\t\t$tw.modules.define(tiddler.fields.title,tiddler.fields[\"module-type\"],$tw.utils.parseFields(tiddler.fields.text));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nRegister all the module tiddlers that have a module type\n*/\n$tw.Wiki.prototype.defineShadowModules = function() {\n\tvar self = this;\n\tthis.eachShadow(function(tiddler,title) {\n\t\t// Don't define the module if it is overidden by an ordinary tiddler\n\t\tif(!self.tiddlerExists(title) && tiddler.hasField(\"module-type\")) {\n\t\t\t// Define the module\n\t\t\t$tw.modules.define(tiddler.fields.title,tiddler.fields[\"module-type\"],tiddler.fields.text);\n\t\t}\n\t});\n};\n\n/*\nEnable safe mode by deleting any tiddlers that override a shadow tiddler\n*/\n$tw.Wiki.prototype.processSafeMode = function() {\n\tvar self = this,\n\t\toverrides = [];\n\t// Find the overriding tiddlers\n\tthis.each(function(tiddler,title) {\n\t\tif(self.isShadowTiddler(title)) {\n\t\t\tconsole.log(title);\n\t\t\toverrides.push(title);\n\t\t}\n\t});\n\t// Assemble a report tiddler\n\tvar titleReportTiddler = \"TiddlyWiki Safe Mode\",\n\t\treport = [];\n\treport.push(\"TiddlyWiki has been started in [[safe mode|https://tiddlywiki.com/static/SafeMode.html]]. All plugins are temporarily disabled. Most customisations have been disabled by renaming the following tiddlers:\")\n\t// Delete the overrides\n\toverrides.forEach(function(title) {\n\t\tvar tiddler = self.getTiddler(title),\n\t\t\tnewTitle = \"SAFE: \" + title;\n\t\tself.deleteTiddler(title);\n\t\tself.addTiddler(new $tw.Tiddler(tiddler, {title: newTitle}));\n\t\treport.push(\"* [[\" + title + \"|\" + newTitle + \"]]\");\n\t});\n\treport.push()\n\tthis.addTiddler(new $tw.Tiddler({title: titleReportTiddler, text: report.join(\"\\n\\n\")}));\n\t// Set $:/DefaultTiddlers to point to our report\n\tthis.addTiddler(new $tw.Tiddler({title: \"$:/DefaultTiddlers\", text: \"[[\" + titleReportTiddler + \"]]\"}));\n};\n\n/*\nExtracts tiddlers from a typed block of text, specifying default field values\n*/\n$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields,options) {\n\tsrcFields = srcFields || Object.create(null);\n\toptions = options || {};\n\tvar deserializer = $tw.Wiki.tiddlerDeserializerModules[options.deserializer],\n\t\tfields = Object.create(null);\n\tif(!deserializer) {\n\t\tdeserializer = $tw.Wiki.tiddlerDeserializerModules[type];\n\t}\n\tif(!deserializer && $tw.utils.getFileExtensionInfo(type)) {\n\t\t// If we didn't find the serializer, try converting it from an extension to a content type\n\t\ttype = $tw.utils.getFileExtensionInfo(type).type;\n\t\tdeserializer = $tw.Wiki.tiddlerDeserializerModules[type];\n\t}\n\tif(!deserializer && $tw.config.contentTypeInfo[type]) {\n\t\t// see if this type has a different deserializer registered with it\n\t\ttype = $tw.config.contentTypeInfo[type].deserializerType;\n\t\tdeserializer = $tw.Wiki.tiddlerDeserializerModules[type];\n\t}\n\tif(!deserializer) {\n\t\t// If we still don't have a deserializer, treat it as plain text\n\t\tdeserializer = $tw.Wiki.tiddlerDeserializerModules[\"text/plain\"];\n\t}\n\tfor(var f in srcFields) {\n\t\tfields[f] = srcFields[f];\n\t}\n\tif(deserializer) {\n\t\treturn deserializer.call(this,text,fields,type);\n\t} else {\n\t\t// Return a raw tiddler for unknown types\n\t\tfields.text = text;\n\t\treturn [fields];\n\t}\n};\n\n/*\nRegister the built in tiddler deserializer modules\n*/\nvar deserializeHeaderComment = function(text,fields) {\n\t\tvar headerCommentRegExp = new RegExp($tw.config.jsModuleHeaderRegExpString,\"mg\"),\n\t\t\tmatch = headerCommentRegExp.exec(text);\n\t\tfields.text = text;\n\t\tif(match) {\n\t\t\tfields = $tw.utils.parseFields(match[1].split(/\\r?\\n\\r?\\n/mg)[0],fields);\n\t\t}\n\t\treturn [fields];\n\t};\n$tw.modules.define(\"$:/boot/tiddlerdeserializer/js\",\"tiddlerdeserializer\",{\n\t\"application/javascript\": deserializeHeaderComment\n});\n$tw.modules.define(\"$:/boot/tiddlerdeserializer/css\",\"tiddlerdeserializer\",{\n\t\"text/css\": deserializeHeaderComment\n});\n$tw.modules.define(\"$:/boot/tiddlerdeserializer/tid\",\"tiddlerdeserializer\",{\n\t\"application/x-tiddler\": function(text,fields) {\n\t\tvar split = text.split(/\\r?\\n\\r?\\n/mg);\n\t\tif(split.length >= 1) {\n\t\t\tfields = $tw.utils.parseFields(split[0],fields);\n\t\t}\n\t\tif(split.length >= 2) {\n\t\t\tfields.text = split.slice(1).join(\"\\n\\n\");\n\t\t}\n\t\treturn [fields];\n\t}\n});\n$tw.modules.define(\"$:/boot/tiddlerdeserializer/tids\",\"tiddlerdeserializer\",{\n\t\"application/x-tiddlers\": function(text,fields) {\n\t\tvar titles = [],\n\t\t\ttiddlers = [],\n\t\t\tmatch = /\\r?\\n\\r?\\n/mg.exec(text);\n\t\tif(match) {\n\t\t\tfields = $tw.utils.parseFields(text.substr(0,match.index),fields);\n\t\t\tvar lines = text.substr(match.index + match[0].length).split(/\\r?\\n/mg);\n\t\t\tfor(var t=0; t<lines.length; t++) {\n\t\t\t\tvar line = lines[t];\n\t\t\t\tif(line.charAt(0) !== \"#\") {\n\t\t\t\t\tvar colonPos= line.indexOf(\":\");\n\t\t\t\t\tif(colonPos !== -1) {\n\t\t\t\t\t\tvar tiddler = $tw.utils.extend(Object.create(null),fields);\n\t\t\t\t\t\ttiddler.title = (tiddler.title || \"\") + line.substr(0,colonPos).trim();\n\t\t\t\t\t\tif(titles.indexOf(tiddler.title) !== -1) {\n\t\t\t\t\t\t\tconsole.log(\"Warning: .multids file contains multiple definitions for \" + tiddler.title);\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitles.push(tiddler.title);\n\t\t\t\t\t\ttiddler.text = line.substr(colonPos + 2).trim();\n\t\t\t\t\t\ttiddlers.push(tiddler);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn tiddlers;\n\t}\n});\n$tw.modules.define(\"$:/boot/tiddlerdeserializer/txt\",\"tiddlerdeserializer\",{\n\t\"text/plain\": function(text,fields,type) {\n\t\tfields.text = text;\n\t\tfields.type = type || \"text/plain\";\n\t\treturn [fields];\n\t}\n});\n$tw.modules.define(\"$:/boot/tiddlerdeserializer/html\",\"tiddlerdeserializer\",{\n\t\"text/html\": function(text,fields) {\n\t\tfields.text = text;\n\t\tfields.type = \"text/html\";\n\t\treturn [fields];\n\t}\n});\n$tw.modules.define(\"$:/boot/tiddlerdeserializer/json\",\"tiddlerdeserializer\",{\n\t\"application/json\": function(text,fields) {\n\t\tvar isTiddlerValid = function(data) {\n\t\t\t\t// Not valid if it's not an object with a title property\n\t\t\t\tif(typeof(data) !== \"object\" || !$tw.utils.hop(data,\"title\")) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tfor(var f in data) {\n\t\t\t\t\tif($tw.utils.hop(data,f)) {\n\t\t\t\t\t\t// Check field name doesn't contain control characters\n\t\t\t\t\t\tif(typeof(data[f]) !== \"string\" || /[\\x00-\\x1F]/.test(f)) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tisTiddlerArrayValid = function(data) {\n\t\t\t\tfor(var t=0; t<data.length; t++) {\n\t\t\t\t\tif(!isTiddlerValid(data[t])) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tdata = $tw.utils.parseJSONSafe(text);\n\t\tif($tw.utils.isArray(data) && isTiddlerArrayValid(data)) {\n\t\t\treturn data;\n\t\t} else if(isTiddlerValid(data)) {\n\t\t\treturn [data];\n\t\t} else {\n\t\t\t// Plain JSON file\n\t\t\tfields.text = text;\n\t\t\tfields.type = \"application/json\";\n\t\t\treturn [fields];\n\t\t}\n\t}\n});\n\n/////////////////////////// Browser definitions\n\nif($tw.browser && !$tw.node) {\n\n/*\nDecrypt any tiddlers stored within the element with the ID \"encryptedArea\". The function is asynchronous to allow the user to be prompted for a password\n\tcallback: function to be called the decryption is complete\n*/\n$tw.boot.decryptEncryptedTiddlers = function(callback) {\n\tvar encryptedArea = document.getElementById(\"encryptedStoreArea\");\n\tif(encryptedArea) {\n\t\tvar encryptedText = encryptedArea.innerHTML,\n\t\t\tprompt = \"Enter a password to decrypt this TiddlyWiki\";\n\t\t// Prompt for the password\n\t\tif($tw.utils.hop($tw.boot,\"encryptionPrompts\")) {\n\t\t\tprompt = $tw.boot.encryptionPrompts.decrypt;\n\t\t}\n\t\t$tw.passwordPrompt.createPrompt({\n\t\t\tserviceName: prompt,\n\t\t\tnoUserName: true,\n\t\t\tsubmitText: \"Decrypt\",\n\t\t\tcallback: function(data) {\n\t\t\t\t// Attempt to decrypt the tiddlers\n\t\t\t\t$tw.crypto.setPassword(data.password);\n\t\t\t\tvar decryptedText = $tw.crypto.decrypt(encryptedText);\n\t\t\t\tif(decryptedText) {\n\t\t\t\t\tvar json = $tw.utils.parseJSONSafe(decryptedText);\n\t\t\t\t\tfor(var title in json) {\n\t\t\t\t\t\t$tw.preloadTiddler(json[title]);\n\t\t\t\t\t}\n\t\t\t\t\t// Call the callback\n\t\t\t\t\tcallback();\n\t\t\t\t\t// Exit and remove the password prompt\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\t// We didn't decrypt everything, so continue to prompt for password\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else {\n\t\t// Just invoke the callback straight away if there weren't any encrypted tiddlers\n\t\tcallback();\n\t}\n};\n\n/*\nRegister a deserializer that can extract tiddlers from the DOM\n*/\n$tw.modules.define(\"$:/boot/tiddlerdeserializer/dom\",\"tiddlerdeserializer\",{\n\t\"(DOM)\": function(node) {\n\t\tvar extractTextTiddlers = function(node) {\n\t\t\t\tvar e = node.firstChild;\n\t\t\t\twhile(e && e.nodeName.toLowerCase() !== \"pre\") {\n\t\t\t\t\te = e.nextSibling;\n\t\t\t\t}\n\t\t\t\tvar title = node.getAttribute ? node.getAttribute(\"title\") : null;\n\t\t\t\tif(e && title) {\n\t\t\t\t\tvar attrs = node.attributes,\n\t\t\t\t\t\ttiddler = {\n\t\t\t\t\t\t\ttext: $tw.utils.htmlDecode(e.innerHTML)\n\t\t\t\t\t\t};\n\t\t\t\t\tfor(var i=attrs.length-1; i >= 0; i--) {\n\t\t\t\t\t\ttiddler[attrs[i].name] = attrs[i].value;\n\t\t\t\t\t}\n\t\t\t\t\treturn [tiddler];\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t},\n\t\t\textractModuleTiddlers = function(node) {\n\t\t\t\tif(node.hasAttribute && node.hasAttribute(\"data-tiddler-title\")) {\n\t\t\t\t\tvar text = node.innerHTML,\n\t\t\t\t\t\ts = text.indexOf(\"{\"),\n\t\t\t\t\t\te = text.lastIndexOf(\"}\");\n\t\t\t\t\tif(node.hasAttribute(\"data-module\") && s !== -1 && e !== -1) {\n\t\t\t\t\t\ttext = text.substring(s+1,e);\n\t\t\t\t\t}\n\t\t\t\t\tvar fields = {text: text},\n\t\t\t\t\t\tattributes = node.attributes;\n\t\t\t\t\tfor(var a=0; a<attributes.length; a++) {\n\t\t\t\t\t\tif(attributes[a].nodeName.substr(0,13) === \"data-tiddler-\") {\n\t\t\t\t\t\t\tfields[attributes[a].nodeName.substr(13)] = attributes[a].value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn [fields];\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t},\n\t\t\tt,result = [];\n\t\tif(node) {\n\t\t\tvar type = (node.getAttribute && node.getAttribute(\"type\")) || null;\n\t\t\tif(type) {\n\t\t\t\t// A new-style container with an explicit deserialization type\n\t\t\t\tresult = $tw.wiki.deserializeTiddlers(type,node.textContent);\n\t\t\t} else {\n\t\t\t\t// An old-style container of classic DIV-based tiddlers\n\t\t\t\tfor(t = 0; t < node.childNodes.length; t++) {\n\t\t\t\t\tvar childNode = node.childNodes[t],\n\t\t\t\t\t\ttiddlers = extractTextTiddlers(childNode);\n\t\t\t\t\ttiddlers = tiddlers || extractModuleTiddlers(childNode);\n\t\t\t\t\tif(tiddlers) {\n\t\t\t\t\t\tresult.push.apply(result,tiddlers);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n});\n\n$tw.loadTiddlersBrowser = function() {\n\t// In the browser, we load tiddlers from certain elements\n\tvar containerSelectors = [\n\t\t// IDs for old-style v5.1.x tiddler stores\n\t\t\"#libraryModules\",\n\t\t\"#modules\",\n\t\t\"#bootKernelPrefix\",\n\t\t\"#bootKernel\",\n\t\t\"#styleArea\",\n\t\t\"#storeArea\",\n\t\t\"#systemArea\",\n\t\t// Classes for new-style v5.2.x JSON tiddler stores\n\t\t\"script.tiddlywiki-tiddler-store\"\n\t];\n\tfor(var t=0; t<containerSelectors.length; t++) {\n\t\tvar nodes = document.querySelectorAll(containerSelectors[t]);\n\t\tfor(var n=0; n<nodes.length; n++) {\n\t\t\t$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers(\"(DOM)\",nodes[n]));\n\t\t}\n\t}\n};\n\n} else {\n\n/////////////////////////// Server definitions\n\n/*\nGet any encrypted tiddlers\n*/\n$tw.boot.decryptEncryptedTiddlers = function(callback) {\n\t// Storing encrypted tiddlers on the server isn't supported yet\n\tcallback();\n};\n\n} // End of if($tw.browser && !$tw.node)\n\n/////////////////////////// Node definitions\n\nif($tw.node) {\n\n/*\nLoad the tiddlers contained in a particular file (and optionally extract fields from the accompanying .meta file) returned as {filepath:,type:,tiddlers:[],hasMetaFile:}\n*/\n$tw.loadTiddlersFromFile = function(filepath,fields) {\n\tvar ext = path.extname(filepath),\n\t\textensionInfo = $tw.utils.getFileExtensionInfo(ext),\n\t\ttype = extensionInfo ? extensionInfo.type : null,\n\t\ttypeInfo = type ? $tw.config.contentTypeInfo[type] : null,\n\t\tdata = fs.readFileSync(filepath,typeInfo ? typeInfo.encoding : \"utf8\"),\n\t\ttiddlers = $tw.wiki.deserializeTiddlers(ext,data,fields),\n\t\tmetadata = $tw.loadMetadataForFile(filepath);\n\tif(metadata) {\n\t\tif(type === \"application/json\") {\n\t\t\ttiddlers = [{text: data, type: \"application/json\"}];\n\t\t}\n\t\ttiddlers = [$tw.utils.extend({},tiddlers[0],metadata)];\n\t}\n\treturn {filepath: filepath, type: type, tiddlers: tiddlers, hasMetaFile: !!metadata};\n};\n\n/*\nLoad the metadata fields in the .meta file corresponding to a particular file\n*/\n$tw.loadMetadataForFile = function(filepath) {\n\tvar metafilename = filepath + \".meta\";\n\tif(fs.existsSync(metafilename)) {\n\t\treturn $tw.utils.parseFields(fs.readFileSync(metafilename,\"utf8\") || \"\");\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nA default set of files for TiddlyWiki to ignore during load.\nThis matches what NPM ignores, and adds \"*.meta\" to ignore tiddler\nmetadata files.\n*/\n$tw.boot.excludeRegExp = /^\\.DS_Store$|^.*\\.meta$|^\\..*\\.swp$|^\\._.*$|^\\.git$|^\\.hg$|^\\.lock-wscript$|^\\.svn$|^\\.wafpickle-.*$|^CVS$|^npm-debug\\.log$/;\n\n/*\nLoad all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property.\n*/\n$tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {\n\texcludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;\n\tvar tiddlers = [];\n\tif(fs.existsSync(filepath)) {\n\t\tvar stat = fs.statSync(filepath);\n\t\tif(stat.isDirectory()) {\n\t\t\tvar files = fs.readdirSync(filepath);\n\t\t\t// Look for a tiddlywiki.files file\n\t\t\tif(files.indexOf(\"tiddlywiki.files\") !== -1) {\n\t\t\t\tArray.prototype.push.apply(tiddlers,$tw.loadTiddlersFromSpecification(filepath,excludeRegExp));\n\t\t\t} else {\n\t\t\t\t// If not, read all the files in the directory\n\t\t\t\t$tw.utils.each(files,function(file) {\n\t\t\t\t\tif(!excludeRegExp.test(file) && file !== \"plugin.info\") {\n\t\t\t\t\t\ttiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(filepath + path.sep + file,excludeRegExp));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} else if(stat.isFile()) {\n\t\t\ttiddlers.push($tw.loadTiddlersFromFile(filepath,{title: filepath}));\n\t\t}\n\t}\n\treturn tiddlers;\n};\n\n/*\nLoad all the tiddlers defined by a `tiddlywiki.files` specification file\nfilepath: pathname of the directory containing the specification file\n*/\n$tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {\n\tvar tiddlers = [];\n\t// Read the specification\n\tvar filesInfo = $tw.utils.parseJSONSafe(fs.readFileSync(filepath + path.sep + \"tiddlywiki.files\",\"utf8\"));\n\t// Helper to process a file\n\tvar processFile = function(filename,isTiddlerFile,fields,isEditableFile) {\n\t\tvar extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],\n\t\t\ttype = (extInfo || {}).type || fields.type || \"text/plain\",\n\t\t\ttypeInfo = $tw.config.contentTypeInfo[type] || {},\n\t\t\tpathname = path.resolve(filepath,filename),\n\t\t\ttext = fs.readFileSync(pathname,typeInfo.encoding || \"utf8\"),\n\t\t\tmetadata = $tw.loadMetadataForFile(pathname) || {},\n\t\t\tfileTiddlers;\n\t\tif(isTiddlerFile) {\n\t\t\tfileTiddlers = $tw.wiki.deserializeTiddlers(path.extname(pathname),text,metadata) || [];\n\t\t} else {\n\t\t\tfileTiddlers =  [$tw.utils.extend({text: text},metadata)];\n\t\t}\n\t\tvar combinedFields = $tw.utils.extend({},fields,metadata);\n\t\t$tw.utils.each(fileTiddlers,function(tiddler) {\n\t\t\t$tw.utils.each(combinedFields,function(fieldInfo,name) {\n\t\t\t\tif(typeof fieldInfo === \"string\" || $tw.utils.isArray(fieldInfo)) {\n\t\t\t\t\ttiddler[name] = fieldInfo;\n\t\t\t\t} else {\n\t\t\t\t\tvar value = tiddler[name];\n\t\t\t\t\tswitch(fieldInfo.source) {\n\t\t\t\t\t\tcase \"filename\":\n\t\t\t\t\t\t\tvalue = path.basename(filename);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"filename-uri-decoded\":\n\t\t\t\t\t\t\tvalue = $tw.utils.decodeURIComponentSafe(path.basename(filename));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"basename\":\n\t\t\t\t\t\t\tvalue = path.basename(filename,path.extname(filename));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"basename-uri-decoded\":\n\t\t\t\t\t\t\tvalue = $tw.utils.decodeURIComponentSafe(path.basename(filename,path.extname(filename)));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"extname\":\n\t\t\t\t\t\t\tvalue = path.extname(filename);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"created\":\n\t\t\t\t\t\t\tvalue = new Date(fs.statSync(pathname).birthtime);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"modified\":\n\t\t\t\t\t\t\tvalue = new Date(fs.statSync(pathname).mtime);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif(fieldInfo.prefix) {\n\t\t\t\t\t\tvalue = fieldInfo.prefix + value;\n\t\t\t\t\t}\n\t\t\t\t\tif(fieldInfo.suffix) {\n\t\t\t\t\t\tvalue = value + fieldInfo.suffix;\n\t\t\t\t\t}\n\t\t\t\t\ttiddler[name] = value;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\tif(isEditableFile) {\n\t\t\ttiddlers.push({filepath: pathname, hasMetaFile: !!metadata && !isTiddlerFile, isEditableFile: true, tiddlers: fileTiddlers});\n\t\t} else {\n\t\t\ttiddlers.push({tiddlers: fileTiddlers});\n\t\t}\n\t};\n\t// Helper to recursively search subdirectories\n\tvar getAllFiles = function(dirPath, recurse, arrayOfFiles) {\n\t\trecurse = recurse || false;\n\t\tarrayOfFiles = arrayOfFiles || [];\n\t\tvar files = fs.readdirSync(dirPath);\n\t\tfiles.forEach(function(file) {\n\t\t\tif (recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {\n\t\t\t\tarrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);\n\t\t\t} else if(fs.statSync(dirPath + path.sep + file).isFile()){\n\t\t\t\tarrayOfFiles.push(path.join(dirPath, path.sep, file));\n\t\t\t}\n\t\t});\n\t\treturn arrayOfFiles;\n\t}\n\t// Process the listed tiddlers\n\t$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {\n\t\tif(tidInfo.prefix && tidInfo.suffix) {\n\t\t\ttidInfo.fields.text = {prefix: tidInfo.prefix,suffix: tidInfo.suffix};\n\t\t} else if(tidInfo.prefix) {\n\t\t\ttidInfo.fields.text = {prefix: tidInfo.prefix};\n\t\t} else if(tidInfo.suffix) {\n\t\t\ttidInfo.fields.text = {suffix: tidInfo.suffix};\n\t\t}\n\t\tprocessFile(tidInfo.file,tidInfo.isTiddlerFile,tidInfo.fields);\n\t});\n\t// Process any listed directories\n\t$tw.utils.each(filesInfo.directories,function(dirSpec) {\n\t\t// Read literal directories directly\n\t\tif(typeof dirSpec === \"string\") {\n\t\t\tvar pathname = path.resolve(filepath,dirSpec);\n\t\t\tif(fs.existsSync(pathname) && fs.statSync(pathname).isDirectory()) {\n\t\t\t\ttiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(pathname,excludeRegExp));\n\t\t\t}\n\t\t} else {\n\t\t\t// Process directory specifier\n\t\t\tvar dirPath = path.resolve(filepath,dirSpec.path);\n\t\t\tif(fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {\n\t\t\t\tvar\tfiles = getAllFiles(dirPath, dirSpec.searchSubdirectories),\n\t\t\t\t\tfileRegExp = new RegExp(dirSpec.filesRegExp || \"^.*$\"),\n\t\t\t\t\tmetaRegExp = /^.*\\.meta$/;\n\t\t\t\tfor(var t=0; t<files.length; t++) {\n\t\t\t\t\tvar thisPath = path.relative(filepath, files[t]),\n\t\t\t\t\tfilename = path.basename(thisPath);\n\t\t\t\t\tif(filename !== \"tiddlywiki.files\" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {\n\t\t\t\t\t\tprocessFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconsole.log(\"Warning: a directory in a tiddlywiki.files file does not exist.\");\n\t\t\t\tconsole.log(\"dirPath: \" + dirPath);\n\t\t\t\tconsole.log(\"tiddlywiki.files location: \" + filepath);\n\t\t\t}\n\t\t}\n\t});\n\treturn tiddlers;\n};\n\n/*\nLoad the tiddlers from a plugin folder, and package them up into a proper JSON plugin tiddler\n*/\n$tw.loadPluginFolder = function(filepath,excludeRegExp) {\n\texcludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;\n\tvar infoPath = filepath + path.sep + \"plugin.info\";\n\tif(fs.existsSync(filepath) && fs.statSync(filepath).isDirectory()) {\n\t\t// Read the plugin information\n\t\tif(!fs.existsSync(infoPath) || !fs.statSync(infoPath).isFile()) {\n\t\t\tconsole.log(\"Warning: missing plugin.info file in \" + filepath);\n\t\t\treturn null;\n\t\t}\n\t\tvar pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,\"utf8\"));\n\t\t// Read the plugin files\n\t\tvar pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);\n\t\t// Save the plugin tiddlers into the plugin info\n\t\tpluginInfo.tiddlers = pluginInfo.tiddlers || Object.create(null);\n\t\tfor(var f=0; f<pluginFiles.length; f++) {\n\t\t\tvar tiddlers = pluginFiles[f].tiddlers;\n\t\t\tfor(var t=0; t<tiddlers.length; t++) {\n\t\t\t\tvar tiddler= tiddlers[t];\n\t\t\t\tif(tiddler.title) {\n\t\t\t\t\tpluginInfo.tiddlers[tiddler.title] = tiddler;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Give the plugin the same version number as the core if it doesn't have one\n\t\tif(!(\"version\" in pluginInfo)) {\n\t\t\tpluginInfo.version = $tw.packageInfo.version;\n\t\t}\n\t\t// Use \"plugin\" as the plugin-type if we don't have one\n\t\tif(!(\"plugin-type\" in pluginInfo)) {\n\t\t\tpluginInfo[\"plugin-type\"] = \"plugin\";\n\t\t}\n\t\tpluginInfo.dependents = pluginInfo.dependents || [];\n\t\tpluginInfo.type = \"application/json\";\n\t\t// Set plugin text\n\t\tpluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers});\n\t\tdelete pluginInfo.tiddlers;\n\t\t// Deserialise array fields (currently required for the dependents field)\n\t\tfor(var field in pluginInfo) {\n\t\t\tif($tw.utils.isArray(pluginInfo[field])) {\n\t\t\t\tpluginInfo[field] = $tw.utils.stringifyList(pluginInfo[field]);\n\t\t\t}\n\t\t}\n\t\treturn pluginInfo;\n\t} else {\n\t\t\treturn null;\n\t}\n};\n\n/*\nname: Name of the plugin to find\npaths: array of file paths to search for it\nReturns the path of the plugin folder\n*/\n$tw.findLibraryItem = function(name,paths) {\n\tvar pathIndex = 0;\n\tdo {\n\t\tvar pluginPath = path.resolve(paths[pathIndex],\"./\" + name)\n\t\tif(fs.existsSync(pluginPath) && fs.statSync(pluginPath).isDirectory()) {\n\t\t\treturn pluginPath;\n\t\t}\n\t} while(++pathIndex < paths.length);\n\treturn null;\n};\n\n/*\nname: Name of the plugin to load\npaths: array of file paths to search for it\n*/\n$tw.loadPlugin = function(name,paths) {\n\tvar pluginPath = $tw.findLibraryItem(name,paths);\n\tif(pluginPath) {\n\t\tvar pluginFields = $tw.loadPluginFolder(pluginPath);\n\t\tif(pluginFields) {\n\t\t\t$tw.wiki.addTiddler(pluginFields);\n\t\t\treturn;\n\t\t}\n\t}\n\tconsole.log(\"Warning: Cannot find plugin '\" + name + \"'\");\n};\n\n/*\nlibraryPath: Path of library folder for these plugins (relative to core path)\nenvVar: Environment variable name for these plugins\nReturns an array of search paths\n*/\n$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {\n\tvar pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],\n\t\tenv = process.env[envVar];\n\tif(env) {\n\t\tenv.split(path.delimiter).map(function(item) {\n\t\t\tif(item) {\n\t\t\t\tpluginPaths.push(item);\n\t\t\t}\n\t\t});\n\t}\n\treturn pluginPaths;\n};\n\n/*\nplugins: Array of names of plugins (eg, \"tiddlywiki/filesystemadaptor\")\nlibraryPath: Path of library folder for these plugins (relative to core path)\nenvVar: Environment variable name for these plugins\n*/\n$tw.loadPlugins = function(plugins,libraryPath,envVar) {\n\tif(plugins) {\n\t\tvar pluginPaths = $tw.getLibraryItemSearchPaths(libraryPath,envVar);\n\t\tfor(var t=0; t<plugins.length; t++) {\n\t\t\t$tw.loadPlugin(plugins[t],pluginPaths);\n\t\t}\n\t}\n};\n\n/*\npath: path of wiki directory\noptions:\n\tparentPaths: array of parent paths that we mustn't recurse into\n\treadOnly: true if the tiddler file paths should not be retained\n*/\n$tw.loadWikiTiddlers = function(wikiPath,options) {\n\toptions = options || {};\n\tvar parentPaths = options.parentPaths || [],\n\t\twikiInfoPath = path.resolve(wikiPath,$tw.config.wikiInfo),\n\t\twikiInfo,\n\t\tpluginFields;\n\t// Bail if we don't have a wiki info file\n\tif(fs.existsSync(wikiInfoPath)) {\n\t\twikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,\"utf8\"));\n\t} else {\n\t\treturn null;\n\t}\n\t// Save the path to the tiddlers folder for the filesystemadaptor\n\tvar config = wikiInfo.config || {};\n\tif($tw.boot.wikiPath == wikiPath) {\n\t\t$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config[\"default-tiddler-location\"] || $tw.config.wikiTiddlersSubDir);\n\t}\n\t// Load any parent wikis\n\tif(wikiInfo.includeWikis) {\n\t\tparentPaths = parentPaths.slice(0);\n\t\tparentPaths.push(wikiPath);\n\t\t$tw.utils.each(wikiInfo.includeWikis,function(info) {\n\t\t\tif(typeof info === \"string\") {\n\t\t\t\tinfo = {path: info};\n\t\t\t}\n\t\t\tvar resolvedIncludedWikiPath = path.resolve(wikiPath,info.path);\n\t\t\tif(parentPaths.indexOf(resolvedIncludedWikiPath) === -1) {\n\t\t\t\tvar subWikiInfo = $tw.loadWikiTiddlers(resolvedIncludedWikiPath,{\n\t\t\t\t\tparentPaths: parentPaths,\n\t\t\t\t\treadOnly: info[\"read-only\"]\n\t\t\t\t});\n\t\t\t\t// Merge the build targets\n\t\t\t\twikiInfo.build = $tw.utils.extend([],subWikiInfo.build,wikiInfo.build);\n\t\t\t} else {\n\t\t\t\t$tw.utils.error(\"Cannot recursively include wiki \" + resolvedIncludedWikiPath);\n\t\t\t}\n\t\t});\n\t}\n\t// Load any plugins, themes and languages listed in the wiki info file\n\t$tw.loadPlugins(wikiInfo.plugins,$tw.config.pluginsPath,$tw.config.pluginsEnvVar);\n\t$tw.loadPlugins(wikiInfo.themes,$tw.config.themesPath,$tw.config.themesEnvVar);\n\t$tw.loadPlugins(wikiInfo.languages,$tw.config.languagesPath,$tw.config.languagesEnvVar);\n\t// Load the wiki files, registering them as writable\n\tvar resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);\n\t$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {\n\t\tif(!options.readOnly && tiddlerFile.filepath) {\n\t\t\t$tw.utils.each(tiddlerFile.tiddlers,function(tiddler) {\n\t\t\t\t$tw.boot.files[tiddler.title] = {\n\t\t\t\t\tfilepath: tiddlerFile.filepath,\n\t\t\t\t\ttype: tiddlerFile.type,\n\t\t\t\t\thasMetaFile: tiddlerFile.hasMetaFile,\n\t\t\t\t\tisEditableFile: config[\"retain-original-tiddler-path\"] || tiddlerFile.isEditableFile || tiddlerFile.filepath.indexOf($tw.boot.wikiTiddlersPath) !== 0\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t\t$tw.wiki.addTiddlers(tiddlerFile.tiddlers);\n\t});\n\tif ($tw.boot.wikiPath == wikiPath) {\n\t\t// Save the original tiddler file locations if requested\n\t\tvar output = {}, relativePath, fileInfo;\n\t\tfor(var title in $tw.boot.files) {\n\t\t\tfileInfo = $tw.boot.files[title];\n\t\t\tif(fileInfo.isEditableFile) {\n\t\t\t\trelativePath = path.relative($tw.boot.wikiTiddlersPath,fileInfo.filepath);\n\t\t\t\tfileInfo.originalpath = relativePath;\n\t\t\t\toutput[title] =\n\t\t\t\t\tpath.sep === \"/\" ?\n\t\t\t\t\trelativePath :\n\t\t\t\t\trelativePath.split(path.sep).join(\"/\");\n\t\t\t}\n\t\t}\n\t\tif(Object.keys(output).length > 0){\n\t\t\t$tw.wiki.addTiddler({title: \"$:/config/OriginalTiddlerPaths\", type: \"application/json\", text: JSON.stringify(output)});\n\t\t}\n\t}\n\t// Load any plugins within the wiki folder\n\tvar wikiPluginsPath = path.resolve(wikiPath,$tw.config.wikiPluginsSubDir);\n\tif(fs.existsSync(wikiPluginsPath)) {\n\t\tvar pluginFolders = fs.readdirSync(wikiPluginsPath);\n\t\tfor(var t=0; t<pluginFolders.length; t++) {\n\t\t\tpluginFields = $tw.loadPluginFolder(path.resolve(wikiPluginsPath,\"./\" + pluginFolders[t]));\n\t\t\tif(pluginFields) {\n\t\t\t\t$tw.wiki.addTiddler(pluginFields);\n\t\t\t}\n\t\t}\n\t}\n\t// Load any themes within the wiki folder\n\tvar wikiThemesPath = path.resolve(wikiPath,$tw.config.wikiThemesSubDir);\n\tif(fs.existsSync(wikiThemesPath)) {\n\t\tvar themeFolders = fs.readdirSync(wikiThemesPath);\n\t\tfor(var t=0; t<themeFolders.length; t++) {\n\t\t\tpluginFields = $tw.loadPluginFolder(path.resolve(wikiThemesPath,\"./\" + themeFolders[t]));\n\t\t\tif(pluginFields) {\n\t\t\t\t$tw.wiki.addTiddler(pluginFields);\n\t\t\t}\n\t\t}\n\t}\n\t// Load any languages within the wiki folder\n\tvar wikiLanguagesPath = path.resolve(wikiPath,$tw.config.wikiLanguagesSubDir);\n\tif(fs.existsSync(wikiLanguagesPath)) {\n\t\tvar languageFolders = fs.readdirSync(wikiLanguagesPath);\n\t\tfor(var t=0; t<languageFolders.length; t++) {\n\t\t\tpluginFields = $tw.loadPluginFolder(path.resolve(wikiLanguagesPath,\"./\" + languageFolders[t]));\n\t\t\tif(pluginFields) {\n\t\t\t\t$tw.wiki.addTiddler(pluginFields);\n\t\t\t}\n\t\t}\n\t}\n\treturn wikiInfo;\n};\n\n$tw.loadTiddlersNode = function() {\n\t// Load the boot tiddlers\n\t$tw.utils.each($tw.loadTiddlersFromPath($tw.boot.bootPath),function(tiddlerFile) {\n\t\t$tw.wiki.addTiddlers(tiddlerFile.tiddlers);\n\t});\n\t// Load the core tiddlers\n\t$tw.wiki.addTiddler($tw.loadPluginFolder($tw.boot.corePath));\n\t// Load any extra plugins\n\t$tw.utils.each($tw.boot.extraPlugins,function(name) {\n\t\tif(name.charAt(0) === \"+\") { // Relative path to plugin\n\t\t\tvar pluginFields = $tw.loadPluginFolder(name.substring(1));\n\t\t\tif(pluginFields) {\n\t\t\t\t$tw.wiki.addTiddler(pluginFields);\n\t\t\t}\n\t\t} else {\n\t\t\tvar parts = name.split(\"/\"),\n\t\t\t\ttype = parts[0];\n\t\t\tif(parts.length  === 3 && [\"plugins\",\"themes\",\"languages\"].indexOf(type) !== -1) {\n\t\t\t\t$tw.loadPlugins([parts[1] + \"/\" + parts[2]],$tw.config[type + \"Path\"],$tw.config[type + \"EnvVar\"]);\n\t\t\t}\n\t\t}\n\t});\n\t// Load the tiddlers from the wiki directory\n\tif($tw.boot.wikiPath) {\n\t\t$tw.boot.wikiInfo = $tw.loadWikiTiddlers($tw.boot.wikiPath);\n\t}\n};\n\n// End of if($tw.node)\n}\n\n/////////////////////////// Main startup function called once tiddlers have been decrypted\n\n/*\nStartup TiddlyWiki\n*/\n$tw.boot.initStartup = function(options) {\n\t// Get the URL hash and check for safe mode\n\t$tw.locationHash = \"#\";\n\tif($tw.browser && !$tw.node) {\n\t\tif(location.hash === \"#:safe\") {\n\t\t\t$tw.safeMode = true;\n\t\t} else {\n\t\t\t$tw.locationHash = $tw.utils.getLocationHash();\n\t\t}\n\t}\n\t// Initialise some more $tw properties\n\t$tw.utils.deepDefaults($tw,{\n\t\tmodules: { // Information about each module\n\t\t\ttitles: Object.create(null), // hashmap by module title of {fn:, exports:, moduleType:}\n\t\t\ttypes: {} // hashmap by module type of hashmap of exports\n\t\t},\n\t\tconfig: { // Configuration overridables\n\t\t\tpluginsPath: \"../plugins/\",\n\t\t\tthemesPath: \"../themes/\",\n\t\t\tlanguagesPath: \"../languages/\",\n\t\t\teditionsPath: \"../editions/\",\n\t\t\twikiInfo: \"./tiddlywiki.info\",\n\t\t\twikiPluginsSubDir: \"./plugins\",\n\t\t\twikiThemesSubDir: \"./themes\",\n\t\t\twikiLanguagesSubDir: \"./languages\",\n\t\t\twikiTiddlersSubDir: \"./tiddlers\",\n\t\t\twikiOutputSubDir: \"./output\",\n\t\t\tjsModuleHeaderRegExpString: \"^\\\\/\\\\*\\\\\\\\(?:\\\\r?\\\\n)((?:^[^\\\\r\\\\n]*(?:\\\\r?\\\\n))+?)(^\\\\\\\\\\\\*\\\\/$(?:\\\\r?\\\\n)?)\",\n\t\t\tfileExtensionInfo: Object.create(null), // Map file extension to {type:}\n\t\t\tcontentTypeInfo: Object.create(null), // Map type to {encoding:,extension:}\n\t\t\tpluginsEnvVar: \"TIDDLYWIKI_PLUGIN_PATH\",\n\t\t\tthemesEnvVar: \"TIDDLYWIKI_THEME_PATH\",\n\t\t\tlanguagesEnvVar: \"TIDDLYWIKI_LANGUAGE_PATH\",\n\t\t\teditionsEnvVar: \"TIDDLYWIKI_EDITION_PATH\"\n\t\t},\n\t\tlog: {}, // Log flags\n\t\tunloadTasks: []\n\t});\n\tif(!$tw.boot.tasks.readBrowserTiddlers) {\n\t\t// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:}\n\t\t$tw.boot.files = Object.create(null);\n\t\t// System paths and filenames\n\t\t$tw.boot.bootPath = options.bootPath || path.dirname(module.filename);\n\t\t$tw.boot.corePath = path.resolve($tw.boot.bootPath,\"../core\");\n\t\t// If there's no arguments then default to `--help`\n\t\tif($tw.boot.argv.length === 0) {\n\t\t\t$tw.boot.argv = [\"--help\"];\n\t\t}\n\t\t// Parse any extra plugin references\n\t\t$tw.boot.extraPlugins = $tw.boot.extraPlugins || [];\n\t\twhile($tw.boot.argv[0] && $tw.boot.argv[0].indexOf(\"+\") === 0) {\n\t\t\t$tw.boot.extraPlugins.push($tw.boot.argv[0].substring(1));\n\t\t\t$tw.boot.argv.splice(0,1);\n\t\t}\n\t\t// If the first command line argument doesn't start with `--` then we\n\t\t// interpret it as the path to the wiki folder, which will otherwise default\n\t\t// to the current folder\n\t\tif($tw.boot.argv[0] && $tw.boot.argv[0].indexOf(\"--\") !== 0) {\n\t\t\t$tw.boot.wikiPath = $tw.boot.argv[0];\n\t\t\t$tw.boot.argv = $tw.boot.argv.slice(1);\n\t\t} else {\n\t\t\t$tw.boot.wikiPath = process.cwd();\n\t\t}\n\t\t// Read package info\n\t\t$tw.packageInfo = $tw.packageInfo || require(\"../package.json\");\n\t\t// Check node version number\n\t\tif(!$tw.utils.checkVersions(process.version.substr(1),$tw.packageInfo.engines.node.substr(2))) {\n\t\t\t$tw.utils.error(\"TiddlyWiki5 requires node.js version \" + $tw.packageInfo.engines.node);\n\t\t}\n\t}\n\t// Add file extension information\n\t$tw.utils.registerFileType(\"text/vnd.tiddlywiki\",\"utf8\",\".tid\");\n\t$tw.utils.registerFileType(\"application/x-tiddler\",\"utf8\",\".tid\");\n\t$tw.utils.registerFileType(\"application/x-tiddlers\",\"utf8\",\".multids\");\n\t$tw.utils.registerFileType(\"application/x-tiddler-html-div\",\"utf8\",\".tiddler\");\n\t$tw.utils.registerFileType(\"text/vnd.tiddlywiki2-recipe\",\"utf8\",\".recipe\");\n\t$tw.utils.registerFileType(\"text/plain\",\"utf8\",\".txt\");\n\t$tw.utils.registerFileType(\"text/css\",\"utf8\",\".css\");\n\t$tw.utils.registerFileType(\"text/html\",\"utf8\",[\".html\",\".htm\"]);\n\t$tw.utils.registerFileType(\"application/hta\",\"utf16le\",\".hta\",{deserializerType:\"text/html\"});\n\t$tw.utils.registerFileType(\"application/javascript\",\"utf8\",\".js\");\n\t$tw.utils.registerFileType(\"application/json\",\"utf8\",\".json\");\n\t$tw.utils.registerFileType(\"application/pdf\",\"base64\",\".pdf\",{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"application/zip\",\"base64\",\".zip\");\n\t$tw.utils.registerFileType(\"application/x-zip-compressed\",\"base64\",\".zip\");\n\t$tw.utils.registerFileType(\"image/jpeg\",\"base64\",[\".jpg\",\".jpeg\"],{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"image/jpg\",\"base64\",[\".jpg\",\".jpeg\"],{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"image/png\",\"base64\",\".png\",{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"image/gif\",\"base64\",\".gif\",{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"image/webp\",\"base64\",\".webp\",{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"image/heic\",\"base64\",\".heic\",{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"image/heif\",\"base64\",\".heif\",{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"image/svg+xml\",\"utf8\",\".svg\",{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"image/vnd.microsoft.icon\",\"base64\",\".ico\",{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"image/x-icon\",\"base64\",\".ico\",{flags:[\"image\"]});\n\t$tw.utils.registerFileType(\"application/font-woff\",\"base64\",\".woff\");\n\t$tw.utils.registerFileType(\"application/x-font-ttf\",\"base64\",\".woff\");\n\t$tw.utils.registerFileType(\"application/font-woff2\",\"base64\",\".woff2\");\n\t$tw.utils.registerFileType(\"audio/ogg\",\"base64\",\".ogg\");\n\t$tw.utils.registerFileType(\"video/ogg\",\"base64\",[\".ogm\",\".ogv\",\".ogg\"]);\n\t$tw.utils.registerFileType(\"video/webm\",\"base64\",\".webm\");\n\t$tw.utils.registerFileType(\"video/mp4\",\"base64\",\".mp4\");\n\t$tw.utils.registerFileType(\"audio/mp3\",\"base64\",\".mp3\");\n\t$tw.utils.registerFileType(\"audio/mp4\",\"base64\",[\".mp4\",\".m4a\"]);\n\t$tw.utils.registerFileType(\"text/markdown\",\"utf8\",[\".md\",\".markdown\"],{deserializerType:\"text/x-markdown\"});\n\t$tw.utils.registerFileType(\"text/x-markdown\",\"utf8\",[\".md\",\".markdown\"]);\n\t$tw.utils.registerFileType(\"application/enex+xml\",\"utf8\",\".enex\");\n\t$tw.utils.registerFileType(\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\"base64\",\".docx\");\n\t$tw.utils.registerFileType(\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\"base64\",\".xlsx\");\n\t$tw.utils.registerFileType(\"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\"base64\",\".pptx\");\n\t$tw.utils.registerFileType(\"text/x-bibtex\",\"utf8\",\".bib\",{deserializerType:\"application/x-bibtex\"});\n\t$tw.utils.registerFileType(\"application/x-bibtex\",\"utf8\",\".bib\");\n\t$tw.utils.registerFileType(\"application/epub+zip\",\"base64\",\".epub\");\n\t$tw.utils.registerFileType(\"application/octet-stream\",\"base64\",\".octet-stream\");\n\t// Create the wiki store for the app\n\t$tw.wiki = new $tw.Wiki();\n\t// Install built in tiddler fields modules\n\t$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap(\"tiddlerfield\");\n\t// Install the tiddler deserializer modules\n\t$tw.Wiki.tiddlerDeserializerModules = Object.create(null);\n\t$tw.modules.applyMethods(\"tiddlerdeserializer\",$tw.Wiki.tiddlerDeserializerModules);\n\t// Call unload handlers in the browser\n\tif($tw.browser) {\n\t\twindow.onbeforeunload = function(event) {\n\t\t\tevent = event || {};\n\t\t\tvar result;\n\t\t\t$tw.utils.each($tw.unloadTasks,function(task) {\n\t\t\t\tvar r = task(event);\n\t\t\t\tif(r) {\n\t\t\t\t\tresult = r;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn result;\n\t\t}\n\t}\n};\n$tw.boot.loadStartup = function(options){\n\n\t// Load tiddlers\n\tif($tw.boot.tasks.readBrowserTiddlers) {\n\t\t$tw.loadTiddlersBrowser();\n\t} else {\n\t\t$tw.loadTiddlersNode();\n\t}\n\t// Load any preloaded tiddlers\n\tif($tw.preloadTiddlers) {\n\t\t$tw.wiki.addTiddlers($tw.preloadTiddlers);\n\t}\n\t// Give hooks a chance to modify the store\n\t$tw.hooks.invokeHook(\"th-boot-tiddlers-loaded\");\n}\n$tw.boot.execStartup = function(options){\n\t// Unpack plugin tiddlers\n\t$tw.wiki.readPluginInfo();\n\t$tw.wiki.registerPluginTiddlers(\"plugin\",$tw.safeMode ? [\"$:/core\"] : undefined);\n\t$tw.wiki.unpackPluginTiddlers();\n\t// Process \"safe mode\"\n\tif($tw.safeMode) {\n\t\t$tw.wiki.processSafeMode();\n\t}\n\t// Register typed modules from the tiddlers we've just loaded\n\t$tw.wiki.defineTiddlerModules();\n\t// And any modules within plugins\n\t$tw.wiki.defineShadowModules();\n\t// Make sure the crypto state tiddler is up to date\n\tif($tw.crypto) {\n\t\t$tw.crypto.updateCryptoStateTiddler();\n\t}\n\t// Gather up any startup modules\n\t$tw.boot.remainingStartupModules = []; // Array of startup modules\n\t$tw.modules.forEachModuleOfType(\"startup\",function(title,module) {\n\t\tif(module.startup) {\n\t\t\t$tw.boot.remainingStartupModules.push(module);\n\t\t}\n\t});\n\t// Keep track of the startup tasks that have been executed\n\t$tw.boot.executedStartupModules = Object.create(null);\n\t$tw.boot.disabledStartupModules = $tw.boot.disabledStartupModules || [];\n\t// Repeatedly execute the next eligible task\n\t$tw.boot.executeNextStartupTask(options.callback);\n}\n/*\nStartup TiddlyWiki\n*/\n$tw.boot.startup = function(options) {\n\toptions = options || {};\n\t// Get the URL hash and check for safe mode\n\t$tw.boot.initStartup(options);\n\t$tw.boot.loadStartup(options);\n\t$tw.boot.execStartup(options);\n};\n\n/*\nAdd another unload task\n*/\n$tw.addUnloadTask = function(task) {\n\tif($tw.unloadTasks.indexOf(task) === -1) {\n\t\t$tw.unloadTasks.push(task);\n\t}\n}\n\n/*\nExecute the remaining eligible startup tasks\n*/\n$tw.boot.executeNextStartupTask = function(callback) {\n\t// Find the next eligible task\n\tvar taskIndex = 0, task,\n\t\tasyncTaskCallback = function() {\n\t\t\tif(task.name) {\n\t\t\t\t$tw.boot.executedStartupModules[task.name] = true;\n\t\t\t}\n\t\t\treturn $tw.boot.executeNextStartupTask(callback);\n\t\t};\n\twhile(taskIndex < $tw.boot.remainingStartupModules.length) {\n\t\ttask = $tw.boot.remainingStartupModules[taskIndex];\n\t\tif($tw.boot.isStartupTaskEligible(task)) {\n\t\t\t// Remove this task from the list\n\t\t\t$tw.boot.remainingStartupModules.splice(taskIndex,1);\n\t\t\t// Assemble log message\n\t\t\tvar s = [\"Startup task:\",task.name];\n\t\t\tif(task.platforms) {\n\t\t\t\ts.push(\"platforms:\",task.platforms.join(\",\"));\n\t\t\t}\n\t\t\tif(task.after) {\n\t\t\t\ts.push(\"after:\",task.after.join(\",\"));\n\t\t\t}\n\t\t\tif(task.before) {\n\t\t\t\ts.push(\"before:\",task.before.join(\",\"));\n\t\t\t}\n\t\t\t$tw.boot.log(s.join(\" \"));\n\t\t\t// Execute task\n\t\t\tif(!$tw.utils.hop(task,\"synchronous\") || task.synchronous) {\n\t\t\t\ttask.startup();\n\t\t\t\tif(task.name) {\n\t\t\t\t\t$tw.boot.executedStartupModules[task.name] = true;\n\t\t\t\t}\n\t\t\t\treturn $tw.boot.executeNextStartupTask(callback);\n\t\t\t} else {\n\t\t\t\ttask.startup(asyncTaskCallback);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\ttaskIndex++;\n\t}\n\tif(typeof callback === 'function') {\n\t\tcallback();\n\t}\n\treturn false;\n};\n\n/*\nReturns true if we are running on one of the platforms specified in taskModule's\n`platforms` array; or if `platforms` property is not defined.\n*/\n$tw.boot.doesTaskMatchPlatform = function(taskModule) {\n\tvar platforms = taskModule.platforms;\n\tif(platforms) {\n\t\tfor(var t=0; t<platforms.length; t++) {\n\t\t\tswitch (platforms[t]) {\n\t\t\t\tcase \"browser\":\n\t\t\t\t\tif ($tw.browser) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"node\":\n\t\t\t\t\tif ($tw.node) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$tw.utils.error(\"Module \" + taskModule.name + \": '\" + platforms[t] + \"' in export.platforms invalid\");\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\treturn true;\n};\n\n$tw.boot.isStartupTaskEligible = function(taskModule) {\n\tvar t;\n\t// Check that the platform is correct\n\tif(!$tw.boot.doesTaskMatchPlatform(taskModule)) {\n\t\treturn false;\n\t}\n\tvar name = taskModule.name,\n\t\tremaining = $tw.boot.remainingStartupModules;\n\tif(name) {\n\t\t// Fail if this module is disabled\n\t\tif($tw.boot.disabledStartupModules.indexOf(name) !== -1) {\n\t\t\treturn false;\n\t\t}\n\t\t// Check that no other outstanding tasks must be executed before this one\n\t\tfor(t=0; t<remaining.length; t++) {\n\t\t\tvar task = remaining[t];\n\t\t\tif(task.before && task.before.indexOf(name) !== -1) {\n\t\t\t\tif($tw.boot.doesTaskMatchPlatform(task) || (task.name && $tw.boot.disabledStartupModules.indexOf(name) !== -1)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Check that all of the tasks that we must be performed after has been done\n\tvar after = taskModule.after;\n\tif(after) {\n\t\tfor(t=0; t<after.length; t++) {\n\t\t\tif(!$tw.boot.executedStartupModules[after[t]]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n};\n\n/*\nGlobal Hooks mechanism which allows plugins to modify default functionality\n*/\n$tw.hooks = $tw.hooks || { names: {}};\n\n/*\nAdd hooks to the  hashmap\n*/\n$tw.hooks.addHook = function(hookName,definition) {\n\tif($tw.utils.hop($tw.hooks.names,hookName)) {\n\t\t$tw.hooks.names[hookName].push(definition);\n\t}\n\telse {\n\t\t$tw.hooks.names[hookName] = [definition];\n\t}\n};\n\n/*\nInvoke the hook by key\n*/\n$tw.hooks.invokeHook = function(hookName /*, value,... */) {\n\tvar args = Array.prototype.slice.call(arguments,1);\n\tif($tw.utils.hop($tw.hooks.names,hookName)) {\n\t\tfor (var i = 0; i < $tw.hooks.names[hookName].length; i++) {\n\t\t\targs[0] = $tw.hooks.names[hookName][i].apply(null,args);\n\t\t}\n\t}\n\treturn args[0];\n};\n\n/////////////////////////// Main boot function to decrypt tiddlers and then startup\n\n$tw.boot.boot = function(callback) {\n\t// Initialise crypto object\n\t$tw.crypto = new $tw.utils.Crypto();\n\t// Initialise password prompter\n\tif($tw.browser && !$tw.node) {\n\t\t$tw.passwordPrompt = new $tw.utils.PasswordPrompt();\n\t}\n\t// Preload any encrypted tiddlers\n\t$tw.boot.decryptEncryptedTiddlers(function() {\n\t\t// Startup\n\t\t$tw.boot.startup({callback: callback});\n\t});\n};\n\n/////////////////////////// Autoboot in the browser\n\nif($tw.browser && !$tw.boot.suppressBoot) {\n\t$tw.boot.boot();\n}\n\nreturn $tw;\n\n});\n\nif(typeof(exports) !== \"undefined\") {\n\texports.TiddlyWiki = _boot;\n} else {\n\t_boot(window.$tw);\n}\n//# sourceURL=$:/boot/boot.js\n"]}